Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(devtools): add stackflow devtools #346

Draft
wants to merge 83 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
e1d0232
feat(devtools): setup devtools workspace
orionmiz Feb 3, 2023
18893c7
fix: bump esbuild
orionmiz Feb 3, 2023
4d7b3c0
fix(devtools): downgrade typescript version
orionmiz Feb 3, 2023
1aa25b9
fix(devtools): fix build command
orionmiz Feb 3, 2023
5738bda
chore: classify directories
orionmiz Feb 3, 2023
b3f4bd3
chore(devtools): add workspaces
orionmiz Feb 3, 2023
9a1908d
chore: dedupe
orionmiz Feb 3, 2023
b57ef36
Revert "chore: dedupe"
orionmiz Feb 4, 2023
fa495ed
Revert "fix: bump esbuild"
orionmiz Feb 4, 2023
89fae94
refactor: use swc
orionmiz Feb 5, 2023
2a280ec
fix: downgrade react types
orionmiz Feb 5, 2023
d995b82
fix: remove template scripts
orionmiz Feb 5, 2023
f6f7c7b
Merge branch 'main' of https://github.com/daangn/stackflow into devto…
orionmiz Feb 6, 2023
ff27533
chore: remove empty scripts
orionmiz Feb 6, 2023
0cfad8c
feat: add vanilla extract
orionmiz Feb 6, 2023
6eeb23a
fix: add vanilla extract plugin
orionmiz Feb 6, 2023
69f1fdd
feat: add tabs router
orionmiz Feb 6, 2023
1d40073
Merge branch 'main' of https://github.com/daangn/stackflow into devto…
orionmiz Feb 6, 2023
5314e97
temp
orionmiz Feb 17, 2023
8e6b3e6
temp
orionmiz Feb 21, 2023
3ae4d15
navigate via stack model
orionmiz Feb 25, 2023
afa2963
temp
orionmiz Mar 7, 2023
180fcb0
change formatDate function
orionmiz Mar 8, 2023
fc80b59
Merge branch 'main' of https://github.com/daangn/stackflow into devto…
orionmiz Mar 14, 2023
ae3bfa1
resolve
orionmiz Mar 14, 2023
2cc1bc3
fix log window
orionmiz Mar 14, 2023
5cfb00f
flatten devtools
orionmiz Mar 14, 2023
e9b2de7
add crxjs plugin
orionmiz Mar 14, 2023
68b599a
add chrome launcher
orionmiz Mar 14, 2023
e81cb02
add chrome types
orionmiz Mar 14, 2023
e9d3742
Disable dispatcher feature
orionmiz Mar 15, 2023
958530c
add crxjs plugin
orionmiz Mar 15, 2023
842ad30
add typecheck command
orionmiz Mar 16, 2023
cc0c63e
reverse label order
orionmiz Mar 23, 2023
3ac3102
temp
orionmiz Mar 29, 2023
2b6f433
feat: add stackflow devtools plugin
orionmiz Mar 29, 2023
d14a1c7
Merge branch 'devtools-plugin' of https://github.com/daangn/stackflow…
orionmiz Mar 29, 2023
ed0a296
chore
orionmiz Mar 29, 2023
bc57687
Merge branch 'main' of https://github.com/daangn/stackflow into devto…
orionmiz Mar 29, 2023
f766187
yarn
orionmiz Mar 29, 2023
8274b6a
fix types
orionmiz Mar 29, 2023
5a66d9f
remove unused dependencies
orionmiz Mar 29, 2023
e483d39
remove unused style
orionmiz Mar 29, 2023
7ead8c1
change param input border color
orionmiz Mar 29, 2023
b5fe53e
change splitter style
orionmiz Mar 29, 2023
9da7b0a
change settings border color
orionmiz Mar 29, 2023
e3cbe0d
change date formatting
orionmiz Mar 29, 2023
2f4bd07
set background color for body
orionmiz Mar 29, 2023
cc8165b
remove unused settings component
orionmiz Mar 29, 2023
f652e66
set fill color for expand icon
orionmiz Mar 29, 2023
4eeba22
support dark theme for expand icon
orionmiz Mar 29, 2023
020a285
add settings icon
orionmiz Mar 29, 2023
fd14257
add photo icon
orionmiz Mar 29, 2023
dcd8deb
add trackNewActivity option
orionmiz Mar 29, 2023
7a0d5f1
seperate FloatingButton component
orionmiz Mar 29, 2023
f5b697d
set diff value as any
orionmiz Mar 29, 2023
e4cc0f6
flex wrap actions
orionmiz Mar 29, 2023
231f156
add actions
orionmiz Mar 29, 2023
9926bfc
add padding to form
orionmiz Mar 29, 2023
fe4f589
change param input border color
orionmiz Mar 29, 2023
db02b46
remove unused sprites
orionmiz Mar 29, 2023
e334fc4
set display for icon to inline block
orionmiz Mar 29, 2023
d431583
remove unused sprites
orionmiz Mar 29, 2023
6a71e2e
add visibility property to floating button
orionmiz Mar 30, 2023
e23ba87
edit manifest
orionmiz Mar 30, 2023
b4c86cd
refactor settings
orionmiz Mar 30, 2023
b107882
change method of clipboard
orionmiz Mar 30, 2023
15521a7
style snapshot
orionmiz Mar 30, 2023
3655e49
v0.1.0
orionmiz Mar 30, 2023
315e1a1
remove clipboard permission
orionmiz Mar 30, 2023
1da0a1f
follow the version of package json
orionmiz Mar 30, 2023
deeb2e4
bump
orionmiz Mar 30, 2023
73d3a71
deopt step actions at the moment
orionmiz Mar 30, 2023
b773d3c
v0.1.2
orionmiz Mar 30, 2023
92995f1
hide scrollbar
orionmiz Mar 30, 2023
67a9e6f
v0.1.3
orionmiz Mar 30, 2023
ff9cb00
style github icon
orionmiz Mar 31, 2023
eeb1f0c
v0.1.4
orionmiz Mar 31, 2023
af333b8
fix treeview crash when data is null
orionmiz Mar 31, 2023
64c9c92
v0.1.5
orionmiz Mar 31, 2023
6516e1a
chore: remove bridge log
orionmiz Jan 18, 2024
6b01d84
fix: catch message error
orionmiz Jan 18, 2024
0ed4c84
v0.1.6
orionmiz Jan 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,013 changes: 991 additions & 22 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
65 changes: 65 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,69 @@ supportedArchitectures:
- darwin
- linux

packageExtensions:
# "@bhch/react-json-form@*":
# dependencies:
# "react-modal": "*"
uniforms@*:
dependencies:
"react": "*"
"@crxjs/vite-plugin@*":
dependencies:
vite: "*"
# "@rjsf/chakra-ui@*":
# dependencies:
# "@chakra-ui/react": "*"
# "@chakra-ui/icons": "*"
# "chakra-react-select": "*"
# "@emotion/react": "*"
# "@emotion/cache": "*"
# "@emotion/weak-memoize": "*"
# chakra-react-select@*:
# dependencies:
# "@chakra-ui/menu": "*"
# "@chakra-ui/spinner": "*"
# "@chakra-ui/media-query": "*"
# "@chakra-ui/system": "*"
# "@chakra-ui/form-control": "*"
# "@chakra-ui/layout": "*"
# "@chakra-ui/icon": "*"
# react-select@*:
# dependencies:
# react-dom: "*"
# "@chakra-ui/toast@*":
# dependencies:
# framer-motion: "*"
# "@chakra-ui/transition@*":
# dependencies:
# framer-motion: "*"
# "@chakra-ui/modal@*":
# dependencies:
# framer-motion: "*"
# "@chakra-ui/popover@*":
# dependencies:
# framer-motion: "*"
# "@chakra-ui/portal@*":
# dependencies:
# react-dom: "*"
# "@chakra-ui/menu@*":
# dependencies:
# framer-motion: "*"
# "@chakra-ui/tooltip@*":
# dependencies:
# framer-motion: "*"
# "@chakra-ui/system@*":
# dependencies:
# "@emotion/styled": "*"
# "@emotion/react": "*"
# "@chakra-ui/icon@*":
# dependencies:
# "@chakra-ui/system": "*"
# "@emotion/styled@*":
# dependencies:
# "@emotion/react": "*"
# "@chakra-ui/css-reset@*":
# dependencies:
# "@emotion/react": "*"

yarnPath: .yarn/releases/yarn-3.2.4.cjs
19 changes: 10 additions & 9 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
"dependencies": {
"@seed-design/design-token": "^1.0.0-alpha.0",
"@seed-design/stylesheet": "^1.0.0-alpha.0",
"@stackflow/compat-await-push": "^1.1.1",
"@stackflow/core": "^1.0.4",
"@stackflow/compat-await-push": "^1.0.3",
"@stackflow/core": "^1.0.3",
"@stackflow/eslint-config": "^1.0.0",
"@stackflow/link": "^1.3.2",
"@stackflow/plugin-basic-ui": "^1.2.2",
"@stackflow/plugin-history-sync": "^1.3.2",
"@stackflow/plugin-preload": "^1.2.2",
"@stackflow/plugin-renderer-basic": "^1.1.1",
"@stackflow/plugin-stack-depth-change": "^1.0.4",
"@stackflow/react": "^1.1.1",
"@stackflow/link": "^1.2.0",
"@stackflow/plugin-basic-ui": "^1.0.4",
"@stackflow/plugin-devtools": "workspace:^",
"@stackflow/plugin-history-sync": "^1.2.0",
"@stackflow/plugin-preload": "^1.1.0",
"@stackflow/plugin-renderer-basic": "^1.0.3",
"@stackflow/plugin-stack-depth-change": "^1.0.3",
"@stackflow/react": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.20.0",
"eslint": "^8.13.0",
Expand Down
2 changes: 2 additions & 0 deletions demo/src/stackflow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { vars } from "@seed-design/design-token";
import { basicUIPlugin } from "@stackflow/plugin-basic-ui";
import { devtoolsPlugin } from "@stackflow/plugin-devtools";
import { historySyncPlugin } from "@stackflow/plugin-history-sync";
import { basicRendererPlugin } from "@stackflow/plugin-renderer-basic";
import { stackflow } from "@stackflow/react";
Expand Down Expand Up @@ -28,6 +29,7 @@ export const { Stack, activities } = stackflow({
},
},
plugins: [
devtoolsPlugin(),
basicRendererPlugin(),
basicUIPlugin({
theme: "cupertino",
Expand Down
24 changes: 24 additions & 0 deletions devtools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
20 changes: 20 additions & 0 deletions devtools/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- <link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384 BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"
/> -->
<!-- <link async rel="stylesheet" href="./src/semantic.css" /> -->
<title>Stackflow Devtools</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
45 changes: 45 additions & 0 deletions devtools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@stackflow/devtools",
"private": true,
"version": "0.1.6",
"type": "module",
"scripts": {
"dev": "yarn workspace @stackflow/core build && vite",
"build": "yarn tsc && yarn vite build",
"preview": "vite preview",
"test": "yarn jest",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@vanilla-extract/css": "^1.9.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@crxjs/vite-plugin": "beta",
"@stackflow/core": "workspace:^",
"@stackflow/plugin-devtools": "workspace:^",
"@swc/core": "^1.3.30",
"@swc/jest": "^0.2.21",
"@types/chrome": "^0.0.223",
"@types/jest": "^28.1.6",
"@types/json-schema": "^7.0.11",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.5",
"@vanilla-extract/vite-plugin": "^3.7.1",
"@vitejs/plugin-react-swc": "^3.1.0",
"chrome-launcher": "^0.15.1",
"jest": "^28.1.0",
"typescript": "^4.7.4",
"vite": "^4.1.0"
},
"jest": {
"coveragePathIgnorePatterns": [
"index.ts",
"index.tsx"
],
"transform": {
"^.+\\.(t|j)sx?$": "@swc/jest"
}
}
}
Empty file added devtools/src/App.css
Empty file.
13 changes: 13 additions & 0 deletions devtools/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "./App.css";
import Layout from "./components/Layout";
import ActivitiesTab from "./tabs/ActivitiesTab";

function App() {
return (
<Layout>
<ActivitiesTab />
</Layout>
);
}

export default App;
3 changes: 3 additions & 0 deletions devtools/src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Button() {
return <div></div>;
}
53 changes: 53 additions & 0 deletions devtools/src/components/Collapse.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { useEffect, useRef, useState } from "react";

const duration = 200;

export default function Collapse({
opened,
children,
}: {
opened: boolean;
children: React.ReactNode;
}) {
const ref = useRef<HTMLDivElement>(null);

const [followed, setFollowed] = useState(false);

useEffect(() => {
if (opened) {
const delay = setTimeout(() => {
setFollowed(true);
}, duration);
return () => clearTimeout(delay);
} else {
setFollowed(false);
const delay = setTimeout(() => {}, duration);
return () => clearTimeout(delay);
}
}, [opened]);

// heights
// opened: (false -> true) = (0 -> clientHeight(instantly) -> auto(after 0.3s by timeout))
// opened: (true -> false) = (auto -> clientHeight(instantly) -> 0(instantly))

const height =
followed && opened
? "auto"
: followed || opened
? `${ref.current?.scrollHeight ?? 0}px`
: "0";

return (
<div
style={{
height,
overflow: "hidden",
transition: `height .2s ease, opacity ${opened ? ".4s" : ".17s"} ease`,
opacity: opened ? 1 : 0,
}}
ref={ref}
>
{children}
</div>
);
}
51 changes: 51 additions & 0 deletions devtools/src/components/FloatingButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { useReducer } from "react";

export default function FloatingButton({
icon,
children,
}: {
icon: React.ReactNode;
children: React.ReactNode;
}) {
const [open, toggle] = useReducer((open) => !open, false);

return (
<div
style={{
position: "relative",
zIndex: 1,
}}
>
<div
style={{
width: "1.5rem",
height: "1.5rem",
opacity: 0.5,
display: "inline-block",
padding: "0.25rem",
cursor: "pointer",
userSelect: "none",
}}
onClick={toggle}
>
{icon}
</div>
<div
style={{
position: "absolute",
right: 0,
border: "1px solid gray",
borderRadius: "0.5rem",
padding: "0.5rem",
transition: "opacity 0.1s ease-in-out",
opacity: open ? 1 : 0,
visibility: open ? "visible" : "hidden",
backgroundColor: "#242424",
zIndex: 2,
}}
>
{children}
</div>
</div>
);
}
52 changes: 52 additions & 0 deletions devtools/src/components/Header.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { style } from "@vanilla-extract/css";

export const header = style({
display: "flex",
alignItems: "center",
backgroundColor: "#1f2937",
padding: "1rem",
});

export const tabs = style({
display: "flex",
flexDirection: "column",
padding: "1rem",
});

export const leftContents = style({
flex: "1 1 auto",
display: "flex",
});

export const rightContents = style({
flex: "0 0",
display: "flex",
gap: "0.5rem",
alignItems: "center",
});

export const footer = style({
flex: "0 0",
color: "white",
});

export const button = style({
padding: "0.5rem 1rem",
backgroundColor: "transparent",
borderRadius: "1rem",
border: "none",
color: "white",
cursor: "pointer",
transition: "background-color 0.2s ease",
":hover": {
backgroundColor: "#e5e7eb",
},
});

export const buttonActive = style([
button,
{
backgroundColor: "#111827",
color: "white",
},
]);
16 changes: 16 additions & 0 deletions devtools/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Logo from "./Logo";
import * as css from "./Header.css";
import Github from "./icons/Github";

export default function Header() {
return (
<div className={css.header}>
<div className={css.leftContents}>
<Logo />
</div>
<div className={css.rightContents}>
<Github />
</div>
</div>
);
}
Loading