@open-slide/core 2.0.1 → 2.2.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.
Files changed (57) hide show
  1. package/dist/{build-DOgOEZZA.js → build-DTmKJyjX.js} +1 -1
  2. package/dist/cli/bin.js +4 -4
  3. package/dist/{config-hT1o6Jct.js → config-Ces2X_3T.js} +159 -17
  4. package/dist/{config-GMR1QUlM.d.ts → config-CpmGqpQi.d.ts} +1 -1
  5. package/dist/{dev-_YkLNJRt.js → dev-ldYag-pR.js} +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +4 -3
  8. package/dist/locale/index.d.ts +5 -2
  9. package/dist/locale/index.js +2 -2
  10. package/dist/{preview-pABcGTQh.js → preview-GYMbZvvk.js} +1 -1
  11. package/dist/{types-BcbaKTNY.d.ts → types-CvAqFqsY.d.ts} +10 -5
  12. package/dist/{update-moCkSyvg.js → update-CPBitJQq.js} +24 -14
  13. package/dist/vite/index.d.ts +1 -1
  14. package/dist/vite/index.js +1 -1
  15. package/dist/{zh-tw-DlZoAc2-.js → zh-tw-B7_Oqv2q.js} +550 -17
  16. package/package.json +3 -3
  17. package/skills/apply-comments/SKILL.md +10 -6
  18. package/skills/create-slide/SKILL.md +2 -0
  19. package/skills/current-slide/SKILL.md +1 -0
  20. package/skills/slide-authoring/SKILL.md +31 -1
  21. package/src/app/app.tsx +2 -0
  22. package/src/app/assets/open-slide.svg +39 -0
  23. package/src/app/components/command/command-menu.tsx +1 -3
  24. package/src/app/components/history-provider.tsx +25 -3
  25. package/src/app/components/icon-switcher-indicator.tsx +1 -1
  26. package/src/app/components/inspector/comment-layer.tsx +992 -0
  27. package/src/app/components/inspector/inspect-overlay.tsx +2 -39
  28. package/src/app/components/inspector/inspector-panel.tsx +9 -92
  29. package/src/app/components/inspector/inspector-provider.tsx +299 -67
  30. package/src/app/components/panel/editor-sidebar.tsx +1 -1
  31. package/src/app/components/panel/save-card.tsx +6 -2
  32. package/src/app/components/preview-step-host.tsx +16 -0
  33. package/src/app/components/sidebar/sidebar.tsx +2 -2
  34. package/src/app/components/slide-transition-layer.tsx +1 -1
  35. package/src/app/components/style-panel/style-panel.tsx +3 -2
  36. package/src/app/components/thumbnail-rail.tsx +76 -1
  37. package/src/app/favicon.ico +0 -0
  38. package/src/app/favicon.svg +39 -0
  39. package/src/app/index.html +2 -1
  40. package/src/app/lib/inspector/freeze-motion.ts +61 -0
  41. package/src/app/lib/inspector/use-comments.ts +32 -3
  42. package/src/app/lib/keys.ts +3 -0
  43. package/src/app/lib/locale-store.ts +6 -1
  44. package/src/app/lib/print-ready.ts +9 -6
  45. package/src/app/routes/presenter.tsx +1 -16
  46. package/src/app/routes/preview.tsx +169 -0
  47. package/src/app/routes/slide.tsx +119 -70
  48. package/src/app/styles.css +64 -80
  49. package/src/locale/en.ts +7 -4
  50. package/src/locale/es.ts +550 -0
  51. package/src/locale/index.ts +1 -0
  52. package/src/locale/ja.ts +7 -5
  53. package/src/locale/types.ts +10 -5
  54. package/src/locale/zh-cn.ts +7 -4
  55. package/src/locale/zh-tw.ts +7 -4
  56. package/src/app/assets/open-slide.png +0 -0
  57. package/src/app/components/inspector/comment-widget.tsx +0 -119
@@ -1,5 +1,5 @@
1
1
  import { r as printHeader, t as createCliLogger } from "./cli/bin.js";
2
- import { t as createViteConfig } from "./config-hT1o6Jct.js";
2
+ import { t as createViteConfig } from "./config-Ces2X_3T.js";
3
3
  import path from "node:path";
4
4
  import { build as build$1, mergeConfig } from "vite";
5
5
  //#region src/cli/build.ts
package/dist/cli/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as detectPackageManager } from "../update-moCkSyvg.js";
2
+ import { t as detectPackageManager } from "../update-CPBitJQq.js";
3
3
  import path from "node:path";
4
4
  import * as readline from "node:readline/promises";
5
5
  import { fileURLToPath } from "node:url";
@@ -453,17 +453,17 @@ async function run(argv) {
453
453
  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) => {
454
454
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
455
455
  await assertViteResolvesToCore();
456
- const { dev } = await import("../dev-_YkLNJRt.js");
456
+ const { dev } = await import("../dev-ldYag-pR.js");
457
457
  await dev(flags);
458
458
  });
459
459
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
460
460
  await assertViteResolvesToCore();
461
- const { build } = await import("../build-DOgOEZZA.js");
461
+ const { build } = await import("../build-DTmKJyjX.js");
462
462
  await build(flags);
463
463
  });
464
464
  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) => {
465
465
  await assertViteResolvesToCore();
466
- const { preview } = await import("../preview-pABcGTQh.js");
466
+ const { preview } = await import("../preview-GYMbZvvk.js");
467
467
  await preview(flags);
468
468
  });
469
469
  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) => {
@@ -1,9 +1,9 @@
1
1
  import { n as defaultDesign } from "./design-Cpqx7SJs.js";
2
- import { C as reorderDefaultExportPagesInSource, D as updateMetaTitleInSource, E as rmSlideDir, O as validateSlideName, S as removePageFromDefaultExportInSource, T as resolveSlideEntry, _ as SLIDE_ID_RE, a as readBody, b as duplicateSlideDir, c as FOLDER_ID_RE, d as readManifest, f as validateIcon, g as shortId, h as writeManifest, i as makeContext, k as validateMutationRequest, l as foldersManifestPath, m as validateReorder, n as registerUpdateRoutes, o as readSlideSource, p as validateName, r as json, s as resolveSlideEntryPath, u as newFolderId, v as duplicateNotesElementInSource, w as reorderNotesArrayInSource, x as removeNotesElementInSource, y as duplicatePageInDefaultExportInSource } from "./update-moCkSyvg.js";
2
+ import { C as reorderDefaultExportPagesInSource, D as updateMetaTitleInSource, E as rmSlideDir, O as validateSlideName, S as removePageFromDefaultExportInSource, T as resolveSlideEntry, _ as SLIDE_ID_RE, a as readBody, b as duplicateSlideDir, c as FOLDER_ID_RE, d as readManifest, f as validateIcon, g as shortId, h as writeManifest, i as makeContext, k as validateMutationRequest, l as foldersManifestPath, m as validateReorder, n as registerUpdateRoutes, o as readSlideSource, p as validateName, r as json, s as resolveSlideEntryPath, u as newFolderId, v as duplicateNotesElementInSource, w as reorderNotesArrayInSource, x as removeNotesElementInSource, y as duplicatePageInDefaultExportInSource } from "./update-CPBitJQq.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
- import { existsSync, readFileSync } from "node:fs";
6
+ import { existsSync, readFileSync, rmSync } from "node:fs";
7
7
  import fs from "node:fs/promises";
8
8
  import { parse } from "@babel/parser";
9
9
  import { randomUUID } from "node:crypto";
@@ -1495,6 +1495,24 @@ function b64urlDecode(s) {
1495
1495
  const pad = s.length % 4 === 0 ? "" : "=".repeat(4 - s.length % 4);
1496
1496
  return Buffer.from(s.replace(/-/g, "+").replace(/_/g, "/") + pad, "base64").toString("utf8");
1497
1497
  }
1498
+ function isFiniteNumber(value) {
1499
+ return typeof value === "number" && Number.isFinite(value);
1500
+ }
1501
+ function parseCommentRect(value) {
1502
+ if (!value || typeof value !== "object") return void 0;
1503
+ const { x, y, w, h } = value;
1504
+ if (!isFiniteNumber(x) || !isFiniteNumber(y) || !isFiniteNumber(w) || !isFiniteNumber(h)) return void 0;
1505
+ if (w <= 0 || h <= 0) return void 0;
1506
+ return {
1507
+ x: Math.round(x),
1508
+ y: Math.round(y),
1509
+ w: Math.round(w),
1510
+ h: Math.round(h)
1511
+ };
1512
+ }
1513
+ function parseCommentPage(value) {
1514
+ return isFiniteNumber(value) && value >= 0 ? Math.floor(value) : void 0;
1515
+ }
1498
1516
  function parseMarkers(source) {
1499
1517
  const comments = [];
1500
1518
  const lines = source.split("\n");
@@ -1509,12 +1527,36 @@ function parseMarkers(source) {
1509
1527
  line: i + 1,
1510
1528
  ts,
1511
1529
  note: payload.note,
1512
- hint: payload.hint
1530
+ hint: payload.hint,
1531
+ rect: parseCommentRect(payload.rect),
1532
+ page: parseCommentPage(payload.page)
1513
1533
  });
1514
1534
  } catch {}
1515
1535
  }
1516
1536
  return comments;
1517
1537
  }
1538
+ function markerColumn(source, line) {
1539
+ const index = (source.split("\n")[line - 1] ?? "").search(/\{\/\*\s*@slide-comment/);
1540
+ return index === -1 ? 0 : index;
1541
+ }
1542
+ function resolveTargets(source, comments) {
1543
+ const ast = parseSource(source);
1544
+ return comments.map((comment) => {
1545
+ if (!ast) return {
1546
+ ...comment,
1547
+ target: null
1548
+ };
1549
+ const column = markerColumn(source, comment.line);
1550
+ const start = findJsxAncestors(ast, comment.line, column).find((node) => t.isJSXElement(node))?.loc?.start;
1551
+ return {
1552
+ ...comment,
1553
+ target: start ? {
1554
+ line: start.line,
1555
+ column: start.column
1556
+ } : null
1557
+ };
1558
+ });
1559
+ }
1518
1560
  function newCommentId() {
1519
1561
  return shortId("c");
1520
1562
  }
@@ -1536,11 +1578,43 @@ function lineIndent(source, lineNumber) {
1536
1578
  }
1537
1579
  function planInsertion(source, target) {
1538
1580
  if (t.isJSXElement(target) && target.openingElement.selfClosing) return null;
1581
+ const offset = (t.isJSXFragment(target) ? target.openingFragment : target.openingElement).end ?? 0;
1539
1582
  return {
1540
- offset: (t.isJSXFragment(target) ? target.openingFragment : target.openingElement).end ?? 0,
1541
- indent: `${lineIndent(source, target.loc?.start.line ?? 1)} `
1583
+ offset,
1584
+ indent: `${lineIndent(source, target.loc?.start.line ?? 1)} `,
1585
+ breakAfter: !/^[ \t]*\r?\n/.test(source.slice(offset))
1542
1586
  };
1543
1587
  }
1588
+ function buildMarker(plan, id, ts, encodedText) {
1589
+ const marker = `\n${plan.indent}{/* @slide-comment id="${id}" ts="${ts}" text="${encodedText}" */}`;
1590
+ return plan.breakAfter ? `${marker}\n${plan.indent}` : marker;
1591
+ }
1592
+ function updateMarkerNote(source, id, note) {
1593
+ const re = new RegExp(`(\\{\\/\\*\\s*@slide-comment\\s+id="${id}"\\s+ts="[^"]+"\\s+text=")([A-Za-z0-9_\\-]+={0,2})("\\s*\\*\\/\\})`);
1594
+ const m = source.match(re);
1595
+ if (!m) return null;
1596
+ let payload;
1597
+ try {
1598
+ payload = JSON.parse(b64urlDecode(m[2]));
1599
+ } catch {
1600
+ return null;
1601
+ }
1602
+ const encoded = b64urlEncode(JSON.stringify({
1603
+ ...payload,
1604
+ note
1605
+ }));
1606
+ return source.replace(re, `$1${encoded}$3`);
1607
+ }
1608
+ function removeMarker(source, id) {
1609
+ const lines = source.split("\n");
1610
+ const idRe = markerDeleteRegex(id);
1611
+ const hit = lines.findIndex((line) => idRe.test(line));
1612
+ if (hit === -1) return null;
1613
+ const stripped = lines[hit].replace(idRe, "");
1614
+ if (stripped.trim() === "") lines.splice(hit, 1);
1615
+ else lines[hit] = stripped;
1616
+ return lines.join("\n");
1617
+ }
1544
1618
  function findInsertion(source, line, column) {
1545
1619
  const ast = parseSource(source);
1546
1620
  if (!ast) return null;
@@ -1567,7 +1641,7 @@ function registerCommentRoutes(server, ctx) {
1567
1641
  if (!file) return json(res, 400, { error: "invalid slideId" });
1568
1642
  const source = await readSlideSource(file);
1569
1643
  if (source === null) return json(res, 404, { error: "slide not found" });
1570
- return json(res, 200, { comments: parseMarkers(source) });
1644
+ return json(res, 200, { comments: resolveTargets(source, parseMarkers(source)) });
1571
1645
  }
1572
1646
  if (method === "POST" && url.pathname === "/add") {
1573
1647
  const requestCheck = validateMutationRequest(req, { requireJsonBody: true });
@@ -1584,11 +1658,13 @@ function registerCommentRoutes(server, ctx) {
1584
1658
  if (!plan) return json(res, 422, { error: `could not find a JSX container around line ${body.line}. Try clicking a different element.` });
1585
1659
  const id = newCommentId();
1586
1660
  const ts = (/* @__PURE__ */ new Date()).toISOString();
1587
- const payload = b64urlEncode(JSON.stringify({
1661
+ const payload = {
1588
1662
  note: body.text,
1589
- hint: body.hint
1590
- }));
1591
- const marker = `\n${plan.indent}{/* @slide-comment id="${id}" ts="${ts}" text="${payload}" */}`;
1663
+ hint: body.hint,
1664
+ rect: parseCommentRect(body.rect),
1665
+ page: parseCommentPage(body.page)
1666
+ };
1667
+ const marker = buildMarker(plan, id, ts, b64urlEncode(JSON.stringify(payload)));
1592
1668
  const next = source.slice(0, plan.offset) + marker + source.slice(plan.offset);
1593
1669
  await fs.writeFile(file, next, "utf8");
1594
1670
  const markerLine = offsetToLine(next, plan.offset + 1);
@@ -1597,6 +1673,22 @@ function registerCommentRoutes(server, ctx) {
1597
1673
  line: markerLine
1598
1674
  });
1599
1675
  }
1676
+ if (method === "PUT" && url.pathname.startsWith("/")) {
1677
+ const requestCheck = validateMutationRequest(req, { requireJsonBody: true });
1678
+ if (!requestCheck.ok) return json(res, requestCheck.status, { error: requestCheck.error });
1679
+ const id = url.pathname.slice(1);
1680
+ if (!/^c-[a-f0-9]+$/.test(id)) return json(res, 400, { error: "invalid id" });
1681
+ const body = await readBody(req);
1682
+ const file = resolveSlideEntryPath(ctx, body.slideId ?? "");
1683
+ if (!file) return json(res, 400, { error: "invalid slideId" });
1684
+ if (!body.text || typeof body.text !== "string") return json(res, 400, { error: "missing text" });
1685
+ const source = await readSlideSource(file);
1686
+ if (source === null) return json(res, 404, { error: "slide not found" });
1687
+ const next = updateMarkerNote(source, id, body.text);
1688
+ if (next === null) return json(res, 404, { error: "marker not found" });
1689
+ await fs.writeFile(file, next, "utf8");
1690
+ return json(res, 200, { ok: true });
1691
+ }
1600
1692
  if (method === "DELETE" && url.pathname.startsWith("/")) {
1601
1693
  const requestCheck = validateMutationRequest(req);
1602
1694
  if (!requestCheck.ok) return json(res, requestCheck.status, { error: requestCheck.error });
@@ -1607,12 +1699,9 @@ function registerCommentRoutes(server, ctx) {
1607
1699
  if (!file) return json(res, 400, { error: "invalid slideId" });
1608
1700
  const source = await readSlideSource(file);
1609
1701
  if (source === null) return json(res, 404, { error: "slide not found" });
1610
- const lines = source.split("\n");
1611
- const idRe = markerDeleteRegex(id);
1612
- const hit = lines.findIndex((l) => idRe.test(l));
1613
- if (hit === -1) return json(res, 404, { error: "marker not found" });
1614
- lines.splice(hit, 1);
1615
- await fs.writeFile(file, lines.join("\n"), "utf8");
1702
+ const next = removeMarker(source, id);
1703
+ if (next === null) return json(res, 404, { error: "marker not found" });
1704
+ await fs.writeFile(file, next, "utf8");
1616
1705
  return json(res, 200, { ok: true });
1617
1706
  }
1618
1707
  next();
@@ -3178,6 +3267,58 @@ async function loadUserConfig(userCwd) {
3178
3267
  }, file, userCwd, "silent"))?.config ?? {};
3179
3268
  }
3180
3269
  //#endregion
3270
+ //#region src/vite/server-info-plugin.ts
3271
+ function serverInfoUrl(address, https, base) {
3272
+ let host = address.address === "::" || address.address === "0.0.0.0" ? "localhost" : address.address;
3273
+ if (host.includes(":")) host = `[${host}]`;
3274
+ const pathname = base.startsWith("/") ? base : "/";
3275
+ return `${https ? "https" : "http"}://${host}:${address.port}${pathname}`;
3276
+ }
3277
+ function serverInfoPlugin(opts) {
3278
+ const outDir = path.join(opts.userCwd, "node_modules", ".open-slide");
3279
+ const outFile = path.join(outDir, "server.json");
3280
+ return {
3281
+ name: "open-slide:server-info",
3282
+ apply: "serve",
3283
+ configureServer(server) {
3284
+ const httpServer = server.httpServer;
3285
+ if (!httpServer) return;
3286
+ let publication = Promise.resolve(null);
3287
+ httpServer.on("listening", () => {
3288
+ const address = httpServer.address();
3289
+ if (!address || typeof address === "string") return;
3290
+ const token = randomUUID();
3291
+ const body = {
3292
+ url: serverInfoUrl(address, Boolean(server.config.server.https), server.config.base),
3293
+ port: address.port,
3294
+ pid: process.pid,
3295
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
3296
+ token
3297
+ };
3298
+ const tmpFile = `${outFile}.${token}.tmp`;
3299
+ publication = (async () => {
3300
+ try {
3301
+ await fs.mkdir(outDir, { recursive: true });
3302
+ await fs.writeFile(tmpFile, `${JSON.stringify(body, null, 2)}\n`, "utf8");
3303
+ await fs.rename(tmpFile, outFile);
3304
+ return token;
3305
+ } catch {
3306
+ await fs.rm(tmpFile, { force: true }).catch(() => {});
3307
+ return null;
3308
+ }
3309
+ })();
3310
+ });
3311
+ httpServer.on("close", async () => {
3312
+ const token = await publication;
3313
+ if (!token) return;
3314
+ try {
3315
+ if (JSON.parse(readFileSync(outFile, "utf8")).token === token) rmSync(outFile, { force: true });
3316
+ } catch {}
3317
+ });
3318
+ }
3319
+ };
3320
+ }
3321
+ //#endregion
3181
3322
  //#region src/vite/themes-plugin.ts
3182
3323
  const THEMES_VMOD = "virtual:open-slide/themes";
3183
3324
  function resolved(id) {
@@ -3386,7 +3527,8 @@ async function createViteConfig(opts) {
3386
3527
  currentPlugin({
3387
3528
  userCwd,
3388
3529
  slidesDir
3389
- })
3530
+ }),
3531
+ serverInfoPlugin({ userCwd })
3390
3532
  ],
3391
3533
  resolve: {
3392
3534
  alias: {
@@ -1,4 +1,4 @@
1
- import { t as Locale } from "./types-BcbaKTNY.js";
1
+ import { t as Locale } from "./types-CvAqFqsY.js";
2
2
  //#region src/config.d.ts
3
3
  type OpenSlideBuildConfig = {
4
4
  showSlideBrowser?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { a as printUrls, i as printShortcutsHint, n as formatError, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
2
- import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-hT1o6Jct.js";
2
+ import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-Ces2X_3T.js";
3
3
  import path from "node:path";
4
4
  import { existsSync } from "node:fs";
5
5
  import { fork } from "node:child_process";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as Plural, t as Locale } from "./types-BcbaKTNY.js";
2
- import { t as OpenSlideConfig } from "./config-GMR1QUlM.js";
1
+ import { n as Plural, t as Locale } from "./types-CvAqFqsY.js";
2
+ import { t as OpenSlideConfig } from "./config-CpmGqpQi.js";
3
3
  import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
4
4
  //#region src/app/components/image-placeholder.d.ts
5
5
  type ImagePlaceholderProps = {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as en, n as zhCN, r as ja, t as zhTW } from "./zh-tw-DlZoAc2-.js";
1
+ import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "./zh-tw-B7_Oqv2q.js";
2
2
  import { n as defaultDesign, r as designToCssVars, t as cssVarsToString } from "./design-Cpqx7SJs.js";
3
3
  import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { toast } from "sonner";
@@ -85,12 +85,13 @@ const LOCALES = {
85
85
  en,
86
86
  "zh-TW": zhTW,
87
87
  "zh-CN": zhCN,
88
- ja
88
+ ja,
89
+ es
89
90
  };
90
91
  const STORAGE_KEY = "open-slide:locale";
91
92
  const configLocale = config.locale;
92
93
  function isLocaleId(value) {
93
- return value === "en" || value === "zh-TW" || value === "zh-CN" || value === "ja";
94
+ return value === "en" || value === "zh-TW" || value === "zh-CN" || value === "ja" || value === "es";
94
95
  }
95
96
  function readStored() {
96
97
  try {
@@ -1,7 +1,10 @@
1
- import { n as Plural, t as Locale } from "../types-BcbaKTNY.js";
1
+ import { n as Plural, t as Locale } from "../types-CvAqFqsY.js";
2
2
  //#region src/locale/en.d.ts
3
3
  declare const en: Locale;
4
4
  //#endregion
5
+ //#region src/locale/es.d.ts
6
+ declare const es: Locale;
7
+ //#endregion
5
8
  //#region src/locale/format.d.ts
6
9
  declare function format(template: string, vars: Record<string, string | number>): string;
7
10
  declare function plural(count: number, forms: Plural): string;
@@ -15,4 +18,4 @@ declare const zhCN: Locale;
15
18
  //#region src/locale/zh-tw.d.ts
16
19
  declare const zhTW: Locale;
17
20
  //#endregion
18
- export { type Locale, type Plural, en, format, ja, plural, zhCN, zhTW };
21
+ export { type Locale, type Plural, en, es, format, ja, plural, zhCN, zhTW };
@@ -1,4 +1,4 @@
1
- import { i as en, n as zhCN, r as ja, t as zhTW } from "../zh-tw-DlZoAc2-.js";
1
+ import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "../zh-tw-B7_Oqv2q.js";
2
2
  //#region src/locale/format.ts
3
3
  function format(template, vars) {
4
4
  return template.replace(/\{(\w+)\}/g, (m, key) => {
@@ -10,4 +10,4 @@ function plural(count, forms) {
10
10
  return count === 1 ? forms.one : forms.other;
11
11
  }
12
12
  //#endregion
13
- export { en, format, ja, plural, zhCN, zhTW };
13
+ export { en, es, format, ja, plural, zhCN, zhTW };
@@ -1,5 +1,5 @@
1
1
  import { a as printUrls, i as printShortcutsHint, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
2
- import { t as createViteConfig } from "./config-hT1o6Jct.js";
2
+ import { t as createViteConfig } from "./config-Ces2X_3T.js";
3
3
  import { mergeConfig, preview as preview$1 } from "vite";
4
4
  //#region src/cli/preview.ts
5
5
  async function preview(opts = {}) {
@@ -4,7 +4,7 @@ type Plural = {
4
4
  other: string;
5
5
  };
6
6
  type Locale = {
7
- id: 'en' | 'zh-TW' | 'zh-CN' | 'ja';
7
+ id: 'en' | 'zh-TW' | 'zh-CN' | 'ja' | 'es';
8
8
  common: {
9
9
  cancel: string;
10
10
  save: string;
@@ -283,20 +283,25 @@ type Locale = {
283
283
  cropFitCover: string;
284
284
  cropFitContain: string;
285
285
  cropApply: string;
286
- leaveComment: string;
286
+ commentMode: string;
287
287
  commentPlaceholder: string;
288
- commentShortcutHint: string;
289
- addComment: string;
288
+ commentPost: string;
290
289
  /** templates: "{count} unsaved change" / "{count} unsaved changes" */
291
290
  unsavedChanges: Plural;
292
291
  /** templates: "{count} comment" / "{count} comments" */
293
292
  commentsCount: Plural;
294
293
  /** template: "line {n}" */
295
294
  commentLineLabel: string;
296
- commentsEmpty: string;
295
+ commentRegionLabel: string;
296
+ commentEmptyHint: string;
297
297
  commentsApplyHintPrefix: string;
298
298
  commentsApplyHintSuffix: string;
299
299
  commentDeleteAria: string;
300
+ /** Prefix for the toast shown when a comment edit fails to write to disk. */
301
+ commentUpdateFailed: string;
302
+ /** Prefix for the toast shown when a comment fails to write to disk. */
303
+ commentAddFailed: string;
304
+ commentRegionNoTarget: string;
300
305
  /** Prefix for the toast shown when one or more buffered edits fail to write to disk. */
301
306
  saveFailed: string;
302
307
  decreaseFontSize: string;
@@ -68,6 +68,21 @@ function validateMutationRequest(req, opts = {}) {
68
68
  //#endregion
69
69
  //#region src/editing/slide-ops.ts
70
70
  const SLIDE_ID_RE = /^[a-z0-9_-]+$/i;
71
+ /**
72
+ * True when a directory under root already uses this id, including a
73
+ * different case. ext4 keeps `Cover` and `cover` as two folders; macOS
74
+ * and Windows usually collapse them. Listing names catches both.
75
+ */
76
+ async function slideIdTaken(root, slideId) {
77
+ let names;
78
+ try {
79
+ names = await fs.readdir(root);
80
+ } catch {
81
+ return false;
82
+ }
83
+ const want = slideId.toLowerCase();
84
+ return names.some((name) => name.toLowerCase() === want);
85
+ }
71
86
  function validateSlideName(v) {
72
87
  if (typeof v !== "string") return null;
73
88
  const trimmed = v.trim();
@@ -172,30 +187,25 @@ async function duplicateSlideDir(slidesRoot, slideId, desiredId) {
172
187
  error: "invalid newId"
173
188
  };
174
189
  newId = desiredId;
175
- const dstDir = path.resolve(root, newId);
176
- if (!dstDir.startsWith(root + path.sep)) return {
190
+ if (!path.resolve(root, newId).startsWith(root + path.sep)) return {
177
191
  ok: false,
178
192
  status: 400,
179
193
  error: "invalid newId"
180
194
  };
181
- try {
182
- await fs.access(dstDir);
183
- return {
184
- ok: false,
185
- status: 409,
186
- error: "slide already exists"
187
- };
188
- } catch {}
195
+ if (await slideIdTaken(root, newId)) return {
196
+ ok: false,
197
+ status: 409,
198
+ error: "slide already exists"
199
+ };
189
200
  } else {
190
201
  let suffix = 1;
191
202
  while (true) {
192
203
  newId = suffix === 1 ? `${slideId}-copy` : `${slideId}-copy-${suffix}`;
193
- try {
194
- await fs.access(path.resolve(root, newId));
204
+ if (await slideIdTaken(root, newId)) {
195
205
  suffix++;
196
- } catch {
197
- break;
206
+ continue;
198
207
  }
208
+ break;
199
209
  }
200
210
  }
201
211
  const dstDir = path.resolve(root, newId);
@@ -1,4 +1,4 @@
1
- import { t as OpenSlideConfig } from "../config-GMR1QUlM.js";
1
+ import { t as OpenSlideConfig } from "../config-CpmGqpQi.js";
2
2
  import { InlineConfig } from "vite";
3
3
  //#region src/vite/config.d.ts
4
4
  type CreateViteConfigOptions = {
@@ -1,2 +1,2 @@
1
- import { t as createViteConfig } from "../config-hT1o6Jct.js";
1
+ import { t as createViteConfig } from "../config-Ces2X_3T.js";
2
2
  export { createViteConfig };