@open-slide/core 1.15.2 → 1.16.0
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/README.md +1 -1
- package/dist/{build-CTCrO_M-.js → build-DaL4Gjn-.js} +1 -1
- package/dist/cli/bin.js +3 -3
- package/dist/{config-HXg3KTTo.js → config-CCHio3pk.js} +39 -11
- package/dist/{config-CE2sKgqH.d.ts → config-DIvIP8vY.d.ts} +1 -1
- package/dist/{dev-2FgsKkoD.js → dev-DLRQoCkT.js} +1 -1
- package/dist/{format-afijk371.js → format-CxmsgcBh.js} +8 -0
- package/dist/index.d.ts +15 -14
- package/dist/index.js +9 -6
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-Bdzz3PTc.js → preview-D3qVGc0S.js} +1 -1
- package/dist/{types-GA4ekcYB.d.ts → types-Di7nvL8V.d.ts} +2 -0
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +1 -1
- package/package.json +3 -3
- package/skills/apply-comments/SKILL.md +7 -8
- package/skills/create-slide/SKILL.md +9 -9
- package/skills/create-theme/SKILL.md +8 -5
- package/skills/current-slide/SKILL.md +1 -1
- package/skills/slide-authoring/SKILL.md +40 -315
- package/skills/slide-authoring/references/assets.md +52 -0
- package/skills/slide-authoring/references/design-system.md +48 -0
- package/skills/slide-authoring/references/morph.md +67 -0
- package/skills/slide-authoring/references/page-numbers.md +16 -0
- package/skills/slide-authoring/references/steps.md +43 -0
- package/skills/slide-authoring/references/transitions.md +175 -0
- package/skills/slide-authoring/references/webfonts.md +20 -0
- package/src/app/components/{shared-element.tsx → morph-element.tsx} +8 -13
- package/src/app/components/slide-transition-layer.tsx +61 -57
- package/src/app/lib/step-context.tsx +9 -1
- package/src/app/lib/transition.ts +2 -2
- package/src/app/routes/presenter.tsx +75 -17
- package/src/locale/en.ts +2 -0
- package/src/locale/ja.ts +2 -0
- package/src/locale/types.ts +2 -0
- package/src/locale/zh-cn.ts +2 -0
- package/src/locale/zh-tw.ts +2 -0
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ export const meta = { title: 'Hello' };
|
|
|
78
78
|
import {
|
|
79
79
|
CANVAS_WIDTH, // 1920
|
|
80
80
|
CANVAS_HEIGHT, // 1080
|
|
81
|
-
|
|
81
|
+
MorphElement, // match or fade objects across pages for morph transitions
|
|
82
82
|
type Page,
|
|
83
83
|
type SlideMeta,
|
|
84
84
|
type SlideModule,
|
package/dist/cli/bin.js
CHANGED
|
@@ -57,15 +57,15 @@ async function run(argv) {
|
|
|
57
57
|
program.name("open-slide").description("Author slides — we handle the Vite/React stack.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-slide --help` for usage)"));
|
|
58
58
|
program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").action(async (flags) => {
|
|
59
59
|
if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
|
|
60
|
-
const { dev } = await import("../dev-
|
|
60
|
+
const { dev } = await import("../dev-DLRQoCkT.js");
|
|
61
61
|
await dev(flags);
|
|
62
62
|
});
|
|
63
63
|
program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
|
|
64
|
-
const { build } = await import("../build-
|
|
64
|
+
const { build } = await import("../build-DaL4Gjn-.js");
|
|
65
65
|
await build(flags);
|
|
66
66
|
});
|
|
67
67
|
program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
|
|
68
|
-
const { preview } = await import("../preview-
|
|
68
|
+
const { preview } = await import("../preview-D3qVGc0S.js");
|
|
69
69
|
await preview(flags);
|
|
70
70
|
});
|
|
71
71
|
program.command("sync:skills").description("Sync built-in skills from @open-slide/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
|
|
@@ -3616,6 +3616,26 @@ function locTagsPlugin(opts) {
|
|
|
3616
3616
|
};
|
|
3617
3617
|
}
|
|
3618
3618
|
|
|
3619
|
+
//#endregion
|
|
3620
|
+
//#region src/vite/recent-writes.ts
|
|
3621
|
+
const recentWrites = new Map();
|
|
3622
|
+
const RECENT_WRITE_WINDOW_MS = 1500;
|
|
3623
|
+
/** Record that `file` was just written by us. */
|
|
3624
|
+
function recordWrite(file, now = Date.now()) {
|
|
3625
|
+
recentWrites.set(file, now);
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* True if `file` was recorded within the recent-write window. Expired entries
|
|
3629
|
+
* are pruned so a stale path can no longer suppress a later genuine edit.
|
|
3630
|
+
*/
|
|
3631
|
+
function hasRecentWrite(file, now = Date.now()) {
|
|
3632
|
+
const ts = recentWrites.get(file);
|
|
3633
|
+
if (ts == null) return false;
|
|
3634
|
+
if (now - ts < RECENT_WRITE_WINDOW_MS) return true;
|
|
3635
|
+
recentWrites.delete(file);
|
|
3636
|
+
return false;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3619
3639
|
//#endregion
|
|
3620
3640
|
//#region src/vite/notes-plugin.ts
|
|
3621
3641
|
function parseSource(source) {
|
|
@@ -3735,17 +3755,11 @@ function applyNotesEdit(source, index, text) {
|
|
|
3735
3755
|
function notesPlugin(opts) {
|
|
3736
3756
|
const userCwd = opts.userCwd;
|
|
3737
3757
|
const slidesDir = opts.slidesDir ?? "slides";
|
|
3738
|
-
const recentWrites = new Map();
|
|
3739
|
-
const RECENT_WRITE_WINDOW_MS = 1500;
|
|
3740
3758
|
return {
|
|
3741
3759
|
name: "open-slide:notes",
|
|
3742
3760
|
apply: "serve",
|
|
3743
3761
|
handleHotUpdate(ctx) {
|
|
3744
|
-
|
|
3745
|
-
if (ts != null && Date.now() - ts < RECENT_WRITE_WINDOW_MS) {
|
|
3746
|
-
recentWrites.delete(ctx.file);
|
|
3747
|
-
return [];
|
|
3748
|
-
}
|
|
3762
|
+
if (hasRecentWrite(ctx.file)) return [];
|
|
3749
3763
|
return void 0;
|
|
3750
3764
|
},
|
|
3751
3765
|
configureServer(server) {
|
|
@@ -3772,7 +3786,7 @@ function notesPlugin(opts) {
|
|
|
3772
3786
|
if (!result.ok) return json(res, result.status, { error: result.error });
|
|
3773
3787
|
const changed = result.source !== source;
|
|
3774
3788
|
if (changed) {
|
|
3775
|
-
|
|
3789
|
+
recordWrite(file);
|
|
3776
3790
|
await fs.writeFile(file, result.source, "utf8");
|
|
3777
3791
|
}
|
|
3778
3792
|
return json(res, 200, {
|
|
@@ -3877,8 +3891,9 @@ function parseCreatedAtMs(iso) {
|
|
|
3877
3891
|
const ms = Date.parse(iso);
|
|
3878
3892
|
return Number.isFinite(ms) ? ms : null;
|
|
3879
3893
|
}
|
|
3894
|
+
const warnedInvalidSlideIds = new Set();
|
|
3880
3895
|
async function generateSlidesModule(files, slidesRoot, isDev) {
|
|
3881
|
-
const
|
|
3896
|
+
const scanned = await Promise.all(files.map(async (abs) => {
|
|
3882
3897
|
const id = toId(abs, slidesRoot);
|
|
3883
3898
|
const importPath = isDev ? `@fs/${normalizePath(abs).replace(/^\/+/, "")}` : abs;
|
|
3884
3899
|
const meta = await readSlideMeta(abs);
|
|
@@ -3889,6 +3904,8 @@ async function generateSlidesModule(files, slidesRoot, isDev) {
|
|
|
3889
3904
|
createdAt: parseCreatedAtMs(meta.createdAt)
|
|
3890
3905
|
};
|
|
3891
3906
|
}));
|
|
3907
|
+
const entries = scanned.filter((e) => SLIDE_ID_RE.test(e.id));
|
|
3908
|
+
const ignored = scanned.filter((e) => !SLIDE_ID_RE.test(e.id)).map((e) => e.id);
|
|
3892
3909
|
const ids = JSON.stringify(entries.map((e) => e.id).sort());
|
|
3893
3910
|
const themesMap = {};
|
|
3894
3911
|
const createdAtMap = {};
|
|
@@ -3915,7 +3932,7 @@ if (import.meta.hot) {
|
|
|
3915
3932
|
const importExpr = isDev ? `import(/* @vite-ignore */ import.meta.env.BASE_URL + ${JSON.stringify(`${e.importPath}?t=`)} + slideImportTokens[${JSON.stringify(e.id)}])` : `import(${JSON.stringify(e.importPath)})`;
|
|
3916
3933
|
return ` case ${JSON.stringify(e.id)}: return ${importExpr};`;
|
|
3917
3934
|
}).join("\n");
|
|
3918
|
-
|
|
3935
|
+
const code = `// virtual:open-slide/slides — generated
|
|
3919
3936
|
export const slideIds = ${ids};
|
|
3920
3937
|
export const slideThemes = ${themesJson};
|
|
3921
3938
|
export const slideCreatedAt = ${createdAtJson};
|
|
@@ -3928,6 +3945,10 @@ ${cases}
|
|
|
3928
3945
|
}
|
|
3929
3946
|
}
|
|
3930
3947
|
`;
|
|
3948
|
+
return {
|
|
3949
|
+
code,
|
|
3950
|
+
ignored
|
|
3951
|
+
};
|
|
3931
3952
|
}
|
|
3932
3953
|
function openSlidePlugin(opts) {
|
|
3933
3954
|
const { userCwd, config, coreVersion } = opts;
|
|
@@ -3976,7 +3997,13 @@ function openSlidePlugin(opts) {
|
|
|
3976
3997
|
async load(id) {
|
|
3977
3998
|
if (id === resolved$1(SLIDES_VMOD)) {
|
|
3978
3999
|
const files = await findSlides(userCwd, slidesDir);
|
|
3979
|
-
|
|
4000
|
+
const { code, ignored } = await generateSlidesModule(files, slidesRoot, isDev);
|
|
4001
|
+
for (const slideId of ignored) {
|
|
4002
|
+
if (warnedInvalidSlideIds.has(slideId)) continue;
|
|
4003
|
+
warnedInvalidSlideIds.add(slideId);
|
|
4004
|
+
this.warn(`Ignoring slide folder "${slideId}": slide ids must match ${SLIDE_ID_RE} (lowercase/uppercase letters, digits, "-", "_"). Rename the folder under "${slidesDir}/" to a kebab-case id so it appears in the browser and can be moved into folders.`);
|
|
4005
|
+
}
|
|
4006
|
+
return code;
|
|
3980
4007
|
}
|
|
3981
4008
|
if (id === resolved$1(CONFIG_VMOD)) {
|
|
3982
4009
|
const userBuild = config.build ?? {};
|
|
@@ -4005,6 +4032,7 @@ function openSlidePlugin(opts) {
|
|
|
4005
4032
|
handleHotUpdate(ctx) {
|
|
4006
4033
|
const slideId = slideIdForEntry(ctx.file);
|
|
4007
4034
|
if (!slideId) return;
|
|
4035
|
+
if (hasRecentWrite(ctx.file)) return [];
|
|
4008
4036
|
queueSlideChanged(ctx.server, slideId);
|
|
4009
4037
|
return [];
|
|
4010
4038
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./design-cpzS8aud.js";
|
|
2
|
-
import { DEV_SUPERVISED_ENV, RESTART_EXIT_CODE, createViteConfig } from "./config-
|
|
2
|
+
import { DEV_SUPERVISED_ENV, RESTART_EXIT_CODE, createViteConfig } from "./config-CCHio3pk.js";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
@@ -140,6 +140,8 @@ const en = {
|
|
|
140
140
|
lastSlide: "Last slide",
|
|
141
141
|
endOfDeck: "End of deck",
|
|
142
142
|
speakerNotes: "Speaker notes",
|
|
143
|
+
notesTextSmaller: "Make notes text smaller",
|
|
144
|
+
notesTextLarger: "Make notes text larger",
|
|
143
145
|
noNotesPrefix: "No speaker notes for this slide. Add ",
|
|
144
146
|
noNotesSuffix: " to your slide module to see notes here.",
|
|
145
147
|
blackScreen: "Black screen",
|
|
@@ -575,6 +577,8 @@ const ja = {
|
|
|
575
577
|
lastSlide: "最後のスライド",
|
|
576
578
|
endOfDeck: "デッキの終わり",
|
|
577
579
|
speakerNotes: "発表者ノート",
|
|
580
|
+
notesTextSmaller: "ノートの文字を小さく",
|
|
581
|
+
notesTextLarger: "ノートの文字を大きく",
|
|
578
582
|
noNotesPrefix: "このスライドには発表者ノートがありません。スライドモジュールに ",
|
|
579
583
|
noNotesSuffix: " を追加するとここに表示されます。",
|
|
580
584
|
blackScreen: "黒い画面",
|
|
@@ -1010,6 +1014,8 @@ const zhCN = {
|
|
|
1010
1014
|
lastSlide: "最后一张",
|
|
1011
1015
|
endOfDeck: "演示结束",
|
|
1012
1016
|
speakerNotes: "演讲备注",
|
|
1017
|
+
notesTextSmaller: "缩小备注文字",
|
|
1018
|
+
notesTextLarger: "放大备注文字",
|
|
1013
1019
|
noNotesPrefix: "该幻灯片没有演讲备注。在你的幻灯片模块中添加 ",
|
|
1014
1020
|
noNotesSuffix: " 即可在此查看备注。",
|
|
1015
1021
|
blackScreen: "黑屏",
|
|
@@ -1445,6 +1451,8 @@ const zhTW = {
|
|
|
1445
1451
|
lastSlide: "最後一張",
|
|
1446
1452
|
endOfDeck: "簡報結束",
|
|
1447
1453
|
speakerNotes: "演講備忘",
|
|
1454
|
+
notesTextSmaller: "縮小備忘文字",
|
|
1455
|
+
notesTextLarger: "放大備忘文字",
|
|
1448
1456
|
noNotesPrefix: "此投影片沒有演講備忘。在你的投影片模組中加入 ",
|
|
1449
1457
|
noNotesSuffix: " 即可在此查看備忘。",
|
|
1450
1458
|
blackScreen: "黑屏",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Locale, Plural } from "./types-
|
|
2
|
-
import { OpenSlideConfig } from "./config-
|
|
1
|
+
import { Locale, Plural } from "./types-Di7nvL8V.js";
|
|
2
|
+
import { OpenSlideConfig } from "./config-DIvIP8vY.js";
|
|
3
3
|
import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
4
6
|
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
5
7
|
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
6
|
-
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
7
|
-
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/app/components/image-placeholder.d.ts
|
|
10
10
|
type ImagePlaceholderProps = {
|
|
@@ -21,22 +21,22 @@ declare function ImagePlaceholder({
|
|
|
21
21
|
style,
|
|
22
22
|
className,
|
|
23
23
|
...rest
|
|
24
|
-
}: ImagePlaceholderProps):
|
|
24
|
+
}: ImagePlaceholderProps): react_jsx_runtime0.JSX.Element;
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
|
-
//#region src/app/components/
|
|
28
|
-
type
|
|
27
|
+
//#region src/app/components/morph-element.d.ts
|
|
28
|
+
type MorphElementProps = {
|
|
29
29
|
id: string;
|
|
30
30
|
children: ReactNode;
|
|
31
31
|
className?: string;
|
|
32
32
|
style?: CSSProperties;
|
|
33
33
|
};
|
|
34
|
-
declare function
|
|
34
|
+
declare function MorphElement({
|
|
35
35
|
id,
|
|
36
36
|
children,
|
|
37
37
|
className,
|
|
38
38
|
style
|
|
39
|
-
}:
|
|
39
|
+
}: MorphElementProps): react_jsx_runtime1.JSX.Element;
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/app/lib/design.d.ts
|
|
@@ -83,9 +83,9 @@ type SlideTransition = {
|
|
|
83
83
|
easing?: string;
|
|
84
84
|
enter?: TransitionPhase;
|
|
85
85
|
exit?: TransitionPhase;
|
|
86
|
-
|
|
86
|
+
morph?: boolean | MorphTransition;
|
|
87
87
|
};
|
|
88
|
-
type
|
|
88
|
+
type MorphTransition = {
|
|
89
89
|
duration?: number;
|
|
90
90
|
easing?: string;
|
|
91
91
|
delay?: number;
|
|
@@ -114,10 +114,11 @@ declare const CANVAS_HEIGHT = 1080;
|
|
|
114
114
|
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/app/lib/step-context.d.ts
|
|
117
|
+
declare function useIsActivePage(): boolean;
|
|
117
118
|
type StepsProps = PropsWithChildren;
|
|
118
119
|
declare function Steps({
|
|
119
120
|
children
|
|
120
|
-
}: StepsProps):
|
|
121
|
+
}: StepsProps): react_jsx_runtime4.JSX.Element;
|
|
121
122
|
type StepProps = PropsWithChildren<{
|
|
122
123
|
duration?: number;
|
|
123
124
|
}>;
|
|
@@ -128,7 +129,7 @@ declare function Step({
|
|
|
128
129
|
children,
|
|
129
130
|
duration,
|
|
130
131
|
_revealed
|
|
131
|
-
}: InternalStepProps):
|
|
132
|
+
}: InternalStepProps): react_jsx_runtime5.JSX.Element;
|
|
132
133
|
|
|
133
134
|
//#endregion
|
|
134
|
-
export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, Locale, OpenSlideConfig, Page, Plural,
|
|
135
|
+
export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, Locale, MorphElement, MorphElementProps, MorphTransition, OpenSlideConfig, Page, Plural, SlideMeta, SlideModule, SlideTransition, Step, StepProps, Steps, StepsProps, TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { en, ja, zhCN, zhTW } from "./format-
|
|
1
|
+
import { en, ja, zhCN, zhTW } from "./format-CxmsgcBh.js";
|
|
2
2
|
import { cssVarsToString, defaultDesign, designToCssVars } from "./design-cpzS8aud.js";
|
|
3
3
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { toast } from "sonner";
|
|
@@ -334,11 +334,11 @@ function PlaceholderIcon() {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
//#endregion
|
|
337
|
-
//#region src/app/components/
|
|
338
|
-
function
|
|
337
|
+
//#region src/app/components/morph-element.tsx
|
|
338
|
+
function MorphElement({ id, children, className, style }) {
|
|
339
339
|
const child = Children.toArray(children)[0] ?? null;
|
|
340
340
|
if (Children.count(children) === 1 && isValidElement(child) && typeof child.type === "string") return cloneElement(child, {
|
|
341
|
-
"data-osd-
|
|
341
|
+
"data-osd-morph": id,
|
|
342
342
|
className: [child.props.className, className].filter(Boolean).join(" ") || void 0,
|
|
343
343
|
style: style ? {
|
|
344
344
|
...child.props.style,
|
|
@@ -348,7 +348,7 @@ function unstable_SharedElement({ id, children, className, style }) {
|
|
|
348
348
|
return /* @__PURE__ */ jsx("div", {
|
|
349
349
|
className,
|
|
350
350
|
style,
|
|
351
|
-
"data-osd-
|
|
351
|
+
"data-osd-morph": id,
|
|
352
352
|
children
|
|
353
353
|
});
|
|
354
354
|
}
|
|
@@ -396,6 +396,9 @@ const GLOBAL_KEY = "__open_slide_step_host_context__";
|
|
|
396
396
|
const g = globalThis;
|
|
397
397
|
if (!g[GLOBAL_KEY]) g[GLOBAL_KEY] = createContext(null);
|
|
398
398
|
const StepHostContext = g[GLOBAL_KEY];
|
|
399
|
+
function useIsActivePage() {
|
|
400
|
+
return useContext(StepHostContext)?.isActivePage ?? false;
|
|
401
|
+
}
|
|
399
402
|
function Steps({ children }) {
|
|
400
403
|
const host = useContext(StepHostContext);
|
|
401
404
|
const flat = Children.toArray(children);
|
|
@@ -466,4 +469,4 @@ function Step({ children, duration = 180, _revealed }) {
|
|
|
466
469
|
}
|
|
467
470
|
|
|
468
471
|
//#endregion
|
|
469
|
-
export { CANVAS_HEIGHT, CANVAS_WIDTH, ImagePlaceholder, Step, Steps, cssVarsToString, defaultDesign, designToCssVars,
|
|
472
|
+
export { CANVAS_HEIGHT, CANVAS_WIDTH, ImagePlaceholder, MorphElement, Step, Steps, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
|
package/dist/locale/index.d.ts
CHANGED
package/dist/locale/index.js
CHANGED
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": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@dnd-kit/sortable": "^10.0.0",
|
|
67
67
|
"@dnd-kit/utilities": "^3.2.2",
|
|
68
68
|
"@fontsource-variable/geist": "^5.2.8",
|
|
69
|
-
"@tailwindcss/vite": "^4.
|
|
69
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
70
70
|
"@vitejs/plugin-react": "^4.3.3",
|
|
71
71
|
"chalk": "^5.3.0",
|
|
72
72
|
"class-variance-authority": "^0.7.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"fast-glob": "^3.3.2",
|
|
77
77
|
"fflate": "^0.8.3",
|
|
78
78
|
"html-to-image": "^1.11.13",
|
|
79
|
-
"lucide-react": "^1.
|
|
79
|
+
"lucide-react": "^1.25.0",
|
|
80
80
|
"next-themes": "^0.4.6",
|
|
81
81
|
"react": "^18.3.1",
|
|
82
82
|
"react-dom": "^18.3.1",
|
|
@@ -28,13 +28,13 @@ Your job: read those markers, perform the described edits, and delete the marker
|
|
|
28
28
|
## Procedure
|
|
29
29
|
|
|
30
30
|
1. **Identify the target slide(s).**
|
|
31
|
-
- If the user names one (`
|
|
31
|
+
- If the user names one (`getting-started`, `q2-roadmap`, etc.), work on that single `slides/<slideId>/index.tsx`.
|
|
32
32
|
- If they say "all" or don't specify, scan every `slides/*/index.tsx`. Process each slide one at a time.
|
|
33
33
|
|
|
34
34
|
2. **Read the file and find all markers.**
|
|
35
35
|
- Run the regex above against the whole file.
|
|
36
36
|
- For each match, base64url-decode `text` and `JSON.parse` it to get `{ note, hint? }`.
|
|
37
|
-
- Record each hit as `{ id, lineIndex (0-based),
|
|
37
|
+
- Record each hit as `{ id, lineIndex (0-based), note, hint }`.
|
|
38
38
|
- If there are no markers, tell the user and stop.
|
|
39
39
|
|
|
40
40
|
3. **Understand each comment in context.**
|
|
@@ -48,14 +48,14 @@ Your job: read those markers, perform the described edits, and delete the marker
|
|
|
48
48
|
|
|
49
49
|
5. **Remove each marker after applying its edit.**
|
|
50
50
|
- Delete the entire marker line including its trailing `\n`.
|
|
51
|
-
- Never leave a marker behind
|
|
51
|
+
- Never leave a marker behind for an edit you applied — that signals a failure. Markers deliberately skipped per the edge cases below stay in place.
|
|
52
52
|
|
|
53
53
|
6. **Verify.**
|
|
54
|
-
- After all edits, re-read the file and confirm
|
|
55
|
-
-
|
|
54
|
+
- After all edits, re-read the file and confirm the only remaining markers are ones you reported as skipped.
|
|
55
|
+
- Confirm the edited JSX is well-formed (balanced tags, no dangling attributes). If the project's `package.json` has typecheck/lint scripts, run them with the project's package manager; scaffolded projects ship neither TypeScript nor a linter — there, rely on the running dev server (or the `build` script) to surface compile errors. Fix any errors you introduced.
|
|
56
56
|
|
|
57
57
|
7. **Report.**
|
|
58
|
-
- Summarise: `N applied,
|
|
58
|
+
- Summarise: `N applied, M skipped` plus a one-line description of each change (including the slide id).
|
|
59
59
|
|
|
60
60
|
## base64url decoding helper
|
|
61
61
|
|
|
@@ -71,8 +71,7 @@ You can run this inline via `node -e '...'` if you need to inspect a payload; ot
|
|
|
71
71
|
## Edge cases
|
|
72
72
|
|
|
73
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.
|
|
75
|
-
- **`_debugSource` used SWC instead of Babel**: not your problem — the marker line is authoritative.
|
|
74
|
+
- **Multiple markers stacked on consecutive lines inside the same element**: they all refer to that enclosing element. Read their notes in source order to understand the combined intent, then apply and delete them bottom-up per step 4.
|
|
76
75
|
- **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
76
|
- **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
77
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
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>/`.
|
|
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", "make a deck 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
4
|
---
|
|
5
5
|
|
|
6
6
|
# Create a slide in open-slide
|
|
@@ -11,16 +11,16 @@ You only write files under `slides/<id>/`. Never modify `package.json`, `open-sl
|
|
|
11
11
|
|
|
12
12
|
## Step 1 — Pick a theme
|
|
13
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.
|
|
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. (`AskUserQuestion` holds at most 4 options — with 4+ themes, offer the 3 most topic-relevant plus "no theme"; the auto-added "Other" lets the user name any omitted theme.)
|
|
15
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. **Also set `theme: '<theme-id>'` on the `meta` export in `index.tsx`** (e.g. `export const meta: SlideMeta = { title: '…', theme: '<theme-id>' };`) so the slide back-links to the theme (chip on the slide card + listing on `/themes/<id>`). In Step 2, skip the **aesthetic direction** question (the theme already commits to one direction); you still need the topic itself, so confirm it before moving on. Page count
|
|
17
|
-
- If the user picks "no theme", or `themes/`
|
|
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. If the theme declares a webfont import, load it per `references/webfonts.md` in `slide-authoring` (module-level, slide-keyed injection) — don't let the slide silently fall back to system fonts. **Also set `theme: '<theme-id>'` on the `meta` export in `index.tsx`** (e.g. `export const meta: SlideMeta = { title: '…', createdAt: '…', theme: '<theme-id>' };` — `createdAt` per the file contract in `slide-authoring`) so the slide back-links to the theme (chip on the slide card + listing on `/themes/<id>`). In Step 2, skip the **aesthetic direction** question (the theme already commits to one direction); you still need the topic itself, so confirm it before moving on. Page count and text density are independent of theme — ask those normally. For motion, if the theme's Motion section commits to a philosophy, present it as the "(Recommended)" option and reuse the theme's paste-ready keyframes; the user can still override.
|
|
17
|
+
- If the user picks "no theme", or `themes/` contains no theme markdown files: proceed to Step 2 unchanged.
|
|
18
18
|
|
|
19
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
20
|
|
|
21
21
|
## Step 2 — Clarify requirements (MUST ask before writing code)
|
|
22
22
|
|
|
23
|
-
**Before writing any code, lock in the four key style decisions below via `AskUserQuestion`.** They 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
|
|
23
|
+
**Before writing any code, lock in the four key style decisions below via `AskUserQuestion`.** They shape every downstream choice (layout, type scale, asset needs, motion code), so locking them in up front avoids rework. Only skip a question when it's already unambiguously answered — by the user's original message, or by a theme picked in Step 1 (a theme settles aesthetic direction, so ask only the remaining three) — and if you skip, restate your assumption so they can correct it.
|
|
24
24
|
|
|
25
25
|
**Topic comes first.** A meaningful aesthetic recommendation requires knowing what the deck is about. If the user's initial request is thin ("make me a deck", "draft some slides"), make a *separate* `AskUserQuestion` call first to gather topic, audience, and any draft outline. Skip this only if the topic is already clear from the user's message — in which case restate your reading of the topic in the next call so they can correct course.
|
|
26
26
|
|
|
@@ -35,9 +35,9 @@ Then ask these four in a single `AskUserQuestion` call (multi-question form):
|
|
|
35
35
|
|
|
36
36
|
Mark the option that best fits the topic and audience as "(Recommended)" so the user has a sensible default. (`AskUserQuestion` already auto-adds "Other" — don't add a generic catch-all yourself.)
|
|
37
37
|
|
|
38
|
-
2. **Page count** — rough length. Offer brackets: 3–5 (short), 6–10 (standard), 11–20 (deep dive)
|
|
38
|
+
2. **Page count** — rough length. Offer brackets: 3–5 (short), 6–10 (standard), 11–20 (deep dive). The auto-added "Other" covers custom counts.
|
|
39
39
|
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.
|
|
40
|
-
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
|
|
40
|
+
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 around the framework primitives first — `<Steps>`/`<Step>` for staged reveals, `SlideTransition` for page changes, morph for shared-element continuity (see `slide-authoring`) — plus CSS `@keyframes` / inline `style` + `useEffect` for in-page motion; no extra libraries.
|
|
41
41
|
|
|
42
42
|
After those four, ask follow-ups **only if still unclear**: brand colors, required assets. Don't pad the conversation with questions already answered.
|
|
43
43
|
|
|
@@ -70,7 +70,7 @@ Pick one coherent palette / type scale / aesthetic and hold it across every page
|
|
|
70
70
|
|
|
71
71
|
**Default: declare a top-level `export const design: DesignSystem = { … }`** at the top of `index.tsx` (after imports) using the chosen palette / type scale, and reference the values via `var(--osd-X)` from inline styles. This keeps the slide tweakable from the Design panel after generation, which is what the user almost always wants. Only skip the `design` const for a one-off slide whose palette is intentionally locked and not meant to be re-themed — in that case, fall back to the local `palette` constants pattern. The "Design system" section of `slide-authoring` covers the format and available tokens.
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
If the `frontend-design` skill is available, consult it for deeper aesthetic guidance when the user wants something bold.
|
|
74
74
|
|
|
75
75
|
## Step 6 — Write `slides/<id>/index.tsx`
|
|
76
76
|
|
|
@@ -86,6 +86,6 @@ Tell the user:
|
|
|
86
86
|
|
|
87
87
|
- The slide id and file path you created.
|
|
88
88
|
- That the dev server will hot-reload — they can open `http://localhost:5173/s/<id>` (or refresh the home page).
|
|
89
|
-
- If dev isn't running: `
|
|
89
|
+
- If dev isn't running: run the project's `dev` script from the project root with its package manager (`npm run dev`, `pnpm dev`, … — match the lockfile).
|
|
90
90
|
|
|
91
91
|
Don't run the dev server yourself unless asked.
|
|
@@ -31,8 +31,8 @@ If the user's original message already specifies the inputs unambiguously, skip
|
|
|
31
31
|
- **Images**: read each path with the `Read` tool (it accepts images). Note dominant colors as hex, type weight/style, layout rhythm, decorative motifs, and any recurring chrome (header bar, footer line, page numbers).
|
|
32
32
|
- **Text**: extract explicit tokens (hex codes, font names, motion verbs) and implicit tone words ("editorial", "playful", "brutalist"). Resolve vague language into concrete decisions before writing.
|
|
33
33
|
- **Existing slide**: read `slides/<id>/index.tsx` and pull:
|
|
34
|
-
- The `palette` object → Palette section.
|
|
35
|
-
-
|
|
34
|
+
- The `design.palette` object (or a legacy top-of-file `palette` const) → Palette section.
|
|
35
|
+
- `design.fonts` / font constants and any `font-size` patterns → Typography section.
|
|
36
36
|
- Padding / alignment patterns → Layout section.
|
|
37
37
|
- Recurring components (TrafficLights, Eyebrow, Footer-style helpers, WindowShell, …) → Fixed components section.
|
|
38
38
|
- `@keyframes` blocks and the shared `styles` string → Motion section.
|
|
@@ -52,6 +52,7 @@ Produce a file with this exact section order. Section bodies adapt to the theme;
|
|
|
52
52
|
---
|
|
53
53
|
name: <Human title, e.g. "Editorial Noir">
|
|
54
54
|
description: <one-line elevator pitch>
|
|
55
|
+
mode: <dark | light — whichever matches the palette's bg>
|
|
55
56
|
---
|
|
56
57
|
|
|
57
58
|
# <Theme name>
|
|
@@ -70,6 +71,7 @@ description: <one-line elevator pitch>
|
|
|
70
71
|
|
|
71
72
|
- Display font: `<stack>` — weight 800–900 for headlines.
|
|
72
73
|
- Body font: `<stack>` — weight 400–500.
|
|
74
|
+
- Webfont import (omit for system stacks): `<stylesheet URL>` — see `references/webfonts.md` in `slide-authoring` for loading rules.
|
|
73
75
|
- Type-scale overrides (only list what differs from `slide-authoring` defaults):
|
|
74
76
|
- Hero title: 180 px (default 140–200 ✓)
|
|
75
77
|
- Body text: 36 px
|
|
@@ -183,8 +185,8 @@ Contract:
|
|
|
183
185
|
- `import { type Page, useSlidePageNumber } from '@open-slide/core';`
|
|
184
186
|
- Inline the **same** `Title`, `Footer`, `Eyebrow` components defined in the theme markdown — verbatim, no abstractions, no imports from elsewhere. The demo and the markdown must stay in lockstep so what the user sees in the panel matches what `create-slide` will paste into a real slide.
|
|
185
187
|
- Export 2–3 `Page` components and a default array. Aim for: a Cover (Eyebrow + Title + subtitle), one Content page exercising body type + accent, and a Closer or "End" card. The "Example usage" block at the bottom of the markdown is a good starting point — extend it.
|
|
186
|
-
- If the theme has runtime-tweakable tokens worth surfacing in the Design panel later, also `export const design: DesignSystem = {...}
|
|
187
|
-
- No
|
|
188
|
+
- If the theme has runtime-tweakable tokens worth surfacing in the Design panel later, also `export const design: DesignSystem = {...}` (add `import type { DesignSystem } from '@open-slide/core';` alongside the base import).
|
|
189
|
+
- No asset file imports, no `import` from `@/`, no slides-only helpers (e.g. `WindowShell` from a real slide). Webfont stylesheet `@import`s inside an inline `<style>` are fine here — a deliberate exception to `webfonts.md`'s loader rules, since the demo only mounts in the Themes panel. Demo files must be self-contained.
|
|
188
190
|
|
|
189
191
|
Skeleton:
|
|
190
192
|
|
|
@@ -220,13 +222,14 @@ export default [Cover, Content, Closer];
|
|
|
220
222
|
Run this checklist before finishing:
|
|
221
223
|
|
|
222
224
|
- [ ] Palette covers `bg` / `text` / `accent` / `muted` at minimum, all as hex.
|
|
225
|
+
- [ ] Frontmatter includes `mode` matching the palette's background.
|
|
223
226
|
- [ ] Type scale specifies hero, heading, body, caption sizes (or explicitly defers to `slide-authoring` defaults).
|
|
224
227
|
- [ ] At least Title and Footer are defined as paste-ready React with concrete inline styles.
|
|
225
228
|
- [ ] Motion section commits to one of static / subtle / rich.
|
|
226
229
|
- [ ] Aesthetic paragraph names a single coherent direction.
|
|
227
230
|
- [ ] Both files written: `themes/<id>.md` and `themes/<id>.demo.tsx`. No slide changes, no config changes.
|
|
228
231
|
- [ ] Demo `.tsx` exports 2–3 pages and inlines the same Title/Footer/Eyebrow components defined in the markdown.
|
|
229
|
-
- [ ] Demo
|
|
232
|
+
- [ ] Demo `.tsx` will load cleanly in the **Themes** panel: verify it against the Step 4b contract by reading the file — do not start a server.
|
|
230
233
|
|
|
231
234
|
## Step 6 — Hand off
|
|
232
235
|
|
|
@@ -76,7 +76,7 @@ Path is relative to the project root (the user's `cwd`, the directory that conta
|
|
|
76
76
|
`updatedAt` is the last time the user navigated. Treat it like a cache:
|
|
77
77
|
|
|
78
78
|
- **Fresh (under ~5 minutes old)**: trust it. Open `pagePath`, do the work.
|
|
79
|
-
- **Older than ~5 minutes
|
|
79
|
+
- **Older than ~5 minutes**: confirm with the user before editing. The dev server may not be running; the user may have switched contexts.
|
|
80
80
|
- **Hours/days old**: ignore it. Ask the user which slide they mean.
|
|
81
81
|
|
|
82
82
|
A *newer* `updatedAt` than the one you saw last turn is the normal signal that the user has moved — switch to the new `slideId` / `pageIndex` / `selection` without asking.
|