@elytracms/studio 0.0.8 → 0.0.10

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 (204) hide show
  1. package/convex/guard.ts +16 -0
  2. package/convex/members.ts +14 -3
  3. package/dist/components/assets/asset-library.js.map +1 -1
  4. package/dist/components/assets/asset-metadata.js.map +1 -1
  5. package/dist/components/assets/asset-search.js.map +1 -1
  6. package/dist/components/assets/asset-selection.js.map +1 -1
  7. package/dist/components/assets/assets-store.js.map +1 -1
  8. package/dist/components/auth-context.js.map +1 -1
  9. package/dist/components/backend-gate.js.map +1 -1
  10. package/dist/components/breadcrumb-context.js.map +1 -1
  11. package/dist/components/builder/blocks-model.js.map +1 -1
  12. package/dist/components/builder/blocks-panel.js.map +1 -1
  13. package/dist/components/builder/builder-store.js.map +1 -1
  14. package/dist/components/builder/canvas-stylesheet.js.map +1 -1
  15. package/dist/components/builder/canvas.js.map +1 -1
  16. package/dist/components/builder/clipboard-actions.js.map +1 -1
  17. package/dist/components/builder/composition-field-editor.js.map +1 -1
  18. package/dist/components/builder/composition-scope.js.map +1 -1
  19. package/dist/components/builder/drag-session.js.map +1 -1
  20. package/dist/components/builder/fixture-thumbnail.js.map +1 -1
  21. package/dist/components/builder/inline-edit.js.map +1 -1
  22. package/dist/components/builder/insert-context.js.map +1 -1
  23. package/dist/components/builder/insert-menu.js.map +1 -1
  24. package/dist/components/builder/layout-inspector.js.map +1 -1
  25. package/dist/components/builder/node-factory.js.map +1 -1
  26. package/dist/components/builder/page-tree.js.map +1 -1
  27. package/dist/components/builder/property-inspector.js.map +1 -1
  28. package/dist/components/builder/rich-text-toolbar.js.map +1 -1
  29. package/dist/components/builder/spacing-handles.js.map +1 -1
  30. package/dist/components/cms/alias-selector.d.ts +20 -0
  31. package/dist/components/cms/alias-selector.js +34 -0
  32. package/dist/components/cms/alias-selector.js.map +1 -0
  33. package/dist/components/cms/asset-picker.js.map +1 -1
  34. package/dist/components/cms/bulk-actions.js.map +1 -1
  35. package/dist/components/cms/bulk-bar.js.map +1 -1
  36. package/dist/components/cms/cell-edit.js.map +1 -1
  37. package/dist/components/cms/cell.js.map +1 -1
  38. package/dist/components/cms/cms-index.js.map +1 -1
  39. package/dist/components/cms/cms-store.d.ts +4 -5
  40. package/dist/components/cms/cms-store.js +45 -14
  41. package/dist/components/cms/cms-store.js.map +1 -1
  42. package/dist/components/cms/collection-table.js +10 -2
  43. package/dist/components/cms/collection-table.js.map +1 -1
  44. package/dist/components/cms/collections-sidebar.js.map +1 -1
  45. package/dist/components/cms/detail-editor.js +134 -58
  46. package/dist/components/cms/detail-editor.js.map +1 -1
  47. package/dist/components/cms/details-pane.d.ts +29 -0
  48. package/dist/components/cms/details-pane.js +29 -0
  49. package/dist/components/cms/details-pane.js.map +1 -0
  50. package/dist/components/cms/doc-state.js.map +1 -1
  51. package/dist/components/cms/document-editor-context.js.map +1 -1
  52. package/dist/components/cms/editable-cell.js.map +1 -1
  53. package/dist/components/cms/field-control.js.map +1 -1
  54. package/dist/components/cms/filter-builder.js.map +1 -1
  55. package/dist/components/cms/import-export.js.map +1 -1
  56. package/dist/components/cms/issues-pane.d.ts +19 -0
  57. package/dist/components/cms/issues-pane.js +33 -0
  58. package/dist/components/cms/issues-pane.js.map +1 -0
  59. package/dist/components/cms/new-page-dialog.js.map +1 -1
  60. package/dist/components/cms/reference-confirm.js.map +1 -1
  61. package/dist/components/cms/relation-picker.js.map +1 -1
  62. package/dist/components/cms/use-cell-edit.js.map +1 -1
  63. package/dist/components/cms/versions-model.js.map +1 -1
  64. package/dist/components/cms/versions-pane.js.map +1 -1
  65. package/dist/components/cms/view-bar.js.map +1 -1
  66. package/dist/components/collab/collab-context.js.map +1 -1
  67. package/dist/components/collab/collab-seed.js.map +1 -1
  68. package/dist/components/components/component-detail.js.map +1 -1
  69. package/dist/components/components/component-status.js.map +1 -1
  70. package/dist/components/components/components-index.js.map +1 -1
  71. package/dist/components/components/field-inspector.js.map +1 -1
  72. package/dist/components/components/fixture-runner.js.map +1 -1
  73. package/dist/components/components/registry-browser.js.map +1 -1
  74. package/dist/components/current-user-menu.js.map +1 -1
  75. package/dist/components/delivery-health-banner.js.map +1 -1
  76. package/dist/components/dev-login-badge.js.map +1 -1
  77. package/dist/components/extensions/extensions-view.js.map +1 -1
  78. package/dist/components/guards.js.map +1 -1
  79. package/dist/components/inspector/inspector-sidebar.d.ts +10 -1
  80. package/dist/components/inspector/inspector-sidebar.js +10 -4
  81. package/dist/components/inspector/inspector-sidebar.js.map +1 -1
  82. package/dist/components/operation-error.js.map +1 -1
  83. package/dist/components/playground-badge.js.map +1 -1
  84. package/dist/components/project-list.js.map +1 -1
  85. package/dist/components/project-session.js.map +1 -1
  86. package/dist/components/project-switcher.js.map +1 -1
  87. package/dist/components/references/builder-deep-link.js.map +1 -1
  88. package/dist/components/references/references-panel.js.map +1 -1
  89. package/dist/components/routes/redirect-chain.js.map +1 -1
  90. package/dist/components/routes/redirect-manager.js.map +1 -1
  91. package/dist/components/routes/route-list.js.map +1 -1
  92. package/dist/components/routes/routes-shell.js.map +1 -1
  93. package/dist/components/section-nav.js.map +1 -1
  94. package/dist/components/section-state.js.map +1 -1
  95. package/dist/components/section-surface.js.map +1 -1
  96. package/dist/components/sections.js.map +1 -1
  97. package/dist/components/settings-form.js.map +1 -1
  98. package/dist/components/studio-context.js.map +1 -1
  99. package/dist/components/studio-project-screen.js +32 -5
  100. package/dist/components/studio-project-screen.js.map +1 -1
  101. package/dist/components/studio-shell.js.map +1 -1
  102. package/dist/components/theme-context.js.map +1 -1
  103. package/dist/components/workspace-gate.js.map +1 -1
  104. package/dist/components/workspace-projects.js.map +1 -1
  105. package/dist/lib/assets/delete-asset.js.map +1 -1
  106. package/dist/lib/assets/image-dimensions.js.map +1 -1
  107. package/dist/lib/assets/index.js.map +1 -1
  108. package/dist/lib/assets/upload-state.js.map +1 -1
  109. package/dist/lib/assets/upload.js.map +1 -1
  110. package/dist/lib/auth/auth-adapter.js.map +1 -1
  111. package/dist/lib/auth/convex-auth-adapter.js.map +1 -1
  112. package/dist/lib/auth/dev-auto-login-adapter.js.map +1 -1
  113. package/dist/lib/auth/index.js.map +1 -1
  114. package/dist/lib/auth/local-auth-adapter.js.map +1 -1
  115. package/dist/lib/auth/route-guard.js.map +1 -1
  116. package/dist/lib/auth-errors.js.map +1 -1
  117. package/dist/lib/bindings/section-bindings.js.map +1 -1
  118. package/dist/lib/clipboard/index.js.map +1 -1
  119. package/dist/lib/clipboard/os-clipboard.js.map +1 -1
  120. package/dist/lib/clipboard/paste-issues.js.map +1 -1
  121. package/dist/lib/clipboard/paste-target.js.map +1 -1
  122. package/dist/lib/cms/published-documents.js.map +1 -1
  123. package/dist/lib/cms-views/index.js.map +1 -1
  124. package/dist/lib/cms-views/selection.js.map +1 -1
  125. package/dist/lib/cms-views/view-model.js.map +1 -1
  126. package/dist/lib/cms-views/views-store.js.map +1 -1
  127. package/dist/lib/data/collection-content.js.map +1 -1
  128. package/dist/lib/data/data-store.js.map +1 -1
  129. package/dist/lib/data/index.js.map +1 -1
  130. package/dist/lib/data/providers.js.map +1 -1
  131. package/dist/lib/data/sample-capture.js.map +1 -1
  132. package/dist/lib/data/sources-store.js.map +1 -1
  133. package/dist/lib/delivery/instant-publish.js.map +1 -1
  134. package/dist/lib/dnd/drop-rules.js.map +1 -1
  135. package/dist/lib/dnd/gap-drag.js.map +1 -1
  136. package/dist/lib/locale/binding-fallback.js.map +1 -1
  137. package/dist/lib/locale/fallback.js.map +1 -1
  138. package/dist/lib/locale/index.js.map +1 -1
  139. package/dist/lib/locale/locale-store.js.map +1 -1
  140. package/dist/lib/locale/locale-switcher.js.map +1 -1
  141. package/dist/lib/locale/route-variant.js.map +1 -1
  142. package/dist/lib/locale/use-studio-locale.js.map +1 -1
  143. package/dist/lib/operations/asset-repository.js.map +1 -1
  144. package/dist/lib/operations/cms-persistence.d.ts +7 -2
  145. package/dist/lib/operations/cms-persistence.js +6 -2
  146. package/dist/lib/operations/cms-persistence.js.map +1 -1
  147. package/dist/lib/operations/graph-commands.js.map +1 -1
  148. package/dist/lib/operations/graph-persistence.js.map +1 -1
  149. package/dist/lib/operations/index.js.map +1 -1
  150. package/dist/lib/operations/operations-package.js.map +1 -1
  151. package/dist/lib/operations/persist-queue.js.map +1 -1
  152. package/dist/lib/operations/session-hydration.js.map +1 -1
  153. package/dist/lib/operations/studio-operations.js.map +1 -1
  154. package/dist/lib/persistence/backend-mode.js.map +1 -1
  155. package/dist/lib/persistence/convex-adapter.js +8 -4
  156. package/dist/lib/persistence/convex-adapter.js.map +1 -1
  157. package/dist/lib/persistence/convex-blob-storage.js.map +1 -1
  158. package/dist/lib/persistence/convex-client.js.map +1 -1
  159. package/dist/lib/persistence/index.js.map +1 -1
  160. package/dist/lib/persona/labels.js +6 -0
  161. package/dist/lib/persona/labels.js.map +1 -1
  162. package/dist/lib/rail.js.map +1 -1
  163. package/dist/lib/references/impact.js.map +1 -1
  164. package/dist/lib/references/index.js.map +1 -1
  165. package/dist/lib/references/reference-model.js.map +1 -1
  166. package/dist/lib/references/references-store.js.map +1 -1
  167. package/dist/lib/registry/index.js.map +1 -1
  168. package/dist/lib/registry/preview.js.map +1 -1
  169. package/dist/lib/registry/project-components.js.map +1 -1
  170. package/dist/lib/routing/index.js.map +1 -1
  171. package/dist/lib/routing/routing-analysis.js.map +1 -1
  172. package/dist/lib/routing/routing-store.js.map +1 -1
  173. package/dist/lib/starters/kit-session.js.map +1 -1
  174. package/dist/lib/theme.js.map +1 -1
  175. package/dist/lib/utils.js.map +1 -1
  176. package/dist/lib/webhooks/config.js.map +1 -1
  177. package/dist/lib/webhooks/dispatcher.js.map +1 -1
  178. package/dist/lib/webhooks/index.js.map +1 -1
  179. package/dist/lib/webhooks/signing.js.map +1 -1
  180. package/dist/lib/webhooks/tags.js.map +1 -1
  181. package/dist/lib/working-graph.js.map +1 -1
  182. package/dist/lib/workspace/index.js.map +1 -1
  183. package/dist/lib/workspace/switcher-source.js.map +1 -1
  184. package/dist/lib/workspace/workspace-source.js.map +1 -1
  185. package/dist/router/index.js.map +1 -1
  186. package/dist/router/match.js.map +1 -1
  187. package/dist/router/search.js.map +1 -1
  188. package/dist/ui/avatar.js.map +1 -1
  189. package/dist/ui/badge.js.map +1 -1
  190. package/dist/ui/button.js.map +1 -1
  191. package/dist/ui/card.js.map +1 -1
  192. package/dist/ui/dialog.js.map +1 -1
  193. package/dist/ui/dropdown-menu.js.map +1 -1
  194. package/dist/ui/field.js.map +1 -1
  195. package/dist/ui/index.js.map +1 -1
  196. package/dist/ui/input.js.map +1 -1
  197. package/dist/ui/inspector.js.map +1 -1
  198. package/dist/ui/layout.js.map +1 -1
  199. package/dist/ui/panel.js.map +1 -1
  200. package/dist/ui/separator.js.map +1 -1
  201. package/dist/ui/toast.js.map +1 -1
  202. package/dist/ui/toolbar.js.map +1 -1
  203. package/dist/ui/typography.js.map +1 -1
  204. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"data-store.js","sourceRoot":"","sources":["../../../src/lib/data/data-store.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExG,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,8BAA8B,CAAA;AAUrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAA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AAC,CAAC,CAAC;wBACR,MAAM,KAAK,GAAU,CAAC,CAAA;wBACtB,OAAO,KAAK,CAAA;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;YACD,gBAAgB,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC;SAC9E,CAAA;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;IAElC,OAAO,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAwB,CAAA;AAC9E,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACrC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;IAC5E,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { createContext, useCallback, useContext, useEffect, useMemo, useReducer, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport {\n SourceRegistry,\n captureSample,\n inferSchema,\n resolveBinding,\n resolveCondition,\n tokensForSchema,\n} from '@elytracms/core/data-binding'\nimport type {\n BindingResolution,\n ConditionResolution,\n DataSource,\n InferredSchema,\n PayloadStore,\n RepeaterItemContext,\n} from '@elytracms/core/data-binding'\nimport type { BindingReference, Condition, JsonValue } from '@elytracms/core/project-graph'\nimport { getStudioOperations } from '../operations'\nimport type { OperationResult, OperationsClient } from '../operations'\nimport { STUDIO_SYSTEM_COLLECTION_IDS } from '../operations/session-hydration'\nimport { resolveDeploymentCollections } from '../workspace'\nimport { hasContentSession } from './collection-content'\nimport { captureSourceSample, cmsSourceForCollection } from './sample-capture'\nimport { deleteDataSource, loadDataSources, saveDataSource } from './sources-store'\n\n/**\n * The project's live data layer (brief §4.6, §7.5, EC-167). Holds the source\n * registry the Builder's Content tab binds through, plus the captured payloads\n * that drive binding resolution. One uniform model across CMS queries, data\n * providers, and the built-in REST/Convex kinds — resolution, sampling,\n * inference and tokenization treat them all identically.\n *\n * There is no source-authoring UI (EC-167): sources exist because code declared\n * them (registered data providers), the schema implied them (per-collection CMS\n * queries), or an editor flow provisioned them (repeating sections, template\n * pages).\n *\n * Persistence: when mounted with a `projectId`, the store hydrates the\n * project's persisted source records (the `cms-data-sources` system collection,\n * see `sources-store.ts`) over the deterministic playground seeds — persisted\n * wins by id, but never over a source provisioned/removed in THIS session —\n * and every provision/remove writes through `@elytracms/core/operations`. Without a\n * `projectId` (tests, fixtures) the store is pure session state, exactly as\n * before.\n */\nexport interface DataStore {\n sources: DataSource[]\n registry: SourceRegistry\n payloads: PayloadStore\n knownSourceIds: ReadonlySet<string>\n\n getSource: (id: string) => DataSource | undefined\n removeSource: (id: string) => void\n /**\n * Create or replace a source with a known id + config and capture its sample\n * immediately (EC-166/EC-167): repeating sections and template pages\n * provision their per-scope CMS query / provider sources through this.\n */\n provisionSource: (source: DataSource) => void\n\n /**\n * The latest persistence failure in plain language, or `null`. Persistence\n * is best-effort on top of the live session (the canvas keeps working on\n * session state), but a failure is recorded here — visible, never silent.\n */\n persistError: string | null\n\n /** The stable path tokens a source exposes from its inferred schema (EC-085). */\n tokensOf: (id: string) => string[]\n schemaOf: (id: string) => InferredSchema | undefined\n sampleOf: (id: string) => JsonValue | undefined\n\n /** Resolve a binding to a renderer-ready resolution (value/props/condition/issue). */\n resolve: (ref: BindingReference, item?: RepeaterItemContext) => BindingResolution\n /** Resolve a binding to the concrete value the renderer injects (EC-086–089). */\n resolveValue: (ref: BindingReference, item?: RepeaterItemContext) => JsonValue | undefined\n /** Evaluate a condition against the captured payloads (EC-088). */\n resolveCondition: (condition: Condition, item?: RepeaterItemContext) => ConditionResolution\n}\n\nexport interface DataState {\n sources: DataSource[]\n /**\n * Ids provisioned or removed in THIS session. Hydration (which resolves\n * asynchronously) never overrides them — the editor's latest action wins\n * over whatever was persisted before it.\n */\n sessionIds: ReadonlySet<string>\n}\n\nexport type DataAction =\n | { type: 'remove'; id: string }\n | { type: 'provision'; source: DataSource }\n /** Merge the project's persisted source records in (persisted wins over seeds). */\n | { type: 'hydrate'; sources: DataSource[] }\n\nfunction upsert(sources: DataSource[], source: DataSource): DataSource[] {\n const exists = sources.some((s) => s.id === source.id)\n return exists ? sources.map((s) => (s.id === source.id ? source : s)) : [...sources, source]\n}\n\n/**\n * A persisted record hydrates as-is when it carries its captured sample;\n * otherwise recapture. Exception (EC-177 gap 1): with a hydrated content\n * session configured (Convex mode), CMS sources ALWAYS recapture by replaying\n * their stored query over the live documents — a sample captured by an earlier\n * session may carry stale (or fixture-derived) entries.\n */\nfunction withSample(source: DataSource): DataSource {\n if (source.kind === 'cms' && hasContentSession()) {\n const sample = captureSourceSample(source)\n return sample !== undefined ? captureSample(source, sample) : source\n }\n if (source.sample !== undefined) return source\n // No persisted sample: try an honest capture (a provider runs; anything the\n // studio can't fetch returns undefined) — never fabricate.\n const sample = captureSourceSample(source)\n return sample !== undefined ? captureSample(source, sample) : source\n}\n\n/**\n * The store's reducer, exported because hydration/session-precedence semantics\n * live here and the app's test harness has no DOM to drive effects through.\n */\nexport function dataStateReducer(state: DataState, action: DataAction): DataState {\n switch (action.type) {\n case 'remove':\n return {\n ...state,\n sources: state.sources.filter((s) => s.id !== action.id),\n sessionIds: new Set([...state.sessionIds, action.id]),\n }\n case 'provision': {\n // Upsert by id; attach a sample only if one can be captured honestly (a\n // provider run, or live CMS content) — otherwise the source carries none.\n const sample = captureSourceSample(action.source)\n const provisioned = sample !== undefined ? captureSample(action.source, sample) : action.source\n return {\n ...state,\n sources: upsert(state.sources, provisioned),\n sessionIds: new Set([...state.sessionIds, provisioned.id]),\n }\n }\n case 'hydrate': {\n let sources = state.sources\n for (const source of action.sources) {\n if (state.sessionIds.has(source.id)) continue // this session already decided\n sources = upsert(sources, withSample(source))\n }\n return sources === state.sources ? state : { ...state, sources }\n }\n default:\n return state\n }\n}\n\nconst DataContext = createContext<DataStore | null>(null)\n\n/**\n * The session's starting state: EMPTY. The studio seeds no sample sources (Oli,\n * 2026-06-19) — real sources arrive from the project's config collections (the\n * hydrate effect, Convex mode) or are added by the author. Nothing is faked.\n */\nexport function initialDataState(): DataState {\n return { sources: [], sessionIds: new Set() }\n}\n\nexport interface DataProviderProps {\n children: ReactNode\n /**\n * When set, the store hydrates from and persists to this project's\n * `cms-data-sources` system collection (through `@elytracms/core/operations`).\n * Without it the store is pure session state (tests, fixtures).\n */\n projectId?: string\n}\n\nexport function DataProvider({ children, projectId }: DataProviderProps) {\n const [state, dispatch] = useReducer(dataStateReducer, undefined, initialDataState)\n const [persistError, setPersistError] = useState<string | null>(null)\n\n // EC-192: surface every config-driven content collection as a pickable CMS\n // source, so the binding/condition pickers list what actually exists — the\n // same collection set the CMS uses (`resolveDeploymentCollections`) — rather\n // than only the demo fixture sources. Merged additively (the `hydrate` upsert\n // skips session-decided ids and recaptures live samples in Convex mode); studio\n // SYSTEM collections (routes/redirects/saved views/data sources) are excluded.\n useEffect(() => {\n if (projectId === undefined) return\n const collections = resolveDeploymentCollections().filter(\n (collection) => !STUDIO_SYSTEM_COLLECTION_IDS.has(collection.id),\n )\n if (collections.length === 0) return\n dispatch({ type: 'hydrate', sources: collections.map(cmsSourceForCollection) })\n }, [projectId])\n\n // Hydrate the project's persisted sources once (operations query). Sources\n // provisioned by other sessions on the same project show up here; the\n // playground seeds stay for everything not persisted.\n useEffect(() => {\n if (projectId === undefined) return\n let cancelled = false\n void getStudioOperations()\n .then(({ operations }) => loadDataSources(operations, projectId))\n .then((result) => {\n if (cancelled) return\n if (!result.ok) {\n setPersistError(result.error.message)\n return\n }\n dispatch({ type: 'hydrate', sources: result.value })\n })\n return () => {\n cancelled = true\n }\n }, [projectId])\n\n // Best-effort persistence on top of the live session: the canvas keeps\n // working on session state; a failed write surfaces via `persistError`.\n const persist = useCallback(\n (write: (operations: OperationsClient, projectId: string) => Promise<OperationResult<void>>) => {\n if (projectId === undefined) return\n void getStudioOperations()\n .then(({ operations }) => write(operations, projectId))\n .then((result) => {\n if (!result.ok) setPersistError(result.error.message)\n })\n .catch((error: unknown) => {\n setPersistError(error instanceof Error ? error.message : 'Saving the data source failed.')\n })\n },\n [projectId],\n )\n\n const store = useMemo<DataStore>(() => {\n const registry = SourceRegistry.from(state.sources)\n const payloads: Record<string, JsonValue> = {}\n for (const source of state.sources) {\n if (source.sample !== undefined) payloads[source.id] = source.sample\n }\n const knownSourceIds = registry.knownSourceIds()\n const ctx = { payloads, registry }\n\n const getSource = (id: string) => registry.get(id)\n const resolve = (ref: BindingReference, item?: RepeaterItemContext) =>\n resolveBinding(ref, ctx, item)\n\n return {\n sources: state.sources,\n registry,\n payloads,\n knownSourceIds,\n getSource,\n removeSource: (id) => {\n dispatch({ type: 'remove', id })\n persist((operations, pid) => deleteDataSource(operations, pid, id))\n },\n provisionSource: (source) => {\n dispatch({ type: 'provision', source })\n // Persist exactly what the session resolves: the source plus any sample\n // that can be captured honestly (a provider run / live CMS content) —\n // never a fabricated one. Matches the `provision` reducer.\n const sample = captureSourceSample(source)\n const provisioned = sample !== undefined ? captureSample(source, sample) : source\n persist((operations, pid) => saveDataSource(operations, pid, provisioned))\n },\n persistError,\n tokensOf: (id) => {\n const schema = getSource(id)?.schema\n return schema ? tokensForSchema(schema) : []\n },\n schemaOf: (id) => {\n const source = getSource(id)\n if (source?.schema) return source.schema\n if (source?.sample !== undefined) return inferSchema(source.sample)\n return undefined\n },\n sampleOf: (id) => getSource(id)?.sample,\n resolve,\n resolveValue: (ref, item) => {\n const r = resolve(ref, item)\n switch (r.kind) {\n case 'value':\n return r.value\n case 'props':\n return r.props\n case 'condition':\n return r.pass\n case 'issue':\n return undefined\n default: {\n const never: never = r\n return never\n }\n }\n },\n resolveCondition: (condition, item) => resolveCondition(condition, ctx, item),\n }\n }, [state, persist, persistError])\n\n return <DataContext.Provider value={store}>{children}</DataContext.Provider>\n}\n\nexport function useData(): DataStore {\n const store = useContext(DataContext)\n if (!store) throw new Error('useData must be used within a <DataProvider>.')\n return store\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,+EAA+E;AAC/E,2EAA2E;AAC3E,wDAAwD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,+EAA+E;AAC/E,2EAA2E;AAC3E,wDAAwD","sourcesContent":["export * from './data-store'\nexport * from './sample-capture'\nexport * from './sources-store'\nexport * from './collection-content'\n// Data providers (EC-167) are imported from './providers' directly: the module\n// exports a `DataProvider` domain type that would collide with the store's\n// `<DataProvider>` React provider in a wildcard barrel.\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/lib/data/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA0EvB;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAsB,QAGvD;IACC,OAAO,QAAwB,CAAA;AACjC,CAAC;AAaD,MAAM,mBAAmB,GAAG,mBAAmB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IACd,IAAI,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC9C,MAAM,GAAgC,EAAE,CAAA;IAEjD,YAAY,YAAoC,EAAE;QAChD,KAAK,MAAM,QAAQ,IAAI,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC3D,CAAC;IAED,QAAQ,CAAC,QAAsB;QAC7B,MAAM,EAAE,GAAG,QAA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EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;AAClC,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,QAAsB;IACnD,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;IACjC,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACvC,CAAC","sourcesContent":["import { z } from 'zod'\nimport type { ConvexSource, DataSource } from '@elytracms/core/data-binding'\nimport type { JsonValue } from '@elytracms/core/project-graph'\n\n/**\n * Typed data providers (EC-167, vision AD-9). External data is a developer\n * concern expressed exactly like a component: a provider is a plain function\n * plus a manifest (id, title, description, output schema, optional params)\n * registered in code. Editors never see providers as anything technical — the\n * Content tab offers them next to CMS collections, labeled by their\n * plain-language titles, and provider results resolve through the unchanged\n * `@elytracms/core/data-binding` engine.\n *\n * Registration mirrors how component manifests register: project code defines\n * providers and registers them in-process here. In a host repository the same\n * definitions would be extracted into synced manifests (the EC-147 component\n * manifest sync path) with the function itself executed behind the\n * project-owned adapter — an honest gap today: this playground registry IS the\n * project code, so \"sync\" is a direct import.\n *\n * Bridging into the engine: a provider is addressed as a `convex`-kind data\n * source whose `functionRef` is `provider:<id>` — a provider is exactly a\n * typed server function, and the engine's source vocabulary already models\n * that. Resolution, sampling, inference, tokens, and broken-binding issues all\n * apply unchanged. (See NOTES: the engine could gain a first-class `provider`\n * source kind as a purely additive change.)\n */\n\n/** A scalar an editor can put into a provider param control. */\nexport type ProviderParamValue = string | number | boolean\n\n/** One choice of a `choice`-kind param. */\nexport interface ProviderParamChoice {\n value: string\n label: string\n}\n\n/**\n * A provider param, surfaced to editors as one plain control (no syntax, no\n * JSON): `choice` renders a select over {@link choices}; the scalar kinds\n * render a matching input.\n */\nexport interface ProviderParamSpec {\n name: string\n /** Plain-language control label, e.g. \"Department\". */\n label: string\n kind: 'text' | 'number' | 'boolean' | 'choice'\n /** For `choice` params: the closed set of offered values. */\n choices?: ProviderParamChoice[]\n defaultValue: ProviderParamValue\n}\n\n/** Arguments a provider runs with (param name → value). */\nexport type ProviderArgs = Record<string, JsonValue>\n\n/** The manifest half of a provider — everything the builder surfaces. */\nexport interface DataProviderManifest {\n /** Stable provider id, e.g. `pricing-plans`. */\n id: string\n /** Plain-language title editors pick, e.g. \"Pricing plans\". */\n title: string\n description: string\n /** Zod schema of the payload; every run is validated against it. */\n output: z.ZodType<JsonValue>\n params?: ProviderParamSpec[]\n}\n\n/** A data provider: a typed function plus its manifest. */\nexport interface DataProvider {\n manifest: DataProviderManifest\n /** Produce the payload. Deterministic here; a host repo may make this async behind its adapter. */\n fetch: (args: ProviderArgs) => JsonValue\n}\n\n/**\n * Define a provider with the output type checked against the schema — the\n * provider-side mirror of `defineDataSourceAdapter` (EC-132) and component\n * `ComponentManifest` definitions.\n */\nexport function defineDataProvider<T extends JsonValue>(provider: {\n manifest: Omit<DataProviderManifest, 'output'> & { output: z.ZodType<T> }\n fetch: (args: ProviderArgs) => T\n}): DataProvider {\n return provider as DataProvider\n}\n\n// ---------------------------------------------------------------------------\n// Registration (mirrors the component-registry contract)\n// ---------------------------------------------------------------------------\n\n/** A structured registration issue — duplicates are reported, never thrown. */\nexport interface ProviderRegistrationIssue {\n code: 'duplicate' | 'invalid-id'\n message: string\n ref: string\n}\n\nconst PROVIDER_ID_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * Registry of data providers keyed by id. First registration wins; duplicates\n * and malformed ids are recorded as structured issues (component-registry\n * semantics).\n */\nexport class DataProviderRegistry {\n private readonly byId = new Map<string, DataProvider>()\n readonly issues: ProviderRegistrationIssue[] = []\n\n constructor(providers: Iterable<DataProvider> = []) {\n for (const provider of providers) this.register(provider)\n }\n\n register(provider: DataProvider): void {\n const id = provider.manifest.id\n if (!PROVIDER_ID_PATTERN.test(id)) {\n this.issues.push({\n code: 'invalid-id',\n ref: id,\n message: `Provider id \"${id}\" must be lower-case and dash-separated (e.g. \"pricing-plans\").`,\n })\n return\n }\n if (this.byId.has(id)) {\n this.issues.push({\n code: 'duplicate',\n ref: id,\n message: `Duplicate provider id \"${id}\" — keeping the first registration.`,\n })\n return\n }\n this.byId.set(id, provider)\n }\n\n get(id: string): DataProvider | undefined {\n return this.byId.get(id)\n }\n\n list(): DataProvider[] {\n return [...this.byId.values()]\n }\n\n get size(): number {\n return this.byId.size\n }\n}\n\n// ---------------------------------------------------------------------------\n// Running a provider (never throws, never crashes a surface)\n// ---------------------------------------------------------------------------\n\n/** The outcome of one provider run: a validated payload or a plain-language issue. */\nexport type ProviderRun =\n | { ok: true; value: JsonValue }\n | { ok: false; message: string }\n\n/** Default args of a provider (its params' declared defaults). */\nexport function defaultProviderArgs(manifest: DataProviderManifest): ProviderArgs {\n return Object.fromEntries((manifest.params ?? []).map((p) => [p.name, p.defaultValue]))\n}\n\n/**\n * Run a provider and validate the result against its output schema. A thrown\n * error or a schema mismatch comes back as a plain-language issue — the\n * binding layer renders a visible fallback, never a crash.\n */\nexport function runProvider(provider: DataProvider, args?: ProviderArgs): ProviderRun {\n const title = provider.manifest.title\n let raw: JsonValue\n try {\n raw = provider.fetch(args ?? defaultProviderArgs(provider.manifest))\n } catch {\n return {\n ok: false,\n message: `“${title}” couldn't load right now — the project code reported a problem. Anything showing it stays empty until it's fixed.`,\n }\n }\n const parsed = provider.manifest.output.safeParse(raw)\n if (!parsed.success) {\n return {\n ok: false,\n message: `“${title}” returned data in an unexpected shape, so it can't be shown. The project code and its declared output no longer agree.`,\n }\n }\n return { ok: true, value: parsed.data }\n}\n\n// ---------------------------------------------------------------------------\n// Bridging providers into the binding engine's source vocabulary\n// ---------------------------------------------------------------------------\n\n/** Shared project-wide provider sources: `provider.<providerId>`. */\nexport const PROVIDER_SOURCE_PREFIX = 'provider.'\n\n/** The functionRef namespace marking a source as provider-backed. */\nconst PROVIDER_FUNCTION_PREFIX = 'provider:'\n\nexport function providerSourceIdFor(providerId: string): string {\n return `${PROVIDER_SOURCE_PREFIX}${providerId}`\n}\n\n/** The provider a source is backed by, or undefined for non-provider sources. */\nexport function providerIdOfSource(source: DataSource | undefined): string | undefined {\n if (source === undefined || source.kind !== 'convex') return undefined\n const ref = source.config.functionRef\n return ref.startsWith(PROVIDER_FUNCTION_PREFIX)\n ? ref.slice(PROVIDER_FUNCTION_PREFIX.length)\n : undefined\n}\n\n/**\n * The engine-shaped source addressing a provider. `args` carry the editor's\n * param choices; `id` defaults to the shared project-wide source.\n */\nexport function providerSourceFor(\n provider: DataProvider,\n args?: ProviderArgs,\n id?: string,\n label?: string,\n): ConvexSource {\n return {\n kind: 'convex',\n id: id ?? providerSourceIdFor(provider.manifest.id),\n label: label ?? provider.manifest.title,\n config: {\n operation: 'query',\n functionRef: `${PROVIDER_FUNCTION_PREFIX}${provider.manifest.id}`,\n args: args ?? defaultProviderArgs(provider.manifest),\n },\n }\n}\n\n// ---------------------------------------------------------------------------\n// The project's registered providers (project-owned, code-first)\n// ---------------------------------------------------------------------------\n\nconst pricingPlanSchema = z.object({\n id: z.string(),\n name: z.string(),\n monthlyPrice: z.number(),\n summary: z.string(),\n featured: z.boolean(),\n})\n\n/** Example provider: a static, code-owned pricing table (think Stripe prices). */\nexport const pricingPlansProvider = defineDataProvider({\n manifest: {\n id: 'pricing-plans',\n title: 'Pricing plans',\n description: 'The pricing tiers exactly as the billing code defines them.',\n output: z.array(pricingPlanSchema),\n },\n fetch: () => [\n {\n id: 'starter',\n name: 'Starter',\n monthlyPrice: 19,\n summary: 'For solo builders shipping their first site.',\n featured: false,\n },\n {\n id: 'studio',\n name: 'Studio',\n monthlyPrice: 49,\n summary: 'For teams that publish every week.',\n featured: true,\n },\n {\n id: 'enterprise',\n name: 'Enterprise',\n monthlyPrice: 199,\n summary: 'For organizations with compliance needs.',\n featured: false,\n },\n ],\n})\n\nconst jobListingSchema = z.object({\n id: z.string(),\n title: z.string(),\n department: z.string(),\n location: z.string(),\n remote: z.boolean(),\n})\n\nconst JOB_LISTINGS = [\n {\n id: 'job-fe',\n title: 'Frontend Engineer',\n department: 'Engineering',\n location: 'Berlin',\n remote: true,\n },\n {\n id: 'job-be',\n title: 'Backend Engineer',\n department: 'Engineering',\n location: 'Amsterdam',\n remote: true,\n },\n {\n id: 'job-pd',\n title: 'Product Designer',\n department: 'Design',\n location: 'Berlin',\n remote: false,\n },\n {\n id: 'job-cm',\n title: 'Content Marketer',\n department: 'Marketing',\n location: 'Remote',\n remote: true,\n },\n] as const\n\n/** Example provider with a param: job listings filterable by department. */\nexport const jobListingsProvider = defineDataProvider({\n manifest: {\n id: 'job-listings',\n title: 'Job listings',\n description: 'Open roles from the hiring system, optionally narrowed to one department.',\n output: z.array(jobListingSchema),\n params: [\n {\n name: 'department',\n label: 'Department',\n kind: 'choice',\n choices: [\n { value: 'all', label: 'All departments' },\n { value: 'Engineering', label: 'Engineering' },\n { value: 'Design', label: 'Design' },\n { value: 'Marketing', label: 'Marketing' },\n ],\n defaultValue: 'all',\n },\n ],\n },\n fetch: ({ department }) =>\n typeof department === 'string' && department !== 'all'\n ? JOB_LISTINGS.filter((job) => job.department === department)\n : [...JOB_LISTINGS],\n})\n\n/**\n * The project's provider registry. In a deployed studio this hydrates from\n * synced provider manifests (the component-manifest sync path); in the\n * playground the project code registers directly.\n */\nexport const projectDataProviders = new DataProviderRegistry([\n pricingPlansProvider,\n jobListingsProvider,\n])\n\nexport function listDataProviders(): DataProvider[] {\n return projectDataProviders.list()\n}\n\nexport function getDataProvider(id: string): DataProvider | undefined {\n return projectDataProviders.get(id)\n}\n\n/**\n * The payload a provider-backed source serves, or `null` when the provider is\n * unregistered or failing — a `null` sample makes every binding against it a\n * visible plain-language issue instead of a crash.\n */\nexport function providerPayload(providerId: string, args?: ProviderArgs): JsonValue {\n const provider = getDataProvider(providerId)\n if (provider === undefined) return null\n const run = runProvider(provider, args)\n return run.ok ? run.value : null\n}\n\n/** A provider's canonical sample (its default-args run), or undefined when failing. */\nexport function providerSample(provider: DataProvider): JsonValue | undefined {\n const run = runProvider(provider)\n return run.ok ? run.value : undefined\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sample-capture.js","sourceRoot":"","sources":["../../../src/lib/data/sample-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAI5D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEjE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAkB;IACpD,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC/F,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,iBAAiB,CAAC,MAAM,CAAC,MAAwB,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAyB;IAC9D,MAAM,MAAM,GAAe;QACzB,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,OAAO,UAAU,CAAC,EAAE,EAAE;QAC1B,KAAK,EAAE,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,EAAE,EAAE,YAAY,EAAE,UAAU,CAAC,EA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AA;IAC7E,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;QAC5E,OAAQ,MAAM,CAAC,QAAiC,IAAI,IAAI,CAAA;IAC1D,CAAC;IACD,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;IACrF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAE,MAAM,CAAC,SAAkC,CAAC,CAAC,CAAC,EAAE,CAAA;AACpE,CAAC","sourcesContent":["import { captureSample } from '@elytracms/core/data-binding'\nimport type { DataSource } from '@elytracms/core/data-binding'\nimport type { JsonValue } from '@elytracms/core/project-graph'\nimport type { CollectionDef } from '@elytracms/core/cms-core'\nimport { humanizeName } from '../utils'\nimport { listQueryOfConfig } from '../bindings/section-bindings'\nimport type { QueryCmsConfig } from '../bindings/section-bindings'\nimport {\n getCollectionDocument,\n hasContentSession,\n playgroundCollection,\n runCollectionListQuery,\n} from './collection-content'\nimport { providerIdOfSource, providerPayload } from './providers'\n\n/**\n * Data-source sample capture (EC-083/EC-166/EC-167). The hosted builder is\n * separate from the site it exports: actually performing a REST fetch / external\n * query happens behind the project-owned adapters in the deployed site, NOT here.\n * So the studio captures a sample ONLY when it can do so honestly — it never\n * fabricates data (Oli, 2026-06-19; cf. backend-mode's \"never silently swap in\n * in-memory storage\", and the v1 \"static props, bindings parked\" direction):\n *\n * - a provider-backed source runs its registered provider (real project code);\n * - a CMS source replays its stored query over the live content session (Convex\n * mode — EC-177 gap 1), so section/template previews show what delivery serves;\n * - anything else — an external source with no in-studio data path — returns\n * `undefined`. The source then carries no sample, and the binding UI shows an\n * honest \"no sample yet\" state instead of inventing rows that aren't there.\n */\nexport function captureSourceSample(source: DataSource): JsonValue | undefined {\n const providerId = providerIdOfSource(source)\n if (providerId !== undefined) {\n return providerPayload(providerId, source.kind === 'convex' ? source.config.args : undefined)\n }\n if (source.kind === 'cms') {\n return cmsDeliverySample(source.config as QueryCmsConfig)\n }\n return undefined\n}\n\n/**\n * A live CMS data source for one config-driven collection (EC-192). The binding\n * and condition pickers enumerate `data.sources`; deriving one source per\n * configured content collection — the same set the CMS uses\n * (`resolveDeploymentCollections`) — means what an editor can bind matches what\n * actually exists. The sample is captured by replaying the collection's list\n * query through the canonical content engine, so when a content session is\n * configured (Convex mode) the inferred field tokens are the collection's real\n * fields; with no session the source is listed but carries no sample.\n */\nexport function cmsSourceForCollection(collection: CollectionDef): DataSource {\n const source: DataSource = {\n kind: 'cms',\n id: `cms.${collection.id}`,\n label: humanizeName(collection.id),\n config: { collectionId: collection.id, filter: {}, limit: 20 },\n }\n const sample = captureSourceSample(source)\n return sample !== undefined ? captureSample(source, sample) : source\n}\n\n/**\n * Replay a CMS source's stored query over the configured content session, in\n * delivery shape (EC-166). Returns `undefined` when no session serves the\n * collection (playground / no backend) — the caller then leaves the source\n * sample-less rather than fabricating one. A query the engine rejects — or one\n * matching nothing — yields an empty list / `null`, never a crash.\n */\nfunction cmsDeliverySample(config: QueryCmsConfig): JsonValue | undefined {\n if (!hasContentSession()) return undefined\n if (playgroundCollection(config.collectionId) === undefined) return undefined\n if (config.documentId !== undefined) {\n const result = getCollectionDocument(config.collectionId, config.documentId)\n return (result.document as unknown as JsonValue) ?? null\n }\n const result = runCollectionListQuery(config.collectionId, listQueryOfConfig(config))\n return result.ok ? (result.documents as unknown as JsonValue) : []\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sources-store.js","sourceRoot":"","sources":["../../../src/lib/data/sources-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAK/D;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAA;AAEzD,+EAA+E;AAC/E,MA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B,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;IACxE,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,OAAO,CAAA;IAC/B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/C,SAAS;QACT,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC;KACnC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,UAA4B,EAC5B,SAAiB,EACjB,QAAgB;IAEhB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/C,SAAS;QACT,GAAG,EAAE,EAAE,UAAU,EAAE,uBAAuB,EAAE,EAAE,EAAE,QAAQ,EAAE;KAC3D,CAAC,CAAA;IACF,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAC1F,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;AAC5D,CAAC","sourcesContent":["import { dataSourceSchema } from '@elytracms/core/data-binding'\nimport type { DataSource } from '@elytracms/core/data-binding'\nimport type { CmsDocument, CollectionDef } from '@elytracms/core/cms-core'\nimport type { OperationResult, OperationsClient } from '../operations'\n\n/**\n * Data-source persistence for the Builder's data layer (LIVE-mode gap fix).\n *\n * EC-166/EC-167 made the builder provision per-section (`cms.section.<nodeId>`)\n * and per-template (`cms.template.<pageId>`) CMS sources, but only as session\n * state — the live delivery chain (`convex/delivery.ts` →\n * `apps/example-site/lib/live-content.ts`) had nothing to carry. Following the\n * EC-170 routing-store / EC-169 views-store pattern, sources persist as\n * documents in ONE system collection, one document per source, and every\n * mutation goes through the *existing* `@elytracms/core/operations` commands\n * (`schema.upsertCollection`, `documents.upsert`, `documents.delete`) — no new\n * operations surface, no direct repository access.\n *\n * The record round-trips the FULL canonical `DataSource` shape (including the\n * captured `sample` + inferred `schema` envelope and the cms config's `sort`):\n * `@elytracms/core/data-binding`'s `dataSourceSchema` is the source of truth, applied\n * on both write and read, so a malformed stored record is dropped on load —\n * never a crash, never a half-parsed source.\n */\n\nexport const DATA_SOURCES_COLLECTION = 'cms-data-sources'\n\n/** System collection holding one document per persisted {@link DataSource}. */\nexport const dataSourcesCollectionDef: CollectionDef = {\n id: DATA_SOURCES_COLLECTION,\n kind: 'document',\n titleField: 'label',\n form: {\n label: 'Data sources',\n labelSingular: 'Data source',\n description: \"System collection managed by the Builder's data layer.\",\n },\n fields: [\n { name: 'label', type: 'text', validation: { required: true } },\n /** The source kind (`rest` | `cms` | `convex`), denormalized for table views. */\n { name: 'kind', type: 'text', validation: { required: true } },\n /** The FULL canonical DataSource, JSON-serialized (validated by Zod on read). */\n { name: 'config', type: 'text', validation: { required: true } },\n ],\n}\n\n// ---- Source ⇄ document mapping ----\n\nexport function sourceToDocument(source: DataSource): CmsDocument {\n const parsed = dataSourceSchema.parse(source)\n return {\n collection: DATA_SOURCES_COLLECTION,\n id: parsed.id,\n values: {\n label: parsed.label,\n kind: parsed.kind,\n config: JSON.stringify(parsed),\n },\n }\n}\n\nexport function documentToSource(document: CmsDocument): DataSource | undefined {\n const raw = document.values.config\n let value: unknown\n try {\n value = typeof raw === 'string' ? JSON.parse(raw) : undefined\n } catch {\n return undefined\n }\n const parsed = dataSourceSchema.safeParse(value)\n if (!parsed.success) return undefined\n // The document id is the source id — a record whose payload disagrees with\n // its own key is malformed and never loads.\n return parsed.data.id === document.id ? parsed.data : undefined\n}\n\n// ---- Reads & writes through @elytracms/operations ----\n\n/** Load every persisted data source of a project (malformed records dropped). */\nexport async function loadDataSources(\n operations: OperationsClient,\n projectId: string,\n): Promise<OperationResult<DataSource[]>> {\n const result = await operations.documents.list({\n projectId,\n collection: DATA_SOURCES_COLLECTION,\n })\n if (!result.ok) return result\n return {\n ok: true,\n value: result.value\n .map((record) => documentToSource(record.document))\n .filter((source): source is DataSource => source !== undefined),\n }\n}\n\n/**\n * Make sure the system collection exists in the project's CMS schema so\n * `documents.upsert` accepts source documents. Idempotent.\n */\nexport async function ensureDataSourcesCollection(\n _operations: OperationsClient,\n _projectId: string,\n): Promise<OperationResult<void>> {\n // No-op (EC-183, AD-11): the data-sources system collection is config-owned and\n // the backend stores documents without a schema-membership check — nothing to\n // register. `dataSourcesCollectionDef` remains the canonical document shape.\n return { ok: true, value: undefined }\n}\n\n/** Create or update a persisted data source (operations command). */\nexport async function saveDataSource(\n operations: OperationsClient,\n projectId: string,\n source: DataSource,\n): Promise<OperationResult<void>> {\n const ensured = await ensureDataSourcesCollection(operations, projectId)\n if (!ensured.ok) return ensured\n const result = await operations.documents.upsert({\n projectId,\n document: sourceToDocument(source),\n })\n return result.ok ? { ok: true, value: undefined } : result\n}\n\n/**\n * Delete a persisted data source. A source that was never persisted (pure\n * session state, e.g. a seed) deletes as a no-op — `not-found` is success\n * here, since the goal state (\"no persisted record\") already holds.\n */\nexport async function deleteDataSource(\n operations: OperationsClient,\n projectId: string,\n sourceId: string,\n): Promise<OperationResult<void>> {\n const result = await operations.documents.delete({\n projectId,\n ref: { collection: DATA_SOURCES_COLLECTION, id: sourceId },\n })\n if (!result.ok && result.error.code === 'not-found') return { ok: true, value: undefined }\n return result.ok ? { ok: true, value: undefined } : result\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"instant-publish.js","sourceRoot":"","sources":["../../../src/lib/delivery/instant-publish.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,sFAAsF;AACtF,MAAM,CA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AA;AAC7F,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,0BAA0B,CAAC,MAA4B;IACrE,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAA;AACvD,CAAC","sourcesContent":["/**\n * EC-268: instant-publish (EC-146) configuration health, studio-side. The Convex\n * `delivery:deliveryConfig` query reports whether each delivery env var is set\n * (booleans only — never the values); these helpers turn that into the list the\n * health banner shows. Kept pure + React-free so it is unit-testable and reusable\n * (a future `elytra doctor`, EC-259, can format the same status).\n */\n\nexport interface DeliveryConfigStatus {\n /** `CANVAS_PROJECT_SCOPE` — without it `publishing.publish` never schedules the webhook. */\n projectScope: boolean\n /** `CANVAS_REVALIDATE_ENDPOINT` — the host route the webhook POSTs to. */\n revalidateEndpoint: boolean\n /** `CANVAS_REVALIDATE_SECRET` — shared HMAC secret (= host `REVALIDATE_SECRET`). */\n revalidateSecret: boolean\n}\n\n/** The pipeline env vars, in setup order, paired with the status key each maps to. */\nexport const INSTANT_PUBLISH_VARS = [\n { key: 'projectScope', env: 'CANVAS_PROJECT_SCOPE' },\n { key: 'revalidateEndpoint', env: 'CANVAS_REVALIDATE_ENDPOINT' },\n { key: 'revalidateSecret', env: 'CANVAS_REVALIDATE_SECRET' },\n] as const satisfies ReadonlyArray<{ key: keyof DeliveryConfigStatus; env: string }>\n\n/** The env var names that are NOT set, in setup order (empty = fully configured). */\nexport function missingInstantPublishVars(status: DeliveryConfigStatus): string[] {\n return INSTANT_PUBLISH_VARS.filter((entry) => !status[entry.key]).map((entry) => entry.env)\n}\n\n/** True when every instant-publish env var is set. */\nexport function isInstantPublishConfigured(status: DeliveryConfigStatus): boolean {\n return missingInstantPublishVars(status).length === 0\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"drop-rules.js","sourceRoot":"","sources":["../../../src/lib/dnd/drop-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,kBAAkB,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AO,OAAO,CAAA;IACvC,CAAC;IACD,OAAO,sBAAsB,CAAC,EAAE,KAAK,EAAE,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;AAC1F,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAMtC;IACC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IACvC,IAAI,CAAC,KAAK;QAAE,OAAO,MAAM,CAAA;IACzB,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,KAAK,GAAG,IAAI;YAAE,OAAO,QAAQ,CAAA;QACjC,IAAI,KAAK,GAAG,IAAI;YAAE,OAAO,OAAO,CAAA;QAChC,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;AACzC,CAAC;AAaD,MAAM,UAAU,gBAAgB,CAC9B,UAA0B,EAC1B,QAAsB;IAEtB,IAAI,UAAU,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAA;IACxC,OAAO,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC","sourcesContent":["import {\n DEFAULT_SLOT,\n GRID_COMPONENT_ID,\n OUTLET_SLOT,\n STACK_COMPONENT_ID,\n getNode,\n getParentInfo,\n gridContainerNode,\n isDescendantOf,\n removeNode,\n updateNode,\n} from '@elytracms/core/project-graph'\nimport type { ComponentNode, GridContainerOptions, InsertTarget } from '@elytracms/core/project-graph'\n\n/**\n * Drag & drop eligibility rules (EC-160 + EC-162, vision §3.1) — pure\n * graph-level functions with **no DOM or UI dependencies**. The canvas and the\n * page tree both resolve drops through `resolveDrop`, so the two surfaces can\n * never disagree about what a manifest slot allow-list permits, which children\n * a component accepts, or whether a move would create a cycle.\n *\n * The drop-zone model is position-based: `into` a slot, `before`/`after` a\n * sibling along the parent's flow axis, and the EC-162 gesture positions\n * `left`/`right` — dropping *beside* an element wraps both in a two-column\n * `Grid` container (see `applyWrap`).\n */\n\n// ---------------------------------------------------------------------------\n// Inputs\n// ---------------------------------------------------------------------------\n\n/**\n * The manifest slice the rules evaluate. Structural (not the full\n * `ComponentManifest`) so tests and future callers can feed minimal lookups.\n */\nexport interface SlotRule {\n name: string\n /** Restrict which component ids may be inserted (omit to allow any). */\n allow?: string[]\n}\n\nexport interface ManifestRules {\n slots: SlotRule[]\n}\n\n/** Resolve a component id to its manifest slot rules (undefined = unknown component). */\nexport type ManifestLookup = (componentId: string) => ManifestRules | undefined\n\n/** What is being dragged. */\nexport type DragSubject =\n /** An existing node of the current page — a completed drop is a `move`. */\n | { kind: 'node'; nodeId: string; componentId: string }\n /** A new subtree (blocks-panel tile) — a completed drop is an `insert`. */\n | { kind: 'component'; componentId: string }\n\n/**\n * Where, relative to a reference node, the drop would land. `into`, `before`\n * and `after` are the EC-160 positions; `left`/`right` are the EC-162 gesture\n * positions — \"beside\" the reference, wrapping both elements in a two-column\n * `Grid` container.\n */\nexport type DropPosition = 'into' | 'before' | 'after' | 'left' | 'right'\n\n/** The side of the reference an EC-162 wrap gesture drops on. */\nexport type WrapSide = 'left' | 'right'\n\nexport interface DropLocation {\n /** The reference node id (the hovered node/row). */\n nodeId: string\n position: DropPosition\n}\n\n// ---------------------------------------------------------------------------\n// Outcomes\n// ---------------------------------------------------------------------------\n\nexport type DropRejectionCode =\n /** The reference node does not exist in the tree. */\n | 'missing-target'\n /** `into` on a component that declares no insertable slot. */\n | 'no-slot'\n /** The target slot's manifest allow-list rejects the dragged component. */\n | 'not-allowed'\n /** Moving a node into itself or its own subtree (cycle). */\n | 'own-subtree'\n /** The page root cannot be moved, and nothing can drop beside it. */\n | 'root'\n /** Structurally valid but changes nothing (dropping a node onto its own position). */\n | 'no-op'\n\nexport interface DropRejection {\n eligible: false\n code: DropRejectionCode\n reason: string\n}\n\n/** An eligible drop: exactly one builder action (move, insert, or wrap) commits it. */\nexport type DropPlan =\n | { eligible: true; kind: 'move'; nodeId: string; target: InsertTarget }\n | { eligible: true; kind: 'insert'; target: InsertTarget }\n /**\n * EC-162 wrap gesture: the reference node and the dragged subject become the\n * two columns of a new `Grid` container, created atomically (`applyWrap`).\n * `nodeId` is present when the subject is an existing node (a move-wrap);\n * absent for blocks-panel components (an insert-wrap via `buildNode`).\n */\n | { eligible: true; kind: 'wrap'; referenceId: string; side: WrapSide; nodeId?: string }\n\nexport type DropResolution = DropPlan | DropRejection\n\nfunction rejected(code: DropRejectionCode, reason: string): DropRejection {\n return { eligible: false, code, reason }\n}\n\n// ---------------------------------------------------------------------------\n// Slot rules\n// ---------------------------------------------------------------------------\n\n/**\n * The slot an `into` drop inserts into: the default `children` slot when\n * declared, else the first authored slot that is not the layout `outlet`.\n * Mirrors the shell's insert-context resolution so click-insert and\n * drag-insert land in the same place.\n */\nexport function primaryInsertSlot(manifest: ManifestRules | undefined): SlotRule | undefined {\n if (!manifest) return undefined\n return (\n manifest.slots.find((s) => s.name === DEFAULT_SLOT) ??\n manifest.slots.find((s) => s.name !== OUTLET_SLOT)\n )\n}\n\n/** True when a component can receive `into` drops at all (declares an insertable slot). */\nexport function canNestInto(getManifest: ManifestLookup, componentId: string): boolean {\n return primaryInsertSlot(getManifest(componentId)) !== undefined\n}\n\n/** True when a slot's allow-list (if any) permits the component id. */\nexport function slotAllows(slot: SlotRule | undefined, componentId: string): boolean {\n if (!slot?.allow) return true\n return slot.allow.includes(componentId)\n}\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve a prospective drop into either an executable plan (one `move` or\n * `insert` builder action → one operations command → one undo step) or a\n * structured rejection the UI shows *during* the drag. Pure: same inputs,\n * same answer, on both surfaces.\n */\nexport function resolveDrop(args: {\n root: ComponentNode\n getManifest: ManifestLookup\n subject: DragSubject\n location: DropLocation\n}): DropResolution {\n const { root, getManifest, subject, location } = args\n\n if (subject.kind === 'node' && subject.nodeId === root.id) {\n return rejected('root', 'The page root cannot be moved.')\n }\n\n const reference = getNode(root, location.nodeId)\n if (!reference) {\n return rejected('missing-target', `Node \"${location.nodeId}\" is not on this page.`)\n }\n\n // EC-162: dropping beside the reference wraps both in a two-column Grid.\n if (location.position === 'left' || location.position === 'right') {\n return resolveWrap({ root, getManifest, subject, reference, side: location.position })\n }\n\n // Resolve the concrete insertion point: parent node, slot, index.\n let parentId: string\n let slotRule: SlotRule | undefined\n let slotName: string\n let index: number\n\n if (location.position === 'into') {\n const manifest = getManifest(reference.componentId)\n const slot = primaryInsertSlot(manifest)\n if (!slot) {\n return rejected('no-slot', `\"${reference.componentId}\" does not accept children.`)\n }\n parentId = reference.id\n slotRule = slot\n slotName = slot.name\n index = (reference.slots?.[slot.name] ?? []).length\n } else {\n const info = getParentInfo(root, reference.id)\n if (!info) {\n return rejected('root', 'Nothing can be dropped beside the page root.')\n }\n parentId = info.parent.id\n slotName = info.slot\n // Unknown parent manifests impose no allow-list; validation owns that issue.\n slotRule = getManifest(info.parent.componentId)?.slots.find((s) => s.name === info.slot)\n index = info.index + (location.position === 'after' ? 1 : 0)\n }\n\n if (!slotAllows(slotRule, subject.componentId)) {\n return rejected(\n 'not-allowed',\n `Slot \"${slotName}\" does not allow \"${subject.componentId}\".`,\n )\n }\n\n const target: InsertTarget = { parentId, slot: slotName, index }\n\n if (subject.kind === 'component') {\n return { eligible: true, kind: 'insert', target }\n }\n\n // Cycle prevention: a node can never land inside its own subtree.\n if (subject.nodeId === parentId || isDescendantOf(root, subject.nodeId, parentId)) {\n return rejected('own-subtree', 'A node cannot be dropped into its own subtree.')\n }\n\n // No-op detection: the final position (after same-slot removal compensation,\n // matching `moveNode`) equals the node's current position.\n const current = getParentInfo(root, subject.nodeId)\n if (current && current.parent.id === parentId && current.slot === slotName) {\n const finalIndex = index > current.index ? index - 1 : index\n if (finalIndex === current.index) {\n return rejected('no-op', 'Dropping here would not move the node.')\n }\n }\n\n return { eligible: true, kind: 'move', nodeId: subject.nodeId, target }\n}\n\n// ---------------------------------------------------------------------------\n// Wrap gesture (EC-162): drop beside → two-column Grid container\n// ---------------------------------------------------------------------------\n\n/**\n * The container a \"drop beside\" gesture creates. Canonical choice (EC-161\n * semantics): a `Grid` with two columns, **not** a horizontal `Stack` —\n * EC-161 gives `Grid` the canonical column vocabulary (`columns` is a\n * validated graph value the contextual inspector refines from 2 → n), while\n * a horizontal Stack expresses flow order, not column tracks. The values\n * mirror the Grid manifest defaults (`columns: 2`, `gap: '4'`), so the\n * gesture's graph is exactly what composing the same layout manually would\n * produce.\n */\nexport const WRAP_GRID_OPTIONS: GridContainerOptions = { columns: 2, gap: '4' }\n\n/** Eligibility for a `left`/`right` (wrap-beside) drop. */\nfunction resolveWrap(args: {\n root: ComponentNode\n getManifest: ManifestLookup\n subject: DragSubject\n reference: ComponentNode\n side: WrapSide\n}): DropResolution {\n const { root, getManifest, subject, reference, side } = args\n\n // The Grid takes the reference's place in its parent slot — so the\n // reference needs a parent (the root is the page anchor, never wrapped)\n // and that slot's allow-list must accept a Grid.\n const info = getParentInfo(root, reference.id)\n if (!info) {\n return rejected('root', 'The page root cannot be wrapped in a container.')\n }\n const parentSlotRule = getManifest(info.parent.componentId)?.slots.find(\n (s) => s.name === info.slot,\n )\n if (!slotAllows(parentSlotRule, GRID_COMPONENT_ID)) {\n return rejected('not-allowed', `Slot \"${info.slot}\" does not allow a Grid container.`)\n }\n\n // Both columns land in the Grid's children slot.\n const gridSlot = primaryInsertSlot(getManifest(GRID_COMPONENT_ID))\n for (const componentId of [reference.componentId, subject.componentId]) {\n if (!slotAllows(gridSlot, componentId)) {\n return rejected('not-allowed', `A Grid container does not allow \"${componentId}\".`)\n }\n }\n\n if (subject.kind === 'component') {\n return { eligible: true, kind: 'wrap', referenceId: reference.id, side }\n }\n if (subject.nodeId === reference.id) {\n return rejected('no-op', 'A node cannot be placed beside itself.')\n }\n // The reference must not live inside the dragged subtree (the subject is\n // lifted out first — taking the reference with it would orphan the wrap).\n if (isDescendantOf(root, subject.nodeId, reference.id)) {\n return rejected('own-subtree', 'A node cannot wrap an element of its own subtree.')\n }\n return { eligible: true, kind: 'wrap', referenceId: reference.id, side, nodeId: subject.nodeId }\n}\n\n/** What lands beside the reference: an existing node (moved) or a built subtree (inserted). */\nexport type WrapPartner =\n | { kind: 'node'; nodeId: string }\n | { kind: 'subtree'; node: ComponentNode }\n\nexport interface WrapResult {\n root: ComponentNode\n /** The id of the created Grid container. */\n containerId: string\n}\n\n/**\n * Execute a wrap plan as **one** structural edit: lift the partner out of the\n * tree (when it is an existing node) and replace the reference with\n * `gridContainerNode(containerId, WRAP_GRID_OPTIONS, [left, right])` in a\n * single pass. The caller commits the result as one builder action → one\n * operations command → one undo step; EC-161 normalization then runs on the\n * *committed* tree, so the two-child container can never be observed (or\n * persisted) in a half-built state. Returns `null` for structurally invalid\n * input (missing nodes, root reference, reference inside the partner).\n *\n * Determinism (EC-162): the produced container subtree is exactly the\n * `gridContainerNode` constructor output — identical to manual composition.\n */\nexport function applyWrap(args: {\n root: ComponentNode\n referenceId: string\n side: WrapSide\n partner: WrapPartner\n containerId: string\n}): WrapResult | null {\n const { root, referenceId, side, partner, containerId } = args\n if (referenceId === root.id || !getNode(root, referenceId)) return null\n\n let working = root\n let partnerNode: ComponentNode\n if (partner.kind === 'node') {\n if (partner.nodeId === referenceId || partner.nodeId === root.id) return null\n const node = getNode(root, partner.nodeId)\n if (!node || isDescendantOf(root, partner.nodeId, referenceId)) return null\n partnerNode = node\n working = removeNode(root, partner.nodeId)\n } else {\n partnerNode = partner.node\n }\n\n const next = updateNode(working, referenceId, (reference) =>\n gridContainerNode(\n containerId,\n WRAP_GRID_OPTIONS,\n side === 'left' ? [partnerNode, reference] : [reference, partnerNode],\n ),\n )\n return { root: next, containerId }\n}\n\n// ---------------------------------------------------------------------------\n// Pointer → position bands (shared hit-testing model)\n// ---------------------------------------------------------------------------\n\n/** The axis along which a container lays out its children. */\nexport type FlowAxis = 'vertical' | 'horizontal'\n\nfunction staticPropValue(node: ComponentNode, name: string): unknown {\n const prop = node.props?.[name]\n return prop?.kind === 'static' ? prop.value : undefined\n}\n\n/**\n * The flow axis of a container — the axis its children stack along, and\n * therefore the hit-band axis for drops over those children (EC-162 ledger\n * fix: bands follow the parent's flow direction, on both surfaces). Mirrors\n * the renderer: a horizontal Stack flows horizontally; a Grid flows\n * horizontally when it actually has ≥ 2 column tracks (an absent/invalid\n * `columns` renders one column). Everything else is block flow (vertical).\n */\nexport function containerFlowAxis(node: ComponentNode | undefined): FlowAxis {\n if (!node) return 'vertical'\n if (node.componentId === STACK_COMPONENT_ID) {\n return staticPropValue(node, 'direction') === 'horizontal' ? 'horizontal' : 'vertical'\n }\n if (node.componentId === GRID_COMPONENT_ID) {\n const columns = staticPropValue(node, 'columns')\n return typeof columns === 'number' && columns >= 2 ? 'horizontal' : 'vertical'\n }\n return 'vertical'\n}\n\n/** Cross-axis side-band width (fraction of the box) that triggers the wrap gesture. */\nconst WRAP_BAND = 0.18\n\n/**\n * Map a 2D pointer offset within a drop target's box onto a `DropPosition`\n * (EC-162). `flow` is the flow axis of the target's *parent* — before/after\n * bands run along it. On vertically flowing targets, narrow side bands on the\n * cross axis produce `left`/`right` (the wrap-into-columns gesture, when\n * `wrappable`); children of horizontal containers get left/right bands for\n * plain reorder instead, so \"beside\" already means before/after there.\n */\nexport function dropPositionForPoint(args: {\n /** Pointer offset across the target's width, 0..1. */\n x: number\n /** Pointer offset across the target's height, 0..1. */\n y: number\n /** Flow axis of the target's parent (the axis siblings stack along). */\n flow: FlowAxis\n nestable: boolean\n edges: boolean\n /** Enable the wrap side-bands (the gesture surface opts in). */\n wrappable?: boolean\n}): DropPosition {\n const { x, y, flow, nestable, edges, wrappable = false } = args\n if (!edges) return 'into'\n if (wrappable && flow === 'vertical') {\n if (x < WRAP_BAND) return 'left'\n if (x > 1 - WRAP_BAND) return 'right'\n }\n return dropPositionForPointer({ ratio: flow === 'horizontal' ? x : y, nestable, edges })\n}\n\n/**\n * Map a pointer offset within a drop target's box onto a `DropPosition`.\n * `ratio` is the pointer's offset along the target's main axis, 0..1 — the\n * caller picks the axis (the parent's flow axis; see `containerFlowAxis`).\n *\n * - nestable targets with siblings: edge quarters insert before/after, the\n * middle half nests into the slot\n * - leaf targets: top/bottom halves insert before/after\n * - targets without siblings (the root): always `into`\n */\nexport function dropPositionForPointer(args: {\n ratio: number\n /** Whether `into` is structurally possible (target declares an insert slot). */\n nestable: boolean\n /** Whether before/after exist (target has a parent slot). */\n edges: boolean\n}): DropPosition {\n const { ratio, nestable, edges } = args\n if (!edges) return 'into'\n if (nestable) {\n if (ratio < 0.25) return 'before'\n if (ratio > 0.75) return 'after'\n return 'into'\n }\n return ratio < 0.5 ? 'before' : 'after'\n}\n\n// ---------------------------------------------------------------------------\n// Indicator state (shared visual contract)\n// ---------------------------------------------------------------------------\n\n/**\n * The visual state a surface shows for the current resolution. `blocked` is\n * the explicit rejection state (never a silent failed drop); `null` means show\n * nothing (a no-op drop is inert, not an error).\n */\nexport type DropIndicator = DropPosition | 'blocked' | null\n\nexport function dropIndicatorFor(\n resolution: DropResolution,\n position: DropPosition,\n): DropIndicator {\n if (resolution.eligible) return position\n return resolution.code === 'no-op' ? null : 'blocked'\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gap-drag.js","sourceRoot":"","sources":["../../../src/lib/dnd/gap-drag.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,+BAA+B,CAAA;AAiBtC,mFAAmF;AACnF,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,IAAI,EAAE,GAAG,mBAAmB,CAAC,CAAA;AAE3E,iFAAiF;AACjF,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAA;AAE5B,8DAA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Gap,\n} from '@elytracms/core/project-graph'\nimport type { ComponentNode, SpacingTokenName } from '@elytracms/core/project-graph'\nimport type { FlowAxis } from './drop-rules'\n\n/**\n * Tokenized gap-drag math (EC-163, vision §3.1 / AD-10) — pure functions with\n * no DOM dependencies, shared by the canvas spacing handles. The drag model is\n * deliberately token-quantized: a pointer delta moves the gap through the\n * EC-161 spacing-token *steps*, and the only values that can ever be produced\n * are a `SpacingTokenName` or `null` (\"no gap\" — the prop is removed, exactly\n * what the layout inspector's \"None\" choice does). No freeform pixel value can\n * leave this module, so none can enter the graph from the canvas.\n */\n\n/** A gap step the drag can land on: a spacing token, or `null` for \"no gap\". */\nexport type GapStep = SpacingTokenName | null\n\n/** The full drag range, smallest to largest: none, then the EC-161 token scale. */\nexport const GAP_STEPS: readonly GapStep[] = [null, ...SPACING_TOKEN_NAMES]\n\n/** Canvas root font size — the deterministic rem basis for token CSS lengths. */\nexport const GAP_REM_PX = 16\n\n/** The pixel length of a gap step at the canvas rem basis. */\nexport function gapStepPx(step: GapStep): number {\n if (step === null) return 0\n const css = SPACING_TOKEN_CSS[step]\n const value = Number.parseFloat(css)\n return css.endsWith('rem') ? value * GAP_REM_PX : value\n}\n\n/** The CSS length a previewed step renders with (the same length the renderer emits). */\nexport function gapStepCss(step: GapStep): string {\n return step === null ? '0px' : SPACING_TOKEN_CSS[step]\n}\n\n/** Snap a raw pixel gap onto the nearest step of the token scale. */\nexport function nearestGapStep(px: number): GapStep {\n let best: GapStep = null\n let bestDistance = Number.POSITIVE_INFINITY\n for (const step of GAP_STEPS) {\n const distance = Math.abs(gapStepPx(step) - px)\n if (distance < bestDistance) {\n bestDistance = distance\n best = step\n }\n }\n return best\n}\n\n/**\n * The step a drag lands on: the starting step's pixel length plus the pointer\n * delta along the container's flow axis, snapped to the scale. Monotonic and\n * deterministic — the same delta from the same start always lands on the same\n * token.\n */\nexport function gapStepFromDrag(start: GapStep, deltaPx: number): GapStep {\n return nearestGapStep(gapStepPx(start) + deltaPx)\n}\n\n/**\n * The current gap step of a container node: a token name verbatim, a legacy\n * on-scale integer mapped to its token, anything else (absent, off-scale,\n * bound) as `null` — mirroring how the layout inspector reads the same prop,\n * so handle and inspector always start from the same value.\n */\nexport function containerGapStep(node: ComponentNode): GapStep {\n const prop = node.props?.['gap']\n if (prop?.kind !== 'static') return null\n if (typeof prop.value === 'string' && isSpacingTokenName(prop.value)) return prop.value\n if (typeof prop.value === 'number') {\n const token = spacingTokenFromLegacyGap(prop.value)\n if (token) return token\n }\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Handle geometry — where the between-children handles sit\n// ---------------------------------------------------------------------------\n\n/** A minimal rectangle (client or document coordinates — caller's choice). */\nexport interface GapRect {\n left: number\n top: number\n width: number\n height: number\n}\n\n/**\n * One draggable spot between two adjacent children. `x`/`y` is the gap's\n * center point; `crossStart`/`crossLength` span the children's shared extent\n * on the cross axis (the handle's visible length).\n */\nexport interface GapHandleSpot {\n /** Index of the leading child of the pair. */\n index: number\n x: number\n y: number\n crossStart: number\n crossLength: number\n}\n\n/**\n * The handle spots between consecutive child rects along the container's flow\n * axis. Pairs that wrap (grid rows: the next rect starts before the previous\n * ends along the axis) or that do not overlap on the cross axis yield no\n * handle — handles only ever sit in real gaps between visual neighbours.\n * Works at gap 0 too: the handle sits on the shared boundary so a closed gap\n * can be dragged open.\n */\nexport function gapHandleSpots(rects: readonly GapRect[], axis: FlowAxis): GapHandleSpot[] {\n const spots: GapHandleSpot[] = []\n for (let i = 0; i < rects.length - 1; i += 1) {\n const a = rects[i]!\n const b = rects[i + 1]!\n const aEnd = axis === 'horizontal' ? a.left + a.width : a.top + a.height\n const bStart = axis === 'horizontal' ? b.left : b.top\n // Wrapped to the next row/column: not visual neighbours along the axis.\n // A small tolerance keeps sub-pixel layout from dropping legitimate pairs.\n if (bStart < aEnd - 0.5) continue\n const crossStart = axis === 'horizontal' ? Math.max(a.top, b.top) : Math.max(a.left, b.left)\n const crossEnd =\n axis === 'horizontal'\n ? Math.min(a.top + a.height, b.top + b.height)\n : Math.min(a.left + a.width, b.left + b.width)\n if (crossEnd <= crossStart) continue\n const mid = (aEnd + bStart) / 2\n spots.push({\n index: i,\n x: axis === 'horizontal' ? mid : crossStart + (crossEnd - crossStart) / 2,\n y: axis === 'horizontal' ? crossStart + (crossEnd - crossStart) / 2 : mid,\n crossStart,\n crossLength: crossEnd - crossStart,\n })\n }\n return spots\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"binding-fallback.js","sourceRoot":"","sources":["../../../src/lib/locale/binding-fallback.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAsB1F,SAAS,WAAW,CAAC,MAAkB;IACrC,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,CAAA;AAC9B,CAAC;AAED,4EAA4E;AAC5E,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;AAC1E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAyB,EACzB,MAA8B,EAC9B,MAAc;IAEd,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAA;IAC7D,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,IAAI,CAAA;IAE5E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAwB,CAAA;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E,OAAO,IAAI,CAAA;QACpC,UAAU,GAAG,KAAK,CAAC,EAAE,CAAA;IACvB,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IAC/E,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAA;IAC9E,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACvC,OAAO;QACL,KAAK;QACL,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,eAAe,EAAE,QAAQ,CAAC,eAAe;KAC1C,CAAA;AACH,CAAC","sourcesContent":["import type { Locale } from '@elytracms/core/cms-core'\nimport type { BindingReference } from '@elytracms/core/project-graph'\nimport type { CmsSource, DataSource } from '@elytracms/core/data-binding'\nimport { listQueryOfConfig } from '../bindings/section-bindings'\nimport type { QueryCmsConfig } from '../bindings/section-bindings'\nimport { getCollectionDocument, runCollectionListQuery } from '../data/collection-content'\nimport type { DisplayedFallback } from './fallback'\n\n/**\n * Fallback visibility for BOUND content (EC-176): given a stored content\n * binding and its CMS source, decide whether the value the canvas currently\n * previews for the active locale is served via EC-018 locale fallback. Used\n * by the inspector's Content tab — the surface that explains what a bound\n * field shows (the canvas overlay itself is out of this wave's reach; see\n * EC-176 notes).\n *\n * Deterministic over the playground delivery engine: the same\n * `@elytracms/core/content` resolution that produced the previewed value reports\n * which fields fell back (`ResolutionInfo.localeFallbacks`), so the label can\n * never disagree with the displayed value.\n */\n\n/** A previewed bound value that fell back, plus which field it came from. */\nexport interface BoundValueFallback extends DisplayedFallback {\n field: string\n}\n\nfunction isCmsSource(source: DataSource): source is CmsSource {\n return source.kind === 'cms'\n}\n\n/** JSON-pointer-ish token → path segments ('/0/title' → ['0', 'title']). */\nfunction pathOfToken(token: string): string[] {\n return token\n .split('/')\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.replaceAll('~1', '/').replaceAll('~0', '~'))\n}\n\n/**\n * Whether the bound field's previewed value (first entry for list/repeater\n * bindings, the bound document otherwise) is a locale fallback in `locale`.\n * `null` when the binding is not CMS-shaped, points at no field, or the value\n * is a real translation.\n */\nexport function cmsBindingFallback(\n binding: BindingReference,\n source: DataSource | undefined,\n locale: Locale,\n): BoundValueFallback | null {\n if (source === undefined || !isCmsSource(source)) return null\n if (binding.mode !== 'value' && binding.mode !== 'repeaterItem') return null\n\n const config = source.config as QueryCmsConfig\n let path = pathOfToken(binding.token)\n if (path.length === 0) return null\n\n // List-shaped value bindings carry a leading entry index; repeater-item\n // bindings preview the first entry (the same convention as ContentPreview).\n let entryIndex = 0\n const listShaped = config.documentId === undefined\n if (binding.mode === 'value' && listShaped) {\n const head = path[0]!\n if (!/^\\d+$/.test(head)) return null\n entryIndex = Number(head)\n path = path.slice(1)\n }\n const field = path[0]\n if (field === undefined) return null\n\n // Resolve the previewed document's id, then ask the delivery engine which\n // fields fell back for it in the active locale.\n let documentId = config.documentId\n if (documentId === undefined) {\n const list = runCollectionListQuery(config.collectionId, listQueryOfConfig(config), locale)\n if (!list.ok) return null\n const entry = list.documents[entryIndex]\n if (entry === undefined) return null\n documentId = entry.id\n }\n\n const { info } = getCollectionDocument(config.collectionId, documentId, locale)\n if (info === null) return null\n const fellBack = info.localeFallbacks.find((entry) => entry.path[0] === field)\n if (fellBack === undefined) return null\n return {\n field,\n sourceLocale: fellBack.sourceLocale,\n requestedLocale: fellBack.requestedLocale,\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../src/lib/locale/fallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAA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I,CAAA;IACnE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAyB,EACzB,GAAgB,EAChB,SAAiB,EACjB,MAAc,EACd,MAAoB;IAEpB,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK;QACrE,QAAQ,EAAE,sBAAsB,CAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC;KAC7E,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAyB,EACzB,GAAgB,EAChB,SAAiB,EACjB,MAAc,EACd,MAAoB;IAEpB,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1D,IAAI,MAAM,KAAK,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAC/D,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;AAClD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,MAAM,CAAC,WAAW,EAAE,CAAA;AAC7B,CAAC","sourcesContent":["import { documentDefaultLocale, isFieldLocalized, resolveField } from '@elytracms/core/cms-core'\nimport type { CmsDocument, CollectionDef, Locale, LocaleConfig } from '@elytracms/core/cms-core'\n\n/**\n * Fallback visibility (EC-176) — the pure \"is this displayed value a\n * fallback?\" decision the CMS table cells, detail-editor fields, and the\n * builder's Content tab all share. One function answers it, so a value is\n * either labeled everywhere or a real translation everywhere — never\n * silently mixed.\n */\n\n/** A displayed value that came from the fallback locale, not the active one. */\nexport interface DisplayedFallback {\n /** The locale the rendered value was actually read from. */\n sourceLocale: Locale\n /** The locale the surface asked for (the ambient active locale). */\n requestedLocale: Locale\n}\n\n/** True when the document stores an explicit variant of `field` for `locale`. */\nexport function hasLocaleVariant(doc: CmsDocument, fieldName: string, locale: Locale): boolean {\n const bag = doc.localized?.[locale]\n return bag !== undefined && fieldName in bag\n}\n\n/**\n * Whether the value a surface displays for `field` in `locale` is served via\n * EC-018 default-locale fallback. `null` means \"not a fallback\": the field is\n * not localized (locale-independent by design), the active locale has its own\n * variant, or there is nothing to display at all (an empty field is empty,\n * not a fallback).\n */\nexport function displayedFieldFallback(\n collection: CollectionDef,\n doc: CmsDocument,\n fieldName: string,\n locale: Locale,\n config: LocaleConfig,\n): DisplayedFallback | null {\n if (!isFieldLocalized(collection, fieldName)) return null\n if (hasLocaleVariant(doc, fieldName, locale)) return null\n const resolved = resolveField(collection, doc, fieldName, locale, config)\n if (!resolved.fellBack || resolved.value === undefined) return null\n return { sourceLocale: resolved.sourceLocale, requestedLocale: locale }\n}\n\n/**\n * The value a surface should display for `field` in `locale` (explicit\n * variant, else fallback) together with its fallback marker. Display and\n * label come from the same resolution, so they can never disagree.\n */\nexport function resolveDisplayedValue(\n collection: CollectionDef,\n doc: CmsDocument,\n fieldName: string,\n locale: Locale,\n config: LocaleConfig,\n): { value: unknown; fallback: DisplayedFallback | null } {\n return {\n value: resolveField(collection, doc, fieldName, locale, config).value,\n fallback: displayedFieldFallback(collection, doc, fieldName, locale, config),\n }\n}\n\n/**\n * True when editing `field` in `locale` would CREATE a new localized variant\n * (rather than update an existing one): the field is localized and the active\n * locale isn't the document's fallback source and has no variant yet. Drives\n * the \"translating from EN\" affordance on editors.\n */\nexport function editCreatesVariant(\n collection: CollectionDef,\n doc: CmsDocument,\n fieldName: string,\n locale: Locale,\n config: LocaleConfig,\n): boolean {\n if (!isFieldLocalized(collection, fieldName)) return false\n if (locale === documentDefaultLocale(doc, config)) return false\n return !hasLocaleVariant(doc, fieldName, locale)\n}\n\n/** Compact display form of a locale code for chips/badges (\"en\" → \"EN\"). */\nexport function localeChipLabel(locale: Locale): string {\n return locale.toUpperCase()\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/locale/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/locale/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA","sourcesContent":["export * from './locale-store'\nexport * from './fallback'\nexport * from './route-variant'\nexport * from './binding-fallback'\nexport * from './use-studio-locale'\nexport * from './locale-switcher'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"locale-store.js","sourceRoot":"","sources":["../../../src/lib/locale/locale-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAsBhG,IAAI,KAAK,GAAsB;IAC7B,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,kBAAkB,CAAC,OAAO;CACnC,CAAA;AAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,SAAS,IAAI;IACX,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,QAAQ,EAAE,CAAA;AAC9C,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,oBAAoB;IAClC,OAAO,KAAK,CAAA;AACd,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,CAAC,MAAM,C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A;AACR,CAAC","sourcesContent":["import { createLocaleConfig, isKnownLocale, sampleLocaleConfig } from '@elytracms/core/cms-core'\nimport type { Locale, LocaleConfig } from '@elytracms/core/cms-core'\n\n/**\n * The studio's ambient locale (EC-176) — framework-free core.\n *\n * One studio-level active locale, set once via the locale switcher, that the\n * builder canvas preview, the CMS table, and the detail editor all follow.\n * Module-level (not React context) on purpose: the playground's content\n * client (`lib/data/collection-content`) reads it at query time without any\n * provider plumbing, and React surfaces subscribe through\n * `useStudioLocale` (`useSyncExternalStore`).\n *\n * Deliberately NOT part of `lib/data/data-store` — the locale is studio\n * state, not a data source.\n */\n\ninterface StudioLocaleState {\n readonly config: LocaleConfig\n readonly active: Locale\n}\n\nlet state: StudioLocaleState = {\n config: sampleLocaleConfig,\n active: sampleLocaleConfig.default,\n}\n\nconst listeners = new Set<() => void>()\n\nfunction emit(): void {\n for (const listener of listeners) listener()\n}\n\n/** Snapshot of `{ config, active }` — stable identity until the next change. */\nexport function getStudioLocaleState(): StudioLocaleState {\n return state\n}\n\n/** The active studio locale every surface renders in. */\nexport function getStudioLocale(): Locale {\n return state.active\n}\n\n/** The project locale config driving the switcher options. */\nexport function getStudioLocaleConfig(): LocaleConfig {\n return state.config\n}\n\n/**\n * Switch the ambient locale. Unknown locales are ignored (the switcher only\n * offers configured ones; programmatic callers get a no-op, never a crash).\n */\nexport function setStudioLocale(locale: Locale): void {\n if (locale === state.active || !isKnownLocale(state.config, locale)) return\n state = { ...state, active: locale }\n emit()\n}\n\n/**\n * Install the project's locale config (e.g. when a CMS session or builder\n * shell mounts with a starter kit's locales). The active locale is kept when\n * it is still configured, otherwise it snaps back to the new default.\n */\nexport function configureStudioLocales(config: LocaleConfig): void {\n const normalized = createLocaleConfig({ default: config.default, locales: config.locales })\n const sameConfig =\n normalized.default === state.config.default &&\n normalized.locales.length === state.config.locales.length &&\n normalized.locales.every((locale, i) => locale === state.config.locales[i])\n const active = isKnownLocale(normalized, state.active) ? state.active : normalized.default\n if (sameConfig && active === state.active) return\n state = { config: normalized, active }\n emit()\n}\n\n/** Subscribe to locale/config changes. Returns the unsubscribe function. */\nexport function subscribeStudioLocale(listener: () => void): () => void {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n}\n\n/** Reset to the sample defaults (tests only — module state is shared). */\nexport function resetStudioLocale(): void {\n state = { config: sampleLocaleConfig, active: sampleLocaleConfig.default }\n emit()\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"locale-switcher.js","sourceRoot":"","sources":["../../../src/lib/locale/locale-switcher.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAA0B;IAClE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAA;IACvD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAE3C,OAAO,CACL,eACE,IAAI,EAAC,OAAO,gBACD,eAAe,iBACd,iBAAiB,EAC7B,SAAS,EAAE,EAAE,CAAC,sDAAsD,EAAE,SAAS,CAAC,aAEhF,KAAC,KAAK,yBAAa,SAAS,EAAC,iDAAiD,GAAG,EAChF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7B,MAAM,SAAS,GAAG,MAAM,KAAK,MAAM,CAAC,OAAO,CAAA;gBAC3C,OAAO,CACL,kBAEE,IAAI,EAAC,QAAQ,kBACC,MAAM,KAAK,MAAM,EAC/B,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,mBAA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,OAAO,CAAA;gBAC3C,OAAO,CACL,kBAEE,IAAI,EAAC,QAAQ,kBACC,MAAM,KAAK,MAAM,EAC/B,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,iBAC7E,iBAAiB,MAAM,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAChC,SAAS,EAAE,EAAE,CACX,2EAA2E,EAC3E,MAAM,KAAK,MAAM;wBACf,CAAC,CAAC,yCAAyC;wBAC3C,CAAC,CAAC,6CAA6C,CAClD,aAEA,MAAM,EACN,SAAS,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,iCAAiC,uBAAS,CAAC,CAAC,CAAC,IAAI,KAdzE,MAAM,CAeJ,CACV,CAAA;YACH,CAAC,CAAC,IACE,CACP,CAAA;AACH,CAAC","sourcesContent":["import { Globe } from 'lucide-react'\nimport { cn } from '../utils'\nimport { localeChipLabel } from './fallback'\nimport { useStudioLocale } from './use-studio-locale'\n\n/**\n * The ambient locale switcher (EC-176): one segmented control, mounted in the\n * builder toolbar and the CMS surface header, both driving the same\n * studio-level active locale. Options come from the project locale config;\n * the default locale is marked. Renders nothing for single-locale projects —\n * no per-control locale ceremony anywhere else.\n */\nexport function LocaleSwitcher({ className }: { className?: string }) {\n const { locale, config, setLocale } = useStudioLocale()\n if (config.locales.length <= 1) return null\n\n return (\n <div\n role=\"group\"\n aria-label=\"Active locale\"\n data-testid=\"locale-switcher\"\n className={cn('flex items-center gap-1 rounded-md bg-muted/50 p-0.5', className)}\n >\n <Globe aria-hidden className=\"ml-1 size-3.5 self-center text-muted-foreground\" />\n {config.locales.map((option) => {\n const isDefault = option === config.default\n return (\n <button\n key={option}\n type=\"button\"\n aria-pressed={option === locale}\n title={isDefault ? `${localeChipLabel(option)} (default locale)` : localeChipLabel(option)}\n data-testid={`locale-option-${option}`}\n onClick={() => setLocale(option)}\n className={cn(\n 'rounded-[5px] px-2 py-0.5 text-xs font-medium uppercase transition-colors',\n option === locale\n ? 'bg-background text-foreground shadow-sm'\n : 'text-muted-foreground hover:text-foreground',\n )}\n >\n {option}\n {isDefault ? <span className=\"ml-0.5 text-muted-foreground/70\">·</span> : null}\n </button>\n )\n })}\n </div>\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"route-variant.js","sourceRoot":"","sources":["../../../src/lib/locale/route-variant.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,kBAAkB,CAChC,MAA8B,EAC9B,MAAc,EACd,aAAqB;IAErB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;IAC3D,IAAI,GAAG;QAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAA;IACnE,IAAI,QAAQ;QAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,aAAa,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAA;IACpF,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9D,CAAC"}
1
+ {"version":3,"file":"route-variant.js","sourceRoot":"","sources":["../../../src/lib/locale/route-variant.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,kBAAkB,CAChC,MAA8B,EAC9B,MAAc,EACd,aAAqB;IAErB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;IAC3D,IAAI,GAAG;QAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAA;IACnE,IAAI,QAAQ;QAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,aAAa,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAA;IACpF,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9D,CAAC","sourcesContent":["import type { Locale, RouteRecord } from '@elytracms/core/cms-core'\n\n/**\n * Per-locale URL preview (EC-176 over EC-170's per-locale routes): given the\n * route records serving one page/template, pick the variant the active locale\n * is actually served by — the locale's own route, else a locale-agnostic\n * route, else the default locale's route *marked as a fallback* (the page has\n * no address of its own in the active locale yet).\n */\n\nexport interface LocaleRouteVariant {\n route: RouteRecord\n /** True when the active locale has no own/agnostic route — the URL shown is the default locale's. */\n fellBack: boolean\n}\n\nexport function localeRouteVariant(\n routes: readonly RouteRecord[],\n locale: Locale,\n defaultLocale: Locale,\n): LocaleRouteVariant | null {\n const own = routes.find((route) => route.locale === locale)\n if (own) return { route: own, fellBack: false }\n const agnostic = routes.find((route) => route.locale === undefined)\n if (agnostic) return { route: agnostic, fellBack: false }\n const fallback = routes.find((route) => route.locale === defaultLocale) ?? routes[0]\n return fallback ? { route: fallback, fellBack: true } : null\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-studio-locale.js","sourceRoot":"","sources":["../../../src/lib/locale/use-studio-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAE5C,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAUvB,yEAAyE;AACzE,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,oBAAoB,CAChC,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,CACrB,CAAA;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;AACnF,CAAC"}
1
+ {"version":3,"file":"use-studio-locale.js","sourceRoot":"","sources":["../../../src/lib/locale/use-studio-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAE5C,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAUvB,yEAAyE;AACzE,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,oBAAoB,CAChC,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,CACrB,CAAA;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;AACnF,CAAC","sourcesContent":["import { useSyncExternalStore } from 'react'\nimport type { Locale, LocaleConfig } from '@elytracms/core/cms-core'\nimport {\n getStudioLocaleState,\n setStudioLocale,\n subscribeStudioLocale,\n} from './locale-store'\n\nexport interface StudioLocale {\n /** The ambient active locale every studio surface renders in. */\n locale: Locale\n /** The project locale config driving the switcher options. */\n config: LocaleConfig\n setLocale: (locale: Locale) => void\n}\n\n/** Subscribe a React surface to the studio's ambient locale (EC-176). */\nexport function useStudioLocale(): StudioLocale {\n const state = useSyncExternalStore(\n subscribeStudioLocale,\n getStudioLocaleState,\n getStudioLocaleState,\n )\n return { locale: state.active, config: state.config, setLocale: setStudioLocale }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"asset-repository.js","sourceRoot":"","sources":["../../../src/lib/operations/asset-repository.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAA4B;IACpE,OAAO;QACL,KAAK,CAAC,WAAW,CAAC,GAAW,EAAE,KAAoB;YACjD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAC/E,IAAI,CAAC,MAAM,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACrD,OAAO,MAAM,CAAC,KAAK,CAAA;QACrB,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,GAAW,EAAE,EAAU;YACvC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;YAC9E,IAAI,CAAC,MAAM,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACvD,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,EAAU;YACpC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;YAC3E,IAAI,CAAC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GAAG,CAAC,CAAA;YAC3B,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACpF,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import type { AssetRecord, AssetRepository, NewAssetInput } from '@elytracms/core/persistence'\nimport type { OperationsClient } from './operations-package'\n\n/**\n * `AssetRepository` facade over the operations layer (EC-141). The asset\n * flows (upload confirm, reference-respecting delete — EC-151) are written\n * against the repository interface; this facade keeps those flows intact\n * while routing every metadata *write* through `assets.*` commands (validate →\n * authorize → mutate → event) and serving reads through `assets.*` queries.\n * Blob bytes stay on `adapter.blobs` — transport, not domain.\n *\n * Operation failures are re-thrown as errors carrying the structured message;\n * the asset flows already convert thrown failures into their structured\n * results (`UploadResult` / `DeleteAssetResult`), which the UI renders.\n */\nexport function operationsAssetRepository(operations: OperationsClient): AssetRepository {\n return {\n async upsertAsset(pid: string, input: NewAssetInput): Promise<AssetRecord> {\n const result = await operations.assets.upsert({ projectId: pid, asset: input })\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n },\n async removeAsset(pid: string, id: string): Promise<void> {\n const result = await operations.assets.remove({ projectId: pid, assetId: id })\n if (!result.ok) throw new Error(result.error.message)\n },\n async getAsset(pid: string, id: string): Promise<AssetRecord> {\n const result = await operations.assets.get({ projectId: pid, assetId: id })\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n },\n async findAsset(pid: string, id: string): Promise<AssetRecord | undefined> {\n const result = await operations.assets.get({ projectId: pid, assetId: id })\n if (!result.ok) {\n if (result.error.code === 'not-found') return undefined\n throw new Error(result.error.message)\n }\n return result.value\n },\n async listAssets(pid: string): Promise<AssetRecord[]> {\n const result = await operations.assets.list({ projectId: pid })\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n },\n async resolveMany(pid: string, ids: readonly string[]): Promise<Map<string, AssetRecord>> {\n const result = await operations.assets.list({ projectId: pid })\n if (!result.ok) throw new Error(result.error.message)\n const wanted = new Set(ids)\n return new Map(result.value.filter((a) => wanted.has(a.id)).map((a) => [a.id, a]))\n },\n }\n}\n"]}
@@ -14,8 +14,13 @@ import type { OperationError, OperationsClient } from './operations-package';
14
14
  export interface CmsPersister {
15
15
  upsertDocument(doc: CmsDocument): void;
16
16
  deleteDocument(ref: DocumentRef): void;
17
- /** Publish (EC-224): snapshot the current draft as a new version and pin it live. */
18
- publishDocument(ref: DocumentRef): void;
17
+ /**
18
+ * Publish (EC-224): snapshot the current draft as a new version and pin it live.
19
+ * EC-273: an optional `snapshot` pins that exact document instead (the studio
20
+ * passes the draft with conditionally-hidden values stripped); the draft row is
21
+ * untouched.
22
+ */
23
+ publishDocument(ref: DocumentRef, snapshot?: CmsDocument): void;
19
24
  /** Unpublish (EC-224): clear the live version pin + any legacy published marker. */
20
25
  unpublishDocument(ref: DocumentRef): void;
21
26
  upsertCollection(collection: CollectionDef): void;
@@ -68,8 +68,12 @@ export function createCmsPersister(options) {
68
68
  deleteDocument(ref) {
69
69
  command((operations) => operations.documents.delete({ projectId: options.projectId, ref }));
70
70
  },
71
- publishDocument(ref) {
72
- command((operations) => operations.documents.publish({ projectId: options.projectId, ref }));
71
+ publishDocument(ref, snapshot) {
72
+ command((operations) => operations.documents.publish({
73
+ projectId: options.projectId,
74
+ ref,
75
+ ...(snapshot ? { snapshot: selfType(snapshot) } : {}),
76
+ }));
73
77
  },
74
78
  unpublishDocument(ref) {
75
79
  command((operations) => operations.documents.unpublish({ projectId: options.projectId, ref }));
@@ -1 +1 @@
1
- {"version":3,"file":"cms-persistence.js","sourceRoot":"","sources":["../../../src/lib/operations/cms-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,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ieldLookup,\n} from '@elytracms/core/cms-core'\nimport type { OperationError, OperationResult, OperationsClient } from './operations-package'\nimport { createPersistQueue } from './persist-queue'\n\n/**\n * CMS session → operations persistence (EC-141). The CMS store keeps documents\n * and collections as optimistic session state (synchronous editing, validation\n * feedback while typing); every mutation is mirrored onto the operations layer\n * through `documents.*` / `schema.*` commands in dispatch order.\n *\n * Baseline: the persisted seed only covers the sample project. Before the\n * first mirrored command, the persister ensures the project has a persisted\n * schema + documents matching the session's starting state (kit imports,\n * sample fixtures), so deletes/updates address records that exist.\n */\nexport interface CmsPersister {\n upsertDocument(doc: CmsDocument): void\n deleteDocument(ref: DocumentRef): void\n /**\n * Publish (EC-224): snapshot the current draft as a new version and pin it live.\n * EC-273: an optional `snapshot` pins that exact document instead (the studio\n * passes the draft with conditionally-hidden values stripped); the draft row is\n * untouched.\n */\n publishDocument(ref: DocumentRef, snapshot?: CmsDocument): void\n /** Unpublish (EC-224): clear the live version pin + any legacy published marker. */\n unpublishDocument(ref: DocumentRef): void\n upsertCollection(collection: CollectionDef): void\n /** Run the baseline seed now (e.g. before applying an AI changeset). */\n ensureBaseline(): Promise<void>\n /** Await every queued command. */\n flush(): Promise<void>\n}\n\nexport interface CmsPersisterOptions {\n projectId: string\n getOperations: () => Promise<OperationsClient>\n /** Session collections/documents at baseline time (read lazily via refs). */\n getCollections: () => readonly CollectionDef[]\n getDocuments: () => readonly CmsDocument[]\n /**\n * Component-prop field-defs by component id (EC-277): the manifest half of the\n * write-time self-typing lens, so a composition's static relation/asset props are\n * self-typed too (\"schema leads, component adopts\"). Omit → document fields are\n * still self-typed; composition static props pass through.\n */\n lookupManifest?: PropFieldLookup\n onError: (error: OperationError) => void\n}\n\nexport function createCmsPersister(options: CmsPersisterOptions): CmsPersister {\n const queue = createPersistQueue()\n let baselineDone = false\n\n /**\n * EC-277: self-type a document through the schema-as-lens (+ the manifest for\n * composition static props) before it is persisted — the single write-time\n * wrapping point, so everything at rest self-describes and derivation stays\n * schema-free. Drift-tolerant: an undeclared collection passes through unchanged.\n */\n function selfType(doc: CmsDocument): CmsDocument {\n const collection = options.getCollections().find((c) => c.id === doc.collection)\n if (!collection) return doc\n return selfTypeDocument(\n doc,\n collection,\n options.lookupManifest ? { lookupManifest: options.lookupManifest } : {},\n )\n }\n\n async function ensureBaselineNow(): Promise<boolean> {\n if (baselineDone) return true\n const operations = await options.getOperations()\n const schema = await operations.schema.get({ projectId: options.projectId })\n if (schema.ok) {\n // A persisted schema exists (seeded sample project or an earlier\n // session) — the session started from the same fixtures, so commands\n // can apply directly.\n baselineDone = true\n return true\n }\n const saved = await operations.schema.save({\n projectId: options.projectId,\n collections: [...options.getCollections()],\n })\n if (!saved.ok) {\n options.onError(saved.error)\n return false\n }\n for (const document of options.getDocuments()) {\n const result = await operations.documents.upsert({\n projectId: options.projectId,\n document: selfType(document),\n })\n if (!result.ok) {\n options.onError(result.error)\n return false\n }\n }\n baselineDone = true\n return true\n }\n\n function command(run: (operations: OperationsClient) => Promise<OperationResult<unknown>>): void {\n queue.push(async () => {\n // A failed baseline already surfaced through onError — running the\n // command against missing records would only add a confusing follow-up.\n if (!(await ensureBaselineNow())) return\n const operations = await options.getOperations()\n const result = await run(operations)\n if (!result.ok) options.onError(result.error)\n })\n }\n\n return {\n upsertDocument(doc) {\n const document = selfType(doc)\n command((operations) =>\n operations.documents.upsert({ projectId: options.projectId, document }),\n )\n },\n deleteDocument(ref) {\n command((operations) => operations.documents.delete({ projectId: options.projectId, ref }))\n },\n publishDocument(ref, snapshot) {\n command((operations) =>\n operations.documents.publish({\n projectId: options.projectId,\n ref,\n ...(snapshot ? { snapshot: selfType(snapshot) } : {}),\n }),\n )\n },\n unpublishDocument(ref) {\n command((operations) =>\n operations.documents.unpublish({ projectId: options.projectId, ref }),\n )\n },\n upsertCollection(collection) {\n command((operations) =>\n operations.schema.upsertCollection({ projectId: options.projectId, collection }),\n )\n },\n async ensureBaseline() {\n queue.push(async () => {\n await ensureBaselineNow()\n })\n await queue.flush()\n },\n flush: () => queue.flush(),\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"graph-commands.js","sourceRoot":"","sources":["../../../src/lib/operations/graph-commands.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAoEjD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,MAAqB,EACrB,IAAqB,EACrB,IAA+B;IAE/B,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,CAAA;YAC9C,OAAO;gBACL,SAAS,EAAE,YAAY;gBACvB,KAAK,EAAE;oBACL,SAAS;oBACT,wDAAwD;oBACxD,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;oBACnC,OAAO,EAAE,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;iBAClD;aACF,CAAA;QACH,CAAC;QAED,KAAK,WAAW;YACd,OAAO;gBACL,SAAS,EAAE,YAAY;gBACvB,uEAAuE;gBACvE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE;aACjE,CAAA;QAEH,uEAAuE;QACvE,oEAAoE;QACpE,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,SAAS,CAAC;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,cAAc,CAAC;QACpB,KAAK,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 {"version":3,"file":"graph-commands.js","sourceRoot":"","sources":["../../../src/lib/operations/graph-commands.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAoEjD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,MAAqB,EACrB,IAAqB,EACrB,IAA+B;IAE/B,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,CAAA;YAC9C,OAAO;gBACL,SAAS,EAAE,YAAY;gBACvB,KAAK,EAAE;oBACL,SAAS;oBACT,wDAAwD;oBACxD,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;oBACnC,OAAO,EAAE,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;iBAClD;aACF,CAAA;QACH,CAAC;QAED,KAAK,WAAW;YACd,OAAO;gBACL,SAAS,EAAE,YAAY;gBACvB,uEAAuE;gBACvE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE;aACjE,CAAA;QAEH,uEAAuE;QACvE,oEAAoE;QACpE,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,SAAS,CAAC;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,cAAc,CAAC;QACpB,KAAK,YAAY;YACf,OAAO,IAAI,CAAA;QAEb;YACE,OAAO,IAAI,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ropValue,\n} from '@elytracms/core/project-graph'\nimport { toProjectGraph } from '../working-graph'\nimport type { WorkingGraph, WorkingPageSeo } from '../working-graph'\nimport type { OperationResult, OperationsClient } from './operations-package'\n\n/**\n * Builder action → graph operation mapping (EC-141, reshaped by EC-187).\n *\n * The canonical `ProjectGraph` is now LAYOUTS-ONLY, and the page-node graph\n * commands (`graph.insertNode`/`removeNode`/`duplicateNode`/`moveNode`/\n * `reorderNode`/`setNodeProp`/`removeNodeProp`/`setNodeCondition`) were DELETED\n * from the operations layer — a page is a CMS document now, edited through the\n * composition-field path, not mirrored as node ops. So every page-tree edit\n * here returns `null`: the legacy `/builder` page editor is in-memory-only for\n * page edits (it is retired in a later slice).\n *\n * What still persists: `loadGraph` (restoring a saved revision), `undo`, and\n * `redo` each save the whole graph via `graph.save` — but a `graph.save`\n * persists a CANONICAL layouts-only `ProjectGraph`, so the WorkingGraph\n * `present` is converted via `toProjectGraph` before it is sent.\n */\n\n/** The builder store's action union (owned here so the mapping stays React-free). */\nexport type BuilderAction =\n /** `pageId` additionally switches the active page (reference deep links, EC-172). */\n | { type: 'select'; id: string | null; pageId?: string }\n | { type: 'hover'; id: string | null }\n | { type: 'viewport'; viewport: 'desktop' | 'tablet' | 'mobile' }\n | { type: 'undo' }\n | { type: 'redo' }\n | { type: 'insert'; target: InsertTarget; node: ComponentNode; select?: boolean }\n | { type: 'remove'; id: string }\n | { type: 'duplicate'; id: string }\n | { type: 'reorder'; id: string; delta: -1 | 1 }\n | { type: 'move'; id: string; target: InsertTarget }\n /**\n * EC-162 layout gesture: wrap the reference node and the dragged subject in\n * a two-column Grid container as ONE atomic structural edit (one undo step).\n */\n | {\n type: 'wrap'\n referenceId: string\n side: 'left' | 'right'\n subject: { kind: 'node'; nodeId: string } | { kind: 'component'; node: ComponentNode }\n }\n | { type: 'setProp'; id: string; name: string; value: PropValue; coalesceKey?: string }\n | { type: 'removeProp'; id: string; name: string }\n | { type: 'setCondition'; id: string; condition: Condition | undefined }\n /**\n * EC-171 legacy page SEO (in-memory only): set a working page's `seo` block.\n * Page SEO persists via the `page` CMS document now, never as a node op — so\n * this action does not mirror to a `graph.*` command.\n */\n | { type: 'setPageSeo'; pageId: string; seo: WorkingPageSeo | undefined }\n | { type: 'loadGraph'; graph: ProjectGraph }\n\n/** The slice of builder state the mapping needs (pre-dispatch snapshot). */\nexport interface BuilderSnapshot {\n present: WorkingGraph\n pageId: string\n nodeSeq: number\n}\n\n/** A graph operation invocation, dispatchable via `operations.execute`. */\nexport interface GraphInvocation {\n operation: string\n input: unknown\n}\n\n/**\n * Map a dispatched builder action onto the `graph.*` command that persists it.\n *\n * After EC-187 only the whole-graph operations survive: `loadGraph`/`undo`/\n * `redo` persist a layouts-only `ProjectGraph` via `graph.save`. Every\n * page-tree edit (insert/remove/duplicate/move/reorder/wrap/setProp/\n * removeProp/setCondition) returns `null` — page-node graph commands are gone;\n * those edits stay in-memory until the page is saved as a CMS document.\n */\nexport function graphInvocationFor(\n projectId: string,\n action: BuilderAction,\n prev: BuilderSnapshot,\n next: { present: WorkingGraph },\n): GraphInvocation | null {\n switch (action.type) {\n case 'undo':\n case 'redo': {\n if (prev.present === next.present) return null\n return {\n operation: 'graph.save',\n input: {\n projectId,\n // graph.save persists the canonical layouts-only graph.\n graph: toProjectGraph(next.present),\n message: action.type === 'undo' ? 'Undo' : 'Redo',\n },\n }\n }\n\n case 'loadGraph':\n return {\n operation: 'graph.save',\n // `loadGraph` carries a canonical (layouts-only) ProjectGraph restore.\n input: { projectId, graph: action.graph, message: 'Load graph' },\n }\n\n // Page-tree edits no longer mirror to node-level graph commands (those\n // operations were deleted) — the page editor is in-memory-only now.\n case 'select':\n case 'hover':\n case 'viewport':\n case 'insert':\n case 'remove':\n case 'duplicate':\n case 'reorder':\n case 'move':\n case 'wrap':\n case 'setProp':\n case 'removeProp':\n case 'setCondition':\n case 'setPageSeo':\n return null\n\n default:\n return null\n }\n}\n\n/**\n * Make the persisted latest revision equal `graph` (the session's working\n * graph) so node-level `graph.*` commands apply onto identical state. Saves a\n * baseline revision when the project has no revision yet or the persisted\n * latest diverged from the session (the builder session is the source of\n * truth for the draft timeline — see the builder-store design note).\n */\nexport async function ensureGraphBaseline(\n operations: OperationsClient,\n projectId: string,\n graph: ProjectGraph | WorkingGraph,\n): Promise<OperationResult<unknown>> {\n // A working graph (the live session) is persisted as the canonical\n // layouts-only graph; a canonical graph passes through unchanged.\n const canonical = 'pages' in graph ? toProjectGraph(graph) : graph\n const latest = await operations.graph.getLatest({ projectId })\n if (latest.ok && JSON.stringify(latest.value.graph) === JSON.stringify(canonical)) return latest\n return operations.graph.save({ projectId, graph: canonical, message: 'Builder session baseline' })\n}\n\n/**\n * Persist \"publish the session's latest state\" (EC-141): ensure the working\n * graph is the persisted latest revision (as the canonical layouts-only\n * graph), then pin it live via `publishing.publish`. Single-environment\n * (EC-179): a deployment IS one environment, so there is no target environment\n * and no promote.\n */\nexport async function persistPublish(\n operations: OperationsClient,\n projectId: string,\n workingGraph: ProjectGraph | WorkingGraph,\n): Promise<OperationResult<unknown>> {\n const baseline = await ensureGraphBaseline(operations, projectId, workingGraph)\n if (!baseline.ok) return baseline\n return operations.publishing.publish({ projectId })\n}\n\n/** Persist an unpublish: revert the deployment to draft. */\nexport async function persistUnpublish(\n operations: OperationsClient,\n projectId: string,\n): Promise<OperationResult<unknown>> {\n return operations.publishing.unpublish({ projectId })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"graph-persistence.js","sourceRoot":"","sources":["../../../src/lib/operations/graph-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAI1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAyBpD,MAAM,UAAU,oBAAoB,CAAC,OAA8B;IACjE,MAAM,KAAK,GAAG,kBAAkB,EAAE,CAAA;IAClC,IAAI,aAAa,GAAG,KAAK,CAAA;IAEzB,OAAO;QACL,OAAO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QACJ,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE;KAC3B,CAAA;AACH,CAAC","sourcesContent":["import { ensureGraphBaseline, graphInvocationFor } from './graph-commands'\nimport type { BuilderAction, BuilderSnapshot } from './graph-commands'\nimport type { WorkingGraph } from '../working-graph'\nimport type { OperationError, OperationsClient } from './operations-package'\nimport { createPersistQueue } from './persist-queue'\n\n/**\n * Builder → operations persistence (EC-141). Mirrors every committed builder\n * mutation onto the operations layer as the matching `graph.*` command, in\n * dispatch order, against a guaranteed-identical baseline revision.\n *\n * Failures are *surfaced, never silent, and never block local editing*: a\n * rejected/denied/failed command reaches `onError` (the store renders it) and\n * invalidates the baseline, so the next mutation re-syncs — which re-surfaces\n * a standing denial instead of silently dropping edits.\n */\nexport interface GraphPersister {\n /** Queue the command mirroring a dispatched action (no-op for pure-UI actions). */\n enqueue(action: BuilderAction, prev: BuilderSnapshot, next: { present: WorkingGraph }): void\n /** Await every queued command (test/publish synchronization point). */\n flush(): Promise<void>\n}\n\nexport interface GraphPersisterOptions {\n projectId: string\n getOperations: () => Promise<OperationsClient>\n onError: (error: OperationError) => void\n}\n\nexport function createGraphPersister(options: GraphPersisterOptions): GraphPersister {\n const queue = createPersistQueue()\n let baselineReady = false\n\n return {\n enqueue(action, prev, next) {\n const invocation = graphInvocationFor(options.projectId, action, prev, next)\n if (!invocation) return\n queue.push(async () => {\n const operations = await options.getOperations()\n // graph.save replaces the whole graph, so it *is* a baseline; the\n // node-level commands need the persisted latest to equal the\n // session's pre-edit graph first.\n if (!baselineReady && invocation.operation !== 'graph.save') {\n const baseline = await ensureGraphBaseline(operations, options.projectId, prev.present)\n if (!baseline.ok) {\n options.onError(baseline.error)\n return\n }\n }\n const result = await operations.execute(invocation.operation, invocation.input)\n if (!result.ok) {\n baselineReady = false\n options.onError(result.error)\n return\n }\n baselineReady = true\n })\n },\n flush: () => queue.flush(),\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/operations/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/operations/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA","sourcesContent":["/**\n * Studio operations layer (EC-141). The single seam every studio mutation\n * goes through — see `studio-operations.ts` for the bootstrap and\n * `operations-package.ts` for why the package is bridged by path.\n */\nexport * from './operations-package'\nexport * from './studio-operations'\nexport * from './persist-queue'\nexport * from './graph-commands'\nexport * from './graph-persistence'\nexport * from './cms-persistence'\nexport * from './asset-repository'\nexport * from './session-hydration'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"operations-package.js","sourceRoot":"","sources":["../../../src/lib/operations/operations-package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,4BAA4B,CAAA"}
1
+ {"version":3,"file":"operations-package.js","sourceRoot":"","sources":["../../../src/lib/operations/operations-package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,4BAA4B,CAAA","sourcesContent":["/**\n * Bridge to `@elytracms/core/operations` (EC-141). Every studio import of operations\n * types/functions goes through `lib/operations`, keeping the app's dependency\n * on the layer a single, swappable seam.\n */\nexport * from '@elytracms/core/operations'\n"]}