agent-canvas 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon/build.ts +1 -1
- package/daemon/client/App.tsx +39 -10
- package/daemon/client/index.html +1 -1
- package/daemon/dist/client.js +47 -47
- package/daemon/dist/index.html +1 -1
- package/daemon/src/compiler.ts +43 -15
- package/package.json +1 -1
- package/skills/canvas/SKILL.md +15 -7
- package/skills/canvas/flows.md +1 -1
package/daemon/build.ts
CHANGED
|
@@ -96,7 +96,7 @@ async function build() {
|
|
|
96
96
|
<meta charset="utf-8" />
|
|
97
97
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
98
98
|
<title>Agent Canvas</title>
|
|
99
|
-
<script
|
|
99
|
+
<script>!function(){var p=localStorage.getItem('canvas-theme')||'auto';document.documentElement.dataset.theme=p==='auto'?(matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light'):p}()</script>
|
|
100
100
|
<link rel="stylesheet" href="/assets/client.css" />
|
|
101
101
|
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/github-dark-dimmed.min.css" />
|
|
102
102
|
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
package/daemon/client/App.tsx
CHANGED
|
@@ -60,23 +60,56 @@ export const RevisionContext = createContext<{
|
|
|
60
60
|
setCompareRevision: () => {},
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
function resolveTheme(pref: string): "light" | "dark" {
|
|
64
|
+
if (pref === "auto") return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
65
|
+
return pref as "light" | "dark";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function applyTheme(pref: string) {
|
|
69
|
+
document.documentElement.dataset.theme = resolveTheme(pref);
|
|
70
|
+
}
|
|
71
|
+
|
|
63
72
|
function ThemeSwitcher() {
|
|
64
|
-
const [
|
|
73
|
+
const [pref, setPref] = useState<"auto" | "light" | "dark">(() => {
|
|
74
|
+
const stored = localStorage.getItem("canvas-theme");
|
|
75
|
+
if (stored === "light" || stored === "dark" || stored === "auto") return stored;
|
|
76
|
+
return "auto";
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
applyTheme(pref);
|
|
81
|
+
if (pref !== "auto") return;
|
|
82
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
83
|
+
const handler = () => applyTheme("auto");
|
|
84
|
+
mq.addEventListener("change", handler);
|
|
85
|
+
return () => mq.removeEventListener("change", handler);
|
|
86
|
+
}, [pref]);
|
|
65
87
|
|
|
66
88
|
const toggle = () => {
|
|
67
|
-
const next =
|
|
68
|
-
document.documentElement.dataset.theme = next;
|
|
89
|
+
const next = pref === "auto" ? "light" : pref === "light" ? "dark" : "auto";
|
|
69
90
|
localStorage.setItem("canvas-theme", next);
|
|
70
|
-
|
|
91
|
+
setPref(next);
|
|
71
92
|
};
|
|
72
93
|
|
|
94
|
+
const titles = { auto: "Theme: system (click for light)", light: "Theme: light (click for dark)", dark: "Theme: dark (click for system)" };
|
|
95
|
+
|
|
73
96
|
return (
|
|
74
97
|
<button
|
|
75
98
|
onClick={toggle}
|
|
76
99
|
className="w-7 h-7 flex items-center justify-center rounded-md text-text-tertiary hover:text-text-secondary hover:bg-bg-elevated transition-colors"
|
|
77
|
-
title={
|
|
100
|
+
title={titles[pref]}
|
|
78
101
|
>
|
|
79
|
-
{
|
|
102
|
+
{pref === "auto" ? (
|
|
103
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
104
|
+
<rect x="2" y="3" width="20" height="14" rx="2" ry="2" />
|
|
105
|
+
<line x1="8" y1="21" x2="16" y2="21" />
|
|
106
|
+
<line x1="12" y1="17" x2="12" y2="21" />
|
|
107
|
+
</svg>
|
|
108
|
+
) : pref === "dark" ? (
|
|
109
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
110
|
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
|
111
|
+
</svg>
|
|
112
|
+
) : (
|
|
80
113
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
81
114
|
<circle cx="12" cy="12" r="5" />
|
|
82
115
|
<line x1="12" y1="1" x2="12" y2="3" />
|
|
@@ -88,10 +121,6 @@ function ThemeSwitcher() {
|
|
|
88
121
|
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
|
89
122
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
|
90
123
|
</svg>
|
|
91
|
-
) : (
|
|
92
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
93
|
-
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
|
94
|
-
</svg>
|
|
95
124
|
)}
|
|
96
125
|
</button>
|
|
97
126
|
);
|
package/daemon/client/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Agent Canvas</title>
|
|
7
|
-
<script
|
|
7
|
+
<script>!function(){var p=localStorage.getItem('canvas-theme')||'auto';document.documentElement.dataset.theme=p==='auto'?(matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light'):p}()</script>
|
|
8
8
|
<link rel="stylesheet" href="/assets/client.css" />
|
|
9
9
|
</head>
|
|
10
10
|
<body class="min-h-screen">
|