@open-slide/core 0.0.11 → 0.0.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/dist/{build-DHiRlpjn.js → build-aiY_8kwE.js} +2 -1
- package/dist/cli/bin.js +43 -4
- package/dist/{config-LZM903FE.js → config-CVqRAagl.js} +592 -63
- package/dist/design-CROQh0AA.js +35 -0
- package/dist/{dev-B3JzCYn7.js → dev-R2we2iaF.js} +2 -1
- package/dist/index.d.ts +55 -4
- package/dist/index.js +110 -1
- package/dist/{preview-UikovHEt.js → preview-CU4zSyGp.js} +2 -1
- package/dist/sync-3oqN1WyK.js +139 -0
- package/dist/sync-B4eLo2H6.js +3 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +2 -1
- package/package.json +2 -1
- package/skills/apply-comments/SKILL.md +83 -0
- package/skills/create-slide/SKILL.md +81 -0
- package/skills/create-theme/SKILL.md +194 -0
- package/skills/slide-authoring/SKILL.md +288 -0
- package/src/app/{App.tsx → app.tsx} +8 -6
- package/src/app/components/{AssetView.tsx → asset-view.tsx} +41 -33
- package/src/app/components/{ClickNavZones.tsx → click-nav-zones.tsx} +1 -1
- package/src/app/components/history-provider.tsx +120 -0
- package/src/app/components/image-placeholder.tsx +121 -0
- package/src/app/components/inspector/{CommentWidget.tsx → comment-widget.tsx} +1 -1
- package/src/app/components/inspector/{InspectOverlay.tsx → inspect-overlay.tsx} +1 -1
- package/src/app/components/inspector/{InspectorPanel.tsx → inspector-panel.tsx} +164 -212
- package/src/app/components/inspector/{InspectorProvider.tsx → inspector-provider.tsx} +186 -18
- package/src/app/components/inspector/save-bar.tsx +47 -0
- package/src/app/components/panel/panel-fields.tsx +60 -0
- package/src/app/components/panel/panel-shell.tsx +78 -0
- package/src/app/components/panel/save-card.tsx +139 -0
- package/src/app/components/pdf-progress-toast.tsx +25 -0
- package/src/app/components/player.tsx +341 -0
- package/src/app/components/present/blackout-overlay.tsx +18 -0
- package/src/app/components/present/control-bar.tsx +204 -0
- package/src/app/components/present/help-overlay.tsx +56 -0
- package/src/app/components/present/jump-input.tsx +74 -0
- package/src/app/components/present/laser-pointer.tsx +40 -0
- package/src/app/components/present/overview-grid.tsx +184 -0
- package/src/app/components/present/progress-bar.tsx +26 -0
- package/src/app/components/present/use-idle.ts +44 -0
- package/src/app/components/present/use-pointer-near-bottom.ts +34 -0
- package/src/app/components/present/use-presenter-channel.ts +71 -0
- package/src/app/components/present/use-touch-swipe.ts +63 -0
- package/src/app/components/sidebar/{FolderItem.tsx → folder-item.tsx} +62 -27
- package/src/app/components/sidebar/{IconPicker.tsx → icon-picker.tsx} +13 -10
- package/src/app/components/sidebar/{Sidebar.tsx → sidebar.tsx} +40 -34
- package/src/app/components/{SlideCanvas.tsx → slide-canvas.tsx} +35 -10
- package/src/app/components/style-panel/design-provider.tsx +139 -0
- package/src/app/components/style-panel/style-panel.tsx +326 -0
- package/src/app/components/style-panel/use-design.ts +112 -0
- package/src/app/components/theme-toggle.tsx +57 -0
- package/src/app/components/thumbnail-rail.tsx +151 -0
- package/src/app/components/ui/button.tsx +51 -19
- package/src/app/components/ui/card.tsx +1 -1
- package/src/app/components/ui/dialog.tsx +25 -9
- package/src/app/components/ui/dropdown-menu.tsx +29 -12
- package/src/app/components/ui/input.tsx +13 -9
- package/src/app/components/ui/popover.tsx +5 -2
- package/src/app/components/ui/progress.tsx +2 -2
- package/src/app/components/ui/select.tsx +11 -5
- package/src/app/components/ui/separator.tsx +1 -1
- package/src/app/components/ui/slider.tsx +4 -4
- package/src/app/components/ui/sonner.tsx +11 -1
- package/src/app/components/ui/tabs.tsx +6 -6
- package/src/app/components/ui/textarea.tsx +11 -7
- package/src/app/components/ui/toggle-group.tsx +2 -2
- package/src/app/components/ui/toggle.tsx +6 -6
- package/src/app/components/ui/tooltip.tsx +5 -2
- package/src/app/lib/export-html.ts +10 -1
- package/src/app/lib/export-pdf.ts +7 -0
- package/src/app/lib/folders.ts +1 -1
- package/src/app/lib/inspector/{useEditor.ts → use-editor.ts} +2 -1
- package/src/app/lib/sdk.ts +5 -0
- package/src/app/lib/slides.ts +1 -1
- package/src/app/lib/utils.ts +1 -1
- package/src/app/main.tsx +5 -2
- package/src/app/routes/{Home.tsx → home.tsx} +266 -97
- package/src/app/routes/presenter.tsx +400 -0
- package/src/app/routes/slide.tsx +519 -0
- package/src/app/styles.css +338 -67
- package/src/app/components/PdfProgressToast.tsx +0 -23
- package/src/app/components/Player.tsx +0 -100
- package/src/app/components/ThumbnailRail.tsx +0 -68
- package/src/app/components/inspector/SaveBar.tsx +0 -77
- package/src/app/routes/Slide.tsx +0 -478
- /package/dist/{config-SXL5qIl6.d.ts → config-DweCbRkQ.d.ts} +0 -0
- /package/src/app/lib/inspector/{useComments.ts → use-comments.ts} +0 -0
- /package/src/app/lib/{useWheelPageNavigation.ts → use-wheel-page-navigation.ts} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/design.ts
|
|
2
|
+
function designToCssVars(d) {
|
|
3
|
+
return {
|
|
4
|
+
"--osd-bg": d.palette.bg,
|
|
5
|
+
"--osd-text": d.palette.text,
|
|
6
|
+
"--osd-accent": d.palette.accent,
|
|
7
|
+
"--osd-font-display": d.fonts.display,
|
|
8
|
+
"--osd-font-body": d.fonts.body,
|
|
9
|
+
"--osd-size-hero": `${d.typeScale.hero}px`,
|
|
10
|
+
"--osd-size-body": `${d.typeScale.body}px`,
|
|
11
|
+
"--osd-radius-md": `${d.radius.md}px`
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function cssVarsToString(vars) {
|
|
15
|
+
return Object.entries(vars).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
16
|
+
}
|
|
17
|
+
const defaultDesign = {
|
|
18
|
+
palette: {
|
|
19
|
+
bg: "#f7f5f0",
|
|
20
|
+
text: "#1a1814",
|
|
21
|
+
accent: "#6d4cff"
|
|
22
|
+
},
|
|
23
|
+
fonts: {
|
|
24
|
+
display: "Georgia, \"Times New Roman\", serif",
|
|
25
|
+
body: "-apple-system, BlinkMacSystemFont, \"Inter\", system-ui, sans-serif"
|
|
26
|
+
},
|
|
27
|
+
typeScale: {
|
|
28
|
+
hero: 168,
|
|
29
|
+
body: 36
|
|
30
|
+
},
|
|
31
|
+
radius: { md: 12 }
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { cssVarsToString, defaultDesign, designToCssVars };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
|
-
import { OpenSlideConfig } from "./config-
|
|
2
|
-
import
|
|
1
|
+
import { OpenSlideConfig } from "./config-DweCbRkQ.js";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { CSSProperties, ComponentType, HTMLAttributes } from "react";
|
|
3
4
|
|
|
5
|
+
//#region src/app/components/image-placeholder.d.ts
|
|
6
|
+
type ImagePlaceholderProps = {
|
|
7
|
+
hint: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
className?: string;
|
|
12
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'style' | 'className'>;
|
|
13
|
+
declare function ImagePlaceholder({
|
|
14
|
+
hint,
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
style,
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
20
|
+
}: ImagePlaceholderProps): react_jsx_runtime0.JSX.Element;
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/design.d.ts
|
|
24
|
+
type DesignPalette = {
|
|
25
|
+
bg: string;
|
|
26
|
+
text: string;
|
|
27
|
+
accent: string;
|
|
28
|
+
};
|
|
29
|
+
type DesignFonts = {
|
|
30
|
+
display: string;
|
|
31
|
+
body: string;
|
|
32
|
+
};
|
|
33
|
+
type DesignTypeScale = {
|
|
34
|
+
hero: number;
|
|
35
|
+
body: number;
|
|
36
|
+
};
|
|
37
|
+
type DesignRadius = {
|
|
38
|
+
md: number;
|
|
39
|
+
};
|
|
40
|
+
type DesignSystem = {
|
|
41
|
+
palette: DesignPalette;
|
|
42
|
+
fonts: DesignFonts;
|
|
43
|
+
typeScale: DesignTypeScale;
|
|
44
|
+
radius: DesignRadius;
|
|
45
|
+
};
|
|
46
|
+
declare function designToCssVars(d: DesignSystem): Record<string, string>;
|
|
47
|
+
declare function cssVarsToString(vars: Record<string, string>): string;
|
|
48
|
+
declare const defaultDesign: DesignSystem;
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
4
51
|
//#region src/app/lib/sdk.d.ts
|
|
5
52
|
type Page = ComponentType;
|
|
6
53
|
type SlideMeta = {
|
|
@@ -9,7 +56,11 @@ type SlideMeta = {
|
|
|
9
56
|
type SlideModule = {
|
|
10
57
|
default: Page[];
|
|
11
58
|
meta?: SlideMeta;
|
|
59
|
+
design?: DesignSystem;
|
|
60
|
+
notes?: (string | undefined)[];
|
|
12
61
|
};
|
|
13
62
|
declare const CANVAS_WIDTH = 1920;
|
|
14
|
-
declare const CANVAS_HEIGHT = 1080;
|
|
15
|
-
|
|
63
|
+
declare const CANVAS_HEIGHT = 1080;
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignRadius, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, OpenSlideConfig, Page, SlideMeta, SlideModule, cssVarsToString, defaultDesign, designToCssVars };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,115 @@
|
|
|
1
|
+
import { cssVarsToString, defaultDesign, designToCssVars } from "./design-CROQh0AA.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/app/components/image-placeholder.tsx
|
|
5
|
+
function ImagePlaceholder({ hint, width, height, style, className,...rest }) {
|
|
6
|
+
const dims = width && height ? `${width} × ${height}` : null;
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8
|
+
...rest,
|
|
9
|
+
"data-slide-placeholder": hint,
|
|
10
|
+
"data-placeholder-w": width,
|
|
11
|
+
"data-placeholder-h": height,
|
|
12
|
+
role: "img",
|
|
13
|
+
"aria-label": hint,
|
|
14
|
+
style: {
|
|
15
|
+
position: "relative",
|
|
16
|
+
width: width ?? "100%",
|
|
17
|
+
height: height ?? "100%",
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
gap: 14,
|
|
23
|
+
border: "1px dashed rgba(120, 120, 130, 0.35)",
|
|
24
|
+
borderRadius: 12,
|
|
25
|
+
background: "linear-gradient(135deg, rgba(120,120,130,0.06) 0%, rgba(120,120,130,0.02) 50%, rgba(120,120,130,0.06) 100%)",
|
|
26
|
+
color: "rgba(90, 90, 100, 0.7)",
|
|
27
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", system-ui, sans-serif",
|
|
28
|
+
textAlign: "center",
|
|
29
|
+
padding: 24,
|
|
30
|
+
boxSizing: "border-box",
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
...style
|
|
33
|
+
},
|
|
34
|
+
className,
|
|
35
|
+
children: [/* @__PURE__ */ jsx(PlaceholderIcon, {}), /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
style: {
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
gap: 6,
|
|
41
|
+
maxWidth: "85%"
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", {
|
|
45
|
+
style: {
|
|
46
|
+
fontSize: 11,
|
|
47
|
+
fontWeight: 600,
|
|
48
|
+
letterSpacing: "0.14em",
|
|
49
|
+
textTransform: "uppercase",
|
|
50
|
+
opacity: .55
|
|
51
|
+
},
|
|
52
|
+
children: "Image"
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx("span", {
|
|
55
|
+
style: {
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
fontWeight: 500,
|
|
58
|
+
lineHeight: 1.4,
|
|
59
|
+
color: "rgba(60, 60, 70, 0.85)"
|
|
60
|
+
},
|
|
61
|
+
children: hint
|
|
62
|
+
}),
|
|
63
|
+
dims && /* @__PURE__ */ jsx("span", {
|
|
64
|
+
style: {
|
|
65
|
+
fontSize: 11,
|
|
66
|
+
fontVariantNumeric: "tabular-nums",
|
|
67
|
+
fontFamily: "ui-monospace, \"SF Mono\", Menlo, Consolas, monospace",
|
|
68
|
+
opacity: .5,
|
|
69
|
+
marginTop: 2
|
|
70
|
+
},
|
|
71
|
+
children: dims
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function PlaceholderIcon() {
|
|
78
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
79
|
+
width: "32",
|
|
80
|
+
height: "32",
|
|
81
|
+
viewBox: "0 0 32 32",
|
|
82
|
+
fill: "none",
|
|
83
|
+
stroke: "currentColor",
|
|
84
|
+
strokeWidth: "1.5",
|
|
85
|
+
strokeLinecap: "round",
|
|
86
|
+
strokeLinejoin: "round",
|
|
87
|
+
style: { opacity: .55 },
|
|
88
|
+
role: "img",
|
|
89
|
+
"aria-label": "image placeholder",
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx("title", { children: "image placeholder" }),
|
|
92
|
+
/* @__PURE__ */ jsx("rect", {
|
|
93
|
+
x: "4",
|
|
94
|
+
y: "6",
|
|
95
|
+
width: "24",
|
|
96
|
+
height: "20",
|
|
97
|
+
rx: "2.5"
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx("circle", {
|
|
100
|
+
cx: "11",
|
|
101
|
+
cy: "13",
|
|
102
|
+
r: "2"
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx("path", { d: "M4 22l7-7 6 6 4-4 7 7" })
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
1
110
|
//#region src/app/lib/sdk.ts
|
|
2
111
|
const CANVAS_WIDTH = 1920;
|
|
3
112
|
const CANVAS_HEIGHT = 1080;
|
|
4
113
|
|
|
5
114
|
//#endregion
|
|
6
|
-
export { CANVAS_HEIGHT, CANVAS_WIDTH };
|
|
115
|
+
export { CANVAS_HEIGHT, CANVAS_WIDTH, ImagePlaceholder, cssVarsToString, defaultDesign, designToCssVars };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { cp, lstat, mkdir, readFile, readdir, readlink, rm, symlink } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
|
|
7
|
+
//#region src/cli/sync.ts
|
|
8
|
+
async function detectSkillsDrift(skillsDir) {
|
|
9
|
+
if (!existsSync(skillsDir)) return [];
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
const agentsSkillsDir = path.join(cwd, ".agents", "skills");
|
|
12
|
+
const skillNames = (await readdir(skillsDir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
13
|
+
const results = [];
|
|
14
|
+
for (const name of skillNames) {
|
|
15
|
+
const src = path.join(skillsDir, name);
|
|
16
|
+
const dst = path.join(agentsSkillsDir, name);
|
|
17
|
+
const srcHash = await hashDir(src);
|
|
18
|
+
const dstHash = existsSync(dst) ? await hashDir(dst) : null;
|
|
19
|
+
let status;
|
|
20
|
+
if (dstHash === null) status = "added";
|
|
21
|
+
else if (dstHash !== srcHash) status = "updated";
|
|
22
|
+
else status = "unchanged";
|
|
23
|
+
results.push({
|
|
24
|
+
name,
|
|
25
|
+
status
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return results;
|
|
29
|
+
}
|
|
30
|
+
async function syncSkills(skillsDir, opts = {}) {
|
|
31
|
+
const { dryRun = false } = opts;
|
|
32
|
+
if (!existsSync(skillsDir)) throw new Error(`Built-in skills directory missing at ${skillsDir}. The @open-slide/core package may be corrupt — try reinstalling.`);
|
|
33
|
+
const cwd = process.cwd();
|
|
34
|
+
const agentsSkillsDir = path.join(cwd, ".agents", "skills");
|
|
35
|
+
const claudeSkillsDir = path.join(cwd, ".claude", "skills");
|
|
36
|
+
const results = await detectSkillsDrift(skillsDir);
|
|
37
|
+
if (results.length === 0) {
|
|
38
|
+
process.stdout.write(chalk.yellow("No skills found to sync.\n"));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
for (const { name, status } of results) {
|
|
42
|
+
const src = path.join(skillsDir, name);
|
|
43
|
+
const dst = path.join(agentsSkillsDir, name);
|
|
44
|
+
if (dryRun) continue;
|
|
45
|
+
if (status === "unchanged") {
|
|
46
|
+
await ensureClaudeSymlink(claudeSkillsDir, name);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
await mkdir(path.dirname(dst), { recursive: true });
|
|
50
|
+
if (existsSync(dst)) await rm(dst, {
|
|
51
|
+
recursive: true,
|
|
52
|
+
force: true
|
|
53
|
+
});
|
|
54
|
+
await cp(src, dst, { recursive: true });
|
|
55
|
+
await ensureClaudeSymlink(claudeSkillsDir, name);
|
|
56
|
+
}
|
|
57
|
+
printSummary(results, dryRun);
|
|
58
|
+
}
|
|
59
|
+
async function ensureClaudeSymlink(claudeSkillsDir, name) {
|
|
60
|
+
await mkdir(claudeSkillsDir, { recursive: true });
|
|
61
|
+
const linkPath = path.join(claudeSkillsDir, name);
|
|
62
|
+
const target = path.join("..", "..", ".agents", "skills", name);
|
|
63
|
+
if (existsSync(linkPath)) try {
|
|
64
|
+
const stat = await lstat(linkPath);
|
|
65
|
+
if (stat.isSymbolicLink()) {
|
|
66
|
+
const current = await readlink(linkPath);
|
|
67
|
+
if (current === target) return;
|
|
68
|
+
}
|
|
69
|
+
await rm(linkPath, {
|
|
70
|
+
recursive: true,
|
|
71
|
+
force: true
|
|
72
|
+
});
|
|
73
|
+
} catch {
|
|
74
|
+
await rm(linkPath, {
|
|
75
|
+
recursive: true,
|
|
76
|
+
force: true
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
await symlink(target, linkPath, "dir");
|
|
81
|
+
} catch (err) {
|
|
82
|
+
const code = err.code;
|
|
83
|
+
if (code === "EPERM" || code === "EEXIST") {
|
|
84
|
+
const absoluteTarget = path.resolve(claudeSkillsDir, target);
|
|
85
|
+
await cp(absoluteTarget, linkPath, { recursive: true });
|
|
86
|
+
} else throw err;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function hashDir(dir) {
|
|
90
|
+
const hash = createHash("sha256");
|
|
91
|
+
const files = await collectFiles(dir);
|
|
92
|
+
files.sort();
|
|
93
|
+
for (const rel of files) {
|
|
94
|
+
const abs = path.join(dir, rel);
|
|
95
|
+
const data = await readFile(abs);
|
|
96
|
+
hash.update(rel);
|
|
97
|
+
hash.update("\0");
|
|
98
|
+
hash.update(data);
|
|
99
|
+
hash.update("\0");
|
|
100
|
+
}
|
|
101
|
+
return hash.digest("hex");
|
|
102
|
+
}
|
|
103
|
+
async function collectFiles(dir, prefix = "") {
|
|
104
|
+
const out = [];
|
|
105
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
106
|
+
for (const entry of entries) {
|
|
107
|
+
const rel = prefix ? path.join(prefix, entry.name) : entry.name;
|
|
108
|
+
if (entry.isDirectory()) out.push(...await collectFiles(path.join(dir, entry.name), rel));
|
|
109
|
+
else if (entry.isFile()) out.push(rel);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
function printSummary(results, dryRun) {
|
|
114
|
+
const symbols = {
|
|
115
|
+
added: chalk.green("+"),
|
|
116
|
+
updated: chalk.yellow("~"),
|
|
117
|
+
unchanged: chalk.dim("=")
|
|
118
|
+
};
|
|
119
|
+
const labels = {
|
|
120
|
+
added: chalk.green("added"),
|
|
121
|
+
updated: chalk.yellow("updated"),
|
|
122
|
+
unchanged: chalk.dim("unchanged")
|
|
123
|
+
};
|
|
124
|
+
const header = dryRun ? chalk.bold("Dry run — no files written:") : chalk.bold("Synced built-in skills:");
|
|
125
|
+
process.stdout.write(`${header}\n`);
|
|
126
|
+
for (const { name, status } of results) process.stdout.write(` ${symbols[status]} ${name} ${chalk.dim(`(${labels[status]})`)}\n`);
|
|
127
|
+
const counts = results.reduce((acc, { status }) => {
|
|
128
|
+
acc[status] += 1;
|
|
129
|
+
return acc;
|
|
130
|
+
}, {
|
|
131
|
+
added: 0,
|
|
132
|
+
updated: 0,
|
|
133
|
+
unchanged: 0
|
|
134
|
+
});
|
|
135
|
+
process.stdout.write(chalk.dim(`\n${counts.added} added, ${counts.updated} updated, ${counts.unchanged} unchanged.\n`));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { detectSkillsDrift, syncSkills };
|
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-slide/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"bin.js",
|
|
21
21
|
"dist",
|
|
22
22
|
"src/app",
|
|
23
|
+
"skills",
|
|
23
24
|
"README.md"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: apply-comments
|
|
3
|
+
description: Apply pending @slide-comment markers written by the open-slide inspector tool. Use when the user asks to "apply comments", "process slide comments", "apply the inspector comments", or references markers left inside `slides/<id>/index.tsx`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Apply slide comments
|
|
7
|
+
|
|
8
|
+
The open-slide editor has an inspector tool that lets the user click on a rendered page element and attach a textual comment (e.g. *"make this red"*, *"change to 'Open Slide Rocks'"*). Each comment is persisted as an in-source JSX marker inside `slides/<slideId>/index.tsx`.
|
|
9
|
+
|
|
10
|
+
Your job: read those markers, perform the described edits, and delete the markers.
|
|
11
|
+
|
|
12
|
+
> **Before making any page edit**, consult the **`slide-authoring`** skill — it is the technical reference for how `slides/<id>/index.tsx` is structured (canvas, type scale, palette, assets, file contract). A comment like *"make this bigger"* or *"change the accent colour"* should be applied in a way that stays consistent with those rules.
|
|
13
|
+
|
|
14
|
+
## Marker format
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
{/* @slide-comment id="c-<8hex>" ts="<ISO>" text="<base64url(JSON)>" */}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- Always sits on its own line as the **first child inside** the JSX element it refers to (i.e. between that element's opening `>` and its other children). The marker is dropped *into* its target, not floated above it.
|
|
21
|
+
- `text` is base64url-encoded JSON: `{"note": "...", "hint"?: "..."}`.
|
|
22
|
+
- Detection regex (authoritative — use exactly this):
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
/\{\/\*\s*@slide-comment\s+id="(c-[a-f0-9]+)"\s+ts="([^"]+)"\s+text="([A-Za-z0-9_\-]+={0,2})"\s*\*\/\}/g
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Procedure
|
|
29
|
+
|
|
30
|
+
1. **Identify the target slide(s).**
|
|
31
|
+
- If the user names one (`example-slide`, `youbike-3-survey`, etc.), work on that single `slides/<slideId>/index.tsx`.
|
|
32
|
+
- If they say "all" or don't specify, scan every `slides/*/index.tsx`. Process each slide one at a time.
|
|
33
|
+
|
|
34
|
+
2. **Read the file and find all markers.**
|
|
35
|
+
- Run the regex above against the whole file.
|
|
36
|
+
- For each match, base64url-decode `text` and `JSON.parse` it to get `{ note, hint? }`.
|
|
37
|
+
- Record each hit as `{ id, lineIndex (0-based), indent, note, hint }`.
|
|
38
|
+
- If there are no markers, tell the user and stop.
|
|
39
|
+
|
|
40
|
+
3. **Understand each comment in context.**
|
|
41
|
+
- The targeted JSX element is the **enclosing** element of the marker — i.e. read upward from the marker line until you reach the unclosed JSX opening tag whose body the marker lives in. That element is the target. (For self-closing elements like `<img />`, the inspector hoists the marker to the nearest non-self-closing ancestor; in that case the comment usually refers to a child of the enclosing element rather than the enclosing element itself — use the `note` text to disambiguate.)
|
|
42
|
+
- Read enough surrounding code (parent element, sibling elements, inline styles) to apply the change faithfully. A comment inside a `<div>` with an inline `background` style usually refers to that element's styling, for example.
|
|
43
|
+
- If the `note` is ambiguous, do the smallest reasonable interpretation and mention the assumption in your summary.
|
|
44
|
+
|
|
45
|
+
4. **Apply edits in reverse line order.**
|
|
46
|
+
- Sort markers by descending `lineIndex` and process one at a time, using the `Edit` tool.
|
|
47
|
+
- Processing top-down would invalidate line numbers for later markers as the file shrinks/grows.
|
|
48
|
+
|
|
49
|
+
5. **Remove each marker after applying its edit.**
|
|
50
|
+
- Delete the entire marker line including its trailing `\n`.
|
|
51
|
+
- Never leave a marker behind. An un-removed marker signals a failure.
|
|
52
|
+
|
|
53
|
+
6. **Verify.**
|
|
54
|
+
- After all edits, re-read the file and confirm zero remaining markers.
|
|
55
|
+
- Run `pnpm tsc --noEmit` and `pnpm biome check` (or `pnpm lint`). Fix any introduced errors.
|
|
56
|
+
|
|
57
|
+
7. **Report.**
|
|
58
|
+
- Summarise: `N applied, 0 remaining` plus a one-line description of each change (including the slide id).
|
|
59
|
+
|
|
60
|
+
## base64url decoding helper
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
function decode(s) {
|
|
64
|
+
const pad = s.length % 4 === 0 ? '' : '='.repeat(4 - (s.length % 4));
|
|
65
|
+
return Buffer.from(s.replace(/-/g, '+').replace(/_/g, '/') + pad, 'base64').toString('utf8');
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You can run this inline via `node -e '...'` if you need to inspect a payload; otherwise just reason about the decoded string.
|
|
70
|
+
|
|
71
|
+
## Edge cases
|
|
72
|
+
|
|
73
|
+
- **Marker with no enclosing JSX element** (shouldn't happen — the inspector won't write one — but if you find one): delete it and note as orphan.
|
|
74
|
+
- **Multiple markers stacked on consecutive lines inside the same element**: they all refer to that enclosing element. Apply them in source order but still delete each line individually.
|
|
75
|
+
- **`_debugSource` used SWC instead of Babel**: not your problem — the marker line is authoritative.
|
|
76
|
+
- **Comment asks for something outside the target element's scope** (e.g. "add a new page"): do the closest-reasonable edit and mention the scope expansion in your summary.
|
|
77
|
+
- **Can't resolve the comment** (e.g. truly ambiguous, or the file changed shape such that the target element doesn't exist): leave the marker in place and report it as skipped. Don't guess.
|
|
78
|
+
|
|
79
|
+
## Do not
|
|
80
|
+
|
|
81
|
+
- Do not touch `package.json`, `open-slide.config.ts`, or files outside `slides/`.
|
|
82
|
+
- Do not add dependencies.
|
|
83
|
+
- Do not re-introduce markers or leave `TODO` breadcrumbs — the user already has a record in git.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-slide
|
|
3
|
+
description: Use this skill when the user wants to create, draft, author, or generate new slides / a presentation in this open-slide repo. Triggers on phrases like "make slides about X", "create a presentation", "draft slides for", "new slide", or when the user asks to add content under `slides/`. Do NOT use for editing the framework itself — only for authoring content inside `slides/<id>/`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create a slide in open-slide
|
|
7
|
+
|
|
8
|
+
This skill owns the **workflow** for drafting a new deck. The technical reference — file contract, 1920×1080 canvas, type scale, palette, layout, assets — lives in the **`slide-authoring`** skill. Read that skill whenever you need details on *how* a page is structured. This skill assumes you'll consult it before writing code.
|
|
9
|
+
|
|
10
|
+
You only write files under `slides/<id>/`. Never modify `package.json`, `open-slide.config.ts`, or existing slides.
|
|
11
|
+
|
|
12
|
+
## Step 1 — Pick a theme
|
|
13
|
+
|
|
14
|
+
List files under `themes/`. If any theme markdown files exist (anything other than `README.md`), call `AskUserQuestion` with each theme id as an option plus a final **"no theme — design from scratch"** option.
|
|
15
|
+
|
|
16
|
+
- If the user picks a theme: read `themes/<id>.md` end-to-end. The theme's palette, typography, layout, and Title/Footer components are now authoritative — copy them directly into the slide. In Step 2, you can skip the **topic & aesthetic** question (the theme already commits to one direction); still ask about page count, text density, and motion since those are independent of theme.
|
|
17
|
+
- If the user picks "no theme", or `themes/` is empty (or contains only `README.md`): proceed to Step 2 unchanged.
|
|
18
|
+
|
|
19
|
+
If you skip the aesthetic question because a theme was picked, restate the theme name in Step 2 so the user can correct course before you start writing.
|
|
20
|
+
|
|
21
|
+
## Step 2 — Clarify requirements (MUST ask before writing code)
|
|
22
|
+
|
|
23
|
+
**Before doing anything else, call `AskUserQuestion` to confirm the four key style decisions below.** These shape every downstream choice (layout, type scale, asset needs, motion code), so locking them in up front avoids rework. Only skip a question when the user's original message already gave an unambiguous answer for it — and if you skip, restate your assumption so they can correct it.
|
|
24
|
+
|
|
25
|
+
Ask these four in a single `AskUserQuestion` call (multi-question form):
|
|
26
|
+
|
|
27
|
+
1. **Topic & aesthetic** — what is this slide about, and what visual direction? Offer options like: minimal editorial, playful, corporate-clean, retro, brutalist, soft/pastel, dark neon. If they have no preference, propose one.
|
|
28
|
+
2. **Page count** — rough length. Offer brackets: 3–5 (short), 6–10 (standard), 11–20 (deep dive), custom.
|
|
29
|
+
3. **Text density per page** — how much copy lives on each page? Offer: minimal (one line / big number), light (heading + 2–3 bullets), standard (heading + 4–5 bullets or short paragraph), dense (multi-column / detailed). This directly drives type scale and layout.
|
|
30
|
+
4. **Motion** — does the user want CSS/React animations and transitions, or a fully static deck? Offer: static (no motion), subtle (fades / entrance only), rich (keyframes, staggered reveals, looping visuals). If animated, plan to use CSS `@keyframes` / inline `style` + `useEffect`; no extra libraries.
|
|
31
|
+
|
|
32
|
+
After those four, ask follow-ups **only if still unclear**: audience, any drafted outline/content, brand colors, required assets. Don't pad the conversation with questions already answered.
|
|
33
|
+
|
|
34
|
+
## Step 3 — Pick a slide id
|
|
35
|
+
|
|
36
|
+
Use **kebab-case**, short, descriptive. Examples: `rust-intro`, `q2-roadmap`, `team-offsite-2026`. Check `slides/` to avoid collisions.
|
|
37
|
+
|
|
38
|
+
## Step 4 — Plan the structure
|
|
39
|
+
|
|
40
|
+
Sketch the slide as a list of page roles before writing code. Common page types:
|
|
41
|
+
|
|
42
|
+
| Role | Purpose |
|
|
43
|
+
| ---------------- | --------------------------------------------- |
|
|
44
|
+
| Cover | Title + subtitle, strong visual |
|
|
45
|
+
| Agenda | What's coming (3–5 items) |
|
|
46
|
+
| Section divider | Big label between chapters |
|
|
47
|
+
| Content | Heading + 2–5 bullets OR heading + one visual |
|
|
48
|
+
| Big number | One statistic the size of the canvas |
|
|
49
|
+
| Quote | Pull-quote with attribution |
|
|
50
|
+
| Comparison | Two-column before/after or A vs B |
|
|
51
|
+
| Closing | CTA, thanks, contact |
|
|
52
|
+
|
|
53
|
+
**Rule of thumb**: one idea per page. If you're tempted to put two, split them.
|
|
54
|
+
|
|
55
|
+
If the deck topic naturally calls for specific real images the user must supply (product screenshots, team photos, customer dashboards), plan where those go and use `<ImagePlaceholder>` from `@open-slide/core` — see the **Image placeholders** section in `slide-authoring`. Default is **no placeholders**: only insert one when a real image is genuinely required.
|
|
56
|
+
|
|
57
|
+
## Step 5 — Commit to a visual direction
|
|
58
|
+
|
|
59
|
+
Pick one coherent palette / type scale / aesthetic and hold it across every page. The full set of constraints (palette structure, type scale, padding, aesthetic options) lives in `slide-authoring` — apply it.
|
|
60
|
+
|
|
61
|
+
If the user wants the slide to remain tweakable from the Design panel afterwards, declare a top-level `const design: DesignSystem = { … }` at the top of `index.tsx` (after imports) using the chosen palette / type scale, and reference `design.X` from inline styles. The "Design system" section of `slide-authoring` covers the format and available tokens.
|
|
62
|
+
|
|
63
|
+
Consult the `frontend-design` skill for deeper aesthetic guidance if the user wants something bold.
|
|
64
|
+
|
|
65
|
+
## Step 6 — Write `slides/<id>/index.tsx`
|
|
66
|
+
|
|
67
|
+
Read the **`slide-authoring`** skill before writing — it covers the file contract, canvas rules, type scale, spacing, and asset imports, and it includes a starter template you can copy. Don't duplicate that knowledge here; use it.
|
|
68
|
+
|
|
69
|
+
## Step 7 — Self-review
|
|
70
|
+
|
|
71
|
+
Run the checklist in `slide-authoring` ("Self-review before finishing"). It covers structural correctness, layout discipline, and asset existence.
|
|
72
|
+
|
|
73
|
+
## Step 8 — Hand off to the user
|
|
74
|
+
|
|
75
|
+
Tell the user:
|
|
76
|
+
|
|
77
|
+
- The slide id and file path you created.
|
|
78
|
+
- That the dev server will hot-reload — they can open `http://localhost:5173/s/<id>` (or refresh the home page).
|
|
79
|
+
- If dev isn't running: `pnpm dev` from the repo root.
|
|
80
|
+
|
|
81
|
+
Don't run the dev server yourself unless asked.
|