@buffcore/admin-shell 0.8.41 → 0.8.43

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 (156) hide show
  1. package/dist/admin.js +2 -1
  2. package/dist/components/Button.d.ts +2 -2
  3. package/dist/components/Button.js +7 -2
  4. package/dist/components/DeviceFrame.d.ts +6 -1
  5. package/dist/components/DeviceFrame.js +2 -2
  6. package/dist/components/look.d.ts +5 -0
  7. package/dist/components/look.js +5 -0
  8. package/dist/console-settings.js +4 -1
  9. package/dist/design-fonts.d.ts +5 -0
  10. package/dist/design-fonts.js +20 -0
  11. package/dist/prototype/PageLook.js +3 -2
  12. package/dist/prototype/create.d.ts +3 -1
  13. package/dist/prototype/create.js +0 -1
  14. package/dist/prototype/page.d.ts +19 -2
  15. package/dist/prototype/page.js +20 -2
  16. package/dist/prototype/shown.js +1 -1
  17. package/dist/prototype/viewer.d.ts +2 -0
  18. package/dist/prototype/viewer.js +6 -2
  19. package/dist/screens/assistant/use-ask.d.ts +4 -3
  20. package/dist/workbench/app/ServedAgents.js +4 -1
  21. package/dist/workbench/app/ServedComp.d.ts +3 -0
  22. package/dist/workbench/app/ServedComp.js +33 -0
  23. package/dist/workbench/app/ServedPrototype.js +28 -1
  24. package/dist/workbench/app/StudioApp.js +29 -20
  25. package/dist/workbench/app/actions.d.ts +10 -1
  26. package/dist/workbench/app/actions.js +9 -2
  27. package/dist/workbench/app/ask-card.d.ts +10 -0
  28. package/dist/workbench/app/ask-card.js +34 -0
  29. package/dist/workbench/app/chat-session.d.ts +34 -0
  30. package/dist/workbench/app/chat.d.ts +39 -0
  31. package/dist/workbench/app/frame.js +4 -2
  32. package/dist/workbench/app/fresh.d.ts +63 -0
  33. package/dist/workbench/app/fresh.js +66 -0
  34. package/dist/workbench/app/host-part-loader.d.ts +5 -2
  35. package/dist/workbench/app/host-part-module.d.ts +17 -0
  36. package/dist/workbench/app/host-part-module.js +55 -0
  37. package/dist/workbench/app/host-parts.d.ts +2 -11
  38. package/dist/workbench/app/host-parts.js +53 -67
  39. package/dist/workbench/app/level-choice.d.ts +3 -0
  40. package/dist/workbench/app/mount.d.ts +4 -1
  41. package/dist/workbench/app/mount.js +2 -2
  42. package/dist/workbench/app/panel-cards.d.ts +3 -3
  43. package/dist/workbench/app/panel-cards.js +3 -2
  44. package/dist/workbench/app/places.d.ts +18 -3
  45. package/dist/workbench/app/places.js +14 -2
  46. package/dist/workbench/app/prototype-comp.d.ts +46 -0
  47. package/dist/workbench/app/prototype-comp.js +77 -0
  48. package/dist/workbench/app/prototype.d.ts +1 -1
  49. package/dist/workbench/app/prototype.js +3 -1
  50. package/dist/workbench/app/scene-address.d.ts +10 -0
  51. package/dist/workbench/app/scene-address.js +14 -0
  52. package/dist/workbench/app/studio-post.js +1 -0
  53. package/dist/workbench/app/test/loop-fixture.d.ts +35 -8
  54. package/dist/workbench/app/usePrototypeUi.js +14 -0
  55. package/dist/workbench/app/useStudio.d.ts +43 -1
  56. package/dist/workbench/app/useStudio.js +8 -1
  57. package/dist/workbench/host-theme.d.ts +3 -0
  58. package/dist/workbench/host-theme.js +14 -0
  59. package/dist/workbench/index.d.ts +1 -0
  60. package/dist/workbench/index.js +1 -0
  61. package/dist/workbench/studio/frame/HostRailEntries.d.ts +3 -0
  62. package/dist/workbench/studio/frame/HostRailEntries.js +15 -0
  63. package/dist/workbench/studio/frame/HostSide.d.ts +6 -0
  64. package/dist/workbench/studio/frame/HostSide.js +31 -0
  65. package/dist/workbench/studio/frame/LevelChip.js +2 -1
  66. package/dist/workbench/studio/frame/LevelChoices.js +24 -8
  67. package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
  68. package/dist/workbench/studio/frame/LimitCard.js +26 -0
  69. package/dist/workbench/studio/frame/NeverAskSetting.d.ts +7 -0
  70. package/dist/workbench/studio/frame/NeverAskSetting.js +24 -0
  71. package/dist/workbench/studio/frame/PanelList.js +5 -2
  72. package/dist/workbench/studio/frame/PanelMessage.js +3 -0
  73. package/dist/workbench/studio/frame/PanelNotice.js +2 -1
  74. package/dist/workbench/studio/frame/PanelScenes.d.ts +5 -0
  75. package/dist/workbench/studio/frame/PanelScenes.js +38 -0
  76. package/dist/workbench/studio/frame/PermissionAskCard.d.ts +18 -0
  77. package/dist/workbench/studio/frame/PermissionAskCard.js +60 -0
  78. package/dist/workbench/studio/frame/PermissionAskFold.d.ts +12 -0
  79. package/dist/workbench/studio/frame/PermissionAskFold.js +54 -0
  80. package/dist/workbench/studio/frame/Place.d.ts +6 -2
  81. package/dist/workbench/studio/frame/Place.js +13 -5
  82. package/dist/workbench/studio/frame/SettingsSheet.js +6 -1
  83. package/dist/workbench/studio/frame/StudioRail.js +2 -1
  84. package/dist/workbench/studio/frame/panelControls.d.ts +17 -0
  85. package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
  86. package/dist/workbench/studio/frame/panelLines.js +2 -1
  87. package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
  88. package/dist/workbench/studio/i18n/comp.en.js +26 -0
  89. package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
  90. package/dist/workbench/studio/i18n/comp.es.js +25 -0
  91. package/dist/workbench/studio/i18n/frame.en.d.ts +39 -0
  92. package/dist/workbench/studio/i18n/frame.en.js +39 -0
  93. package/dist/workbench/studio/i18n/frame.es.json +40 -1
  94. package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
  95. package/dist/workbench/studio/i18n/fresh.en.js +20 -0
  96. package/dist/workbench/studio/i18n/fresh.es.json +18 -0
  97. package/dist/workbench/studio/i18n/index.js +6 -0
  98. package/dist/workbench/studio/i18n/levels.en.d.ts +5 -0
  99. package/dist/workbench/studio/i18n/levels.en.js +5 -0
  100. package/dist/workbench/studio/i18n/levels.es.json +6 -1
  101. package/dist/workbench/studio/i18n/loop.en.d.ts +4 -0
  102. package/dist/workbench/studio/i18n/loop.en.js +4 -0
  103. package/dist/workbench/studio/i18n/loop.es.json +4 -0
  104. package/dist/workbench/studio/i18n/save.en.d.ts +1 -3
  105. package/dist/workbench/studio/i18n/save.en.js +13 -15
  106. package/dist/workbench/studio/i18n/save.es.json +14 -16
  107. package/dist/workbench/studio/i18n/structure.en.d.ts +6 -0
  108. package/dist/workbench/studio/i18n/structure.en.js +6 -0
  109. package/dist/workbench/studio/i18n/structure.es.d.ts +6 -0
  110. package/dist/workbench/studio/i18n/structure.es.js +6 -0
  111. package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
  112. package/dist/workbench/studio/loop/AgentsPage.js +5 -4
  113. package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
  114. package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
  115. package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
  116. package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
  117. package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
  118. package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
  119. package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
  120. package/dist/workbench/studio/loop/PrototypePage.js +4 -3
  121. package/dist/workbench/studio/loop/PrototypeScenes.js +1 -2
  122. package/dist/workbench/studio/loop/PrototypeSimplePage.js +15 -7
  123. package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
  124. package/dist/workbench/studio/loop/PrototypeSnapshot.js +7 -2
  125. package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
  126. package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
  127. package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
  128. package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
  129. package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
  130. package/dist/workbench/studio/loop/SaveStep.js +3 -1
  131. package/dist/workbench/studio/loop/ServedBrand.js +3 -3
  132. package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
  133. package/dist/workbench/studio/loop/StructurePage.d.ts +7 -0
  134. package/dist/workbench/studio/loop/StructurePage.js +3 -2
  135. package/dist/workbench/studio/loop/StructurePreview.js +4 -4
  136. package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
  137. package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
  138. package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
  139. package/dist/workbench/studio/loop/step-state.d.ts +1 -1
  140. package/dist/workbench/studio/loop/step-state.js +9 -8
  141. package/dist/workbench/studio/loop/structure-answers.d.ts +8 -0
  142. package/dist/workbench/studio/loop/structure-answers.js +34 -0
  143. package/dist/workbench/studio/loop/usePlanningDraft.js +7 -2
  144. package/dist/workbench/studio/loop/usePlanningSave.d.ts +16 -2
  145. package/dist/workbench/studio/loop/usePlanningSave.js +40 -2
  146. package/dist/workbench/studio/loop/usePrototypeRecord.js +5 -4
  147. package/dist/workbench/studio/loop/useReviewedSave.d.ts +9 -4
  148. package/dist/workbench/studio/loop/useReviewedSave.js +89 -30
  149. package/dist/workbench/studio/run/LiveServers.js +1 -1
  150. package/dist/workbench/studio/run/ReleasePage.js +1 -1
  151. package/dist/workbench/studio/run/ReleasesPage.js +2 -2
  152. package/dist/workbench/studio/run/ServedRelease.js +1 -1
  153. package/dist/workbench/studio/work/work-test-data.d.ts +9 -4
  154. package/package.json +6 -6
  155. package/vite.d.ts +6 -1
  156. package/vite.js +78 -5
@@ -91,5 +91,5 @@ export function ServedRelease({ release, server = { destination: '', addressKind
91
91
  return (_jsxs(Page, { title: t('studio.frame.page.release'), sub: t('studio.release.intro'), actions: _jsx(Button, { disabled: !onReleases, variant: "secondary", onClick: onReleases, style: actionStyle, children: t('studio.frame.place.release') }), children: [_jsx(Place, { id: "tabs:release" }), _jsx(WithHostSide, { id: "side:release", children: _jsxs(Stack, { children: [_jsx(DestinationPanel, { server: server, onServer: onServer, busy: busy, onReview: d.review }), _jsx(ReleasePrerequisites, { rows: rows, main: release.main }), _jsx(Decision, { statusKey: status, reason: reason, blocked: blocked, busy: busy, deploy: release.runs.deploy, onApprove: () => {
92
92
  if (!blocked)
93
93
  void d.decide(() => onRun?.('deploy', { ...server }));
94
- } }), _jsx(Place, { id: "approve:release" })] }) })] }));
94
+ } }), _jsx(Place, { id: "approve:release", subject: release.main ? { release: release.main } : undefined })] }) })] }));
95
95
  }
@@ -23,6 +23,8 @@ export declare function scaleFacts(): {
23
23
  model?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", string>> | undefined;
24
24
  effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
25
25
  level: "auto" | "guide" | "lead" | "review";
26
+ neverAsk?: boolean | undefined;
27
+ review?: boolean | undefined;
26
28
  } | null;
27
29
  found: {
28
30
  id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
@@ -77,7 +79,7 @@ export declare function scaleFacts(): {
77
79
  approved?: {
78
80
  version: number;
79
81
  approval: {
80
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
82
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
81
83
  signatures: {
82
84
  by: string;
83
85
  at: string;
@@ -102,7 +104,7 @@ export declare function scaleFacts(): {
102
104
  pending?: {
103
105
  version: number;
104
106
  approval: {
105
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
107
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
106
108
  signatures: {
107
109
  by: string;
108
110
  at: string;
@@ -127,7 +129,7 @@ export declare function scaleFacts(): {
127
129
  superseded?: {
128
130
  version: number;
129
131
  approval: {
130
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
132
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
131
133
  signatures: {
132
134
  by: string;
133
135
  at: string;
@@ -220,14 +222,16 @@ export declare function scaleFacts(): {
220
222
  who: string;
221
223
  place: string;
222
224
  main: boolean;
225
+ planned?: string | undefined;
223
226
  }[];
224
227
  notes: string[];
228
+ surface?: "desktop" | "phone" | undefined;
225
229
  problem?: string | undefined;
226
230
  } | null | undefined;
227
231
  themeDirection?: string | undefined;
228
232
  themeVoice?: string | undefined;
229
233
  brand: {
230
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
234
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
231
235
  signatures: {
232
236
  by: string;
233
237
  at: string;
@@ -329,6 +333,7 @@ export declare function scaleFacts(): {
329
333
  } | undefined;
330
334
  committedLevel?: "auto" | "guide" | "lead" | "review" | undefined;
331
335
  effectiveLevel?: "auto" | "guide" | "lead" | "review" | undefined;
336
+ neverAsk?: boolean | undefined;
332
337
  level?: {
333
338
  source: "host";
334
339
  where: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buffcore/admin-shell",
3
- "version": "0.8.41",
3
+ "version": "0.8.43",
4
4
  "description": "The React DOM admin console for a BuffCore product, with its prototype viewer.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "BuffApe",
@@ -37,11 +37,11 @@
37
37
  "@tanstack/react-router": "1.170.42",
38
38
  "firebase": "12.19.0",
39
39
  "qrcode": "1.5.4",
40
- "@buffcore/sdk": "0.8.41",
41
- "@buffcore/tokens": "0.8.41",
42
- "@buffcore/contracts": "0.8.41",
43
- "@buffcore/i18n": "0.8.41",
44
- "@buffcore/config": "0.8.41"
40
+ "@buffcore/config": "0.8.43",
41
+ "@buffcore/contracts": "0.8.43",
42
+ "@buffcore/i18n": "0.8.43",
43
+ "@buffcore/sdk": "0.8.43",
44
+ "@buffcore/tokens": "0.8.43"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": ">=19",
package/vite.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  // Types for vite.js. The plugin's hooks are Vite's; a Vite config takes it as a plugin.
2
2
  export const SERVICE_WORKER: '/firebase-messaging-sw.js';
3
3
  export const MANIFEST: '/manifest.webmanifest';
4
+ export const FONT_LIST: 'buffcore-fonts';
5
+
6
+ /** The design system's font files (`design/fonts/` beside the product's `buffcore.config.ts`). */
7
+ export function designFontFiles(from: string): string[];
4
8
 
5
9
  /**
6
10
  * Serves BuffCore's files at the console's root, in development and in the build: Firebase's
7
- * service worker for pages on this device, and a web app manifest for the home screen.
11
+ * service worker for pages on this device, a web app manifest for the home screen, and the design
12
+ * system's font files (`/_fonts/`), listed in the page for the console to load.
8
13
  */
9
14
  export function adminConsole(options: { name: string }): { name: string };
package/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // `@buffcore/admin-shell/vite`: what the admin console needs from its Vite app. Plain JavaScript, so
2
2
  // Node loads it in a product's vite.config.ts from node_modules.
3
- import { readFileSync } from 'node:fs';
4
- import { dirname, join } from 'node:path';
3
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
4
+ import { basename, dirname, join, resolve } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
7
  // import.meta.url, which Vite keeps when it bundles a config that imports this file.
@@ -9,6 +9,37 @@ const here = dirname(fileURLToPath(import.meta.url));
9
9
 
10
10
  export const SERVICE_WORKER = '/firebase-messaging-sw.js';
11
11
  export const MANIFEST = '/manifest.webmanifest';
12
+ /** The element of the console's page that lists the design system's font files. */
13
+ export const FONT_LIST = 'buffcore-fonts';
14
+
15
+ const FONT_TYPES = { woff2: 'font/woff2', woff: 'font/woff', ttf: 'font/ttf', otf: 'font/otf' };
16
+ const fontType = (/** @type {string} */ file) =>
17
+ FONT_TYPES[/** @type {keyof typeof FONT_TYPES} */ (file.split('.').pop()?.toLowerCase() ?? '')];
18
+
19
+ /**
20
+ * The design system's font files (`design/fonts/` beside the product's `buffcore.config.ts`, the
21
+ * nearest one up from the console's folder, inside its repository), read each time: none when
22
+ * the folder is missing.
23
+ *
24
+ * @param {string} from The console's folder.
25
+ * @returns {string[]}
26
+ */
27
+ export function designFontFiles(from) {
28
+ let dir = resolve(from);
29
+ while (!existsSync(join(dir, 'buffcore.config.ts'))) {
30
+ if (dirname(dir) === dir || existsSync(join(dir, '.git'))) return [];
31
+ dir = dirname(dir);
32
+ }
33
+ const fonts = join(dir, 'design', 'fonts');
34
+ try {
35
+ return readdirSync(fonts, { withFileTypes: true })
36
+ .filter((entry) => entry.isFile() && fontType(entry.name))
37
+ .map((entry) => join(fonts, entry.name))
38
+ .sort();
39
+ } catch {
40
+ return [];
41
+ }
42
+ }
12
43
 
13
44
  /**
14
45
  * Serves BuffCore's files at the console's root, in development and in the build, so a product
@@ -18,6 +49,10 @@ export const MANIFEST = '/manifest.webmanifest';
18
49
  * @param {{ name: string }} options The name under the icon on the home screen.
19
50
  */
20
51
  export function adminConsole({ name }) {
52
+ // Where the console's files are served from, once Vite has read its config.
53
+ let root = process.cwd();
54
+ let base = '/';
55
+ const fontPath = (/** @type {string} */ file) => `_fonts/${encodeURIComponent(basename(file))}`;
21
56
  const files = {
22
57
  [SERVICE_WORKER]: {
23
58
  type: 'text/javascript',
@@ -39,22 +74,60 @@ export function adminConsole({ name }) {
39
74
  const address = URL.parse(process.env.APE_ADMIN_URL ?? '');
40
75
  return { server: { host: address?.hostname === '[::1]' ? '::1' : '127.0.0.1' } };
41
76
  },
77
+ /** @param {{ root: string, base: string }} config */
78
+ configResolved(config) {
79
+ root = config.root;
80
+ base = config.base;
81
+ },
42
82
  /** @param {{ middlewares: { use: (handler: (req: { url?: string }, res: import('node:http').ServerResponse, next: () => void) => void) => void } }} server */
43
83
  configureServer(server) {
44
84
  server.middlewares.use((req, res, next) => {
45
- const file = files[new URL(req.url ?? '/', 'http://console').pathname];
85
+ const path = new URL(req.url ?? '/', 'http://console').pathname;
86
+ // The design system's fonts, by name: only the files listed, never a path.
87
+ const font = path.startsWith(`${base}_fonts/`)
88
+ ? designFontFiles(root).find((file) => `${base}${fontPath(file)}` === path)
89
+ : undefined;
90
+ if (font) {
91
+ res.setHeader('Content-Type', fontType(font) ?? 'application/octet-stream');
92
+ res.end(readFileSync(font));
93
+ return;
94
+ }
95
+ const file = files[path];
46
96
  if (!file) return next();
47
97
  res.setHeader('Content-Type', file.type);
48
98
  res.end(file.source);
49
99
  });
50
100
  },
51
- /** @this {{ emitFile: (file: { type: 'asset'; fileName: string; source: string }) => void }} */
101
+ /** @this {{ emitFile: (file: { type: 'asset'; fileName: string; source: string | Uint8Array }) => void }} */
52
102
  generateBundle() {
53
103
  for (const [path, file] of Object.entries(files))
54
104
  this.emitFile({ type: 'asset', fileName: path.slice(1), source: file.source });
105
+ for (const font of designFontFiles(root))
106
+ this.emitFile({
107
+ type: 'asset',
108
+ fileName: decodeURIComponent(fontPath(font)),
109
+ source: readFileSync(font),
110
+ });
55
111
  },
112
+ /**
113
+ * The manifest's link, and the design system's font files for the console to match to its
114
+ * theme's families (`designFontCss`): a list the page reads, never runs.
115
+ */
56
116
  transformIndexHtml() {
57
- return [{ tag: 'link', attrs: { rel: 'manifest', href: MANIFEST }, injectTo: 'head' }];
117
+ const fonts = designFontFiles(root).map((font) => `${base}${fontPath(font)}`);
118
+ return [
119
+ { tag: 'link', attrs: { rel: 'manifest', href: MANIFEST }, injectTo: 'head' },
120
+ ...(fonts.length
121
+ ? [
122
+ {
123
+ tag: 'script',
124
+ attrs: { type: 'application/json', id: FONT_LIST },
125
+ children: JSON.stringify(fonts).replaceAll('<', '\\u003c'),
126
+ injectTo: 'head',
127
+ },
128
+ ]
129
+ : []),
130
+ ];
58
131
  },
59
132
  };
60
133
  }