@elytracms/studio 0.0.86 → 0.0.87

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 (203) hide show
  1. package/convex/asset-revalidate.test.ts +186 -0
  2. package/convex/assets.ts +53 -19
  3. package/convex/cms.ts +22 -0
  4. package/convex/delivery.ts +33 -116
  5. package/convex/functions.ts +3 -3
  6. package/convex/rail-write-parity.test.ts +180 -0
  7. package/convex/redirects.ts +33 -11
  8. package/convex/revalidate.ts +7 -5
  9. package/convex/triggers.ts +53 -3
  10. package/dist/components/app-views/default-modules.d.ts +20 -20
  11. package/dist/components/app-views/default-modules.js +27 -48
  12. package/dist/components/app-views/default-modules.js.map +1 -1
  13. package/dist/components/app-views/studio-config.d.ts +5 -6
  14. package/dist/components/app-views/studio-config.js.map +1 -1
  15. package/dist/components/assets/asset-metadata.d.ts +28 -19
  16. package/dist/components/assets/asset-metadata.js +24 -31
  17. package/dist/components/assets/asset-metadata.js.map +1 -1
  18. package/dist/components/assets/asset-selection.d.ts +24 -5
  19. package/dist/components/assets/asset-selection.js +39 -9
  20. package/dist/components/assets/asset-selection.js.map +1 -1
  21. package/dist/components/assets/assets-collection-view-source.d.ts +17 -14
  22. package/dist/components/assets/assets-collection-view-source.js +25 -31
  23. package/dist/components/assets/assets-collection-view-source.js.map +1 -1
  24. package/dist/components/builder/blocks-panel.js +3 -3
  25. package/dist/components/builder/blocks-panel.js.map +1 -1
  26. package/dist/components/builder/builder-store.d.ts +25 -1
  27. package/dist/components/builder/builder-store.js +3 -2
  28. package/dist/components/builder/builder-store.js.map +1 -1
  29. package/dist/components/builder/canvas-chrome-css.js +0 -17
  30. package/dist/components/builder/canvas-chrome-css.js.map +1 -1
  31. package/dist/components/builder/canvas-chrome.d.ts +10 -12
  32. package/dist/components/builder/canvas-chrome.js +12 -13
  33. package/dist/components/builder/canvas-chrome.js.map +1 -1
  34. package/dist/components/builder/canvas-dnd.d.ts +8 -0
  35. package/dist/components/builder/canvas-dnd.js +5 -3
  36. package/dist/components/builder/canvas-dnd.js.map +1 -1
  37. package/dist/components/builder/canvas-render-context.d.ts +12 -24
  38. package/dist/components/builder/canvas-render-context.js +15 -44
  39. package/dist/components/builder/canvas-render-context.js.map +1 -1
  40. package/dist/components/builder/canvas.js +5 -11
  41. package/dist/components/builder/canvas.js.map +1 -1
  42. package/dist/components/builder/clipboard-actions.d.ts +14 -6
  43. package/dist/components/builder/clipboard-actions.js +29 -20
  44. package/dist/components/builder/clipboard-actions.js.map +1 -1
  45. package/dist/components/builder/composition-field-editor.d.ts +19 -26
  46. package/dist/components/builder/composition-field-editor.js +30 -52
  47. package/dist/components/builder/composition-field-editor.js.map +1 -1
  48. package/dist/components/builder/insert-context.d.ts +3 -1
  49. package/dist/components/builder/insert-context.js +15 -10
  50. package/dist/components/builder/insert-context.js.map +1 -1
  51. package/dist/components/builder/page-tree.d.ts +29 -0
  52. package/dist/components/builder/page-tree.js +56 -58
  53. package/dist/components/builder/page-tree.js.map +1 -1
  54. package/dist/components/builder/reuse.js +5 -2
  55. package/dist/components/builder/reuse.js.map +1 -1
  56. package/dist/components/cms/asset-field.js +20 -32
  57. package/dist/components/cms/asset-field.js.map +1 -1
  58. package/dist/components/cms/cms-composition-validators.js +11 -2
  59. package/dist/components/cms/cms-composition-validators.js.map +1 -1
  60. package/dist/components/cms/editable-cell.js +5 -2
  61. package/dist/components/cms/editable-cell.js.map +1 -1
  62. package/dist/components/cms/use-document-versions.js +1 -0
  63. package/dist/components/cms/use-document-versions.js.map +1 -1
  64. package/dist/components/cms/versions-model.d.ts +0 -12
  65. package/dist/components/cms/versions-model.js +3 -15
  66. package/dist/components/cms/versions-model.js.map +1 -1
  67. package/dist/components/components/component-detail.js +1 -1
  68. package/dist/components/components/component-detail.js.map +1 -1
  69. package/dist/components/components/transfer-dialog.js +2 -4
  70. package/dist/components/components/transfer-dialog.js.map +1 -1
  71. package/dist/components/components/transfer.d.ts +13 -10
  72. package/dist/components/components/transfer.js +21 -19
  73. package/dist/components/components/transfer.js.map +1 -1
  74. package/dist/components/project-session.d.ts +9 -0
  75. package/dist/components/project-session.js +1 -1
  76. package/dist/components/project-session.js.map +1 -1
  77. package/dist/components/redirects/redirects-collection-view-source.d.ts +17 -2
  78. package/dist/components/redirects/redirects-collection-view-source.js +20 -6
  79. package/dist/components/redirects/redirects-collection-view-source.js.map +1 -1
  80. package/dist/components/section-surface.js +3 -2
  81. package/dist/components/section-surface.js.map +1 -1
  82. package/dist/components/settings-form.js +1 -2
  83. package/dist/components/settings-form.js.map +1 -1
  84. package/dist/components/studio-context.js +1 -18
  85. package/dist/components/studio-context.js.map +1 -1
  86. package/dist/components/studio-project-screen.js +3 -5
  87. package/dist/components/studio-project-screen.js.map +1 -1
  88. package/dist/lib/ai/apply-content.js +73 -29
  89. package/dist/lib/ai/apply-content.js.map +1 -1
  90. package/dist/lib/ai/constraints.d.ts +35 -0
  91. package/dist/lib/ai/constraints.js +104 -4
  92. package/dist/lib/ai/constraints.js.map +1 -1
  93. package/dist/lib/ai/route.js +4 -1
  94. package/dist/lib/ai/route.js.map +1 -1
  95. package/dist/lib/ai/shape.d.ts +3 -2
  96. package/dist/lib/ai/shape.js +16 -24
  97. package/dist/lib/ai/shape.js.map +1 -1
  98. package/dist/lib/ai/types.d.ts +8 -0
  99. package/dist/lib/ai/types.js.map +1 -1
  100. package/dist/lib/ai/update-fields.js +33 -12
  101. package/dist/lib/ai/update-fields.js.map +1 -1
  102. package/dist/lib/assets/asset-placements.d.ts +35 -0
  103. package/dist/lib/assets/asset-placements.js +74 -0
  104. package/dist/lib/assets/asset-placements.js.map +1 -0
  105. package/dist/lib/assets/backfill-thumbs.d.ts +9 -8
  106. package/dist/lib/assets/backfill-thumbs.js +13 -25
  107. package/dist/lib/assets/backfill-thumbs.js.map +1 -1
  108. package/dist/lib/clipboard/paste-issues.d.ts +17 -15
  109. package/dist/lib/clipboard/paste-issues.js +8 -45
  110. package/dist/lib/clipboard/paste-issues.js.map +1 -1
  111. package/dist/lib/clipboard/paste-target.d.ts +25 -1
  112. package/dist/lib/clipboard/paste-target.js +13 -6
  113. package/dist/lib/clipboard/paste-target.js.map +1 -1
  114. package/dist/lib/cms/published-documents.js +1 -0
  115. package/dist/lib/cms/published-documents.js.map +1 -1
  116. package/dist/lib/cms-views/view-model.d.ts +3 -3
  117. package/dist/lib/data/index.d.ts +0 -3
  118. package/dist/lib/data/index.js +4 -6
  119. package/dist/lib/data/index.js.map +1 -1
  120. package/dist/lib/dnd/drop-rules.d.ts +45 -2
  121. package/dist/lib/dnd/drop-rules.js +64 -9
  122. package/dist/lib/dnd/drop-rules.js.map +1 -1
  123. package/dist/lib/engine-version.d.ts +1 -1
  124. package/dist/lib/engine-version.js +1 -1
  125. package/dist/lib/engine-version.js.map +1 -1
  126. package/dist/lib/i18n/messages.de.js +4 -56
  127. package/dist/lib/i18n/messages.de.js.map +1 -1
  128. package/dist/lib/i18n/messages.en.d.ts +4 -53
  129. package/dist/lib/i18n/messages.en.js +8 -57
  130. package/dist/lib/i18n/messages.en.js.map +1 -1
  131. package/dist/lib/locale/fallback.js +8 -2
  132. package/dist/lib/locale/fallback.js.map +1 -1
  133. package/dist/lib/locale/index.d.ts +0 -1
  134. package/dist/lib/locale/index.js +0 -1
  135. package/dist/lib/locale/index.js.map +1 -1
  136. package/dist/lib/locale/locale-store.d.ts +10 -3
  137. package/dist/lib/locale/locale-store.js +12 -5
  138. package/dist/lib/locale/locale-store.js.map +1 -1
  139. package/dist/lib/operations/session-hydration.d.ts +9 -5
  140. package/dist/lib/operations/session-hydration.js +10 -10
  141. package/dist/lib/operations/session-hydration.js.map +1 -1
  142. package/dist/lib/persistence/convex-adapter.js +63 -75
  143. package/dist/lib/persistence/convex-adapter.js.map +1 -1
  144. package/dist/lib/persona/labels.d.ts +0 -2
  145. package/dist/lib/persona/labels.js +1 -7
  146. package/dist/lib/persona/labels.js.map +1 -1
  147. package/dist/lib/registry/index.d.ts +4 -2
  148. package/dist/lib/registry/index.js +26 -21
  149. package/dist/lib/registry/index.js.map +1 -1
  150. package/dist/lib/registry/project-components.js +0 -3
  151. package/dist/lib/registry/project-components.js.map +1 -1
  152. package/dist/lib/routes/route-issues.js +4 -5
  153. package/dist/lib/routes/route-issues.js.map +1 -1
  154. package/dist/lib/theme.js +3 -2
  155. package/dist/lib/theme.js.map +1 -1
  156. package/dist/lib/webhooks/tags.js +11 -14
  157. package/dist/lib/webhooks/tags.js.map +1 -1
  158. package/dist/lib/workspace/index.d.ts +1 -1
  159. package/dist/lib/workspace/index.js +1 -1
  160. package/dist/lib/workspace/index.js.map +1 -1
  161. package/dist/previews/enumerate.d.ts +27 -9
  162. package/dist/previews/enumerate.js +27 -6
  163. package/dist/previews/enumerate.js.map +1 -1
  164. package/dist/previews/manifest-format.d.ts +9 -0
  165. package/dist/previews/manifest-format.js.map +1 -1
  166. package/dist/router/match.d.ts +0 -2
  167. package/dist/router/match.js +0 -2
  168. package/dist/router/match.js.map +1 -1
  169. package/dist/ui/badge.d.ts +1 -1
  170. package/package.json +2 -2
  171. package/src/styles/studio.css +5 -4
  172. package/src/styles/tokens.css +72 -55
  173. package/convex/content.ts +0 -291
  174. package/dist/components/collab/collab-context.d.ts +0 -27
  175. package/dist/components/collab/collab-context.js +0 -39
  176. package/dist/components/collab/collab-context.js.map +0 -1
  177. package/dist/components/collab/collab-seed.d.ts +0 -15
  178. package/dist/components/collab/collab-seed.js +0 -20
  179. package/dist/components/collab/collab-seed.js.map +0 -1
  180. package/dist/components/extensions/extensions-view.d.ts +0 -7
  181. package/dist/components/extensions/extensions-view.js +0 -127
  182. package/dist/components/extensions/extensions-view.js.map +0 -1
  183. package/dist/lib/bindings/section-bindings.d.ts +0 -24
  184. package/dist/lib/bindings/section-bindings.js +0 -9
  185. package/dist/lib/bindings/section-bindings.js.map +0 -1
  186. package/dist/lib/data/data-store.d.ts +0 -98
  187. package/dist/lib/data/data-store.js +0 -211
  188. package/dist/lib/data/data-store.js.map +0 -1
  189. package/dist/lib/data/providers.d.ts +0 -143
  190. package/dist/lib/data/providers.js +0 -255
  191. package/dist/lib/data/providers.js.map +0 -1
  192. package/dist/lib/data/sample-capture.d.ts +0 -30
  193. package/dist/lib/data/sample-capture.js +0 -70
  194. package/dist/lib/data/sample-capture.js.map +0 -1
  195. package/dist/lib/data/sources-store.d.ts +0 -42
  196. package/dist/lib/data/sources-store.js +0 -120
  197. package/dist/lib/data/sources-store.js.map +0 -1
  198. package/dist/lib/locale/binding-fallback.d.ts +0 -35
  199. package/dist/lib/locale/binding-fallback.js +0 -73
  200. package/dist/lib/locale/binding-fallback.js.map +0 -1
  201. package/dist/lib/starters/kit-session.d.ts +0 -5
  202. package/dist/lib/starters/kit-session.js +0 -17
  203. package/dist/lib/starters/kit-session.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { ComponentRegistry, isCanvasEligible } from '@elytracms/core/component-registry';
2
- import { basePrimitives, getImplementation } from '@elytracms/core/runtime-renderer';
2
+ import { basePrimitives, getImplementation, registerImplementations } from '@elytracms/core/runtime-renderer';
3
3
  import { resolveWorkspaceConfig } from '@elytracms/core/studio-core';
4
4
  import { DEFAULT_VARIANT } from '../components/builder/blocks-model.js';
5
5
  /**
@@ -10,6 +10,13 @@ import { DEFAULT_VARIANT } from '../components/builder/blocks-model.js';
10
10
  * id). A config that fails shape-resolution contributes no project components
11
11
  * — the primitives still enumerate, and the CLI surfaces config problems
12
12
  * through the studio/doctor, not here.
13
+ *
14
+ * EC-555: the kept entries' implementations (`unknown` in the config) go through
15
+ * core's one registration step, like the studio registry's and the Next host's —
16
+ * a non-component is withheld (its preview renders the missing-component
17
+ * fallback, never `createElement`) and returned as an `invalid-implementation`
18
+ * issue. The first-wins dedupe runs BEFORE the check, so a withheld entry still
19
+ * claims its id.
13
20
  */
14
21
  export function previewComponentsFromConfig(config) {
15
22
  const base = basePrimitives();
@@ -21,6 +28,7 @@ export function previewComponentsFromConfig(config) {
21
28
  implementations[manifest.id] = implementation;
22
29
  }
23
30
  const seen = new Set(manifests.map((m) => m.id));
31
+ const kept = [];
24
32
  const resolved = resolveWorkspaceConfig(config);
25
33
  for (const project of resolved.projects) {
26
34
  for (const entry of project.components ?? []) {
@@ -28,15 +36,28 @@ export function previewComponentsFromConfig(config) {
28
36
  continue;
29
37
  seen.add(entry.manifest.id);
30
38
  manifests.push(entry.manifest);
31
- implementations[entry.manifest.id] = entry.implementation;
39
+ kept.push(entry);
32
40
  }
33
41
  }
34
- return { manifests, implementations };
42
+ // Ids are unique by construction here (deduped against the primitives too),
43
+ // so the merge order below decides nothing.
44
+ const project = registerImplementations(kept);
45
+ return {
46
+ manifests,
47
+ implementations: { ...implementations, ...project.implementations },
48
+ issues: project.issues,
49
+ };
35
50
  }
36
- /** The {@link StudioRegistry}-shaped registry the harness renders against. */
51
+ /**
52
+ * The {@link StudioRegistry}-shaped registry the harness renders against. Its
53
+ * `registry.issues` carries the implementation issues too — the same list the
54
+ * studio registry records them into (EC-555).
55
+ */
37
56
  export function previewRegistryFromConfig(config) {
38
- const { manifests, implementations } = previewComponentsFromConfig(config);
39
- return { registry: new ComponentRegistry(manifests), implementations };
57
+ const { manifests, implementations, issues } = previewComponentsFromConfig(config);
58
+ const registry = new ComponentRegistry(manifests);
59
+ registry.issues.push(...issues);
60
+ return { registry, implementations };
40
61
  }
41
62
  /**
42
63
  * Enumerate every generated-preview entry for a config: canvas-eligible
@@ -1 +1 @@
1
- {"version":3,"file":"enumerate.js","sourceRoot":"","sources":["../../src/previews/enumerate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAExF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AA2CpE;;;;;;;;GAQG;AACH,MAAM,UAAU,2BAA2B,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E,eAAe;gBACxB,SAAS,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE;aACtD,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import type { ComponentType } from 'react'\nimport { ComponentRegistry, isCanvasEligible } from '@elytracms/core/component-registry'\nimport type { ComponentFixture, ComponentManifest } from '@elytracms/core/component-registry'\nimport { basePrimitives, getImplementation } from '@elytracms/core/runtime-renderer'\nimport type { ComponentImplementations } from '@elytracms/core/runtime-renderer'\nimport { resolveWorkspaceConfig } from '@elytracms/core/studio-core'\nimport { DEFAULT_VARIANT } from '../components/builder/blocks-model'\nimport type { StudioRegistry } from '../lib/registry'\n\n/**\n * EC-440 — the fixture-preview enumeration behind `elytra previews`. ONE\n * source of truth for \"which previews exist\" shared by the CLI's node-side\n * driver (hashing, staleness `--check`) and the browser render harness\n * ({@link import('./harness').mountPreviewHarness}) — both derive the entry\n * set from the consumer's `elytra.config.ts` default export through here, so\n * generation, staleness checking, and rendering can never disagree.\n *\n * DATA-FREE by construction: this module reads the consumer CONFIG (registry\n * manifests + implementations — code), never a persistence adapter, auth, or\n * content data. The entry set mirrors the blocks panel exactly (EC-439): every\n * canvas-eligible manifest, one entry per declared fixture, and a single\n * implicit {@link DEFAULT_VARIANT} entry for fixture-less manifests. Base\n * primitives are included — they are insertable tiles too. Layout-helper\n * presets are NOT manifests and keep their placeholder treatment.\n */\n\n/** One renderable preview: a component fixture plus its staleness-hash inputs. */\nexport interface PreviewEntrySpec {\n componentId: string\n /** The fixture name, or {@link DEFAULT_VARIANT} for a fixture-less manifest. */\n fixture: string\n /**\n * The render-relevant inputs the CLI hashes (with the engine version) for\n * staleness: the manifest's prop + slot shape (defaults live in the prop\n * field-defs, so seeded renders are covered) and the declared fixture's own\n * props/slotChildren (`fixture: null` for the implicit Default variant).\n * Deliberately NOT hashed: the component implementation and the theme —\n * drift there is caught by regeneration runs, not by the hash (the ratified\n * EC-440 staleness split).\n */\n hashInput: {\n manifest: { props: ComponentManifest['props']; slots: ComponentManifest['slots'] }\n fixture: {\n props: NonNullable<ComponentFixture['props']> | null\n slotChildren: NonNullable<ComponentFixture['slotChildren']> | null\n } | null\n }\n}\n\n/**\n * The component set a config carries, as the harness registry input: the base\n * primitives plus every resolved project's `components` entries, deduped by\n * component id (first declaration wins — the generated-preview seam is keyed\n * by component id alone, so one image serves every project that registers the\n * id). A config that fails shape-resolution contributes no project components\n * — the primitives still enumerate, and the CLI surfaces config problems\n * through the studio/doctor, not here.\n */\nexport function previewComponentsFromConfig(config: unknown): {\n manifests: ComponentManifest[]\n implementations: ComponentImplementations\n} {\n const base = basePrimitives()\n const manifests: ComponentManifest[] = [...base.manifests]\n const implementations: Record<string, ComponentType<Record<string, unknown>>> = {}\n for (const manifest of base.manifests) {\n const implementation = getImplementation(base.implementations, manifest.id)\n if (implementation) implementations[manifest.id] = implementation\n }\n const seen = new Set(manifests.map((m) => m.id))\n\n const resolved = resolveWorkspaceConfig(config)\n for (const project of resolved.projects) {\n for (const entry of project.components ?? []) {\n if (seen.has(entry.manifest.id)) continue\n seen.add(entry.manifest.id)\n manifests.push(entry.manifest)\n implementations[entry.manifest.id] = entry.implementation as ComponentType<Record<string, unknown>>\n }\n }\n return { manifests, implementations }\n}\n\n/** The {@link StudioRegistry}-shaped registry the harness renders against. */\nexport function previewRegistryFromConfig(config: unknown): StudioRegistry {\n const { manifests, implementations } = previewComponentsFromConfig(config)\n return { registry: new ComponentRegistry(manifests), implementations }\n}\n\n/**\n * Enumerate every generated-preview entry for a config: canvas-eligible\n * manifests only (server-only components never render on the client canvas),\n * one entry per declared fixture in declaration order, else one implicit\n * {@link DEFAULT_VARIANT} entry. Components are sorted by id so the output —\n * and everything the CLI derives from it (manifest JSON, file writes) — is\n * deterministic regardless of registration order.\n */\nexport function previewEntriesForConfig(config: unknown): PreviewEntrySpec[] {\n const { manifests } = previewComponentsFromConfig(config)\n const entries: PreviewEntrySpec[] = []\n for (const manifest of [...manifests].sort((a, b) => a.id.localeCompare(b.id))) {\n if (!isCanvasEligible(manifest)) continue\n const manifestShape = { props: manifest.props, slots: manifest.slots }\n if (manifest.fixtures && manifest.fixtures.length > 0) {\n for (const fixture of manifest.fixtures) {\n entries.push({\n componentId: manifest.id,\n fixture: fixture.name,\n hashInput: {\n manifest: manifestShape,\n fixture: { props: fixture.props ?? null, slotChildren: fixture.slotChildren ?? null },\n },\n })\n }\n } else {\n entries.push({\n componentId: manifest.id,\n fixture: DEFAULT_VARIANT,\n hashInput: { manifest: manifestShape, fixture: null },\n })\n }\n }\n return entries\n}\n"]}
1
+ {"version":3,"file":"enumerate.js","sourceRoot":"","sources":["../../src/previews/enumerate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAMxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAE7G,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAiDpE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAe;IAKzD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA;IAC7B,MAAM,SAAS,GAAwB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1D,MAAM,eAAe,GAA2D,EAAE,CAAA;IAClF,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAA;QAC3E,IAAI,cAAc;YAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,cAAc,CAAA;IACnE,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,C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esContent":["import type { ComponentType } from 'react'\nimport { ComponentRegistry, isCanvasEligible } from '@elytracms/core/component-registry'\nimport type {\n ComponentFixture,\n ComponentIssue,\n ComponentManifest,\n} from '@elytracms/core/component-registry'\nimport { basePrimitives, getImplementation, registerImplementations } from '@elytracms/core/runtime-renderer'\nimport type { ComponentImplementations } from '@elytracms/core/runtime-renderer'\nimport { resolveWorkspaceConfig } from '@elytracms/core/studio-core'\nimport type { HostComponentEntry } from '@elytracms/core/studio-core'\nimport { DEFAULT_VARIANT } from '../components/builder/blocks-model'\nimport type { StudioRegistry } from '../lib/registry'\n\n/**\n * EC-440 — the fixture-preview enumeration behind `elytra previews`. ONE\n * source of truth for \"which previews exist\" shared by the CLI's node-side\n * driver (hashing, staleness `--check`) and the browser render harness\n * ({@link import('./harness').mountPreviewHarness}) — both derive the entry\n * set from the consumer's `elytra.config.ts` default export through here, so\n * generation, staleness checking, and rendering can never disagree.\n *\n * DATA-FREE by construction: this module reads the consumer CONFIG (registry\n * manifests + implementations — code), never a persistence adapter, auth, or\n * content data. The entry set mirrors the blocks panel exactly (EC-439): every\n * canvas-eligible manifest, one entry per declared fixture, and a single\n * implicit {@link DEFAULT_VARIANT} entry for fixture-less manifests. Base\n * primitives are included — they are insertable tiles too. Layout-helper\n * presets are NOT manifests and keep their placeholder treatment.\n */\n\n/** One renderable preview: a component fixture plus its staleness-hash inputs. */\nexport interface PreviewEntrySpec {\n componentId: string\n /** The fixture name, or {@link DEFAULT_VARIANT} for a fixture-less manifest. */\n fixture: string\n /**\n * The DECLARED render inputs the CLI hashes per entry for staleness: the\n * manifest's prop + slot shape (defaults live in the prop field-defs, so\n * seeded renders are covered) and the declared fixture's own\n * props/slotChildren (`fixture: null` for the implicit Default variant). A\n * change here re-renders one entry.\n *\n * NOT in here: the component implementation and the theme — a config arrives\n * evaluated, so neither has a per-entry identity. The CLI covers them as\n * manifest-level render dependencies instead (EC-600: content hashes of the\n * project source files the config imports plus the theme `@import` chain),\n * and a change there re-renders every entry. Before EC-600 this comment said\n * regeneration caught such drift; it did not — regeneration only rendered what\n * this hash called stale.\n */\n hashInput: {\n manifest: { props: ComponentManifest['props']; slots: ComponentManifest['slots'] }\n fixture: {\n props: NonNullable<ComponentFixture['props']> | null\n slotChildren: NonNullable<ComponentFixture['slotChildren']> | null\n } | null\n }\n}\n\n/**\n * The component set a config carries, as the harness registry input: the base\n * primitives plus every resolved project's `components` entries, deduped by\n * component id (first declaration wins — the generated-preview seam is keyed\n * by component id alone, so one image serves every project that registers the\n * id). A config that fails shape-resolution contributes no project components\n * — the primitives still enumerate, and the CLI surfaces config problems\n * through the studio/doctor, not here.\n *\n * EC-555: the kept entries' implementations (`unknown` in the config) go through\n * core's one registration step, like the studio registry's and the Next host's —\n * a non-component is withheld (its preview renders the missing-component\n * fallback, never `createElement`) and returned as an `invalid-implementation`\n * issue. The first-wins dedupe runs BEFORE the check, so a withheld entry still\n * claims its id.\n */\nexport function previewComponentsFromConfig(config: unknown): {\n manifests: ComponentManifest[]\n implementations: ComponentImplementations\n issues: ComponentIssue[]\n} {\n const base = basePrimitives()\n const manifests: ComponentManifest[] = [...base.manifests]\n const implementations: Record<string, ComponentType<Record<string, unknown>>> = {}\n for (const manifest of base.manifests) {\n const implementation = getImplementation(base.implementations, manifest.id)\n if (implementation) implementations[manifest.id] = implementation\n }\n const seen = new Set(manifests.map((m) => m.id))\n\n const kept: HostComponentEntry[] = []\n const resolved = resolveWorkspaceConfig(config)\n for (const project of resolved.projects) {\n for (const entry of project.components ?? []) {\n if (seen.has(entry.manifest.id)) continue\n seen.add(entry.manifest.id)\n manifests.push(entry.manifest)\n kept.push(entry)\n }\n }\n // Ids are unique by construction here (deduped against the primitives too),\n // so the merge order below decides nothing.\n const project = registerImplementations(kept)\n return {\n manifests,\n implementations: { ...implementations, ...project.implementations },\n issues: project.issues,\n }\n}\n\n/**\n * The {@link StudioRegistry}-shaped registry the harness renders against. Its\n * `registry.issues` carries the implementation issues too — the same list the\n * studio registry records them into (EC-555).\n */\nexport function previewRegistryFromConfig(config: unknown): StudioRegistry {\n const { manifests, implementations, issues } = previewComponentsFromConfig(config)\n const registry = new ComponentRegistry(manifests)\n registry.issues.push(...issues)\n return { registry, implementations }\n}\n\n/**\n * Enumerate every generated-preview entry for a config: canvas-eligible\n * manifests only (server-only components never render on the client canvas),\n * one entry per declared fixture in declaration order, else one implicit\n * {@link DEFAULT_VARIANT} entry. Components are sorted by id so the output —\n * and everything the CLI derives from it (manifest JSON, file writes) — is\n * deterministic regardless of registration order.\n */\nexport function previewEntriesForConfig(config: unknown): PreviewEntrySpec[] {\n const { manifests } = previewComponentsFromConfig(config)\n const entries: PreviewEntrySpec[] = []\n for (const manifest of [...manifests].sort((a, b) => a.id.localeCompare(b.id))) {\n if (!isCanvasEligible(manifest)) continue\n const manifestShape = { props: manifest.props, slots: manifest.slots }\n if (manifest.fixtures && manifest.fixtures.length > 0) {\n for (const fixture of manifest.fixtures) {\n entries.push({\n componentId: manifest.id,\n fixture: fixture.name,\n hashInput: {\n manifest: manifestShape,\n fixture: { props: fixture.props ?? null, slotChildren: fixture.slotChildren ?? null },\n },\n })\n }\n } else {\n entries.push({\n componentId: manifest.id,\n fixture: DEFAULT_VARIANT,\n hashInput: { manifest: manifestShape, fixture: null },\n })\n }\n }\n return entries\n}\n"]}
@@ -42,6 +42,15 @@ export interface GeneratedPreviewsManifest {
42
42
  /** The `@elytracms/studio` version the images were rendered with. */
43
43
  engine: string;
44
44
  entries: GeneratedPreviewsManifestEntry[];
45
+ /**
46
+ * EC-600 (format v3): the render dependencies the images were rendered against —
47
+ * project source files imported by the config plus the theme `@import` chain, each
48
+ * with its content hash. Written and compared by the CLI; the studio ignores it.
49
+ */
50
+ renderDeps?: Array<{
51
+ path: string;
52
+ hash: string;
53
+ }>;
45
54
  }
46
55
  /**
47
56
  * Adapt a previews manifest (a plain JSON import) into the EC-439
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-format.js","sourceRoot":"","sources":["../../src/previews/manifest-format.ts"],"names":[],"mappings":"AAkDA,0EAA0E;AAC1E,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAC7D,MAAM,KAAK,GAAG,KAAgC,CAAA;IAC9C,OAAO,CACL,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAC9B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAiB;IAC7D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,MAAM,OAAO,GAAI,QAAkC,CAAC,OAAO,CAAA;QAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,IAAI,eAAe,CAAC,KAAK,CAAC;oBAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;YAC/F,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;AACrF,CAAC;AAED,SAAS,SAAS,CAAC,WAAmB,EAAE,OAAe;IACrD,wEAAwE;IACxE,OAAO,GAAG,WAAW,SAAS,OAAO,EAAE,CAAA;AACzC,CAAC","sourcesContent":["import type { GeneratedPreviewLookup } from '../components/builder/blocks-model'\n\n/**\n * The previews-manifest format (EC-440) — the JSON contract between the\n * `elytra previews` CLI (the writer) and a consumer's `studio.config.tsx`\n * (the reader, via {@link generatedPreviewsFromManifest}).\n *\n * The CLI renders every canvas-eligible component's fixtures headlessly\n * against the consumer theme, writes the images to the studio app's\n * `public/elytra-previews/` (served at `/elytra-previews/...`), and writes\n * this manifest next to `studio.config.tsx` (`studio/elytra-previews.json`)\n * so it is importable as a plain JSON module. Everything in it is\n * deterministic — no timestamps — so an unchanged re-run rewrites nothing.\n */\n\n/**\n * The manifest FORMAT VERSION is declared once, in the CLI (`@elytracms/cli`\n * `src/previews.js` `PREVIEWS_MANIFEST_VERSION`) — the CLI is both its writer and\n * its only reader (`elytra previews --check` reports a mismatch as itself and\n * regenerates). EC-514 removed the mirror this module used to carry: nothing in the\n * studio ever read it, and a hand-kept copy is a drift site with no reader to catch\n * the drift. The reader below is version-agnostic by design — it only ever looks at\n * `componentId`/`fixture`/`url`, so a manifest of any version resolves tiles.\n */\n\n/** One generated preview artifact: a component fixture and its rendered image. */\nexport interface GeneratedPreviewsManifestEntry {\n componentId: string\n /** The fixture name, or `'Default'` for a fixture-less component's implicit variant. */\n fixture: string\n /** Root-relative image URL (the file lives in the studio app's `public/`). */\n url: string\n /**\n * Input hash (sha-256 hex over the stable-serialized inputs: manifest prop +\n * slot shape, fixture props/slotChildren — NOT the engine version, EC-502).\n * `elytra previews` skips entries whose hash is unchanged; `elytra previews\n * --check` flags entries whose hash drifted as stale. Deliberately NOT part of\n * the lookup — the studio only reads `componentId`/`fixture`/`url`.\n */\n hash: string\n}\n\n/** The manifest document `elytra previews` writes (`studio/elytra-previews.json`). */\nexport interface GeneratedPreviewsManifest {\n version: number\n /** The `@elytracms/studio` version the images were rendered with. */\n engine: string\n entries: GeneratedPreviewsManifestEntry[]\n}\n\n/** Tolerant entry guard — a malformed entry is skipped, never a crash. */\nfunction isManifestEntry(value: unknown): value is GeneratedPreviewsManifestEntry {\n if (typeof value !== 'object' || value === null) return false\n const entry = value as Record<string, unknown>\n return (\n typeof entry.componentId === 'string' &&\n typeof entry.fixture === 'string' &&\n typeof entry.url === 'string'\n )\n}\n\n/**\n * Adapt a previews manifest (a plain JSON import) into the EC-439\n * {@link GeneratedPreviewLookup} seam. The whole consumer wiring is ~2 lines:\n *\n * ```tsx\n * // studio.config.tsx\n * import previewsManifest from './elytra-previews.json'\n * export default defineStudio({\n * previews: { generated: generatedPreviewsFromManifest(previewsManifest) },\n * })\n * ```\n *\n * Tolerant by design (the input is a generated file a human may hand-edit or\n * delete): a malformed document or entry yields lookup misses — the blocks\n * panel then falls back to the icon+name placeholder — never a crash. A\n * fixture-less component's single implicit variant is looked up (and written\n * by the CLI) under the fixture name `'Default'`.\n */\nexport function generatedPreviewsFromManifest(manifest: unknown): GeneratedPreviewLookup {\n const byKey = new Map<string, string>()\n if (typeof manifest === 'object' && manifest !== null) {\n const entries = (manifest as { entries?: unknown }).entries\n if (Array.isArray(entries)) {\n for (const entry of entries) {\n if (isManifestEntry(entry)) byKey.set(lookupKey(entry.componentId, entry.fixture), entry.url)\n }\n }\n }\n return (componentId, fixtureName) => byKey.get(lookupKey(componentId, fixtureName))\n}\n\nfunction lookupKey(componentId: string, fixture: string): string {\n // NUL (\\u0000) can appear in neither a component id nor a fixture name.\n return `${componentId}\\u0000${fixture}`\n}\n"]}
1
+ {"version":3,"file":"manifest-format.js","sourceRoot":"","sources":["../../src/previews/manifest-format.ts"],"names":[],"mappings":"AAwDA,0EAA0E;AAC1E,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAC7D,MAAM,KAAK,GAAG,KAAgC,CAAA;IAC9C,OAAO,CACL,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QACjC,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAC9B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAiB;IAC7D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,MAAM,OAAO,GAAI,QAAkC,CAAC,OAAO,CAAA;QAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,IAAI,eAAe,CAAC,KAAK,CAAC;oBAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;YAC/F,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;AACrF,CAAC;AAED,SAAS,SAAS,CAAC,WAAmB,EAAE,OAAe;IACrD,wEAAwE;IACxE,OAAO,GAAG,WAAW,SAAS,OAAO,EAAE,CAAA;AACzC,CAAC","sourcesContent":["import type { GeneratedPreviewLookup } from '../components/builder/blocks-model'\n\n/**\n * The previews-manifest format (EC-440) — the JSON contract between the\n * `elytra previews` CLI (the writer) and a consumer's `studio.config.tsx`\n * (the reader, via {@link generatedPreviewsFromManifest}).\n *\n * The CLI renders every canvas-eligible component's fixtures headlessly\n * against the consumer theme, writes the images to the studio app's\n * `public/elytra-previews/` (served at `/elytra-previews/...`), and writes\n * this manifest next to `studio.config.tsx` (`studio/elytra-previews.json`)\n * so it is importable as a plain JSON module. Everything in it is\n * deterministic — no timestamps — so an unchanged re-run rewrites nothing.\n */\n\n/**\n * The manifest FORMAT VERSION is declared once, in the CLI (`@elytracms/cli`\n * `src/previews.js` `PREVIEWS_MANIFEST_VERSION`) — the CLI is both its writer and\n * its only reader (`elytra previews --check` reports a mismatch as itself and\n * regenerates). EC-514 removed the mirror this module used to carry: nothing in the\n * studio ever read it, and a hand-kept copy is a drift site with no reader to catch\n * the drift. The reader below is version-agnostic by design — it only ever looks at\n * `componentId`/`fixture`/`url`, so a manifest of any version resolves tiles.\n */\n\n/** One generated preview artifact: a component fixture and its rendered image. */\nexport interface GeneratedPreviewsManifestEntry {\n componentId: string\n /** The fixture name, or `'Default'` for a fixture-less component's implicit variant. */\n fixture: string\n /** Root-relative image URL (the file lives in the studio app's `public/`). */\n url: string\n /**\n * Input hash (sha-256 hex over the stable-serialized inputs: manifest prop +\n * slot shape, fixture props/slotChildren — NOT the engine version, EC-502).\n * `elytra previews` skips entries whose hash is unchanged; `elytra previews\n * --check` flags entries whose hash drifted as stale. Deliberately NOT part of\n * the lookup — the studio only reads `componentId`/`fixture`/`url`.\n */\n hash: string\n}\n\n/** The manifest document `elytra previews` writes (`studio/elytra-previews.json`). */\nexport interface GeneratedPreviewsManifest {\n version: number\n /** The `@elytracms/studio` version the images were rendered with. */\n engine: string\n entries: GeneratedPreviewsManifestEntry[]\n /**\n * EC-600 (format v3): the render dependencies the images were rendered against —\n * project source files imported by the config plus the theme `@import` chain, each\n * with its content hash. Written and compared by the CLI; the studio ignores it.\n */\n renderDeps?: Array<{ path: string; hash: string }>\n}\n\n/** Tolerant entry guard — a malformed entry is skipped, never a crash. */\nfunction isManifestEntry(value: unknown): value is GeneratedPreviewsManifestEntry {\n if (typeof value !== 'object' || value === null) return false\n const entry = value as Record<string, unknown>\n return (\n typeof entry.componentId === 'string' &&\n typeof entry.fixture === 'string' &&\n typeof entry.url === 'string'\n )\n}\n\n/**\n * Adapt a previews manifest (a plain JSON import) into the EC-439\n * {@link GeneratedPreviewLookup} seam. The whole consumer wiring is ~2 lines:\n *\n * ```tsx\n * // studio.config.tsx\n * import previewsManifest from './elytra-previews.json'\n * export default defineStudio({\n * previews: { generated: generatedPreviewsFromManifest(previewsManifest) },\n * })\n * ```\n *\n * Tolerant by design (the input is a generated file a human may hand-edit or\n * delete): a malformed document or entry yields lookup misses — the blocks\n * panel then falls back to the icon+name placeholder — never a crash. A\n * fixture-less component's single implicit variant is looked up (and written\n * by the CLI) under the fixture name `'Default'`.\n */\nexport function generatedPreviewsFromManifest(manifest: unknown): GeneratedPreviewLookup {\n const byKey = new Map<string, string>()\n if (typeof manifest === 'object' && manifest !== null) {\n const entries = (manifest as { entries?: unknown }).entries\n if (Array.isArray(entries)) {\n for (const entry of entries) {\n if (isManifestEntry(entry)) byKey.set(lookupKey(entry.componentId, entry.fixture), entry.url)\n }\n }\n }\n return (componentId, fixtureName) => byKey.get(lookupKey(componentId, fixtureName))\n}\n\nfunction lookupKey(componentId: string, fixture: string): string {\n // NUL (\\u0000) can appear in neither a component id nor a fixture name.\n return `${componentId}\\u0000${fixture}`\n}\n"]}
@@ -53,8 +53,6 @@ export declare const studioPath: {
53
53
  readonly settings: () => string;
54
54
  readonly assets: () => string;
55
55
  readonly asset: (assetId: string) => string;
56
- readonly routes: () => string;
57
- readonly extensions: () => string;
58
56
  readonly builder: () => string;
59
57
  readonly components: () => string;
60
58
  readonly component: (componentId: string) => string;
@@ -61,8 +61,6 @@ export const studioPath = {
61
61
  // see asset-detail.tsx) drives it (AD-19).
62
62
  assets: () => 'assets',
63
63
  asset: (assetId) => `assets/${assetId}`,
64
- routes: () => 'routes',
65
- extensions: () => 'extensions',
66
64
  builder: () => 'builder',
67
65
  components: () => 'components',
68
66
  component: (componentId) => `components/${componentId}`,
@@ -1 +1 @@
1
- {"version":3,"file":"match.js","sourceRoot":"","sources":["../../src/router/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,yFAAyF;AACzF,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,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AE,CAAC,MAAc,EAAE,EAAE,CAAC,SAAS,MAAM,EAAE;IAC3C,8EAA8E;IAC9E,4CAA4C;IAC5C,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;IAC5B,QAAQ,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,aAAa,UAAU,EAAE;CACnD,CAAA","sourcesContent":["/**\n * Studio route table (EC-223 Stage 6 — catch-all routing). The studio mounts as\n * a SINGLE splat route per project (`/$projectId/$`); this pure matcher turns the\n * splat's trailing pathname into a typed match that the screen resolver renders.\n * Keeping the URL→screen map inside the engine (instead of in per-consumer route\n * files) is what lets the package own its navigation with a near-empty consumer\n * route tree — the goal of Stage 6.\n *\n * Deterministic and dependency-free: every screen state is reproducible from a\n * pathname string (see `match.test.ts`), satisfying the fixtures-reproducibility\n * convention without needing a router instance.\n *\n * EC-239 (app-view modularization): the route table is no longer a hardcoded\n * per-section switch — the studio's surfaces are a config-extendable VIEW registry\n * derived from the section rail, so the matcher is registry-AGNOSTIC. It splits the\n * splat into a view id (the first segment) + that view's trailing segments; the\n * screen resolver looks the id up in the registry and the view's own `parsePath`\n * interprets the segments (CMS: collection/document; components: id; flat: none).\n * Keeping the matcher free of the surface list is what lets a consuming repo add a\n * routable custom view purely from config.\n *\n * /$projectId → { section: 'index' } (redirect to first view)\n * /$projectId/<id> → { section: 'view', viewId: '<id>', segments: [] }\n * /$projectId/<id>/a/b → { section: 'view', viewId: '<id>', segments: ['a','b'] }\n *\n * The view decides whether its segments resolve; an unknown id or an over-deep\n * path becomes a not-found at the resolver, not here.\n */\n\nexport type StudioRouteMatch =\n | { section: 'index' }\n | { section: 'view'; viewId: string; segments: string[] }\n\n/** Split a splat pathname into clean segments (drops empty/leading/trailing slashes). */\nfunction segments(splat: string): string[] {\n return splat\n .split('/')\n .map((segment) => segment.trim())\n .filter(Boolean)\n}\n\n/**\n * Match the trailing pathname of the project splat (`_splat`) into a view id +\n * its segments. `splat` is everything after `/$projectId/` — e.g. `'cms/page/abc'`\n * for `/p1/cms/page/abc` → `{ viewId: 'cms', segments: ['page', 'abc'] }`. An\n * empty splat is the bare project index (which redirects to the first view).\n */\nexport function matchStudioRoute(splat: string): StudioRouteMatch {\n const [viewId, ...rest] = segments(splat)\n if (viewId === undefined) return { section: 'index' }\n return { section: 'view', viewId, segments: rest }\n}\n\n/**\n * The inverse of {@link matchStudioRoute}: build the `_splat` subpath for a\n * screen. Navigation addresses the single project splat as\n * `to={STUDIO_PROJECT_ROUTE} params={{ projectId, _splat: studioPath.X(...) }}`,\n * so the URL-construction lives in exactly one place — the same module that\n * parses it back. `matchStudioRoute(studioPath.cmsDocument(c, d))` round-trips\n * (pinned in `match.test.ts`), which is what keeps the two directions in sync.\n */\nexport const studioPath = {\n index: () => '',\n settings: () => 'settings',\n // The assets rail (EC-319) — a list + a per-asset detail, mirroring the CMS\n // arity so the SAME portable list surface (plus a bespoke detail surface,\n // see asset-detail.tsx) drives it (AD-19).\n assets: () => 'assets',\n asset: (assetId: string) => `assets/${assetId}`,\n routes: () => 'routes',\n extensions: () => 'extensions',\n builder: () => 'builder',\n components: () => 'components',\n component: (componentId: string) => `components/${componentId}`,\n cms: () => 'cms',\n cmsCollection: (collectionId: string) => `cms/${collectionId}`,\n cmsDocument: (collectionId: string, documentId: string) =>\n `cms/${collectionId}/${documentId}`,\n // The users rail (EC-240) — a list + a per-member detail, mirroring the CMS\n // arity so the SAME portable list/edit surfaces drive it (AD-19).\n users: () => 'users',\n user: (userId: string) => `users/${userId}`,\n // The redirects rail (EC-303) — editorial redirects as data, same list+detail\n // arity over the portable surfaces (AD-19).\n redirects: () => 'redirects',\n redirect: (redirectId: string) => `redirects/${redirectId}`,\n} as const\n"]}
1
+ {"version":3,"file":"match.js","sourceRoot":"","sources":["../../src/router/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,yFAAyF;AACzF,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK;SACT,KAA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C,SAAS,MAAM,EAAE;IAC3C,8EAA8E;IAC9E,4CAA4C;IAC5C,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;IAC5B,QAAQ,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,aAAa,UAAU,EAAE;CACnD,CAAA","sourcesContent":["/**\n * Studio route table (EC-223 Stage 6 — catch-all routing). The studio mounts as\n * a SINGLE splat route per project (`/$projectId/$`); this pure matcher turns the\n * splat's trailing pathname into a typed match that the screen resolver renders.\n * Keeping the URL→screen map inside the engine (instead of in per-consumer route\n * files) is what lets the package own its navigation with a near-empty consumer\n * route tree — the goal of Stage 6.\n *\n * Deterministic and dependency-free: every screen state is reproducible from a\n * pathname string (see `match.test.ts`), satisfying the fixtures-reproducibility\n * convention without needing a router instance.\n *\n * EC-239 (app-view modularization): the route table is no longer a hardcoded\n * per-section switch — the studio's surfaces are a config-extendable VIEW registry\n * derived from the section rail, so the matcher is registry-AGNOSTIC. It splits the\n * splat into a view id (the first segment) + that view's trailing segments; the\n * screen resolver looks the id up in the registry and the view's own `parsePath`\n * interprets the segments (CMS: collection/document; components: id; flat: none).\n * Keeping the matcher free of the surface list is what lets a consuming repo add a\n * routable custom view purely from config.\n *\n * /$projectId → { section: 'index' } (redirect to first view)\n * /$projectId/<id> → { section: 'view', viewId: '<id>', segments: [] }\n * /$projectId/<id>/a/b → { section: 'view', viewId: '<id>', segments: ['a','b'] }\n *\n * The view decides whether its segments resolve; an unknown id or an over-deep\n * path becomes a not-found at the resolver, not here.\n */\n\nexport type StudioRouteMatch =\n | { section: 'index' }\n | { section: 'view'; viewId: string; segments: string[] }\n\n/** Split a splat pathname into clean segments (drops empty/leading/trailing slashes). */\nfunction segments(splat: string): string[] {\n return splat\n .split('/')\n .map((segment) => segment.trim())\n .filter(Boolean)\n}\n\n/**\n * Match the trailing pathname of the project splat (`_splat`) into a view id +\n * its segments. `splat` is everything after `/$projectId/` — e.g. `'cms/page/abc'`\n * for `/p1/cms/page/abc` → `{ viewId: 'cms', segments: ['page', 'abc'] }`. An\n * empty splat is the bare project index (which redirects to the first view).\n */\nexport function matchStudioRoute(splat: string): StudioRouteMatch {\n const [viewId, ...rest] = segments(splat)\n if (viewId === undefined) return { section: 'index' }\n return { section: 'view', viewId, segments: rest }\n}\n\n/**\n * The inverse of {@link matchStudioRoute}: build the `_splat` subpath for a\n * screen. Navigation addresses the single project splat as\n * `to={STUDIO_PROJECT_ROUTE} params={{ projectId, _splat: studioPath.X(...) }}`,\n * so the URL-construction lives in exactly one place — the same module that\n * parses it back. `matchStudioRoute(studioPath.cmsDocument(c, d))` round-trips\n * (pinned in `match.test.ts`), which is what keeps the two directions in sync.\n */\nexport const studioPath = {\n index: () => '',\n settings: () => 'settings',\n // The assets rail (EC-319) — a list + a per-asset detail, mirroring the CMS\n // arity so the SAME portable list surface (plus a bespoke detail surface,\n // see asset-detail.tsx) drives it (AD-19).\n assets: () => 'assets',\n asset: (assetId: string) => `assets/${assetId}`,\n builder: () => 'builder',\n components: () => 'components',\n component: (componentId: string) => `components/${componentId}`,\n cms: () => 'cms',\n cmsCollection: (collectionId: string) => `cms/${collectionId}`,\n cmsDocument: (collectionId: string, documentId: string) =>\n `cms/${collectionId}/${documentId}`,\n // The users rail (EC-240) — a list + a per-member detail, mirroring the CMS\n // arity so the SAME portable list/edit surfaces drive it (AD-19).\n users: () => 'users',\n user: (userId: string) => `users/${userId}`,\n // The redirects rail (EC-303) — editorial redirects as data, same list+detail\n // arity over the portable surfaces (AD-19).\n redirects: () => 'redirects',\n redirect: (redirectId: string) => `redirects/${redirectId}`,\n} as const\n"]}
@@ -1,7 +1,7 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
2
  import type { HTMLAttributes } from 'react';
3
3
  export declare const badgeVariants: (props?: ({
4
- variant?: "error" | "default" | "warning" | "info" | "success" | "primary" | "outline" | null | undefined;
4
+ variant?: "error" | "default" | "warning" | "success" | "primary" | "outline" | "info" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elytracms/studio",
3
3
  "author": "finaldream <hi@finaldream.de>",
4
- "version": "0.0.86",
4
+ "version": "0.0.87",
5
5
  "engines": {
6
6
  "node": ">=22.18.0"
7
7
  },
@@ -153,7 +153,7 @@
153
153
  "lucide-react": "^1.23.0",
154
154
  "tailwind-merge": "^3.6.0",
155
155
  "zod": "^4.4.3",
156
- "@elytracms/core": "^0.0.86"
156
+ "@elytracms/core": "^0.0.87"
157
157
  },
158
158
  "peerDependencies": {
159
159
  "@tanstack/react-router": "^1.170.0",
@@ -17,10 +17,11 @@
17
17
  @import '@fontsource-variable/hanken-grotesk';
18
18
  @import '@fontsource-variable/jetbrains-mono';
19
19
  /*
20
- * Design-token CSS variables (`:root` + `.dark`) are GENERATED from the canonical
21
- * @elytracms/design-tokens package. Edit tokens there and run `pnpm gen:tokens`.
22
- * Cool-slate neutrals + a confident cobalt accent; monospace carries every technical
23
- * token (component ids, path tokens, issue codes) to reinforce the code-first identity.
20
+ * The colour roles are declared once, hand-written, in tokens.css (EC-607); the
21
+ * `@theme inline` block below maps each to its Tailwind colour and is the one
22
+ * declaration of the fonts and the radius scale. Cool-slate neutrals + a confident
23
+ * cobalt accent; monospace carries every technical token (component ids, path tokens,
24
+ * issue codes) to reinforce the code-first identity.
24
25
  */
25
26
  @import './tokens.css';
26
27
 
@@ -1,63 +1,80 @@
1
- /* GENERATED from @elytracms/design-tokens — do not edit by hand. Run `pnpm gen:tokens`. */
1
+ /*
2
+ * Studio colour tokens: the one declaration (EC-607). Hand-written, so edit here.
3
+ *
4
+ * Each role is declared ONCE as `light-dark(<light>, <dark>)`, so a role cannot
5
+ * exist without both values. The `dark` class on <html> (lib/theme.ts) only flips
6
+ * `color-scheme`, which picks the value; it also gives native controls and
7
+ * scrollbars the matching scheme. A role that tracks another is a plain `var()`.
8
+ *
9
+ * Components never use raw colours: studio.css maps each role to a Tailwind colour
10
+ * (`bg-primary`, `text-muted-foreground`, …) and the in-canvas chrome uses no var()
11
+ * at all (canvas-chrome-css.ts). A new role is one line here plus its `@theme inline`
12
+ * line in studio.css; lib/theme-tokens-contract.test.ts fails if a mapped role is missing.
13
+ *
14
+ * Needs light-dark(): Chrome 123, Safari 17.5, Firefox 120.
15
+ */
2
16
  :root {
3
- --background: oklch(0.985 0.002 250);
4
- --foreground: oklch(0.21 0.02 264);
5
- --card: oklch(1 0 0);
17
+ color-scheme: light;
18
+ --radius: 0.5rem;
19
+
20
+ /* App canvas background */
21
+ --background: light-dark(oklch(0.985 0.002 250), oklch(0.176 0.012 264));
22
+ /* Primary text */
23
+ --foreground: light-dark(oklch(0.21 0.02 264), oklch(0.95 0.005 250));
24
+ /* Card surface */
25
+ --card: light-dark(oklch(1 0 0), oklch(0.205 0.013 264));
26
+ /* Text on cards */
6
27
  --card-foreground: var(--foreground);
7
- --panel: oklch(0.974 0.003 255);
28
+ /* Inspector / rail surface */
29
+ --panel: light-dark(oklch(0.974 0.003 255), oklch(0.196 0.013 264));
30
+ /* Text on panels */
8
31
  --panel-foreground: var(--foreground);
9
- --popover: oklch(1 0 0);
32
+ /* Floating surface */
33
+ --popover: light-dark(oklch(1 0 0), oklch(0.214 0.013 264));
34
+ /* Text on popovers */
10
35
  --popover-foreground: var(--foreground);
11
- --muted: oklch(0.955 0.004 255);
12
- --muted-foreground: oklch(0.5 0.018 260);
13
- --border: oklch(0.908 0.005 260);
14
- --input: oklch(0.908 0.005 260);
15
- --ring: oklch(0.55 0.17 256);
16
- --primary: oklch(0.55 0.17 256);
17
- --primary-foreground: oklch(0.99 0.005 250);
18
- --secondary: oklch(0.955 0.004 255);
19
- --secondary-foreground: oklch(0.3 0.02 264);
20
- --accent: oklch(0.95 0.022 256);
21
- --accent-foreground: oklch(0.36 0.07 256);
22
- --success: oklch(0.58 0.13 150);
23
- --success-foreground: oklch(0.99 0.01 150);
24
- --warning: oklch(0.68 0.14 70);
25
- --warning-foreground: oklch(0.24 0.04 70);
26
- --destructive: oklch(0.57 0.2 27);
27
- --destructive-foreground: oklch(0.99 0.01 27);
28
- --info: oklch(0.56 0.12 248);
29
- --info-foreground: oklch(0.99 0.01 248);
30
- --grid-line: oklch(0.8 0.01 260 / 0.5);
31
- --radius: 0.5rem;
36
+ /* Subtle fill */
37
+ --muted: light-dark(oklch(0.955 0.004 255), oklch(0.256 0.013 264));
38
+ /* Secondary text */
39
+ --muted-foreground: light-dark(oklch(0.5 0.018 260), oklch(0.66 0.02 258));
40
+ /* Hairline borders */
41
+ --border: light-dark(oklch(0.908 0.005 260), oklch(0.278 0.013 264));
42
+ /* Form control borders */
43
+ --input: light-dark(oklch(0.908 0.005 260), oklch(0.3 0.013 264));
44
+ /* Focus ring */
45
+ --ring: light-dark(oklch(0.55 0.17 256), oklch(0.66 0.16 256));
46
+ /* Primary action (cobalt) */
47
+ --primary: light-dark(oklch(0.55 0.17 256), oklch(0.66 0.16 256));
48
+ /* Text on primary */
49
+ --primary-foreground: light-dark(oklch(0.99 0.005 250), oklch(0.16 0.02 264));
50
+ /* Secondary action */
51
+ --secondary: light-dark(oklch(0.955 0.004 255), oklch(0.256 0.013 264));
52
+ /* Text on secondary */
53
+ --secondary-foreground: light-dark(oklch(0.3 0.02 264), oklch(0.92 0.005 250));
54
+ /* Selected / emphasis fill */
55
+ --accent: light-dark(oklch(0.95 0.022 256), oklch(0.288 0.03 256));
56
+ /* Text on accent */
57
+ --accent-foreground: light-dark(oklch(0.36 0.07 256), oklch(0.88 0.03 256));
58
+ /* Success / valid */
59
+ --success: light-dark(oklch(0.58 0.13 150), oklch(0.7 0.14 150));
60
+ /* Text on success */
61
+ --success-foreground: light-dark(oklch(0.99 0.01 150), oklch(0.16 0.03 150));
62
+ /* Warning */
63
+ --warning: light-dark(oklch(0.68 0.14 70), oklch(0.79 0.14 75));
64
+ /* Text on warning */
65
+ --warning-foreground: light-dark(oklch(0.24 0.04 70), oklch(0.2 0.04 75));
66
+ /* Error / destructive */
67
+ --destructive: light-dark(oklch(0.57 0.2 27), oklch(0.67 0.18 25));
68
+ /* Text on destructive */
69
+ --destructive-foreground: light-dark(oklch(0.99 0.01 27), oklch(0.16 0.03 25));
70
+ /* Informational / bound */
71
+ --info: light-dark(oklch(0.56 0.12 248), oklch(0.7 0.13 245));
72
+ /* Text on info */
73
+ --info-foreground: light-dark(oklch(0.99 0.01 248), oklch(0.16 0.03 245));
74
+ /* Canvas grid lines */
75
+ --grid-line: light-dark(oklch(0.8 0.01 260 / 0.5), oklch(0.5 0.012 264 / 0.32));
32
76
  }
33
77
 
34
78
  .dark {
35
- --background: oklch(0.176 0.012 264);
36
- --foreground: oklch(0.95 0.005 250);
37
- --card: oklch(0.205 0.013 264);
38
- --card-foreground: var(--foreground);
39
- --panel: oklch(0.196 0.013 264);
40
- --panel-foreground: var(--foreground);
41
- --popover: oklch(0.214 0.013 264);
42
- --popover-foreground: var(--foreground);
43
- --muted: oklch(0.256 0.013 264);
44
- --muted-foreground: oklch(0.66 0.02 258);
45
- --border: oklch(0.278 0.013 264);
46
- --input: oklch(0.3 0.013 264);
47
- --ring: oklch(0.66 0.16 256);
48
- --primary: oklch(0.66 0.16 256);
49
- --primary-foreground: oklch(0.16 0.02 264);
50
- --secondary: oklch(0.256 0.013 264);
51
- --secondary-foreground: oklch(0.92 0.005 250);
52
- --accent: oklch(0.288 0.03 256);
53
- --accent-foreground: oklch(0.88 0.03 256);
54
- --success: oklch(0.7 0.14 150);
55
- --success-foreground: oklch(0.16 0.03 150);
56
- --warning: oklch(0.79 0.14 75);
57
- --warning-foreground: oklch(0.2 0.04 75);
58
- --destructive: oklch(0.67 0.18 25);
59
- --destructive-foreground: oklch(0.16 0.03 25);
60
- --info: oklch(0.7 0.13 245);
61
- --info-foreground: oklch(0.16 0.03 245);
62
- --grid-line: oklch(0.5 0.012 264 / 0.32);
79
+ color-scheme: dark;
63
80
  }