@open-slide/core 1.19.1 → 2.0.0-beta.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/dist/{build-CaV_vhIw.js → build-CfAxF6Dm.js} +2 -5
- package/dist/cli/bin.d.ts +1 -1
- package/dist/cli/bin.js +139 -13
- package/dist/{config-CDHB8Oow.d.ts → config-AtA2Bqtn.d.ts} +4 -4
- package/dist/{config-GA6NMgs_.js → config-C_VI2EpT.js} +545 -776
- package/dist/{design-cpzS8aud.js → design-Cpqx7SJs.js} +1 -2
- package/dist/{dev-D57ui2yV.js → dev-BChELmc-.js} +4 -7
- package/dist/index.d.ts +7 -37
- package/dist/index.js +51 -54
- package/dist/locale/index.d.ts +2 -8
- package/dist/locale/index.js +13 -3
- package/dist/{preview-D40Zw_o0.js → preview-CcCQa268.js} +3 -7
- package/dist/{types-8HghULIe.d.ts → types-BzPSOxe-.d.ts} +5 -9
- package/dist/vite/index.d.ts +1 -4
- package/dist/vite/index.js +2 -4
- package/dist/{format-74A3B6zu.js → zh-tw-BxZ_pYqe.js} +13 -49
- package/package.json +12 -12
- package/skills/create-slide/SKILL.md +4 -1
- package/skills/slide-authoring/SKILL.md +25 -2
- package/src/app/app.tsx +1 -3
- package/src/app/assets/open-slide.png +0 -0
- package/src/app/components/asset-view.tsx +8 -16
- package/src/app/components/command/home-command-menu.tsx +6 -6
- package/src/app/components/export-progress-toast.tsx +80 -0
- package/src/app/components/history-provider.tsx +1 -5
- package/src/app/components/image-placeholder.tsx +4 -12
- package/src/app/components/inspector/asset-picker-dialog.tsx +6 -16
- package/src/app/components/inspector/image-crop-dialog.tsx +1 -4
- package/src/app/components/inspector/inline-text-editor.tsx +798 -0
- package/src/app/components/inspector/inspect-overlay.tsx +30 -72
- package/src/app/components/inspector/inspector-panel.tsx +17 -49
- package/src/app/components/inspector/inspector-provider.tsx +53 -36
- package/src/app/components/notes-drawer.tsx +2 -5
- package/src/app/components/overview-grid.tsx +5 -4
- package/src/app/components/panel/panel-shell.tsx +1 -3
- package/src/app/components/player.tsx +5 -6
- package/src/app/components/present/control-bar.tsx +4 -4
- package/src/app/components/present/jump-input.tsx +3 -2
- package/src/app/components/present/use-presenter-channel.ts +0 -1
- package/src/app/components/sidebar/folder-item.tsx +39 -16
- package/src/app/components/sidebar/sidebar-footer.tsx +7 -1
- package/src/app/components/sidebar/sidebar.tsx +91 -64
- package/src/app/components/slide-canvas.tsx +2 -6
- package/src/app/components/slide-transition-layer.tsx +48 -76
- package/src/app/components/style-panel/design-provider.tsx +1 -14
- package/src/app/components/style-panel/use-design.ts +1 -28
- package/src/app/components/themes/theme-detail.tsx +4 -4
- package/src/app/components/themes/themes-gallery.tsx +11 -6
- package/src/app/components/thumbnail-rail.tsx +7 -12
- package/src/app/lib/assets.ts +6 -7
- package/src/app/lib/dom.ts +42 -0
- package/src/app/lib/export-html.ts +10 -25
- package/src/app/lib/export-pdf.ts +11 -28
- package/src/app/lib/export-pptx.ts +6 -36
- package/src/app/lib/folders.ts +51 -46
- package/src/app/lib/inspector/inline-text.ts +31 -0
- package/src/app/lib/inspector/pick-target.ts +38 -0
- package/src/app/lib/inspector/use-comments.ts +1 -1
- package/src/app/lib/keys.ts +18 -0
- package/src/app/lib/last-home-location.ts +18 -0
- package/src/app/lib/print-ready.ts +2 -4
- package/src/app/lib/slides.ts +7 -4
- package/src/app/lib/text-diff.ts +19 -0
- package/src/app/lib/use-click-page-navigation.ts +2 -6
- package/src/app/lib/use-is-mobile.ts +2 -14
- package/src/app/lib/use-media-query.ts +20 -0
- package/src/app/lib/use-prefers-reduced-motion.ts +5 -13
- package/src/app/lib/use-slide-module.ts +1 -1
- package/src/app/lib/use-wheel-page-navigation.ts +1 -1
- package/src/app/lib/utils.test.ts +25 -1
- package/src/app/lib/utils.ts +8 -0
- package/src/app/routes/home-shell.tsx +71 -64
- package/src/app/routes/home.tsx +41 -52
- package/src/app/routes/presenter.tsx +10 -20
- package/src/app/routes/slide.tsx +84 -71
- package/src/app/routes/themes.tsx +7 -8
- package/src/app/styles.css +33 -44
- package/src/locale/en.ts +2 -7
- package/src/locale/ja.ts +2 -7
- package/src/locale/types.ts +2 -7
- package/src/locale/zh-cn.ts +2 -7
- package/src/locale/zh-tw.ts +2 -7
- package/dist/sync-BCJDRIqo.js +0 -139
- package/dist/sync-j9_QPovT.js +0 -3
- package/src/app/components/pdf-progress-toast.tsx +0 -36
- package/src/app/components/pptx-progress-toast.tsx +0 -36
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { createViteConfig } from "./config-GA6NMgs_.js";
|
|
1
|
+
import { t as createViteConfig } from "./config-C_VI2EpT.js";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { build as build$1, mergeConfig } from "vite";
|
|
5
|
-
|
|
6
4
|
//#region src/cli/build.ts
|
|
7
5
|
async function build(opts = {}) {
|
|
8
6
|
const base = await createViteConfig({
|
|
@@ -12,6 +10,5 @@ async function build(opts = {}) {
|
|
|
12
10
|
const config = mergeConfig(base, { build: { ...opts.outDir !== void 0 ? { outDir: path.resolve(process.cwd(), opts.outDir) } : {} } });
|
|
13
11
|
await build$1(config);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
//#endregion
|
|
17
|
-
export { build };
|
|
14
|
+
export { build };
|
package/dist/cli/bin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/cli/bin.js
CHANGED
|
@@ -1,12 +1,141 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { detectSkillsDrift, syncSkills } from "../sync-BCJDRIqo.js";
|
|
3
2
|
import chalk from "chalk";
|
|
4
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { cp, lstat, mkdir, readFile, readdir, readlink, rm, symlink } from "node:fs/promises";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import * as readline from "node:readline/promises";
|
|
7
6
|
import { fileURLToPath } from "node:url";
|
|
8
7
|
import { Command, Option } from "commander";
|
|
9
|
-
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
//#region src/cli/sync.ts
|
|
11
|
+
async function detectSkillsDrift(skillsDir) {
|
|
12
|
+
if (!existsSync(skillsDir)) return [];
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const agentsSkillsDir = path.join(cwd, ".agents", "skills");
|
|
15
|
+
const skillNames = (await readdir(skillsDir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
16
|
+
const results = [];
|
|
17
|
+
for (const name of skillNames) {
|
|
18
|
+
const src = path.join(skillsDir, name);
|
|
19
|
+
const dst = path.join(agentsSkillsDir, name);
|
|
20
|
+
const srcHash = await hashDir(src);
|
|
21
|
+
const dstHash = existsSync(dst) ? await hashDir(dst) : null;
|
|
22
|
+
let status;
|
|
23
|
+
if (dstHash === null) status = "added";
|
|
24
|
+
else if (dstHash !== srcHash) status = "updated";
|
|
25
|
+
else status = "unchanged";
|
|
26
|
+
results.push({
|
|
27
|
+
name,
|
|
28
|
+
status
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return results;
|
|
32
|
+
}
|
|
33
|
+
async function syncSkills(skillsDir, opts = {}) {
|
|
34
|
+
const { dryRun = false } = opts;
|
|
35
|
+
if (!existsSync(skillsDir)) throw new Error(`Built-in skills directory missing at ${skillsDir}. The @open-slide/core package may be corrupt — try reinstalling.`);
|
|
36
|
+
const cwd = process.cwd();
|
|
37
|
+
const agentsSkillsDir = path.join(cwd, ".agents", "skills");
|
|
38
|
+
const claudeSkillsDir = path.join(cwd, ".claude", "skills");
|
|
39
|
+
const results = await detectSkillsDrift(skillsDir);
|
|
40
|
+
if (results.length === 0) {
|
|
41
|
+
process.stdout.write(chalk.yellow("No skills found to sync.\n"));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
for (const { name, status } of results) {
|
|
45
|
+
const src = path.join(skillsDir, name);
|
|
46
|
+
const dst = path.join(agentsSkillsDir, name);
|
|
47
|
+
if (dryRun) continue;
|
|
48
|
+
if (status === "unchanged") {
|
|
49
|
+
await ensureClaudeSymlink(claudeSkillsDir, name);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
await mkdir(path.dirname(dst), { recursive: true });
|
|
53
|
+
if (existsSync(dst)) await rm(dst, {
|
|
54
|
+
recursive: true,
|
|
55
|
+
force: true
|
|
56
|
+
});
|
|
57
|
+
await cp(src, dst, { recursive: true });
|
|
58
|
+
await ensureClaudeSymlink(claudeSkillsDir, name);
|
|
59
|
+
}
|
|
60
|
+
printSummary(results, dryRun);
|
|
61
|
+
}
|
|
62
|
+
async function ensureClaudeSymlink(claudeSkillsDir, name) {
|
|
63
|
+
await mkdir(claudeSkillsDir, { recursive: true });
|
|
64
|
+
const linkPath = path.join(claudeSkillsDir, name);
|
|
65
|
+
const target = path.join("..", "..", ".agents", "skills", name);
|
|
66
|
+
if (existsSync(linkPath)) try {
|
|
67
|
+
if ((await lstat(linkPath)).isSymbolicLink()) {
|
|
68
|
+
if (await readlink(linkPath) === target) return;
|
|
69
|
+
}
|
|
70
|
+
await rm(linkPath, {
|
|
71
|
+
recursive: true,
|
|
72
|
+
force: true
|
|
73
|
+
});
|
|
74
|
+
} catch {
|
|
75
|
+
await rm(linkPath, {
|
|
76
|
+
recursive: true,
|
|
77
|
+
force: true
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
await symlink(target, linkPath, "dir");
|
|
82
|
+
} catch (err) {
|
|
83
|
+
const code = err.code;
|
|
84
|
+
if (code === "EPERM" || code === "EEXIST") {
|
|
85
|
+
const absoluteTarget = path.resolve(claudeSkillsDir, target);
|
|
86
|
+
await cp(absoluteTarget, linkPath, { recursive: true });
|
|
87
|
+
} else throw err;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function hashDir(dir) {
|
|
91
|
+
const hash = createHash("sha256");
|
|
92
|
+
const files = await collectFiles(dir);
|
|
93
|
+
files.sort();
|
|
94
|
+
for (const rel of files) {
|
|
95
|
+
const abs = path.join(dir, rel);
|
|
96
|
+
const data = await readFile(abs);
|
|
97
|
+
hash.update(rel);
|
|
98
|
+
hash.update("\0");
|
|
99
|
+
hash.update(data);
|
|
100
|
+
hash.update("\0");
|
|
101
|
+
}
|
|
102
|
+
return hash.digest("hex");
|
|
103
|
+
}
|
|
104
|
+
async function collectFiles(dir, prefix = "") {
|
|
105
|
+
const out = [];
|
|
106
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
107
|
+
for (const entry of entries) {
|
|
108
|
+
const rel = prefix ? path.join(prefix, entry.name) : entry.name;
|
|
109
|
+
if (entry.isDirectory()) out.push(...await collectFiles(path.join(dir, entry.name), rel));
|
|
110
|
+
else if (entry.isFile()) out.push(rel);
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
function printSummary(results, dryRun) {
|
|
115
|
+
const symbols = {
|
|
116
|
+
added: chalk.green("+"),
|
|
117
|
+
updated: chalk.yellow("~"),
|
|
118
|
+
unchanged: chalk.dim("=")
|
|
119
|
+
};
|
|
120
|
+
const labels = {
|
|
121
|
+
added: chalk.green("added"),
|
|
122
|
+
updated: chalk.yellow("updated"),
|
|
123
|
+
unchanged: chalk.dim("unchanged")
|
|
124
|
+
};
|
|
125
|
+
const header = dryRun ? chalk.bold("Dry run — no files written:") : chalk.bold("Synced built-in skills:");
|
|
126
|
+
process.stdout.write(`${header}\n`);
|
|
127
|
+
for (const { name, status } of results) process.stdout.write(` ${symbols[status]} ${name} ${chalk.dim(`(${labels[status]})`)}\n`);
|
|
128
|
+
const counts = results.reduce((acc, { status }) => {
|
|
129
|
+
acc[status] += 1;
|
|
130
|
+
return acc;
|
|
131
|
+
}, {
|
|
132
|
+
added: 0,
|
|
133
|
+
updated: 0,
|
|
134
|
+
unchanged: 0
|
|
135
|
+
});
|
|
136
|
+
process.stdout.write(chalk.dim(`\n${counts.added} added, ${counts.updated} updated, ${counts.unchanged} unchanged.\n`));
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
10
139
|
//#region src/cli/run.ts
|
|
11
140
|
async function readVersion() {
|
|
12
141
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -30,8 +159,7 @@ async function runSkillsDriftCheck(skillsDir) {
|
|
|
30
159
|
const stale = drift.filter((d) => d.status !== "unchanged");
|
|
31
160
|
if (stale.length === 0) return;
|
|
32
161
|
const names = stale.map((d) => d.name).join(", ");
|
|
33
|
-
|
|
34
|
-
if (!interactive) {
|
|
162
|
+
if (!Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
35
163
|
process.stderr.write(`${chalk.yellow("!")} Skills out of date (${names}). Run \`open-slide sync:skills\` to update.\n`);
|
|
36
164
|
return;
|
|
37
165
|
}
|
|
@@ -57,24 +185,22 @@ async function run(argv) {
|
|
|
57
185
|
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
186
|
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
187
|
if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
|
|
60
|
-
const { dev } = await import("../dev-
|
|
188
|
+
const { dev } = await import("../dev-BChELmc-.js");
|
|
61
189
|
await dev(flags);
|
|
62
190
|
});
|
|
63
191
|
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-
|
|
192
|
+
const { build } = await import("../build-CfAxF6Dm.js");
|
|
65
193
|
await build(flags);
|
|
66
194
|
});
|
|
67
195
|
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-
|
|
196
|
+
const { preview } = await import("../preview-CcCQa268.js");
|
|
69
197
|
await preview(flags);
|
|
70
198
|
});
|
|
71
199
|
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) => {
|
|
72
|
-
|
|
73
|
-
await syncSkills$1(resolveBuiltinSkillsDir(), flags);
|
|
200
|
+
await syncSkills(resolveBuiltinSkillsDir(), flags);
|
|
74
201
|
});
|
|
75
202
|
await program.parseAsync(argv, { from: "user" });
|
|
76
203
|
}
|
|
77
|
-
|
|
78
204
|
//#endregion
|
|
79
205
|
//#region src/cli/bin.ts
|
|
80
206
|
run(process.argv.slice(2)).catch((err) => {
|
|
@@ -82,5 +208,5 @@ run(process.argv.slice(2)).catch((err) => {
|
|
|
82
208
|
process.stderr.write(`${chalk.red("error:")} ${message}\n`);
|
|
83
209
|
process.exit(1);
|
|
84
210
|
});
|
|
85
|
-
|
|
86
|
-
|
|
211
|
+
//#endregion
|
|
212
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Locale } from "./types-
|
|
2
|
-
|
|
1
|
+
import { t as Locale } from "./types-BzPSOxe-.js";
|
|
3
2
|
//#region src/config.d.ts
|
|
4
3
|
type OpenSlideBuildConfig = {
|
|
5
4
|
showSlideBrowser?: boolean;
|
|
@@ -20,5 +19,6 @@ type OpenSlideConfig = {
|
|
|
20
19
|
*/
|
|
21
20
|
locale?: Locale;
|
|
22
21
|
build?: OpenSlideBuildConfig;
|
|
23
|
-
};
|
|
24
|
-
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { OpenSlideConfig as t };
|