@autono/open-pages 0.5.0 → 0.7.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 (125) hide show
  1. package/dist/{build-L50pau9v.js → build-CCoxDxL-.js} +11 -10
  2. package/dist/cli/bin.d.ts +1 -1
  3. package/dist/cli/bin.js +434 -28
  4. package/dist/{config-CDUdFE8N.js → config-D_U_aCQz.js} +484 -460
  5. package/dist/{config-C9or4m4J.d.ts → config-p-TWNXbv.d.ts} +4 -4
  6. package/dist/{design-C13iz9_4.js → design-Cpqx7SJs.js} +1 -2
  7. package/dist/{dev-CzJYXFOO.js → dev-CTrB263u.js} +40 -20
  8. package/dist/{export-DbVwSmKW.js → export-enKL9R7x.js} +7 -10
  9. package/dist/index.d.ts +6 -8
  10. package/dist/index.js +2 -3
  11. package/dist/locale/index.d.ts +8 -14
  12. package/dist/locale/index.js +67 -32
  13. package/dist/{open-pages-plugin-C0poXLsx.js → open-pages-plugin-C8cFhMB9.js} +23 -38
  14. package/dist/preview-Dmzyd1cf.js +24 -0
  15. package/dist/sync-ui-BzRiAGCK.js +132 -0
  16. package/dist/{types-C5NCdDT-.d.ts → types-DDdUFUIS.d.ts} +19 -6
  17. package/dist/{update-CV62NhBT.js → update-CWaCKlnl.js} +14 -5
  18. package/dist/{update-package-Cxt57pz7.js → update-package-GaNsVdr8.js} +50 -22
  19. package/dist/{version-B6AiiGvT.js → version-DZrXLoAD.js} +19 -3
  20. package/dist/vite/index.d.ts +3 -7
  21. package/dist/vite/index.js +2 -7
  22. package/package.json +24 -22
  23. package/src/app/app.tsx +19 -14
  24. package/src/app/assets/autono-social.png +0 -0
  25. package/src/app/assets/autono.svg +7 -0
  26. package/src/app/components/asset-view.tsx +510 -26
  27. package/src/app/components/command/command-menu.tsx +5 -1
  28. package/src/app/components/command/command.tsx +4 -2
  29. package/src/app/components/command/home-command-menu.tsx +6 -6
  30. package/src/app/components/icon-tooltip.tsx +24 -15
  31. package/src/app/components/sidebar/folder-item.tsx +46 -19
  32. package/src/app/components/sidebar/icon-picker.tsx +1 -1
  33. package/src/app/components/sidebar/sidebar-footer.tsx +18 -7
  34. package/src/app/components/sidebar/sidebar.tsx +91 -64
  35. package/src/app/components/theme-toggle.tsx +4 -5
  36. package/src/app/components/themes/theme-detail.tsx +6 -3
  37. package/src/app/components/themes/themes-gallery.tsx +12 -7
  38. package/src/app/index.html +33 -2
  39. package/src/app/lib/assets.ts +33 -0
  40. package/src/app/lib/last-home-location.ts +18 -0
  41. package/src/app/main.tsx +10 -1
  42. package/src/app/routes/home-shell.tsx +82 -61
  43. package/src/app/routes/home.tsx +42 -39
  44. package/src/app/routes/page.tsx +18 -3
  45. package/src/app/routes/themes.tsx +6 -8
  46. package/src/app/styles.css +40 -4
  47. package/src/app/virtual.d.ts +1 -0
  48. package/src/locale/en.ts +17 -6
  49. package/src/locale/ja.ts +18 -6
  50. package/src/locale/types.ts +17 -4
  51. package/src/locale/zh-cn.ts +19 -8
  52. package/src/locale/zh-tw.ts +17 -6
  53. package/src/shared/update-package.ts +193 -0
  54. package/workspace/components.json +25 -0
  55. package/workspace/deps.json +24 -0
  56. package/workspace/hooks/use-mobile.ts +19 -0
  57. package/workspace/lib/utils.ts +6 -0
  58. package/workspace/styles/globals.css +135 -0
  59. package/workspace/ui/accordion.tsx +79 -0
  60. package/workspace/ui/alert-dialog.tsx +197 -0
  61. package/workspace/ui/alert.tsx +76 -0
  62. package/workspace/ui/aspect-ratio.tsx +11 -0
  63. package/workspace/ui/attachment.tsx +204 -0
  64. package/workspace/ui/avatar.tsx +110 -0
  65. package/workspace/ui/badge.tsx +49 -0
  66. package/workspace/ui/breadcrumb.tsx +122 -0
  67. package/workspace/ui/bubble.tsx +125 -0
  68. package/workspace/ui/button-group.tsx +83 -0
  69. package/workspace/ui/button.tsx +67 -0
  70. package/workspace/ui/calendar.tsx +222 -0
  71. package/workspace/ui/card.tsx +103 -0
  72. package/workspace/ui/carousel.tsx +240 -0
  73. package/workspace/ui/chart.tsx +373 -0
  74. package/workspace/ui/checkbox.tsx +31 -0
  75. package/workspace/ui/collapsible.tsx +33 -0
  76. package/workspace/ui/combobox.tsx +297 -0
  77. package/workspace/ui/command.tsx +195 -0
  78. package/workspace/ui/context-menu.tsx +261 -0
  79. package/workspace/ui/dialog.tsx +168 -0
  80. package/workspace/ui/direction.tsx +22 -0
  81. package/workspace/ui/drawer.tsx +132 -0
  82. package/workspace/ui/dropdown-menu.tsx +269 -0
  83. package/workspace/ui/empty.tsx +104 -0
  84. package/workspace/ui/field.tsx +236 -0
  85. package/workspace/ui/hover-card.tsx +42 -0
  86. package/workspace/ui/input-group.tsx +156 -0
  87. package/workspace/ui/input-otp.tsx +87 -0
  88. package/workspace/ui/input.tsx +19 -0
  89. package/workspace/ui/item.tsx +196 -0
  90. package/workspace/ui/kbd.tsx +26 -0
  91. package/workspace/ui/label.tsx +22 -0
  92. package/workspace/ui/marker.tsx +69 -0
  93. package/workspace/ui/menubar.tsx +280 -0
  94. package/workspace/ui/message-scroller.tsx +129 -0
  95. package/workspace/ui/message.tsx +92 -0
  96. package/workspace/ui/native-select.tsx +61 -0
  97. package/workspace/ui/navigation-menu.tsx +164 -0
  98. package/workspace/ui/pagination.tsx +129 -0
  99. package/workspace/ui/popover.tsx +87 -0
  100. package/workspace/ui/progress.tsx +31 -0
  101. package/workspace/ui/radio-group.tsx +42 -0
  102. package/workspace/ui/resizable.tsx +50 -0
  103. package/workspace/ui/scroll-area.tsx +53 -0
  104. package/workspace/ui/select.tsx +192 -0
  105. package/workspace/ui/separator.tsx +26 -0
  106. package/workspace/ui/sheet.tsx +147 -0
  107. package/workspace/ui/sidebar.tsx +702 -0
  108. package/workspace/ui/skeleton.tsx +13 -0
  109. package/workspace/ui/slider.tsx +59 -0
  110. package/workspace/ui/sonner.tsx +47 -0
  111. package/workspace/ui/spinner.tsx +10 -0
  112. package/workspace/ui/switch.tsx +33 -0
  113. package/workspace/ui/table.tsx +114 -0
  114. package/workspace/ui/tabs.tsx +90 -0
  115. package/workspace/ui/textarea.tsx +18 -0
  116. package/workspace/ui/toggle-group.tsx +87 -0
  117. package/workspace/ui/toggle.tsx +45 -0
  118. package/workspace/ui/tooltip.tsx +57 -0
  119. package/dist/export-BsK6OCpc.js +0 -4
  120. package/dist/preview-CPufRmuj.js +0 -21
  121. package/dist/sync-Be_hxSOF.js +0 -139
  122. package/dist/sync-lKEXyPOh.js +0 -3
  123. package/dist/version-CeffgdfZ.js +0 -3
  124. package/src/app/components/language-toggle.tsx +0 -46
  125. package/src/app/favicon.ico +0 -0
@@ -1,11 +1,10 @@
1
- import fs from "node:fs/promises";
1
+ import { createRequire } from "node:module";
2
2
  import path from "node:path";
3
3
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import fs from "node:fs/promises";
4
5
  import { loadConfigFromFile, normalizePath } from "vite";
5
6
  import { parse } from "@babel/parser";
6
- import { createRequire } from "node:module";
7
7
  import fg from "fast-glob";
8
-
9
8
  //#region src/editing/page-ops.ts
10
9
  const PAGE_ID_RE = /^[a-z0-9_-]+$/i;
11
10
  function validatePageName(v) {
@@ -45,8 +44,7 @@ function readMetaTitleInSource(source) {
45
44
  for (const property of properties) {
46
45
  if (property.type !== "ObjectProperty" || property.computed) continue;
47
46
  const key = property.key;
48
- const keyName = key?.type === "Identifier" ? key.name : key?.type === "StringLiteral" ? key.value : void 0;
49
- if (keyName !== "title") continue;
47
+ if ((key?.type === "Identifier" ? key.name : key?.type === "StringLiteral" ? key.value : void 0) !== "title") continue;
50
48
  const value = property.value;
51
49
  if (value?.type === "StringLiteral" && typeof value.value === "string") return {
52
50
  kind: "found",
@@ -54,8 +52,7 @@ function readMetaTitleInSource(source) {
54
52
  };
55
53
  if (value?.type === "TemplateLiteral") {
56
54
  const expressions = value.expressions ?? [];
57
- const quasis = value.quasis ?? [];
58
- const firstValue = quasis[0]?.value;
55
+ const firstValue = (value.quasis ?? [])[0]?.value;
59
56
  const cooked = firstValue?.cooked;
60
57
  const raw = firstValue?.raw;
61
58
  if (expressions.length === 0 && typeof (cooked ?? raw) === "string") return {
@@ -114,14 +111,14 @@ async function duplicatePageDir(pagesRoot, pageId, desiredId) {
114
111
  error: "invalid newId"
115
112
  };
116
113
  newId = desiredId;
117
- const dstDir$1 = path.resolve(root, newId);
118
- if (!dstDir$1.startsWith(root + path.sep)) return {
114
+ const dstDir = path.resolve(root, newId);
115
+ if (!dstDir.startsWith(root + path.sep)) return {
119
116
  ok: false,
120
117
  status: 400,
121
118
  error: "invalid newId"
122
119
  };
123
120
  try {
124
- await fs.access(dstDir$1);
121
+ await fs.access(dstDir);
125
122
  return {
126
123
  ok: false,
127
124
  status: 409,
@@ -156,8 +153,7 @@ async function duplicatePageDir(pagesRoot, pageId, desiredId) {
156
153
  status: 422,
157
154
  error: "could not update copied page title"
158
155
  };
159
- const title = metaTitle.kind === "found" ? metaTitle.title : pageId;
160
- const updated = updateMetaTitleInSource(source, `${title} (copy)`);
156
+ const updated = updateMetaTitleInSource(source, `${metaTitle.kind === "found" ? metaTitle.title : pageId} (copy)`);
161
157
  if (updated === null) return {
162
158
  ok: false,
163
159
  status: 422,
@@ -248,18 +244,14 @@ function updateMetaTitleInSource(source, title) {
248
244
  return source.slice(0, openBrace + 1) + newBody + source.slice(closeBrace);
249
245
  }
250
246
  const firstIndentMatch = body.match(/\n([ \t]+)\S/);
251
- const indent = firstIndentMatch ? firstIndentMatch[1] : " ";
252
- const trimmedBody = body.replace(/^\s*\n?/, "");
253
- const needsSeparator = trimmedBody.trim().length > 0;
254
- const insertion$1 = `\n${indent}title: ${newLiteral}${needsSeparator ? "," : ""}`;
255
- return source.slice(0, openBrace + 1) + insertion$1 + body + source.slice(closeBrace);
247
+ const insertion = `\n${firstIndentMatch ? firstIndentMatch[1] : " "}title: ${newLiteral}${body.replace(/^\s*\n?/, "").trim().length > 0 ? "," : ""}`;
248
+ return source.slice(0, openBrace + 1) + insertion + body + source.slice(closeBrace);
256
249
  }
257
250
  const exportDefaultIdx = source.search(/export\s+default\b/);
258
251
  if (exportDefaultIdx === -1) return null;
259
252
  const insertion = `export const meta: PageMeta = { title: ${newLiteral} };\n\n`;
260
253
  return source.slice(0, exportDefaultIdx) + insertion + source.slice(exportDefaultIdx);
261
254
  }
262
-
263
255
  //#endregion
264
256
  //#region src/vite/open-pages-plugin.ts
265
257
  const CONFIG_FILE = "open-pages.config.ts";
@@ -310,10 +302,9 @@ async function findPages(userCwd, pagesDir) {
310
302
  absolute: true,
311
303
  onlyFiles: true
312
304
  });
313
- const byId = new Map();
305
+ const byId = /* @__PURE__ */ new Map();
314
306
  for (const file of hits.sort()) {
315
- const rel = path.relative(abs, file);
316
- const [id, name] = rel.split(path.sep);
307
+ const [id, name] = path.relative(abs, file).split(path.sep);
317
308
  const kind = REACT_ENTRY_RE.test(name) ? "react" : "html";
318
309
  const existing = byId.get(id);
319
310
  if (!existing || existing.kind === "html" && kind === "react") byId.set(id, {
@@ -362,9 +353,8 @@ function extractMeta(src) {
362
353
  };
363
354
  }
364
355
  function extractHtmlMeta(src) {
365
- const title = src.match(HTML_TITLE_RE)?.[1]?.trim() ?? null;
366
356
  return {
367
- title: title || null,
357
+ title: (src.match(HTML_TITLE_RE)?.[1]?.trim() ?? null) || null,
368
358
  theme: null,
369
359
  createdAt: null
370
360
  };
@@ -382,7 +372,7 @@ function parseCreatedAtMs(iso) {
382
372
  const ms = Date.parse(iso);
383
373
  return Number.isFinite(ms) ? ms : null;
384
374
  }
385
- const warnedInvalidPageIds = new Set();
375
+ const warnedInvalidPageIds = /* @__PURE__ */ new Set();
386
376
  async function generatePagesModule(entries, isDev) {
387
377
  const scanned = await Promise.all(entries.map(async (entry) => {
388
378
  const importPath = isDev ? `@fs/${normalizePath(entry.file).replace(/^\/+/, "")}` : entry.file;
@@ -425,7 +415,8 @@ if (import.meta.hot) {
425
415
  const importExpr = isDev ? `import(/* @vite-ignore */ import.meta.env.BASE_URL + ${JSON.stringify(`${e.importPath}?t=`)} + pageImportTokens[${JSON.stringify(e.id)}])` : `import(${JSON.stringify(e.importPath)})`;
426
416
  return ` case ${JSON.stringify(e.id)}: return ${importExpr};`;
427
417
  }).join("\n");
428
- const code = `// virtual:open-pages/pages — generated
418
+ return {
419
+ code: `// virtual:open-pages/pages — generated
429
420
  export const pageIds = ${JSON.stringify(valid.map((e) => e.id))};
430
421
  export const pageKinds = ${JSON.stringify(kinds)};
431
422
  export const pageThemes = ${JSON.stringify(themesMap)};
@@ -438,9 +429,7 @@ ${cases}
438
429
  default: throw new Error('Page not found: ' + id);
439
430
  }
440
431
  }
441
- `;
442
- return {
443
- code,
432
+ `,
444
433
  ignored
445
434
  };
446
435
  }
@@ -510,7 +499,7 @@ function openPagesPlugin(opts) {
510
499
  return null;
511
500
  };
512
501
  let pageChangeTimer = null;
513
- const pendingPageChanges = new Set();
502
+ const pendingPageChanges = /* @__PURE__ */ new Set();
514
503
  const queuePageChanged = (server, id) => {
515
504
  pendingPageChanges.add(id);
516
505
  if (pageChangeTimer) clearTimeout(pageChangeTimer);
@@ -592,8 +581,7 @@ function openPagesPlugin(opts) {
592
581
  reloadTimer = setTimeout(async () => {
593
582
  reloadTimer = null;
594
583
  try {
595
- const entries = await findPages(userCwd, pagesDir);
596
- if (pagesSignature(entries) === generatedSignature) return;
584
+ if (pagesSignature(await findPages(userCwd, pagesDir)) === generatedSignature) return;
597
585
  } catch (err) {
598
586
  server.config.logger.error(`[open-pages] failed to rescan pages: ${err}`, { error: err instanceof Error ? err : void 0 });
599
587
  }
@@ -638,8 +626,7 @@ function openPagesPlugin(opts) {
638
626
  if (p === foldersManifestPath) invalidateFolders();
639
627
  });
640
628
  server.middlewares.use("/__page", async (req, res, next) => {
641
- const url = new URL(req.url ?? "/", "http://local");
642
- const m = url.pathname.match(/^\/([^/]+)\/(?:index\.html)?$/);
629
+ const m = new URL(req.url ?? "/", "http://local").pathname.match(/^\/([^/]+)\/(?:index\.html)?$/);
643
630
  if (!m || (req.method ?? "GET") !== "GET") return next();
644
631
  const pageId = decodeURIComponent(m[1]);
645
632
  if (!PAGE_ID_RE.test(pageId)) return next();
@@ -666,12 +653,10 @@ function openPagesPlugin(opts) {
666
653
  async function loadUserConfig(userCwd) {
667
654
  const file = path.join(userCwd, CONFIG_FILE);
668
655
  if (!existsSync(file)) return {};
669
- const loaded = await loadConfigFromFile({
656
+ return (await loadConfigFromFile({
670
657
  command: "serve",
671
658
  mode: "development"
672
- }, file, userCwd, "silent");
673
- return loaded?.config ?? {};
659
+ }, file, userCwd, "silent"))?.config ?? {};
674
660
  }
675
-
676
661
  //#endregion
677
- export { PAGE_ID_RE, duplicatePageDir, extractMeta, findPages, invalidatePagesModule, loadUserConfig, openPagesPlugin, resolvePageEntry, rmPageDir, updateMetaTitleInSource, validatePageName };
662
+ export { openPagesPlugin as a, resolvePageEntry as c, validatePageName as d, loadUserConfig as i, rmPageDir as l, findPages as n, PAGE_ID_RE as o, invalidatePagesModule as r, duplicatePageDir as s, extractMeta as t, updateMetaTitleInSource as u };
@@ -0,0 +1,24 @@
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-D_U_aCQz.js";
3
+ import { mergeConfig, preview as preview$1 } from "vite";
4
+ //#region src/cli/preview.ts
5
+ async function preview(opts = {}) {
6
+ const base = await createViteConfig({ userCwd: process.cwd() });
7
+ const config = mergeConfig(base, {
8
+ customLogger: createCliLogger(),
9
+ preview: {
10
+ ...opts.port !== void 0 ? { port: opts.port } : {},
11
+ ...opts.host !== void 0 ? { host: opts.host } : {},
12
+ ...opts.open !== void 0 ? { open: opts.open } : {}
13
+ }
14
+ });
15
+ const server = await preview$1(config);
16
+ printHeader(`preview · ${startupDuration()}`);
17
+ printUrls(server.resolvedUrls, opts.host);
18
+ if (shortcutsEnabled()) {
19
+ printShortcutsHint();
20
+ server.bindCLIShortcuts();
21
+ }
22
+ }
23
+ //#endregion
24
+ export { preview };
@@ -0,0 +1,132 @@
1
+ import path from "node:path";
2
+ import chalk from "chalk";
3
+ import { existsSync } from "node:fs";
4
+ import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
5
+ import { createHash } from "node:crypto";
6
+ //#region src/cli/sync-ui.ts
7
+ const UI_MANIFEST = path.join("ui", ".sync-manifest.json");
8
+ const ENTRIES = [
9
+ "ui",
10
+ "lib",
11
+ "hooks"
12
+ ];
13
+ function hashOf(data) {
14
+ return createHash("sha256").update(data).digest("hex");
15
+ }
16
+ async function collectFiles(dir, prefix = "") {
17
+ const out = [];
18
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
19
+ const rel = prefix ? path.join(prefix, entry.name) : entry.name;
20
+ if (entry.isDirectory()) out.push(...await collectFiles(path.join(dir, entry.name), rel));
21
+ else if (entry.isFile()) out.push(rel);
22
+ }
23
+ return out;
24
+ }
25
+ async function readManifest(file) {
26
+ try {
27
+ const parsed = JSON.parse(await readFile(file, "utf8"));
28
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
29
+ } catch {}
30
+ return null;
31
+ }
32
+ /** Hashes of the canonical set, keyed by workspace-relative path. */
33
+ async function canonicalHashes(canonicalDir) {
34
+ const hashes = {};
35
+ for (const entry of ENTRIES) {
36
+ const root = path.join(canonicalDir, entry);
37
+ if (!existsSync(root)) continue;
38
+ for (const rel of await collectFiles(root)) {
39
+ const wsRel = path.join(entry, rel).split(path.sep).join("/");
40
+ hashes[wsRel] = hashOf(await readFile(path.join(root, rel)));
41
+ }
42
+ }
43
+ return hashes;
44
+ }
45
+ async function syncUi(workspaceDir, canonicalDir, opts = {}) {
46
+ const { dryRun = false, force = false } = opts;
47
+ const result = {
48
+ added: [],
49
+ updated: [],
50
+ unchanged: [],
51
+ skipped: [],
52
+ forced: [],
53
+ removedUpstream: [],
54
+ addedDeps: []
55
+ };
56
+ const manifestPath = path.join(workspaceDir, UI_MANIFEST);
57
+ const manifest = await readManifest(manifestPath) ?? {};
58
+ const next = {};
59
+ const canonical = await canonicalHashes(canonicalDir);
60
+ for (const [rel, canonicalHash] of Object.entries(canonical)) {
61
+ const dst = path.join(workspaceDir, rel);
62
+ const src = path.join(canonicalDir, rel);
63
+ const write = async () => {
64
+ if (dryRun) return;
65
+ await mkdir(path.dirname(dst), { recursive: true });
66
+ await writeFile(dst, await readFile(src));
67
+ };
68
+ if (!existsSync(dst)) {
69
+ await write();
70
+ next[rel] = canonicalHash;
71
+ result.added.push(rel);
72
+ continue;
73
+ }
74
+ const currentHash = hashOf(await readFile(dst));
75
+ if (currentHash === canonicalHash) {
76
+ next[rel] = canonicalHash;
77
+ result.unchanged.push(rel);
78
+ continue;
79
+ }
80
+ const pristine = manifest[rel] !== void 0 && manifest[rel] === currentHash;
81
+ if (pristine || force) {
82
+ await write();
83
+ next[rel] = canonicalHash;
84
+ (pristine ? result.updated : result.forced).push(rel);
85
+ continue;
86
+ }
87
+ if (manifest[rel] !== void 0) next[rel] = manifest[rel];
88
+ result.skipped.push(rel);
89
+ }
90
+ for (const rel of Object.keys(manifest)) if (!(rel in canonical) && existsSync(path.join(workspaceDir, rel))) {
91
+ next[rel] ??= manifest[rel];
92
+ result.removedUpstream.push(rel);
93
+ }
94
+ result.addedDeps = await ensureDeps(workspaceDir, canonicalDir, dryRun);
95
+ if (!dryRun) {
96
+ const sorted = Object.fromEntries(Object.entries(next).sort(([a], [b]) => a.localeCompare(b)));
97
+ await mkdir(path.dirname(manifestPath), { recursive: true });
98
+ await writeFile(manifestPath, `${JSON.stringify(sorted, null, 2)}\n`, "utf8");
99
+ }
100
+ return result;
101
+ }
102
+ async function ensureDeps(workspaceDir, canonicalDir, dryRun) {
103
+ const depsFile = path.join(canonicalDir, "deps.json");
104
+ const pkgFile = path.join(workspaceDir, "package.json");
105
+ if (!existsSync(depsFile) || !existsSync(pkgFile)) return [];
106
+ const wanted = JSON.parse(await readFile(depsFile, "utf8"));
107
+ const pkg = JSON.parse(await readFile(pkgFile, "utf8"));
108
+ const missing = Object.entries(wanted).filter(([name]) => !pkg.dependencies?.[name] && !pkg.devDependencies?.[name]);
109
+ if (missing.length === 0) return [];
110
+ if (!dryRun) {
111
+ pkg.dependencies ??= {};
112
+ for (const [name, range] of missing) pkg.dependencies[name] = range;
113
+ pkg.dependencies = Object.fromEntries(Object.entries(pkg.dependencies).sort(([a], [b]) => a.localeCompare(b)));
114
+ await writeFile(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
115
+ }
116
+ return missing.map(([name]) => name);
117
+ }
118
+ function printUiSummary(result, dryRun) {
119
+ const header = dryRun ? chalk.bold("Dry run — no files written:") : chalk.bold("Synced the workspace ui set:");
120
+ process.stdout.write(`${header}\n`);
121
+ const row = (symbol, rel, label) => process.stdout.write(` ${symbol} ${rel} ${chalk.dim(`(${label})`)}\n`);
122
+ for (const rel of result.added) row(chalk.green("+"), rel, "added");
123
+ for (const rel of result.updated) row(chalk.yellow("~"), rel, "updated");
124
+ for (const rel of result.forced) row(chalk.red("!"), rel, "overwrote your edits (--force)");
125
+ for (const rel of result.skipped) row(chalk.dim("#"), rel, "edited by you — skipped");
126
+ for (const rel of result.removedUpstream) row(chalk.dim("-"), rel, "no longer shipped — yours to keep or delete");
127
+ process.stdout.write(chalk.dim(`\n${result.added.length} added, ${result.updated.length + result.forced.length} updated, ${result.unchanged.length} unchanged, ${result.skipped.length} skipped.\n`));
128
+ if (result.skipped.length > 0 && result.forced.length === 0) process.stdout.write(chalk.dim("Skipped files differ from what was scaffolded. Re-run with --force to overwrite them.\n"));
129
+ if (result.addedDeps.length > 0) process.stdout.write(`${chalk.yellow("!")} Added ${result.addedDeps.map((d) => chalk.bold(d)).join(", ")} to package.json — run your package manager's install.\n`);
130
+ }
131
+ //#endregion
132
+ export { printUiSummary, syncUi };
@@ -124,6 +124,7 @@ type Locale = {
124
124
  noMatchingAssetsHint: string;
125
125
  clearFilters: string;
126
126
  searchLogos: string;
127
+ searchFonts: string;
127
128
  upload: string;
128
129
  dropToUpload: string;
129
130
  loading: string;
@@ -161,6 +162,20 @@ type Locale = {
161
162
  logoSearchEmptyHintSuffix: string;
162
163
  logoVariantLight: string;
163
164
  logoVariantDark: string;
165
+ fontSearchTitle: string;
166
+ fontSearchPoweredByPrefix: string;
167
+ fontSearchPlaceholder: string;
168
+ fontSearchPreviewPlaceholder: string;
169
+ fontSearchErrorTitle: string;
170
+ fontSearchErrorBody: string;
171
+ /** template: 'No fonts for "{query}"' */
172
+ fontSearchNoResults: string;
173
+ fontSearchEmpty: string;
174
+ fontSearchEmptyHintPrefix: string;
175
+ fontSearchEmptyHintSuffix: string;
176
+ fontWeightLabel: string;
177
+ fontPreviewSample: string;
178
+ /** template: "Upload failed ({status})" */
164
179
  toastUploadFailed: string;
165
180
  toastReplaced: string;
166
181
  toastUploadedAs: string;
@@ -170,6 +185,7 @@ type Locale = {
170
185
  toastDeleteFailed: string;
171
186
  toastDeleted: string;
172
187
  toastDownloadFailed: string;
188
+ toastFontDownloadFailed: string;
173
189
  toastSearchFailed: string;
174
190
  };
175
191
  commandMenu: {
@@ -196,10 +212,6 @@ type Locale = {
196
212
  dark: string;
197
213
  system: string;
198
214
  };
199
- languageToggle: {
200
- toggleAria: string;
201
- title: string;
202
- };
203
215
  themes: {
204
216
  title: string;
205
217
  noThemesTitle: string;
@@ -215,5 +227,6 @@ type Locale = {
215
227
  expandPromptAria: string;
216
228
  collapsePromptAria: string;
217
229
  };
218
- }; //#endregion
219
- export { Locale, Plural };
230
+ };
231
+ //#endregion
232
+ export { Plural as n, Locale as t };
@@ -1,8 +1,7 @@
1
- import { PKG, detectPackageManager, fetchLatest, formatCommand, isOutdated, localOpenPagesCommand, runCommand, updateCommandFor } from "./update-package-Cxt57pz7.js";
1
+ import { a as installCommandFor, c as localOpenPagesCommand, i as formatCommand, l as runCommand, n as detectPackageManager, r as fetchLatest, s as isOutdated, t as PKG, u as updateCommandFor } from "./update-package-GaNsVdr8.js";
2
+ import path from "node:path";
2
3
  import chalk from "chalk";
3
4
  import { readFile } from "node:fs/promises";
4
- import path from "node:path";
5
-
6
5
  //#region src/cli/update.ts
7
6
  async function installedVersion(cwd) {
8
7
  try {
@@ -30,8 +29,18 @@ async function update(opts) {
30
29
  process.stdout.write(chalk.dim("$ open-pages sync:skills\n"));
31
30
  await runCommand(localOpenPagesCommand(cwd, ["sync:skills"]), cwd, { stdio: "inherit" });
32
31
  }
32
+ if (opts.ui !== false) {
33
+ process.stdout.write(chalk.dim("$ open-pages sync:ui\n"));
34
+ const pkgFile = path.join(cwd, "package.json");
35
+ const before = await readFile(pkgFile, "utf8").catch(() => "");
36
+ await runCommand(localOpenPagesCommand(cwd, ["sync:ui"]), cwd, { stdio: "inherit" });
37
+ if (await readFile(pkgFile, "utf8").catch(() => "") !== before) {
38
+ const reinstall = installCommandFor(packageManager);
39
+ process.stdout.write(chalk.dim(`$ ${formatCommand(reinstall)}\n`));
40
+ await runCommand(reinstall, cwd, { stdio: "inherit" });
41
+ }
42
+ }
33
43
  process.stdout.write(`${chalk.green("✓")} Updated ${PKG} to ${target}. Restart \`open-pages dev\` to use it.\n`);
34
44
  }
35
-
36
45
  //#endregion
37
- export { update };
46
+ export { update };
@@ -1,10 +1,9 @@
1
- import fs from "node:fs/promises";
2
1
  import path from "node:path";
3
2
  import { spawn } from "node:child_process";
4
-
3
+ import fs from "node:fs/promises";
5
4
  //#region src/shared/update-package.ts
6
5
  const PKG = "@autono/open-pages";
7
- const CACHE_TTL_MS = 10 * 60 * 1e3;
6
+ const CACHE_TTL_MS = 6e5;
8
7
  const COMMAND_TIMEOUT_MS = 3e5;
9
8
  let cache = null;
10
9
  function parseSemver(v) {
@@ -57,12 +56,39 @@ async function fileExists(file) {
57
56
  return false;
58
57
  }
59
58
  }
59
+ const LOCKFILES = [
60
+ ["pnpm-lock.yaml", "pnpm"],
61
+ ["yarn.lock", "yarn"],
62
+ ["bun.lockb", "bun"],
63
+ ["bun.lock", "bun"],
64
+ ["package-lock.json", "npm"]
65
+ ];
66
+ const PROJECT_ROOT_MARKERS = ["pnpm-workspace.yaml", ".git"];
67
+ async function declaredPackageManager(dir) {
68
+ try {
69
+ const raw = await fs.readFile(path.join(dir, "package.json"), "utf8");
70
+ const declared = JSON.parse(raw).packageManager;
71
+ if (typeof declared !== "string") return null;
72
+ const name = declared.split("@")[0];
73
+ return name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" ? name : null;
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+ async function isProjectRoot(dir) {
79
+ for (const marker of PROJECT_ROOT_MARKERS) if (await fileExists(path.join(dir, marker))) return true;
80
+ return false;
81
+ }
60
82
  async function detectPackageManager(cwd) {
61
- if (await fileExists(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
62
- if (await fileExists(path.join(cwd, "yarn.lock"))) return "yarn";
63
- if (await fileExists(path.join(cwd, "bun.lockb"))) return "bun";
64
- if (await fileExists(path.join(cwd, "bun.lock"))) return "bun";
65
- if (await fileExists(path.join(cwd, "package-lock.json"))) return "npm";
83
+ let dir = cwd;
84
+ while (true) {
85
+ const declared = await declaredPackageManager(dir);
86
+ if (declared) return declared;
87
+ for (const [lockfile, pm] of LOCKFILES) if (await fileExists(path.join(dir, lockfile))) return pm;
88
+ const parent = path.dirname(dir);
89
+ if (parent === dir || await isProjectRoot(dir)) break;
90
+ dir = parent;
91
+ }
66
92
  const ua = process.env.npm_config_user_agent ?? "";
67
93
  if (ua.startsWith("pnpm")) return "pnpm";
68
94
  if (ua.startsWith("yarn")) return "yarn";
@@ -71,17 +97,14 @@ async function detectPackageManager(cwd) {
71
97
  }
72
98
  async function updateCommandFor(packageManager, cwd) {
73
99
  switch (packageManager) {
74
- case "pnpm": {
75
- const workspaceRoot = await fileExists(path.join(cwd, "pnpm-workspace.yaml"));
76
- return {
77
- cmd: "pnpm",
78
- args: workspaceRoot ? [
79
- "add",
80
- "--workspace-root",
81
- `${PKG}@latest`
82
- ] : ["add", `${PKG}@latest`]
83
- };
84
- }
100
+ case "pnpm": return {
101
+ cmd: "pnpm",
102
+ args: await fileExists(path.join(cwd, "pnpm-workspace.yaml")) ? [
103
+ "add",
104
+ "--workspace-root",
105
+ `${PKG}@latest`
106
+ ] : ["add", `${PKG}@latest`]
107
+ };
85
108
  case "yarn": return {
86
109
  cmd: "yarn",
87
110
  args: ["add", `${PKG}@latest`]
@@ -100,6 +123,12 @@ async function updateCommandFor(packageManager, cwd) {
100
123
  * The freshly installed package's own CLI, so skills come from the new
101
124
  * version rather than whatever process is driving the update.
102
125
  */
126
+ function installCommandFor(packageManager) {
127
+ return {
128
+ cmd: packageManager,
129
+ args: ["install"]
130
+ };
131
+ }
103
132
  function localOpenPagesCommand(cwd, args) {
104
133
  const bin = path.join(cwd, "node_modules", ...PKG.split("/"), "bin.js");
105
134
  return {
@@ -126,7 +155,7 @@ async function runCommand(spec, cwd, opts = {}) {
126
155
  let stderr = "";
127
156
  const timer = setTimeout(() => {
128
157
  child.kill();
129
- reject(new Error(`${formatCommand(spec)} timed out`));
158
+ reject(/* @__PURE__ */ new Error(`${formatCommand(spec)} timed out`));
130
159
  }, COMMAND_TIMEOUT_MS);
131
160
  child.stderr?.on("data", (chunk) => {
132
161
  stderr += chunk.toString("utf8");
@@ -147,6 +176,5 @@ async function runCommand(spec, cwd, opts = {}) {
147
176
  });
148
177
  });
149
178
  }
150
-
151
179
  //#endregion
152
- export { PKG, detectPackageManager, fetchLatest, formatCommand, invalidateLatestCache, isOutdated, localOpenPagesCommand, runCommand, updateCommandFor };
180
+ export { installCommandFor as a, localOpenPagesCommand as c, formatCommand as i, runCommand as l, detectPackageManager as n, invalidateLatestCache as o, fetchLatest as r, isOutdated as s, PKG as t, updateCommandFor as u };
@@ -1,8 +1,25 @@
1
+ import "node:module";
1
2
  import path from "node:path";
2
3
  import { fileURLToPath } from "node:url";
3
4
  import { existsSync, readFileSync } from "node:fs";
4
-
5
+ //#region \0rolldown/runtime.js
6
+ var __defProp = Object.defineProperty;
7
+ var __exportAll = (all, no_symbols) => {
8
+ let target = {};
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
14
+ return target;
15
+ };
16
+ //#endregion
5
17
  //#region src/vite/version.ts
18
+ var version_exports = /* @__PURE__ */ __exportAll({
19
+ APP_ROOT: () => APP_ROOT,
20
+ PKG_ROOT: () => PKG_ROOT,
21
+ readCoreVersion: () => readCoreVersion
22
+ });
6
23
  function findPackageRoot(fromFile) {
7
24
  let dir = path.dirname(fromFile);
8
25
  while (dir !== path.dirname(dir)) {
@@ -21,6 +38,5 @@ function readCoreVersion() {
21
38
  return "0.0.0";
22
39
  }
23
40
  }
24
-
25
41
  //#endregion
26
- export { APP_ROOT, PKG_ROOT, readCoreVersion };
42
+ export { version_exports as i, PKG_ROOT as n, readCoreVersion as r, APP_ROOT as t };
@@ -1,14 +1,10 @@
1
- import "../types-C5NCdDT-.js";
2
- import { OpenPagesConfig } from "../config-C9or4m4J.js";
1
+ import { t as OpenPagesConfig } from "../config-p-TWNXbv.js";
3
2
  import { InlineConfig } from "vite";
4
-
5
3
  //#region src/vite/config.d.ts
6
4
  type CreateViteConfigOptions = {
7
5
  userCwd: string;
8
6
  config?: OpenPagesConfig;
9
7
  mode?: 'serve' | 'build';
10
8
  };
11
- declare function createViteConfig(opts: CreateViteConfigOptions): Promise<InlineConfig>;
12
-
13
- //#endregion
14
- export { createViteConfig };
9
+ export declare function createViteConfig(opts: CreateViteConfigOptions): Promise<InlineConfig>;
10
+ //#endregion
@@ -1,7 +1,2 @@
1
- import "../design-C13iz9_4.js";
2
- import "../open-pages-plugin-C0poXLsx.js";
3
- import { createViteConfig } from "../config-CDUdFE8N.js";
4
- import "../update-package-Cxt57pz7.js";
5
- import "../version-B6AiiGvT.js";
6
-
7
- export { createViteConfig };
1
+ import { t as createViteConfig } from "../config-D_U_aCQz.js";
2
+ export { createViteConfig };