@elytracms/studio 0.0.37 → 0.0.39
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.
- package/convex/cms.ts +8 -2
- package/dist/components/app-views/default-modules.d.ts +60 -5
- package/dist/components/app-views/default-modules.js +53 -15
- package/dist/components/app-views/default-modules.js.map +1 -1
- package/dist/components/app-views/module.d.ts +2 -0
- package/dist/components/app-views/module.js +8 -0
- package/dist/components/app-views/module.js.map +1 -1
- package/dist/components/assets/asset-detail.d.ts +24 -0
- package/dist/components/assets/asset-detail.js +163 -0
- package/dist/components/assets/asset-detail.js.map +1 -0
- package/dist/components/assets/asset-grid.d.ts +28 -0
- package/dist/components/assets/asset-grid.js +68 -0
- package/dist/components/assets/asset-grid.js.map +1 -0
- package/dist/components/assets/asset-metadata.d.ts +19 -0
- package/dist/components/assets/asset-metadata.js +44 -0
- package/dist/components/assets/asset-metadata.js.map +1 -1
- package/dist/components/assets/assets-collection-view-source.d.ts +54 -0
- package/dist/components/assets/assets-collection-view-source.js +186 -0
- package/dist/components/assets/assets-collection-view-source.js.map +1 -0
- package/dist/components/assets/assets-module.d.ts +18 -0
- package/dist/components/assets/assets-module.js +94 -0
- package/dist/components/assets/assets-module.js.map +1 -0
- package/dist/components/assets/assets-store.js +2 -7
- package/dist/components/assets/assets-store.js.map +1 -1
- package/dist/components/assets/assets-view-preference.d.ts +15 -0
- package/dist/components/assets/assets-view-preference.js +22 -0
- package/dist/components/assets/assets-view-preference.js.map +1 -0
- package/dist/components/builder/builder-store.d.ts +12 -0
- package/dist/components/builder/builder-store.js +18 -16
- package/dist/components/builder/builder-store.js.map +1 -1
- package/dist/components/builder/clipboard-actions.js +5 -14
- package/dist/components/builder/clipboard-actions.js.map +1 -1
- package/dist/components/builder/composition-field-editor-lazy.d.ts +19 -0
- package/dist/components/builder/composition-field-editor-lazy.js +29 -0
- package/dist/components/builder/composition-field-editor-lazy.js.map +1 -0
- package/dist/components/builder/composition-field-editor.js +1 -4
- package/dist/components/builder/composition-field-editor.js.map +1 -1
- package/dist/components/builder/insert-context.d.ts +8 -0
- package/dist/components/builder/insert-context.js +1 -3
- package/dist/components/builder/insert-context.js.map +1 -1
- package/dist/components/builder/page-tree.js +1 -3
- package/dist/components/builder/page-tree.js.map +1 -1
- package/dist/components/builder/property-inspector.js +7 -134
- package/dist/components/builder/property-inspector.js.map +1 -1
- package/dist/components/cms/cms-store.d.ts +15 -4
- package/dist/components/cms/cms-store.js +42 -24
- package/dist/components/cms/cms-store.js.map +1 -1
- package/dist/components/cms/collection-table.d.ts +8 -1
- package/dist/components/cms/collection-table.js +62 -10
- package/dist/components/cms/collection-table.js.map +1 -1
- package/dist/components/cms/column-width.d.ts +25 -0
- package/dist/components/cms/column-width.js +47 -0
- package/dist/components/cms/column-width.js.map +1 -0
- package/dist/components/cms/detail-editor.js +101 -68
- package/dist/components/cms/detail-editor.js.map +1 -1
- package/dist/components/cms/discard-draft.d.ts +32 -0
- package/dist/components/cms/discard-draft.js +13 -0
- package/dist/components/cms/discard-draft.js.map +1 -0
- package/dist/components/cms/document-staging.d.ts +7 -0
- package/dist/components/cms/document-staging.js +44 -0
- package/dist/components/cms/document-staging.js.map +1 -0
- package/dist/components/cms/field-connection.d.ts +22 -0
- package/dist/components/cms/field-connection.js +37 -0
- package/dist/components/cms/field-connection.js.map +1 -0
- package/dist/components/cms/field-control.js +158 -34
- package/dist/components/cms/field-control.js.map +1 -1
- package/dist/components/cms/prop-fields.d.ts +43 -0
- package/dist/components/cms/prop-fields.js +130 -0
- package/dist/components/cms/prop-fields.js.map +1 -0
- package/dist/components/cms/rich-text/component-embed.d.ts +17 -3
- package/dist/components/cms/rich-text/component-embed.js +29 -7
- package/dist/components/cms/rich-text/component-embed.js.map +1 -1
- package/dist/components/cms/rich-text/editor.d.ts +3 -0
- package/dist/components/cms/rich-text/editor.js +21 -3
- package/dist/components/cms/rich-text/editor.js.map +1 -1
- package/dist/components/cms/rich-text/embed-picker.d.ts +17 -0
- package/dist/components/cms/rich-text/embed-picker.js +34 -0
- package/dist/components/cms/rich-text/embed-picker.js.map +1 -0
- package/dist/components/cms/rich-text/embed-props.d.ts +49 -0
- package/dist/components/cms/rich-text/embed-props.js +106 -0
- package/dist/components/cms/rich-text/embed-props.js.map +1 -0
- package/dist/components/cms/rich-text/extensions.d.ts +7 -1
- package/dist/components/cms/rich-text/extensions.js +6 -1
- package/dist/components/cms/rich-text/extensions.js.map +1 -1
- package/dist/components/cms/rich-text/index.d.ts +6 -1
- package/dist/components/cms/rich-text/index.js +6 -1
- package/dist/components/cms/rich-text/index.js.map +1 -1
- package/dist/components/cms/rich-text/insert.d.ts +21 -0
- package/dist/components/cms/rich-text/insert.js +55 -0
- package/dist/components/cms/rich-text/insert.js.map +1 -0
- package/dist/components/cms/rich-text/lazy.d.ts +19 -0
- package/dist/components/cms/rich-text/lazy.js +26 -0
- package/dist/components/cms/rich-text/lazy.js.map +1 -0
- package/dist/components/cms/rich-text/slash-command.d.ts +27 -0
- package/dist/components/cms/rich-text/slash-command.js +158 -0
- package/dist/components/cms/rich-text/slash-command.js.map +1 -0
- package/dist/components/cms/rich-text/toolbar.d.ts +5 -6
- package/dist/components/cms/rich-text/toolbar.js +3 -5
- package/dist/components/cms/rich-text/toolbar.js.map +1 -1
- package/dist/components/cms/row-actions.d.ts +28 -0
- package/dist/components/cms/row-actions.js +20 -0
- package/dist/components/cms/row-actions.js.map +1 -0
- package/dist/components/cms/use-document-versions.d.ts +8 -1
- package/dist/components/cms/use-document-versions.js +31 -4
- package/dist/components/cms/use-document-versions.js.map +1 -1
- package/dist/components/cms/version-compare-lazy.d.ts +1 -0
- package/dist/components/cms/version-compare-lazy.js +23 -0
- package/dist/components/cms/version-compare-lazy.js.map +1 -0
- package/dist/components/cms/version-compare-text.d.ts +46 -0
- package/dist/components/cms/version-compare-text.js +78 -0
- package/dist/components/cms/version-compare-text.js.map +1 -1
- package/dist/components/cms/version-compare.d.ts +9 -5
- package/dist/components/cms/version-compare.js +184 -59
- package/dist/components/cms/version-compare.js.map +1 -1
- package/dist/components/cms/versions-pane.js +10 -4
- package/dist/components/cms/versions-pane.js.map +1 -1
- package/dist/components/components/component-detail.d.ts +5 -3
- package/dist/components/components/component-detail.js +41 -8
- package/dist/components/components/component-detail.js.map +1 -1
- package/dist/components/components/component-preview.d.ts +61 -0
- package/dist/components/components/component-preview.js +103 -0
- package/dist/components/components/component-preview.js.map +1 -0
- package/dist/components/components/components-index.d.ts +5 -3
- package/dist/components/components/components-index.js +19 -24
- package/dist/components/components/components-index.js.map +1 -1
- package/dist/components/components/registry-browser.d.ts +7 -0
- package/dist/components/components/registry-browser.js +20 -36
- package/dist/components/components/registry-browser.js.map +1 -1
- package/dist/components/components/taxonomy.d.ts +51 -0
- package/dist/components/components/taxonomy.js +73 -0
- package/dist/components/components/taxonomy.js.map +1 -0
- package/dist/components/components/transfer-dialog.d.ts +20 -0
- package/dist/components/components/transfer-dialog.js +64 -0
- package/dist/components/components/transfer-dialog.js.map +1 -0
- package/dist/components/components/transfer.d.ts +43 -0
- package/dist/components/components/transfer.js +31 -0
- package/dist/components/components/transfer.js.map +1 -0
- package/dist/components/project-list.js +3 -4
- package/dist/components/project-list.js.map +1 -1
- package/dist/components/project-switcher.js +3 -2
- package/dist/components/project-switcher.js.map +1 -1
- package/dist/components/rail-store-status.d.ts +21 -0
- package/dist/components/rail-store-status.js +21 -0
- package/dist/components/rail-store-status.js.map +1 -0
- package/dist/components/redirects/redirects-module.js +4 -8
- package/dist/components/redirects/redirects-module.js.map +1 -1
- package/dist/components/redirects/redirects-store.js +2 -7
- package/dist/components/redirects/redirects-store.js.map +1 -1
- package/dist/components/sign-in-needed-badge.d.ts +6 -0
- package/dist/components/sign-in-needed-badge.js +13 -0
- package/dist/components/sign-in-needed-badge.js.map +1 -0
- package/dist/components/studio-project-screen.js +1 -4
- package/dist/components/studio-project-screen.js.map +1 -1
- package/dist/components/studio-shell.js +1 -4
- package/dist/components/studio-shell.js.map +1 -1
- package/dist/components/users/users-module.js +5 -7
- package/dist/components/users/users-module.js.map +1 -1
- package/dist/components/users/users-store.js +2 -7
- package/dist/components/users/users-store.js.map +1 -1
- package/dist/lib/auth/index.js +1 -1
- package/dist/lib/auth/index.js.map +1 -1
- package/dist/lib/clipboard/paste-target.js +1 -3
- package/dist/lib/clipboard/paste-target.js.map +1 -1
- package/dist/lib/cms-views/view-model.d.ts +0 -2
- package/dist/lib/cms-views/view-model.js +0 -7
- package/dist/lib/cms-views/view-model.js.map +1 -1
- package/dist/lib/diff-view-preference.d.ts +7 -0
- package/dist/lib/diff-view-preference.js +21 -0
- package/dist/lib/diff-view-preference.js.map +1 -0
- package/dist/lib/i18n/messages.en.js +81 -30
- package/dist/lib/i18n/messages.en.js.map +1 -1
- package/dist/lib/local-preference.d.ts +11 -0
- package/dist/lib/local-preference.js +26 -0
- package/dist/lib/local-preference.js.map +1 -0
- package/dist/lib/locale/fallback.d.ts +45 -0
- package/dist/lib/locale/fallback.js +85 -0
- package/dist/lib/locale/fallback.js.map +1 -1
- package/dist/lib/persona/labels.d.ts +6 -0
- package/dist/lib/persona/labels.js +8 -0
- package/dist/lib/persona/labels.js.map +1 -1
- package/dist/lib/query/index.d.ts +1 -1
- package/dist/lib/query/index.js +1 -1
- package/dist/lib/query/index.js.map +1 -1
- package/dist/lib/query/operations-query.d.ts +14 -2
- package/dist/lib/query/operations-query.js +11 -6
- package/dist/lib/query/operations-query.js.map +1 -1
- package/dist/lib/rail.d.ts +0 -6
- package/dist/lib/rail.js +6 -25
- package/dist/lib/rail.js.map +1 -1
- package/dist/lib/theme.d.ts +0 -6
- package/dist/lib/theme.js +10 -13
- package/dist/lib/theme.js.map +1 -1
- package/dist/router/match.d.ts +1 -0
- package/dist/router/match.js +4 -0
- package/dist/router/match.js.map +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/package.json +22 -24
- package/src/styles/studio.css +17 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-store.js","s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ED,2HAA2H;AAC3H,MAAM,UAAU,eAAe,CAAC,UAAyB,EAAE,MAAe;IACxE,MAAM,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACtD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACvC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,UAAU,CAAC,EAAE,CAAA;IAC9F,OAAO,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;AAC9D,CAAC;AAED,yIAAyI;AACzI,MAAM,UAAU,uBAAuB,CAAC,UAAyB,EAAE,MAAe;IAChF,MAAM,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IAC9D,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACpG,CAAC;IACD,OAAO,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,CAAA;AACtF,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA","sourcesContent":["import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport {\n createCollectionRegistry,\n createDocumentStore,\n documentKey,\n documentSchema,\n resolveDocumentTitle,\n resolveField,\n resolveLabel,\n sampleDocuments,\n seedDefaults,\n sampleFilterableCollections,\n sampleLocaleConfig,\n samplePublishedKeys,\n resolveSingletonDocument,\n titleFieldOf,\n validateDocument,\n} from '@elytracms/core/cms-core'\nimport type {\n BlocksFieldDef,\n CmsDocument,\n CmsValidationIssue,\n CollectionDef,\n CompositionIssue,\n DocumentRef,\n FieldDef,\n Locale,\n LocaleConfig,\n RestoreScope,\n RichTextFieldDef,\n} from '@elytracms/core/cms-core'\nimport { validateCompositionValue } from '@elytracms/core/project-graph'\nimport type { ComponentNode } from '@elytracms/core/project-graph'\nimport { collectComponentEmbeds, parseRichTextValue } from '@elytracms/core/rich-text'\nimport type { DocumentVersionRecord } from '@elytracms/core/persistence'\nimport { localizedLabel, resolveMsgLabel, translate } from '@elytracms/studio/lib/i18n'\nimport { configureStudioLocales, useStudioLocale } from '@elytracms/studio/lib/locale'\nimport { getStudioRegistry, studioManifestLookup } from '@elytracms/studio/lib/registry'\nimport { resolveDeploymentCollections } from '@elytracms/studio/lib/workspace'\nimport { createCmsPersister, getStudioOperations } from '@elytracms/studio/lib/operations'\nimport type {\n CmsPersister,\n OperationError,\n OperationResult,\n} from '@elytracms/studio/lib/operations'\nimport {\n ALL_VIEW_ID,\n canonicalViewState,\n configViewsFor,\n defaultViewState,\n viewStatesEqual,\n} from '@elytracms/studio/lib/cms-views'\nimport type { TableViewState } from '@elytracms/studio/lib/cms-views'\nimport { useOptionalAssets } from '../assets/assets-store'\nimport { applyCellValue, commitCellEdit } from './cell-edit'\nimport type { CellCommitInput, CellCommitOutcome } from './cell-edit'\nimport { runBulkAction } from './bulk-actions'\nimport type { BulkAction, BulkReport, BulkSetField } from './bulk-actions'\n\n/**\n * A resolved table view: a named bundle of filters (closed AD-3 vocabulary),\n * sort, and visible/ordered columns. EC-246b: named views are **config-as-code**\n * (declared in `cms/`, read live via `configViewsFor`) — the editor-owned DB\n * saved-view store (EC-169) is retired. The unnamed \"All documents\" default is\n * derived per collection; editors keep only transient in-session tweaks + Reset.\n */\nexport interface SavedView {\n id: string\n name: string\n state: TableViewState\n}\n\n/**\n * EC-188: validate a `blocks` composition field value against the field's `allow`\n * vocabulary + the code-owned component registry (the leash), mapping graph\n * issues into plain CMS findings. Injected into `validateDocument` so cms-core\n * stays free of `@elytracms/core/project-graph`. Never throws — a malformed (non-node)\n * value degrades to a single finding, matching the \"validation is first-class,\n * never a crash\" rule.\n */\nfunction validateComposition(value: unknown, field: BlocksFieldDef): CompositionIssue[] {\n if (value == null) return []\n const roots = Array.isArray(value) ? value : [value]\n if (!roots.every((r) => r != null && typeof r === 'object' && 'componentId' in r)) {\n return [{ message: 'is not a valid composition (expected component nodes)', severity: 'error' }]\n }\n const components = getStudioRegistry().registry.lookup\n return validateCompositionValue(value as ComponentNode | ComponentNode[], {\n allow: field.allow,\n components,\n }).map((issue) => ({\n message: issue.message,\n severity: issue.severity,\n nodePath: issue.path.join('/'),\n }))\n}\n\n/**\n * EC-189: validate the composition embeds inside a `richText` field value. Each\n * `componentEmbed` holds a single `ComponentNode` constrained by the field's\n * `allow` vocabulary (the SAME leash a `blocks` field uses). Parse the value, walk\n * its embeds at any depth, and validate each embedded node via\n * `validateCompositionValue`; findings carry the rich-text node path joined with\n * the in-embed graph path. Injected into `validateDocument` so cms-core depends on\n * neither `@elytracms/core/project-graph` nor `@elytracms/core/rich-text`. Never throws — a\n * malformed embed degrades to a single finding.\n */\nfunction validateRichTextEmbeds(value: unknown, field: RichTextFieldDef): CompositionIssue[] {\n if (value == null) return []\n const parsed = parseRichTextValue(value)\n // A plain-string / schema-invalid rich-text value carries no embeds to check\n // here (scalar type validation owns reporting a malformed value).\n if (!parsed.ok) return []\n const components = getStudioRegistry().registry.lookup\n const out: CompositionIssue[] = []\n for (const occurrence of collectComponentEmbeds(parsed.value.doc)) {\n if (!occurrence.embedded) {\n out.push({\n message: `embed at ${occurrence.nodePath} is missing a valid embedded component`,\n severity: 'error',\n nodePath: occurrence.nodePath,\n })\n continue\n }\n for (const issue of validateCompositionValue(occurrence.embedded, {\n allow: field.allow,\n components,\n })) {\n out.push({\n message: issue.message,\n severity: issue.severity,\n nodePath: `${occurrence.nodePath}/attrs/node/${issue.path.join('/')}`,\n })\n }\n }\n return out\n}\n\nexport interface ImportReport {\n added: number\n rejected: { id: string; issues: CmsValidationIssue[] }[]\n}\n\n/**\n * A document's recorded version history plus its live pin (EC-224), as the\n * Versions inspector pane reads it. `versions` is newest-first; `publishedVersion`\n * is the recorded version currently pinned live, absent when unpublished.\n */\nexport interface DocumentVersionsView {\n versions: DocumentVersionRecord[]\n publishedVersion?: number\n}\n\nexport interface CmsStore {\n /** The project this CMS session edits (set when persistence is enabled); the asset picker scopes the real library by it (EC-152). */\n projectId?: string\n collections: readonly CollectionDef[]\n localeConfig: LocaleConfig\n /**\n * The studio's ambient active locale (EC-176): table cells, detail forms,\n * and inline edits all display and write THIS locale. Switched once via the\n * shared `LocaleSwitcher`, never per control.\n */\n activeLocale: Locale\n getCollection(id: string): CollectionDef | undefined\n documentsOf(collectionId: string): CmsDocument[]\n getDocument(ref: DocumentRef): CmsDocument | undefined\n /** Resolve a relation/asset target's display title. */\n titleOf(ref: DocumentRef): string\n saveDocument(doc: CmsDocument): void\n /**\n * Commit ONE field edit from the table (EC-168): optimistic session apply +\n * exactly one `documents.upsert` operations command, awaited. Validation\n * failures and operation rejections return a structured error (the caller\n * renders it on the cell) and leave the session rolled back.\n */\n commitFieldEdit(input: CellCommitInput): Promise<CellCommitOutcome>\n createDocument(collectionId: string): DocumentRef\n /**\n * Ensure a singleton collection's lone document exists and return its ref\n * (EC-274). Resolves the existing single document, or creates one with a normal\n * generated id (never the collection id). Idempotent. The singleton route opens\n * through this so the one document always exists to edit.\n */\n ensureSingletonDocument(collectionId: string): DocumentRef\n deleteDocument(ref: DocumentRef): void\n /**\n * Is this document currently published? Sourced from the version POINTER\n * (EC-224), not the flat `state` enum — seeded from hydration and updated by\n * {@link publishDocument}/{@link unpublishDocument}.\n */\n isPublished(ref: DocumentRef): boolean\n /**\n * Publish: snapshot the draft as a new version and pin it live (EC-224).\n * Flips published-ness optimistically, then reconciles against the backend\n * record (EC-225) so the badge can never claim a publish the backend refused\n * (e.g. blocked by publish-time field validation).\n */\n publishDocument(ref: DocumentRef): Promise<void>\n /**\n * Unpublish: clear the live version pin (EC-224). Blocked at the operations\n * layer while strict relation fields published-reference it (EC-173); the\n * optimistic flip reconciles against the backend on rejection (EC-225).\n */\n unpublishDocument(ref: DocumentRef): Promise<void>\n /**\n * Load this document's recorded version history + live pin (EC-224) for the\n * Versions inspector pane. Fixture/playground sessions (no project) have no\n * persisted history → an empty view. Failures surface as {@link persistError}.\n */\n loadDocumentVersions(ref: DocumentRef): Promise<DocumentVersionsView>\n /**\n * Restore a recorded version as the new working draft (EC-224): the operation\n * snapshots the current draft first (so the rollback is itself undoable), then\n * loads the chosen snapshot. An optional `scope` (EC-298) restores only one\n * field or block, laid over the current draft, instead of the whole document.\n * Returns the restored draft (or null on failure/fixture session) so the open\n * editor can adopt it.\n */\n restoreDocumentVersion(\n ref: DocumentRef,\n version: number,\n scope?: RestoreScope,\n ): Promise<CmsDocument | null>\n importDocuments(collectionId: string, docs: unknown[]): ImportReport\n validate(doc: CmsDocument): CmsValidationIssue[]\n isFieldReadOnly(field: FieldDef): boolean\n // Views (EC-246b): the built-in default + config-declared named views (from\n // `cms/`, read live). Shared views are code, not editor-owned DB data.\n viewsOf(collectionId: string): SavedView[]\n activeViewId(collectionId: string): string\n /** Switch views — resets the working table state to the view's state. */\n setActiveView(collectionId: string, viewId: string): void\n /** The live table state (the active view's state plus unsaved edits). */\n tableStateOf(collectionId: string): TableViewState\n /**\n * Update the working state. Always pass an updater when deriving from the\n * previous state — render-time snapshots go stale across rapid events.\n */\n setTableState(\n collectionId: string,\n update: TableViewState | ((prev: TableViewState) => TableViewState),\n ): void\n /** Does the working state diverge from the active view (\"unsaved changes\")? */\n isViewDirty(collectionId: string): boolean\n /** Discard working-state edits, back to the active view. */\n resetTableState(collectionId: string): void\n /**\n * Bulk publish/unpublish/delete (EC-169) + set-field (EC-247): one operations\n * command PER item, per-item outcomes in the report — partial failure is\n * enumerated, never silent. Only succeeded items mutate the session. A\n * `set-field` carries its `{ field, value }` payload.\n */\n runBulk(\n collectionId: string,\n ids: readonly string[],\n action: BulkAction,\n setField?: BulkSetField,\n ): Promise<BulkReport>\n /**\n * Mirror a collection into the session (e.g. an accepted AI-generated\n * schema, EC-097). Replaces by id. Session-only: persistence happens through\n * the accept flow's changeset (`schema.upsertCollection`), not here.\n */\n addCollection(def: CollectionDef): void\n /**\n * Most recent failed/denied persisted mutation (structured, from the\n * operation result). Rendered by the CMS surface — never a silent failure.\n */\n persistError: OperationError | null\n clearPersistError(): void\n /** Seed the persisted baseline now (e.g. before applying an AI changeset). */\n ensurePersistedBaseline(): Promise<void>\n /** Await all queued persisted mutations (tests, publish flows). */\n flushPersistence(): Promise<void>\n}\n\nconst CmsContext = createContext<CmsStore | null>(null)\n\nfunction primaryField(collection: CollectionDef): string {\n return titleFieldOf(collection)?.name ?? collection.fields[0]?.name ?? 'id'\n}\n\n/** The unnamed built-in view: no filters, no sort, every field visible. */\nfunction defaultView(collection: CollectionDef | undefined): SavedView {\n return {\n id: ALL_VIEW_ID,\n name: translate('cms.list.view.all'),\n state: collection\n ? defaultViewState(collection)\n : { filters: [], sort: null, columns: [], hidden: [] },\n }\n}\n\n/**\n * The CMS session store (EC-141): documents and collections are optimistic,\n * synchronous session state (live validation while typing); every mutation —\n * create/save/delete/state transitions — is mirrored onto the operations\n * layer (`documents.*` / `schema.*` commands) through {@link createCmsPersister}.\n * Failed/denied commands surface as {@link CmsStore.persistError}.\n */\nexport function CmsProvider({\n children,\n projectId,\n initialCollections,\n initialDocuments,\n initialPublishedKeys,\n initialLocaleConfig,\n}: {\n children: ReactNode\n /** Enables persistence through the shared operations client. */\n projectId?: string\n /** Seed collections (e.g. from an imported starter kit, EC-119); defaults to the samples. */\n initialCollections?: CollectionDef[]\n initialDocuments?: CmsDocument[]\n /**\n * Published document keys from hydration (EC-224): the version pointer\n * (`publishedVersion` set). Absent (kit / fixture sessions) → the sample\n * fixtures' published set (`samplePublishedKeys`).\n */\n initialPublishedKeys?: readonly string[]\n /** Locale config for the seeded content; defaults to the sample config. */\n initialLocaleConfig?: LocaleConfig\n}) {\n const [documents, setDocuments] = useState<CmsDocument[]>(() =>\n (initialDocuments ?? sampleDocuments).map((d) => structuredClone(d)),\n )\n // Published-ness as the version POINTER (EC-224), decoupled from the flat\n // `state` enum: seeded from hydration's pointer set, or — when none is supplied\n // — the canonical sample published set for the playground. A kit's imported\n // content (`initialDocuments` without a pointer set) starts unpublished\n // (drafts) until an editor publishes it. The flat `state` is never consulted.\n const [publishedKeys, setPublishedKeys] = useState<Set<string>>(() => {\n if (initialPublishedKeys) return new Set(initialPublishedKeys)\n return new Set(initialDocuments ? [] : samplePublishedKeys)\n })\n const [activeViews, setActiveViews] = useState<Record<string, string>>({})\n // The live table state per collection where it diverges from the active\n // view; absent key = exactly the active view's state (not dirty).\n const [tableStates, setTableStates] = useState<Record<string, TableViewState>>({})\n // Collections are stateful so AI-generated schemas (EC-097) can be accepted\n // into the session. The session schema IS the source the sort/filter\n // offering follows (EC-177 gap 3): hydrated sessions receive the persisted\n // schema via `initialCollections`; the fixture fallback is the canonical\n // cms-core sample schema WITH its declared `filterable` flags — no\n // session-side widenings, so the studio never offers a field the backend's\n // delivery engine would reject.\n const [collections, setCollections] = useState<CollectionDef[]>(() => [\n ...(initialCollections ?? sampleFilterableCollections),\n ])\n const [persistError, setPersistError] = useState<OperationError | null>(null)\n const seq = useRef(0)\n // EC-274: collection ids whose lone singleton document this session has already\n // created — a synchronous guard so a re-invoked effect (or StrictMode's double\n // mount) never materializes a second document under a freshly generated id.\n const ensuredSingletons = useRef<Set<string>>(new Set())\n\n // Latest session state for the persister's lazy baseline (no re-subscribing).\n const collectionsRef = useRef(collections)\n collectionsRef.current = collections\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n\n const persisterRef = useRef<CmsPersister | null>(null)\n if (persisterRef.current === null && projectId !== undefined) {\n persisterRef.current = createCmsPersister({\n projectId,\n getOperations: async () => (await getStudioOperations()).operations,\n getCollections: () => collectionsRef.current,\n getDocuments: () => documentsRef.current,\n // EC-277: self-type composition static props on write (the manifest half of\n // the lens), so extraction stays schema-free. Document fields self-type via\n // the schema alone (above); the registry adds blocks/embed prop coverage.\n lookupManifest: studioManifestLookup(),\n onError: setPersistError,\n })\n }\n\n const registry = useMemo(() => createCollectionRegistry(collections), [collections])\n const store = useMemo(() => createDocumentStore(documents), [documents])\n const localeConfig = initialLocaleConfig ?? sampleLocaleConfig\n\n // Asset existence is validated against the REAL asset library (assets live in\n // their own repository, not as CMS documents). With the ambient AssetsProvider\n // present, the oracle is the set of uploaded asset ids — but only once loaded;\n // while it loads we are optimistic so a valid upload is never transiently\n // flagged \"unknown\". With no provider (tests/fixtures), the oracle is absent\n // and asset existence falls back to the document store.\n const assetStore = useOptionalAssets()\n const assetExists = useMemo<((id: string) => boolean) | undefined>(() => {\n if (!assetStore) return undefined\n if (assetStore.status !== 'ready') return () => true\n const ids = new Set(assetStore.assets.map((asset) => asset.id))\n return (id) => ids.has(id)\n }, [assetStore])\n\n // The ambient studio locale (EC-176): this session's locale config drives\n // the switcher options; every CMS surface follows the one active locale.\n const { locale: activeLocale } = useStudioLocale()\n useEffect(() => {\n configureStudioLocales(localeConfig)\n }, [localeConfig])\n\n const getCollection = useCallback((id: string) => registry.get(id), [registry])\n\n const getDocument = useCallback(\n (ref: DocumentRef) => documents.find((d) => d.collection === ref.collection && d.id === ref.id),\n [documents],\n )\n\n const titleOf = useCallback(\n (ref: DocumentRef) => {\n const doc = documents.find((d) => d.collection === ref.collection && d.id === ref.id)\n const collection = registry.get(ref.collection)\n if (!doc || !collection) return ref.id\n // EC-296/EC-242: a function `titleField` (title pattern) composes the title\n // from the document's resolved values (active locale). Only resolve the full\n // value set when a function is declared — the common string `titleField` case\n // still resolves the single title field below (primaryField === the title field).\n if (typeof collection.titleField === 'function') {\n const values: Record<string, unknown> = {}\n for (const field of collection.fields) {\n values[field.name] = resolveField(collection, doc, field.name, activeLocale, localeConfig).value\n }\n return resolveDocumentTitle(collection, values, ref.id)\n }\n // Resolve through the locale layer in the ambient active locale (EC-176)\n // with EC-018 fallback, so localized titles follow the switcher.\n const { value } = resolveField(\n collection,\n doc,\n primaryField(collection),\n activeLocale,\n localeConfig,\n )\n return typeof value === 'string' && value ? value : ref.id\n },\n [documents, registry, localeConfig, activeLocale],\n )\n\n const saveDocument = useCallback((doc: CmsDocument) => {\n setDocuments((prev) => {\n const i = prev.findIndex((d) => d.collection === doc.collection && d.id === doc.id)\n if (i < 0) return [...prev, doc]\n const next = [...prev]\n next[i] = doc\n return next\n })\n persisterRef.current?.upsertDocument(doc)\n }, [])\n\n const commitFieldEdit = useCallback(\n (input: CellCommitInput): Promise<CellCommitOutcome> => {\n const replaceWith = (doc: CmsDocument) =>\n setDocuments((prev) =>\n prev.map((d) => (d.collection === doc.collection && d.id === doc.id ? doc : d)),\n )\n const persister = persisterRef.current\n return commitCellEdit(\n {\n registry,\n documents: documentsRef.current,\n localeConfig,\n applySession: replaceWith,\n rollbackSession: replaceWith,\n ...(persister && projectId !== undefined\n ? {\n dispatch: async (next: CmsDocument) => {\n // Make sure the persisted baseline + every queued mutation\n // landed first, then issue the commit's single command.\n await persister.ensureBaseline()\n const { operations } = await getStudioOperations()\n return operations.documents.upsert({ projectId, document: next })\n },\n }\n : {}),\n },\n input,\n )\n },\n [registry, localeConfig, projectId],\n )\n\n const createDocument = useCallback(\n (collectionId: string): DocumentRef => {\n seq.current += 1\n const id = `new-${collectionId}-${seq.current}`\n // EC-297: seed the collection's declared field defaults at create time.\n const collection = registry.get(collectionId)\n const doc: CmsDocument = {\n collection: collectionId,\n id,\n values: collection ? seedDefaults(collection) : {},\n }\n setDocuments((prev) => [...prev, doc])\n persisterRef.current?.upsertDocument(doc)\n return { collection: collectionId, id }\n },\n [registry],\n )\n\n // EC-274 (re-scopes EC-217): a singleton is a UI lens, not a fixed id. Resolve\n // the collection's lone document and return its ref; if none exists yet, create\n // one with a NORMAL generated id (never the collection id — no code ever names a\n // literal doc id). Idempotent under React effects/StrictMode: the create guard\n // keys on \"any document in this collection\", so a re-invocation never adds a\n // second. On drift (>1 doc) the studio routes to the list, so this defensively\n // returns the first; the empty draft persists like any create.\n const ensureSingletonDocument = useCallback(\n (collectionId: string): DocumentRef => {\n const collection = registry.get(collectionId)\n const resolution = collection\n ? resolveSingletonDocument(collection, documentsRef.current)\n : ({ kind: 'empty' } as const)\n if (resolution.kind === 'ready') {\n return { collection: collectionId, id: resolution.doc.id }\n }\n if (resolution.kind === 'drift') {\n return { collection: collectionId, id: resolution.docs[0]!.id }\n }\n // Empty: create the lone document once. The ref guard (synchronous) plus the\n // updater's \"any doc in collection\" check make this idempotent under a\n // re-invoked effect or StrictMode's double mount — never a second draft.\n const existing = documentsRef.current.find((d) => d.collection === collectionId)\n if (existing) return { collection: collectionId, id: existing.id }\n if (ensuredSingletons.current.has(collectionId)) {\n return { collection: collectionId, id: `new-${collectionId}-pending` }\n }\n ensuredSingletons.current.add(collectionId)\n seq.current += 1\n const id = `new-${collectionId}-${seq.current}`\n // EC-297: seed the singleton's declared field defaults at create time.\n const doc: CmsDocument = {\n collection: collectionId,\n id,\n values: collection ? seedDefaults(collection) : {},\n }\n setDocuments((prev) =>\n prev.some((d) => d.collection === collectionId) ? prev : [...prev, doc],\n )\n persisterRef.current?.upsertDocument(doc)\n return { collection: collectionId, id }\n },\n [registry],\n )\n\n const deleteDocument = useCallback((ref: DocumentRef) => {\n setDocuments((prev) =>\n prev.filter((d) => !(d.collection === ref.collection && d.id === ref.id)),\n )\n persisterRef.current?.deleteDocument(ref)\n }, [])\n\n // EC-224: published-ness IS the version pointer (`publishedKeys`) — the SOLE\n // studio source of truth, read via `isPublished`. The live row stays a\n // continuous draft (Sanity model); no flat `state` mirror is maintained. Every\n // reader now consults the pointer (the table badge/$state via `isPublished`,\n // the preview engine via the pin), so the flat field is read by nothing here.\n const setPublished = useCallback((ref: DocumentRef, published: boolean) => {\n const key = documentKey(ref)\n setPublishedKeys((prev) => {\n if (prev.has(key) === published) return prev\n const next = new Set(prev)\n if (published) next.add(key)\n else next.delete(key)\n return next\n })\n }, [])\n\n const isPublished = useCallback(\n (ref: DocumentRef) => publishedKeys.has(documentKey(ref)),\n [publishedKeys],\n )\n\n // Reconcile published-ness for a ref against the AUTHORITATIVE backend record\n // (EC-225): the optimistic flip is a guess; once the queued op settles we read\n // the actual pin so the badge can never claim a state the backend refused\n // (a publish blocked by field rules, an unpublish blocked by a strict ref).\n const reconcilePublished = useCallback(\n async (ref: DocumentRef) => {\n if (projectId === undefined) return\n const { operations } = await getStudioOperations()\n const record = await operations.documents.get({ projectId, ref })\n if (record.ok) setPublished(ref, record.value.publishedVersion !== undefined)\n },\n [projectId, setPublished],\n )\n\n const publishDocument = useCallback(\n async (ref: DocumentRef) => {\n setPublished(ref, true) // optimistic\n // EC-273: no clearing here — the draft is already free of conditionally-hidden\n // values (the editor clears them on write), so the snapshot the publish op\n // pins is clean by construction.\n persisterRef.current?.publishDocument(ref)\n await persisterRef.current?.flush()\n await reconcilePublished(ref)\n },\n [setPublished, reconcilePublished],\n )\n\n const unpublishDocument = useCallback(\n async (ref: DocumentRef) => {\n setPublished(ref, false) // optimistic\n persisterRef.current?.unpublishDocument(ref)\n await persisterRef.current?.flush()\n await reconcilePublished(ref)\n },\n [setPublished, reconcilePublished],\n )\n\n const loadDocumentVersions = useCallback(\n async (ref: DocumentRef): Promise<DocumentVersionsView> => {\n // No persisted backend (fixture/playground): no recorded history.\n if (projectId === undefined) return { versions: [] }\n const { operations } = await getStudioOperations()\n const [versionsRes, recordRes] = await Promise.all([\n operations.documents.listVersions({ projectId, ref }),\n operations.documents.get({ projectId, ref }),\n ])\n if (!versionsRes.ok) {\n setPersistError(versionsRes.error)\n return { versions: [] }\n }\n // The pinned (live) version comes off the document record; a never-saved\n // doc simply has no record (and no versions) — not an error to surface.\n const publishedVersion = recordRes.ok ? recordRes.value.publishedVersion : undefined\n return {\n versions: versionsRes.value,\n ...(publishedVersion !== undefined ? { publishedVersion } : {}),\n }\n },\n [projectId],\n )\n\n const restoreDocumentVersion = useCallback(\n async (\n ref: DocumentRef,\n version: number,\n scope?: RestoreScope,\n ): Promise<CmsDocument | null> => {\n if (projectId === undefined) return null\n // Land any queued edits before the restore reads the current draft to\n // snapshot it (same ordering contract as commitFieldEdit/runBulk). This is\n // what makes a granular (field/block) restore merge over the LATEST draft.\n await persisterRef.current?.ensureBaseline()\n const { operations } = await getStudioOperations()\n const result = await operations.documents.restore({\n projectId,\n ref,\n version,\n ...(scope ? { scope } : {}),\n })\n if (!result.ok) {\n setPersistError(result.error)\n return null\n }\n const restored = result.value.document\n setDocuments((prev) =>\n prev.map((d) =>\n d.collection === restored.collection && d.id === restored.id ? restored : d,\n ),\n )\n return restored\n },\n [projectId],\n )\n\n const validate = useCallback(\n (doc: CmsDocument) =>\n validateDocument(registry, doc, {\n store,\n localeConfig,\n validateComposition,\n validateRichTextEmbeds,\n // EC-224: the EC-173 weak-reference warning sources published-ness from\n // the version pointer, so editing a published doc that references an\n // unpublished target surfaces the fallback warning again (it had gone\n // inert once the flat `state` mirror was dropped in B-3b).\n isPublished,\n assetExists,\n }),\n [registry, store, localeConfig, isPublished, assetExists],\n )\n\n const importDocuments = useCallback(\n (collectionId: string, raw: unknown[]): ImportReport => {\n const report: ImportReport = { added: 0, rejected: [] }\n // Pre-parse so intra-batch relation/asset targets resolve during validation.\n const parsedBatch: CmsDocument[] = []\n const schemaFails: { item: unknown; error: ReturnType<typeof documentSchema.safeParse> }[] =\n []\n for (const item of raw) {\n const parsed = documentSchema.safeParse({ ...(item as object), collection: collectionId })\n if (parsed.success) parsedBatch.push(parsed.data)\n else schemaFails.push({ item, error: parsed })\n }\n for (const { item, error } of schemaFails) {\n report.rejected.push({\n id: (item as { id?: string })?.id ?? translate('cms.list.import.noId'),\n issues: (error.success ? [] : error.error.issues).map((e) => ({\n code: 'invalid-field-value' as const,\n severity: 'error' as const,\n message: e.message,\n path: e.path.map((p) => (typeof p === 'symbol' ? String(p) : p)),\n })),\n })\n }\n // Validate each against existing docs PLUS the rest of the batch.\n const batchStore = createDocumentStore([...documents, ...parsedBatch])\n const accepted: CmsDocument[] = []\n for (const doc of parsedBatch) {\n const issues = validateDocument(registry, doc, { store: batchStore, localeConfig, assetExists })\n const errors = issues.filter((iss) => iss.severity === 'error')\n if (errors.length > 0) report.rejected.push({ id: doc.id, issues: errors })\n else accepted.push(doc)\n }\n if (accepted.length > 0) {\n setDocuments((prev) => {\n const next = [...prev]\n for (const doc of accepted) {\n const i = next.findIndex((d) => d.collection === doc.collection && d.id === doc.id)\n if (i < 0) next.push(doc)\n else next[i] = doc\n }\n return next\n })\n for (const doc of accepted) persisterRef.current?.upsertDocument(doc)\n // EC-224: imports land as the working DRAFT. Publish-ness is the version\n // pointer (`publishedKeys`), set by publishing — never carried in the\n // imported row — so an import never auto-publishes; the editor publishes\n // explicitly afterward.\n report.added = accepted.length\n }\n return report\n },\n [registry, documents, localeConfig, assetExists],\n )\n\n const isFieldReadOnly = useCallback((field: FieldDef) => field.form?.readOnly === true, [])\n\n // --- Views (EC-246b: config-as-code) --------------------------------------\n\n const viewsOf = useCallback(\n (collectionId: string): SavedView[] => {\n // The built-in default plus the collection's config-declared views (EC-246b).\n // Views are PRESENTATION, read live from elytra.config.ts (AD-11) — not the\n // persisted content schema the session booted from — so they reflect code\n // immediately without a re-seed (the persisted schema is only baselined on\n // first run). The EC-169 DB saved-view store is retired: shared views are\n // code, editors keep only transient in-session tweaks + Reset.\n const configCollection = resolveDeploymentCollections().find((c) => c.id === collectionId)\n return [\n defaultView(registry.get(collectionId)),\n ...(configCollection ? configViewsFor(configCollection) : []),\n ]\n },\n [registry],\n )\n\n const activeViewOf = useCallback(\n (collectionId: string): SavedView => {\n const id = activeViews[collectionId] ?? ALL_VIEW_ID\n return (\n viewsOf(collectionId).find((view) => view.id === id) ??\n defaultView(registry.get(collectionId))\n )\n },\n [activeViews, viewsOf, registry],\n )\n\n const tableStateOf = useCallback(\n (collectionId: string): TableViewState =>\n tableStates[collectionId] ?? activeViewOf(collectionId).state,\n [tableStates, activeViewOf],\n )\n\n const dropTableState = useCallback((collectionId: string) => {\n setTableStates((prev) => {\n if (!(collectionId in prev)) return prev\n const next = { ...prev }\n delete next[collectionId]\n return next\n })\n }, [])\n\n const setActiveView = useCallback(\n (collectionId: string, viewId: string) => {\n setActiveViews((prev) => ({ ...prev, [collectionId]: viewId }))\n dropTableState(collectionId)\n },\n [dropTableState],\n )\n\n // --- Bulk actions (EC-169) ------------------------------------------------\n\n const runBulk = useCallback(\n async (\n collectionId: string,\n ids: readonly string[],\n action: BulkAction,\n setField?: BulkSetField,\n ): Promise<BulkReport> => {\n const collection = registry.get(collectionId)\n // A set-field needs both the field payload AND the collection def to fold\n // the value the locale-aware way — guard so a misconfigured call fails\n // loud rather than silently no-opping each item.\n if (action === 'set-field' && (!setField || !collection)) {\n return {\n action,\n ...(setField ? { setField } : {}),\n results: ids.map((id) => ({\n ref: { collection: collectionId, id },\n title: titleOf({ collection: collectionId, id }),\n ok: false,\n reason: translate('cms.list.bulk.error.invalidSetField'),\n error: { code: 'unknown', message: 'Invalid set-field request.' },\n })),\n }\n }\n // The next document for a set-field item: fold the value into the active\n // locale's bag (localized) or the shared `values` (non-localized).\n const setFieldDoc = (doc: CmsDocument): CmsDocument =>\n applyCellValue(collection!, doc, setField!.field, activeLocale, setField!.value)\n\n let dispatch:\n | ((action: BulkAction, ref: DocumentRef) => Promise<OperationResult<unknown>>)\n | undefined\n const persister = persisterRef.current\n if (persister && projectId !== undefined) {\n // Pending queued mutations + baseline land first, then one awaited\n // command per item (same ordering contract as commitFieldEdit).\n await persister.ensureBaseline()\n const { operations } = await getStudioOperations()\n dispatch = (bulkAction, ref) => {\n if (bulkAction === 'delete') return operations.documents.delete({ projectId, ref })\n if (bulkAction === 'publish') return operations.documents.publish({ projectId, ref })\n if (bulkAction === 'unpublish') return operations.documents.unpublish({ projectId, ref })\n // set-field: upsert the document carrying the new value. The write\n // path self-types it through the schema lens (EC-277); a scalar field\n // stores its scalar as-is.\n const current = documentsRef.current.find(\n (d) => d.collection === ref.collection && d.id === ref.id,\n )\n if (!current) {\n return Promise.resolve<OperationResult<unknown>>({\n ok: false,\n error: {\n code: 'not-found',\n message: 'Document is no longer in the session.',\n entity: 'cms-document',\n key: `${ref.collection}:${ref.id}`,\n },\n })\n }\n return operations.documents.upsert({ projectId, document: setFieldDoc(current) })\n }\n }\n return runBulkAction(\n {\n documents: documentsRef.current,\n titleOf,\n validate: (doc) =>\n validateDocument(registry, doc, {\n store: createDocumentStore(documentsRef.current),\n localeConfig,\n // EC-225: include the composition validators so a bulk PUBLISH\n // gates blocks/richText validity the same way the detail editor\n // does — the operations-layer publish gate has no component\n // registry, so composition validity is a studio-validation invariant.\n validateComposition,\n validateRichTextEmbeds,\n assetExists,\n }),\n // EC-224: a succeeded publish/unpublish moves the version pointer\n // (`publishedKeys`) via setPublished — there is no separate flat\n // `state` mirror to keep in sync (published-ness is derived from the\n // pointer set).\n applyState: (ref, state) => setPublished(ref, state === 'published'),\n applyDelete: (ref) =>\n setDocuments((prev) =>\n prev.filter((d) => !(d.collection === ref.collection && d.id === ref.id)),\n ),\n // EC-247: fold the new value into the session document (same\n // locale-aware path the dispatched upsert used).\n applySetField: (ref) =>\n setDocuments((prev) =>\n prev.map((d) =>\n d.collection === ref.collection && d.id === ref.id ? setFieldDoc(d) : d,\n ),\n ),\n ...(dispatch ? { dispatch } : {}),\n },\n collectionId,\n ids,\n action,\n setField,\n )\n },\n [projectId, titleOf, registry, localeConfig, activeLocale, setPublished, assetExists],\n )\n\n const store$ = useMemo<CmsStore>(\n () => ({\n ...(projectId !== undefined ? { projectId } : {}),\n collections,\n localeConfig,\n activeLocale,\n getCollection,\n documentsOf: (collectionId) => documents.filter((d) => d.collection === collectionId),\n getDocument,\n titleOf,\n saveDocument,\n commitFieldEdit,\n createDocument,\n ensureSingletonDocument,\n deleteDocument,\n isPublished,\n publishDocument,\n unpublishDocument,\n loadDocumentVersions,\n restoreDocumentVersion,\n importDocuments,\n validate,\n isFieldReadOnly,\n viewsOf,\n activeViewId: (collectionId) => activeViews[collectionId] ?? ALL_VIEW_ID,\n setActiveView,\n tableStateOf,\n setTableState: (collectionId, update) =>\n setTableStates((prev) => {\n const current = prev[collectionId] ?? activeViewOf(collectionId).state\n const next = typeof update === 'function' ? update(current) : update\n return { ...prev, [collectionId]: next }\n }),\n isViewDirty: (collectionId) => {\n const working = tableStates[collectionId]\n if (working === undefined) return false\n const active = activeViewOf(collectionId).state\n const collection = registry.get(collectionId)\n if (collection === undefined) return !viewStatesEqual(working, active)\n // Compare schema-resolved forms (EC-213): a column-order reconciliation\n // or a stale `hidden` entry must not read as an unsaved edit.\n return !viewStatesEqual(\n canonicalViewState(collection, working),\n canonicalViewState(collection, active),\n )\n },\n resetTableState: dropTableState,\n runBulk,\n addCollection: (def) =>\n setCollections((prev) => [...prev.filter((c) => c.id !== def.id), def]),\n persistError,\n clearPersistError: () => setPersistError(null),\n ensurePersistedBaseline: () => persisterRef.current?.ensureBaseline() ?? Promise.resolve(),\n flushPersistence: () => persisterRef.current?.flush() ?? Promise.resolve(),\n }),\n [\n projectId,\n collections,\n documents,\n localeConfig,\n activeLocale,\n getCollection,\n getDocument,\n titleOf,\n saveDocument,\n commitFieldEdit,\n createDocument,\n ensureSingletonDocument,\n deleteDocument,\n isPublished,\n publishDocument,\n unpublishDocument,\n loadDocumentVersions,\n restoreDocumentVersion,\n importDocuments,\n validate,\n isFieldReadOnly,\n viewsOf,\n activeViews,\n activeViewOf,\n tableStates,\n tableStateOf,\n setActiveView,\n dropTableState,\n runBulk,\n registry,\n persistError,\n ],\n )\n\n return <CmsContext.Provider value={store$}>{children}</CmsContext.Provider>\n}\n\nexport function useCms(): CmsStore {\n const store = useContext(CmsContext)\n if (!store) throw new Error('useCms must be used within a <CmsProvider>.')\n return store\n}\n\n/**\n * A field's display label (EC-241): resolve its (possibly localized) `form.label`,\n * falling back to the field name. **`locale` defaults to the active UI locale** —\n * a bare `fieldLabel(field)` localizes a `{ en, de }` map against the browser locale\n * (via the non-hook `localizedLabel`), so a German editor sees German labels. Pass an\n * explicit `locale` only to force a specific one (e.g. a content-locale variant view).\n */\nexport function fieldLabel(field: FieldDef, locale?: string): string {\n // A catalog-backed built-in-rail label (msgLabel) always resolves through the\n // catalog against the active UI locale, ignoring a content-locale override — a rail\n // is chrome, not localized content.\n const chrome = resolveMsgLabel(field.form?.label)\n if (chrome !== undefined) return chrome\n if (locale !== undefined) return resolveLabel(field.form?.label, locale) ?? field.name\n return localizedLabel(field.form?.label, field.name)\n}\n\n/** A collection's plural display label (EC-241): localized `form.label`, else its id. Defaults to the active UI locale. */\nexport function collectionLabel(collection: CollectionDef, locale?: string): string {\n const chrome = resolveMsgLabel(collection.form?.label)\n if (chrome !== undefined) return chrome\n if (locale !== undefined) return resolveLabel(collection.form?.label, locale) ?? collection.id\n return localizedLabel(collection.form?.label, collection.id)\n}\n\n/** A collection's singular display label (EC-241): localized `form.labelSingular`, else the plural. Defaults to the active UI locale. */\nexport function collectionLabelSingular(collection: CollectionDef, locale?: string): string {\n const chrome = resolveMsgLabel(collection.form?.labelSingular)\n if (chrome !== undefined) return chrome\n if (locale !== undefined) {\n return resolveLabel(collection.form?.labelSingular, locale) ?? collectionLabel(collection, locale)\n }\n return localizedLabel(collection.form?.labelSingular) || collectionLabel(collection)\n}\n\nexport { primaryField }\nexport type { Locale }\n"]}
|
|
1
|
+
{"version":3,"file":"cms-store.js","sourceRoot":"","sources":["../../../src/components/cms/cms-store.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpG,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,2BAA2B,EAC3B,kBAAkB,E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Y;QACZ,YAAY;QACZ,aAAa;QACb,WAAW;QACX,OAAO;QACP,YAAY;QACZ,eAAe;QACf,cAAc;QACd,uBAAuB;QACvB,cAAc;QACd,WAAW;QACX,eAAe;QACf,iBAAiB;QACjB,oBAAoB;QACpB,sBAAsB;QACtB,eAAe;QACf,QAAQ;QACR,eAAe;QACf,OAAO;QACP,WAAW;QACX,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,aAAa;QACb,cAAc;QACd,OAAO;QACP,QAAQ;QACR,YAAY;KACb,CACF,CAAA;IAED,OAAO,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,QAAQ,GAAuB,CAAA;AAC7E,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IACpC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAC1E,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAe,EAAE,MAAe;IACzD,8EAA8E;IAC9E,oFAAoF;IACpF,oCAAoC;IACpC,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACjD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACvC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAA;IACtF,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;AACtD,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA","sourcesContent":["import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport {\n createCollectionRegistry,\n createDocumentStore,\n documentKey,\n documentSchema,\n resolveDocumentTitle,\n resolveField,\n resolveLabel,\n sampleDocuments,\n seedDefaults,\n sampleFilterableCollections,\n sampleLocaleConfig,\n samplePublishedKeys,\n resolveSingletonDocument,\n titleFieldOf,\n validateDocument,\n} from '@elytracms/core/cms-core'\nimport type {\n BlocksFieldDef,\n CmsDocument,\n CmsValidationIssue,\n CollectionDef,\n CompositionIssue,\n DocumentRef,\n FieldDef,\n Locale,\n LocaleConfig,\n RestoreScope,\n RichTextFieldDef,\n} from '@elytracms/core/cms-core'\nimport { validateCompositionValue } from '@elytracms/core/project-graph'\nimport type { ComponentNode } from '@elytracms/core/project-graph'\nimport { collectComponentEmbeds, parseRichTextValue } from '@elytracms/core/rich-text'\nimport type { DocumentVersionRecord } from '@elytracms/core/persistence'\nimport { localizedLabel, resolveMsgLabel, translate } from '@elytracms/studio/lib/i18n'\nimport { configureStudioLocales, useStudioLocale } from '@elytracms/studio/lib/locale'\nimport { getStudioRegistry, studioManifestLookup } from '@elytracms/studio/lib/registry'\nimport { resolveDeploymentCollections } from '@elytracms/studio/lib/workspace'\nimport { createCmsPersister, getStudioOperations } from '@elytracms/studio/lib/operations'\nimport type {\n CmsPersister,\n OperationError,\n OperationResult,\n} from '@elytracms/studio/lib/operations'\nimport {\n ALL_VIEW_ID,\n canonicalViewState,\n configViewsFor,\n defaultViewState,\n viewStatesEqual,\n} from '@elytracms/studio/lib/cms-views'\nimport type { TableViewState } from '@elytracms/studio/lib/cms-views'\nimport { useOptionalAssets } from '../assets/assets-store'\nimport { stagedDocuments } from './document-staging'\nimport { applyCellValue, commitCellEdit } from './cell-edit'\nimport type { CellCommitInput, CellCommitOutcome } from './cell-edit'\nimport { runBulkAction } from './bulk-actions'\nimport type { BulkAction, BulkReport, BulkSetField } from './bulk-actions'\n\n/**\n * A resolved table view: a named bundle of filters (closed AD-3 vocabulary),\n * sort, and visible/ordered columns. EC-246b: named views are **config-as-code**\n * (declared in `cms/`, read live via `configViewsFor`) — the editor-owned DB\n * saved-view store (EC-169) is retired. The unnamed \"All documents\" default is\n * derived per collection; editors keep only transient in-session tweaks + Reset.\n */\nexport interface SavedView {\n id: string\n name: string\n state: TableViewState\n}\n\n/**\n * EC-188: validate a `blocks` composition field value against the field's `allow`\n * vocabulary + the code-owned component registry (the leash), mapping graph\n * issues into plain CMS findings. Injected into `validateDocument` so cms-core\n * stays free of `@elytracms/core/project-graph`. Never throws — a malformed (non-node)\n * value degrades to a single finding, matching the \"validation is first-class,\n * never a crash\" rule.\n */\nfunction validateComposition(value: unknown, field: BlocksFieldDef): CompositionIssue[] {\n if (value == null) return []\n const roots = Array.isArray(value) ? value : [value]\n if (!roots.every((r) => r != null && typeof r === 'object' && 'componentId' in r)) {\n return [{ message: 'is not a valid composition (expected component nodes)', severity: 'error' }]\n }\n const components = getStudioRegistry().registry.lookup\n return validateCompositionValue(value as ComponentNode | ComponentNode[], {\n allow: field.allow,\n components,\n }).map((issue) => ({\n message: issue.message,\n severity: issue.severity,\n nodePath: issue.path.join('/'),\n }))\n}\n\n/**\n * EC-189: validate the composition embeds inside a `richText` field value. Each\n * `componentEmbed` holds a single `ComponentNode` constrained by the field's\n * `allow` vocabulary (the SAME leash a `blocks` field uses). Parse the value, walk\n * its embeds at any depth, and validate each embedded node via\n * `validateCompositionValue`; findings carry the rich-text node path joined with\n * the in-embed graph path. Injected into `validateDocument` so cms-core depends on\n * neither `@elytracms/core/project-graph` nor `@elytracms/core/rich-text`. Never throws — a\n * malformed embed degrades to a single finding.\n */\nfunction validateRichTextEmbeds(value: unknown, field: RichTextFieldDef): CompositionIssue[] {\n if (value == null) return []\n const parsed = parseRichTextValue(value)\n // A plain-string / schema-invalid rich-text value carries no embeds to check\n // here (scalar type validation owns reporting a malformed value).\n if (!parsed.ok) return []\n const components = getStudioRegistry().registry.lookup\n const out: CompositionIssue[] = []\n for (const occurrence of collectComponentEmbeds(parsed.value.doc)) {\n if (!occurrence.embedded) {\n out.push({\n message: `embed at ${occurrence.nodePath} is missing a valid embedded component`,\n severity: 'error',\n nodePath: occurrence.nodePath,\n })\n continue\n }\n for (const issue of validateCompositionValue(occurrence.embedded, {\n allow: field.allow,\n components,\n })) {\n out.push({\n message: issue.message,\n severity: issue.severity,\n nodePath: `${occurrence.nodePath}/attrs/node/${issue.path.join('/')}`,\n })\n }\n }\n return out\n}\n\nexport interface ImportReport {\n added: number\n rejected: { id: string; issues: CmsValidationIssue[] }[]\n}\n\n/**\n * A document's recorded version history plus its live pin (EC-224), as the\n * Versions inspector pane reads it. `versions` is newest-first; `publishedVersion`\n * is the recorded version currently pinned live, absent when unpublished.\n */\nexport interface DocumentVersionsView {\n versions: DocumentVersionRecord[]\n publishedVersion?: number\n}\n\nexport interface CmsStore {\n /** The project this CMS session edits (set when persistence is enabled); the asset picker scopes the real library by it (EC-152). */\n projectId?: string\n collections: readonly CollectionDef[]\n localeConfig: LocaleConfig\n /**\n * The studio's ambient active locale (EC-176): table cells, detail forms,\n * and inline edits all display and write THIS locale. Switched once via the\n * shared `LocaleSwitcher`, never per control.\n */\n activeLocale: Locale\n getCollection(id: string): CollectionDef | undefined\n documentsOf(collectionId: string): CmsDocument[]\n getDocument(ref: DocumentRef): CmsDocument | undefined\n /** Resolve a relation/asset target's display title. */\n titleOf(ref: DocumentRef): string\n saveDocument(doc: CmsDocument): void\n /**\n * Commit ONE field edit from the table (EC-168): optimistic session apply +\n * exactly one `documents.upsert` operations command, awaited. Validation\n * failures and operation rejections return a structured error (the caller\n * renders it on the cell) and leave the session rolled back.\n */\n commitFieldEdit(input: CellCommitInput): Promise<CellCommitOutcome>\n createDocument(collectionId: string): DocumentRef\n /**\n * Ensure a singleton collection's lone document exists and return its ref\n * (EC-274). Resolves the existing single document, or creates one with a normal\n * generated id (never the collection id). Idempotent. The singleton route opens\n * through this so the one document always exists to edit.\n */\n ensureSingletonDocument(collectionId: string): DocumentRef\n deleteDocument(ref: DocumentRef): void\n /**\n * Is this document currently published? Sourced from the version POINTER\n * (EC-224), not the flat `state` enum — seeded from hydration and updated by\n * {@link publishDocument}/{@link unpublishDocument}.\n */\n isPublished(ref: DocumentRef): boolean\n /**\n * Publish: snapshot the draft as a new version and pin it live (EC-224).\n * Flips published-ness optimistically, then reconciles against the backend\n * record (EC-225) so the badge can never claim a publish the backend refused\n * (e.g. blocked by publish-time field validation).\n */\n publishDocument(ref: DocumentRef): Promise<void>\n /**\n * Unpublish: clear the live version pin (EC-224). Blocked at the operations\n * layer while strict relation fields published-reference it (EC-173); the\n * optimistic flip reconciles against the backend on rejection (EC-225).\n */\n unpublishDocument(ref: DocumentRef): Promise<void>\n /**\n * Load this document's recorded version history + live pin (EC-224) for the\n * Versions inspector pane. Fixture/playground sessions (no project) have no\n * persisted history → an empty view. Failures surface as {@link persistError}.\n */\n loadDocumentVersions(ref: DocumentRef): Promise<DocumentVersionsView>\n /**\n * Restore a recorded version as the new working draft (EC-224): the operation\n * snapshots the current draft first (so the rollback is itself undoable), then\n * loads the chosen snapshot. An optional `scope` (EC-298) restores only one\n * field or block, laid over the current draft, instead of the whole document.\n * Returns the restored draft (or null on failure/fixture session) so the open\n * editor can adopt it.\n */\n restoreDocumentVersion(\n ref: DocumentRef,\n version: number,\n scope?: RestoreScope,\n ): Promise<CmsDocument | null>\n importDocuments(collectionId: string, docs: unknown[]): ImportReport\n validate(doc: CmsDocument): CmsValidationIssue[]\n isFieldReadOnly(field: FieldDef): boolean\n // Views (EC-246b): the built-in default + config-declared named views (from\n // `cms/`, read live). Shared views are code, not editor-owned DB data.\n viewsOf(collectionId: string): SavedView[]\n activeViewId(collectionId: string): string\n /** Switch views — resets the working table state to the view's state. */\n setActiveView(collectionId: string, viewId: string): void\n /** The live table state (the active view's state plus unsaved edits). */\n tableStateOf(collectionId: string): TableViewState\n /**\n * Update the working state. Always pass an updater when deriving from the\n * previous state — render-time snapshots go stale across rapid events.\n */\n setTableState(\n collectionId: string,\n update: TableViewState | ((prev: TableViewState) => TableViewState),\n ): void\n /** Does the working state diverge from the active view (\"unsaved changes\")? */\n isViewDirty(collectionId: string): boolean\n /** Discard working-state edits, back to the active view. */\n resetTableState(collectionId: string): void\n /**\n * Bulk publish/unpublish/delete (EC-169) + set-field (EC-247): one operations\n * command PER item, per-item outcomes in the report — partial failure is\n * enumerated, never silent. Only succeeded items mutate the session. A\n * `set-field` carries its `{ field, value }` payload.\n */\n runBulk(\n collectionId: string,\n ids: readonly string[],\n action: BulkAction,\n setField?: BulkSetField,\n ): Promise<BulkReport>\n /**\n * Mirror a collection into the session (e.g. an accepted AI-generated\n * schema, EC-097). Replaces by id. Session-only: persistence happens through\n * the accept flow's changeset (`schema.upsertCollection`), not here.\n */\n addCollection(def: CollectionDef): void\n /**\n * Most recent failed/denied persisted mutation (structured, from the\n * operation result). Rendered by the CMS surface — never a silent failure.\n */\n persistError: OperationError | null\n clearPersistError(): void\n /** Seed the persisted baseline now (e.g. before applying an AI changeset). */\n ensurePersistedBaseline(): Promise<void>\n /** Await all queued persisted mutations (tests, publish flows). */\n flushPersistence(): Promise<void>\n}\n\nconst CmsContext = createContext<CmsStore | null>(null)\n\nfunction primaryField(collection: CollectionDef): string {\n return titleFieldOf(collection)?.name ?? collection.fields[0]?.name ?? 'id'\n}\n\n/**\n * EC-316 (bug fix) — mint a fresh, COLLISION-FREE document id for `+ New`.\n *\n * `seq` is an in-memory, per-session counter (reset to 0 on every reload). A\n * document minted `new-<collection>-<n>` in a PRIOR session can already occupy\n * whatever `n` this session's counter would next reissue — the pre-fix bug:\n * `+ New` on a `post` collection that already held a (possibly published)\n * `new-post-1` handed out that SAME id again, silently opening the existing\n * document for editing instead of creating a fresh draft. Walking the counter\n * past every id already in `existingIds` makes the mint collision-free\n * regardless of what a prior session left behind.\n */\nexport function mintDocumentId(\n collectionId: string,\n seq: { current: number },\n existingIds: ReadonlySet<string>,\n): string {\n let id: string\n do {\n seq.current += 1\n id = `new-${collectionId}-${seq.current}`\n } while (existingIds.has(id))\n return id\n}\n\n/** The unnamed built-in view: no filters, no sort, every field visible. */\nfunction defaultView(collection: CollectionDef | undefined): SavedView {\n return {\n id: ALL_VIEW_ID,\n name: translate('cms.list.view.all'),\n state: collection\n ? defaultViewState(collection)\n : { filters: [], sort: null, columns: [], hidden: [] },\n }\n}\n\n/**\n * The CMS session store (EC-141): documents and collections are optimistic,\n * synchronous session state (live validation while typing); every mutation —\n * create/save/delete/state transitions — is mirrored onto the operations\n * layer (`documents.*` / `schema.*` commands) through {@link createCmsPersister}.\n * Failed/denied commands surface as {@link CmsStore.persistError}.\n */\nexport function CmsProvider({\n children,\n projectId,\n initialCollections,\n initialDocuments,\n initialPublishedKeys,\n initialLocaleConfig,\n}: {\n children: ReactNode\n /** Enables persistence through the shared operations client. */\n projectId?: string\n /** Seed collections (e.g. from an imported starter kit, EC-119); defaults to the samples. */\n initialCollections?: CollectionDef[]\n initialDocuments?: CmsDocument[]\n /**\n * Published document keys from hydration (EC-224): the version pointer\n * (`publishedVersion` set). Absent (kit / fixture sessions) → the sample\n * fixtures' published set (`samplePublishedKeys`).\n */\n initialPublishedKeys?: readonly string[]\n /** Locale config for the seeded content; defaults to the sample config. */\n initialLocaleConfig?: LocaleConfig\n}) {\n const [documents, setDocuments] = useState<CmsDocument[]>(() => {\n const seeded = (initialDocuments ?? sampleDocuments).map((d) => structuredClone(d))\n // EC-320: merge any documents STAGED by the Components-view \"Use in document…\"\n // transfer (a playground cross-mount handoff — see document-staging). Staged\n // wins by id; empty in Convex mode, where hydration is the source of truth.\n const staged = stagedDocuments(projectId)\n if (staged.length === 0) return seeded\n const byKey = new Map(seeded.map((d) => [`${d.collection}/${d.id}`, d]))\n for (const d of staged) byKey.set(`${d.collection}/${d.id}`, d)\n return [...byKey.values()]\n })\n // Published-ness as the version POINTER (EC-224), decoupled from the flat\n // `state` enum: seeded from hydration's pointer set, or — when none is supplied\n // — the canonical sample published set for the playground. A kit's imported\n // content (`initialDocuments` without a pointer set) starts unpublished\n // (drafts) until an editor publishes it. The flat `state` is never consulted.\n const [publishedKeys, setPublishedKeys] = useState<Set<string>>(() => {\n if (initialPublishedKeys) return new Set(initialPublishedKeys)\n return new Set(initialDocuments ? [] : samplePublishedKeys)\n })\n const [activeViews, setActiveViews] = useState<Record<string, string>>({})\n // The live table state per collection where it diverges from the active\n // view; absent key = exactly the active view's state (not dirty).\n const [tableStates, setTableStates] = useState<Record<string, TableViewState>>({})\n // Collections are stateful so AI-generated schemas (EC-097) can be accepted\n // into the session. The session schema IS the source the sort/filter\n // offering follows (EC-177 gap 3): hydrated sessions receive the persisted\n // schema via `initialCollections`; the fixture fallback is the canonical\n // cms-core sample schema WITH its declared `filterable` flags — no\n // session-side widenings, so the studio never offers a field the backend's\n // delivery engine would reject.\n const [collections, setCollections] = useState<CollectionDef[]>(() => [\n ...(initialCollections ?? sampleFilterableCollections),\n ])\n const [persistError, setPersistError] = useState<OperationError | null>(null)\n const seq = useRef(0)\n // EC-274: collection ids whose lone singleton document this session has already\n // created — a synchronous guard so a re-invoked effect (or StrictMode's double\n // mount) never materializes a second document under a freshly generated id.\n const ensuredSingletons = useRef<Set<string>>(new Set())\n\n // Latest session state for the persister's lazy baseline (no re-subscribing).\n const collectionsRef = useRef(collections)\n collectionsRef.current = collections\n const documentsRef = useRef(documents)\n documentsRef.current = documents\n\n const persisterRef = useRef<CmsPersister | null>(null)\n if (persisterRef.current === null && projectId !== undefined) {\n persisterRef.current = createCmsPersister({\n projectId,\n getOperations: async () => (await getStudioOperations()).operations,\n getCollections: () => collectionsRef.current,\n getDocuments: () => documentsRef.current,\n // EC-277: self-type composition static props on write (the manifest half of\n // the lens), so extraction stays schema-free. Document fields self-type via\n // the schema alone (above); the registry adds blocks/embed prop coverage.\n lookupManifest: studioManifestLookup(),\n onError: setPersistError,\n })\n }\n\n const registry = useMemo(() => createCollectionRegistry(collections), [collections])\n const store = useMemo(() => createDocumentStore(documents), [documents])\n const localeConfig = initialLocaleConfig ?? sampleLocaleConfig\n\n // Asset existence is validated against the REAL asset library (assets live in\n // their own repository, not as CMS documents). With the ambient AssetsProvider\n // present, the oracle is the set of uploaded asset ids — but only once loaded;\n // while it loads we are optimistic so a valid upload is never transiently\n // flagged \"unknown\". With no provider (tests/fixtures), the oracle is absent\n // and asset existence falls back to the document store.\n const assetStore = useOptionalAssets()\n const assetExists = useMemo<((id: string) => boolean) | undefined>(() => {\n if (!assetStore) return undefined\n if (assetStore.status !== 'ready') return () => true\n const ids = new Set(assetStore.assets.map((asset) => asset.id))\n return (id) => ids.has(id)\n }, [assetStore])\n\n // The ambient studio locale (EC-176): this session's locale config drives\n // the switcher options; every CMS surface follows the one active locale.\n const { locale: activeLocale } = useStudioLocale()\n useEffect(() => {\n configureStudioLocales(localeConfig)\n }, [localeConfig])\n\n const getCollection = useCallback((id: string) => registry.get(id), [registry])\n\n const getDocument = useCallback(\n (ref: DocumentRef) => documents.find((d) => d.collection === ref.collection && d.id === ref.id),\n [documents],\n )\n\n const titleOf = useCallback(\n (ref: DocumentRef) => {\n const doc = documents.find((d) => d.collection === ref.collection && d.id === ref.id)\n const collection = registry.get(ref.collection)\n if (!doc || !collection) return ref.id\n // EC-296/EC-242: a function `titleField` (title pattern) composes the title\n // from the document's resolved values (active locale). Only resolve the full\n // value set when a function is declared — the common string `titleField` case\n // still resolves the single title field below (primaryField === the title field).\n if (typeof collection.titleField === 'function') {\n const values: Record<string, unknown> = {}\n for (const field of collection.fields) {\n values[field.name] = resolveField(collection, doc, field.name, activeLocale, localeConfig).value\n }\n return resolveDocumentTitle(collection, values, ref.id)\n }\n // Resolve through the locale layer in the ambient active locale (EC-176)\n // with EC-018 fallback, so localized titles follow the switcher.\n const { value } = resolveField(\n collection,\n doc,\n primaryField(collection),\n activeLocale,\n localeConfig,\n )\n return typeof value === 'string' && value ? value : ref.id\n },\n [documents, registry, localeConfig, activeLocale],\n )\n\n const saveDocument = useCallback((doc: CmsDocument) => {\n setDocuments((prev) => {\n const i = prev.findIndex((d) => d.collection === doc.collection && d.id === doc.id)\n if (i < 0) return [...prev, doc]\n const next = [...prev]\n next[i] = doc\n return next\n })\n persisterRef.current?.upsertDocument(doc)\n }, [])\n\n const commitFieldEdit = useCallback(\n (input: CellCommitInput): Promise<CellCommitOutcome> => {\n const replaceWith = (doc: CmsDocument) =>\n setDocuments((prev) =>\n prev.map((d) => (d.collection === doc.collection && d.id === doc.id ? doc : d)),\n )\n const persister = persisterRef.current\n return commitCellEdit(\n {\n registry,\n documents: documentsRef.current,\n localeConfig,\n applySession: replaceWith,\n rollbackSession: replaceWith,\n ...(persister && projectId !== undefined\n ? {\n dispatch: async (next: CmsDocument) => {\n // Make sure the persisted baseline + every queued mutation\n // landed first, then issue the commit's single command.\n await persister.ensureBaseline()\n const { operations } = await getStudioOperations()\n return operations.documents.upsert({ projectId, document: next })\n },\n }\n : {}),\n },\n input,\n )\n },\n [registry, localeConfig, projectId],\n )\n\n const createDocument = useCallback(\n (collectionId: string): DocumentRef => {\n // EC-316: never reissue an id a document (this session's or a prior\n // one's) already holds — see `mintDocumentId`.\n const existingIds = new Set(\n documentsRef.current.filter((d) => d.collection === collectionId).map((d) => d.id),\n )\n const id = mintDocumentId(collectionId, seq, existingIds)\n // EC-297: seed the collection's declared field defaults at create time.\n const collection = registry.get(collectionId)\n const doc: CmsDocument = {\n collection: collectionId,\n id,\n values: collection ? seedDefaults(collection) : {},\n }\n setDocuments((prev) => [...prev, doc])\n persisterRef.current?.upsertDocument(doc)\n return { collection: collectionId, id }\n },\n [registry],\n )\n\n // EC-274 (re-scopes EC-217): a singleton is a UI lens, not a fixed id. Resolve\n // the collection's lone document and return its ref; if none exists yet, create\n // one with a NORMAL generated id (never the collection id — no code ever names a\n // literal doc id). Idempotent under React effects/StrictMode: the create guard\n // keys on \"any document in this collection\", so a re-invocation never adds a\n // second. On drift (>1 doc) the studio routes to the list, so this defensively\n // returns the first; the empty draft persists like any create.\n const ensureSingletonDocument = useCallback(\n (collectionId: string): DocumentRef => {\n const collection = registry.get(collectionId)\n const resolution = collection\n ? resolveSingletonDocument(collection, documentsRef.current)\n : ({ kind: 'empty' } as const)\n if (resolution.kind === 'ready') {\n return { collection: collectionId, id: resolution.doc.id }\n }\n if (resolution.kind === 'drift') {\n return { collection: collectionId, id: resolution.docs[0]!.id }\n }\n // Empty: create the lone document once. The ref guard (synchronous) plus the\n // updater's \"any doc in collection\" check make this idempotent under a\n // re-invoked effect or StrictMode's double mount — never a second draft.\n const existing = documentsRef.current.find((d) => d.collection === collectionId)\n if (existing) return { collection: collectionId, id: existing.id }\n if (ensuredSingletons.current.has(collectionId)) {\n return { collection: collectionId, id: `new-${collectionId}-pending` }\n }\n ensuredSingletons.current.add(collectionId)\n // EC-316: same collision-free mint as `createDocument` (defensive here —\n // the singleton-empty branch only runs when no document exists yet).\n const existingIds = new Set(\n documentsRef.current.filter((d) => d.collection === collectionId).map((d) => d.id),\n )\n const id = mintDocumentId(collectionId, seq, existingIds)\n // EC-297: seed the singleton's declared field defaults at create time.\n const doc: CmsDocument = {\n collection: collectionId,\n id,\n values: collection ? seedDefaults(collection) : {},\n }\n setDocuments((prev) =>\n prev.some((d) => d.collection === collectionId) ? prev : [...prev, doc],\n )\n persisterRef.current?.upsertDocument(doc)\n return { collection: collectionId, id }\n },\n [registry],\n )\n\n const deleteDocument = useCallback((ref: DocumentRef) => {\n setDocuments((prev) =>\n prev.filter((d) => !(d.collection === ref.collection && d.id === ref.id)),\n )\n persisterRef.current?.deleteDocument(ref)\n }, [])\n\n // EC-224: published-ness IS the version pointer (`publishedKeys`) — the SOLE\n // studio source of truth, read via `isPublished`. The live row stays a\n // continuous draft (Sanity model); no flat `state` mirror is maintained. Every\n // reader now consults the pointer (the table badge/$state via `isPublished`,\n // the preview engine via the pin), so the flat field is read by nothing here.\n const setPublished = useCallback((ref: DocumentRef, published: boolean) => {\n const key = documentKey(ref)\n setPublishedKeys((prev) => {\n if (prev.has(key) === published) return prev\n const next = new Set(prev)\n if (published) next.add(key)\n else next.delete(key)\n return next\n })\n }, [])\n\n const isPublished = useCallback(\n (ref: DocumentRef) => publishedKeys.has(documentKey(ref)),\n [publishedKeys],\n )\n\n // Reconcile published-ness for a ref against the AUTHORITATIVE backend record\n // (EC-225): the optimistic flip is a guess; once the queued op settles we read\n // the actual pin so the badge can never claim a state the backend refused\n // (a publish blocked by field rules, an unpublish blocked by a strict ref).\n const reconcilePublished = useCallback(\n async (ref: DocumentRef) => {\n if (projectId === undefined) return\n const { operations } = await getStudioOperations()\n const record = await operations.documents.get({ projectId, ref })\n if (record.ok) setPublished(ref, record.value.publishedVersion !== undefined)\n },\n [projectId, setPublished],\n )\n\n const publishDocument = useCallback(\n async (ref: DocumentRef) => {\n setPublished(ref, true) // optimistic\n // EC-273: no clearing here — the draft is already free of conditionally-hidden\n // values (the editor clears them on write), so the snapshot the publish op\n // pins is clean by construction.\n persisterRef.current?.publishDocument(ref)\n await persisterRef.current?.flush()\n await reconcilePublished(ref)\n },\n [setPublished, reconcilePublished],\n )\n\n const unpublishDocument = useCallback(\n async (ref: DocumentRef) => {\n setPublished(ref, false) // optimistic\n persisterRef.current?.unpublishDocument(ref)\n await persisterRef.current?.flush()\n await reconcilePublished(ref)\n },\n [setPublished, reconcilePublished],\n )\n\n const loadDocumentVersions = useCallback(\n async (ref: DocumentRef): Promise<DocumentVersionsView> => {\n // No persisted backend (fixture/playground): no recorded history.\n if (projectId === undefined) return { versions: [] }\n const { operations } = await getStudioOperations()\n const [versionsRes, recordRes] = await Promise.all([\n operations.documents.listVersions({ projectId, ref }),\n operations.documents.get({ projectId, ref }),\n ])\n if (!versionsRes.ok) {\n setPersistError(versionsRes.error)\n return { versions: [] }\n }\n // The pinned (live) version comes off the document record; a never-saved\n // doc simply has no record (and no versions) — not an error to surface.\n const publishedVersion = recordRes.ok ? recordRes.value.publishedVersion : undefined\n return {\n versions: versionsRes.value,\n ...(publishedVersion !== undefined ? { publishedVersion } : {}),\n }\n },\n [projectId],\n )\n\n const restoreDocumentVersion = useCallback(\n async (\n ref: DocumentRef,\n version: number,\n scope?: RestoreScope,\n ): Promise<CmsDocument | null> => {\n if (projectId === undefined) return null\n // Land any queued edits before the restore reads the current draft to\n // snapshot it (same ordering contract as commitFieldEdit/runBulk). This is\n // what makes a granular (field/block) restore merge over the LATEST draft.\n await persisterRef.current?.ensureBaseline()\n const { operations } = await getStudioOperations()\n const result = await operations.documents.restore({\n projectId,\n ref,\n version,\n ...(scope ? { scope } : {}),\n })\n if (!result.ok) {\n setPersistError(result.error)\n return null\n }\n const restored = result.value.document\n setDocuments((prev) =>\n prev.map((d) =>\n d.collection === restored.collection && d.id === restored.id ? restored : d,\n ),\n )\n return restored\n },\n [projectId],\n )\n\n const validate = useCallback(\n (doc: CmsDocument) =>\n validateDocument(registry, doc, {\n store,\n localeConfig,\n validateComposition,\n validateRichTextEmbeds,\n // EC-224: the EC-173 weak-reference warning sources published-ness from\n // the version pointer, so editing a published doc that references an\n // unpublished target surfaces the fallback warning again (it had gone\n // inert once the flat `state` mirror was dropped in B-3b).\n isPublished,\n assetExists,\n }),\n [registry, store, localeConfig, isPublished, assetExists],\n )\n\n const importDocuments = useCallback(\n (collectionId: string, raw: unknown[]): ImportReport => {\n const report: ImportReport = { added: 0, rejected: [] }\n // Pre-parse so intra-batch relation/asset targets resolve during validation.\n const parsedBatch: CmsDocument[] = []\n const schemaFails: { item: unknown; error: ReturnType<typeof documentSchema.safeParse> }[] =\n []\n for (const item of raw) {\n const parsed = documentSchema.safeParse({ ...(item as object), collection: collectionId })\n if (parsed.success) parsedBatch.push(parsed.data)\n else schemaFails.push({ item, error: parsed })\n }\n for (const { item, error } of schemaFails) {\n report.rejected.push({\n id: (item as { id?: string })?.id ?? translate('cms.list.import.noId'),\n issues: (error.success ? [] : error.error.issues).map((e) => ({\n code: 'invalid-field-value' as const,\n severity: 'error' as const,\n message: e.message,\n path: e.path.map((p) => (typeof p === 'symbol' ? String(p) : p)),\n })),\n })\n }\n // Validate each against existing docs PLUS the rest of the batch.\n const batchStore = createDocumentStore([...documents, ...parsedBatch])\n const accepted: CmsDocument[] = []\n for (const doc of parsedBatch) {\n const issues = validateDocument(registry, doc, { store: batchStore, localeConfig, assetExists })\n const errors = issues.filter((iss) => iss.severity === 'error')\n if (errors.length > 0) report.rejected.push({ id: doc.id, issues: errors })\n else accepted.push(doc)\n }\n if (accepted.length > 0) {\n setDocuments((prev) => {\n const next = [...prev]\n for (const doc of accepted) {\n const i = next.findIndex((d) => d.collection === doc.collection && d.id === doc.id)\n if (i < 0) next.push(doc)\n else next[i] = doc\n }\n return next\n })\n for (const doc of accepted) persisterRef.current?.upsertDocument(doc)\n // EC-224: imports land as the working DRAFT. Publish-ness is the version\n // pointer (`publishedKeys`), set by publishing — never carried in the\n // imported row — so an import never auto-publishes; the editor publishes\n // explicitly afterward.\n report.added = accepted.length\n }\n return report\n },\n [registry, documents, localeConfig, assetExists],\n )\n\n const isFieldReadOnly = useCallback((field: FieldDef) => field.form?.readOnly === true, [])\n\n // --- Views (EC-246b: config-as-code) --------------------------------------\n\n const viewsOf = useCallback(\n (collectionId: string): SavedView[] => {\n // The built-in default plus the collection's config-declared views (EC-246b).\n // Views are PRESENTATION, read live from elytra.config.ts (AD-11) — not the\n // persisted content schema the session booted from — so they reflect code\n // immediately without a re-seed (the persisted schema is only baselined on\n // first run). The EC-169 DB saved-view store is retired: shared views are\n // code, editors keep only transient in-session tweaks + Reset.\n const configCollection = resolveDeploymentCollections().find((c) => c.id === collectionId)\n return [\n defaultView(registry.get(collectionId)),\n ...(configCollection ? configViewsFor(configCollection) : []),\n ]\n },\n [registry],\n )\n\n const activeViewOf = useCallback(\n (collectionId: string): SavedView => {\n const id = activeViews[collectionId] ?? ALL_VIEW_ID\n return (\n viewsOf(collectionId).find((view) => view.id === id) ??\n defaultView(registry.get(collectionId))\n )\n },\n [activeViews, viewsOf, registry],\n )\n\n const tableStateOf = useCallback(\n (collectionId: string): TableViewState =>\n tableStates[collectionId] ?? activeViewOf(collectionId).state,\n [tableStates, activeViewOf],\n )\n\n const dropTableState = useCallback((collectionId: string) => {\n setTableStates((prev) => {\n if (!(collectionId in prev)) return prev\n const next = { ...prev }\n delete next[collectionId]\n return next\n })\n }, [])\n\n const setActiveView = useCallback(\n (collectionId: string, viewId: string) => {\n setActiveViews((prev) => ({ ...prev, [collectionId]: viewId }))\n dropTableState(collectionId)\n },\n [dropTableState],\n )\n\n // --- Bulk actions (EC-169) ------------------------------------------------\n\n const runBulk = useCallback(\n async (\n collectionId: string,\n ids: readonly string[],\n action: BulkAction,\n setField?: BulkSetField,\n ): Promise<BulkReport> => {\n const collection = registry.get(collectionId)\n // A set-field needs both the field payload AND the collection def to fold\n // the value the locale-aware way — guard so a misconfigured call fails\n // loud rather than silently no-opping each item.\n if (action === 'set-field' && (!setField || !collection)) {\n return {\n action,\n ...(setField ? { setField } : {}),\n results: ids.map((id) => ({\n ref: { collection: collectionId, id },\n title: titleOf({ collection: collectionId, id }),\n ok: false,\n reason: translate('cms.list.bulk.error.invalidSetField'),\n error: { code: 'unknown', message: 'Invalid set-field request.' },\n })),\n }\n }\n // The next document for a set-field item: fold the value into the active\n // locale's bag (localized) or the shared `values` (non-localized).\n const setFieldDoc = (doc: CmsDocument): CmsDocument =>\n applyCellValue(collection!, doc, setField!.field, activeLocale, setField!.value)\n\n let dispatch:\n | ((action: BulkAction, ref: DocumentRef) => Promise<OperationResult<unknown>>)\n | undefined\n const persister = persisterRef.current\n if (persister && projectId !== undefined) {\n // Pending queued mutations + baseline land first, then one awaited\n // command per item (same ordering contract as commitFieldEdit).\n await persister.ensureBaseline()\n const { operations } = await getStudioOperations()\n dispatch = (bulkAction, ref) => {\n if (bulkAction === 'delete') return operations.documents.delete({ projectId, ref })\n if (bulkAction === 'publish') return operations.documents.publish({ projectId, ref })\n if (bulkAction === 'unpublish') return operations.documents.unpublish({ projectId, ref })\n // set-field: upsert the document carrying the new value. The write\n // path self-types it through the schema lens (EC-277); a scalar field\n // stores its scalar as-is.\n const current = documentsRef.current.find(\n (d) => d.collection === ref.collection && d.id === ref.id,\n )\n if (!current) {\n return Promise.resolve<OperationResult<unknown>>({\n ok: false,\n error: {\n code: 'not-found',\n message: 'Document is no longer in the session.',\n entity: 'cms-document',\n key: `${ref.collection}:${ref.id}`,\n },\n })\n }\n return operations.documents.upsert({ projectId, document: setFieldDoc(current) })\n }\n }\n return runBulkAction(\n {\n documents: documentsRef.current,\n titleOf,\n validate: (doc) =>\n validateDocument(registry, doc, {\n store: createDocumentStore(documentsRef.current),\n localeConfig,\n // EC-225: include the composition validators so a bulk PUBLISH\n // gates blocks/richText validity the same way the detail editor\n // does — the operations-layer publish gate has no component\n // registry, so composition validity is a studio-validation invariant.\n validateComposition,\n validateRichTextEmbeds,\n assetExists,\n }),\n // EC-224: a succeeded publish/unpublish moves the version pointer\n // (`publishedKeys`) via setPublished — there is no separate flat\n // `state` mirror to keep in sync (published-ness is derived from the\n // pointer set).\n applyState: (ref, state) => setPublished(ref, state === 'published'),\n applyDelete: (ref) =>\n setDocuments((prev) =>\n prev.filter((d) => !(d.collection === ref.collection && d.id === ref.id)),\n ),\n // EC-247: fold the new value into the session document (same\n // locale-aware path the dispatched upsert used).\n applySetField: (ref) =>\n setDocuments((prev) =>\n prev.map((d) =>\n d.collection === ref.collection && d.id === ref.id ? setFieldDoc(d) : d,\n ),\n ),\n ...(dispatch ? { dispatch } : {}),\n },\n collectionId,\n ids,\n action,\n setField,\n )\n },\n [projectId, titleOf, registry, localeConfig, activeLocale, setPublished, assetExists],\n )\n\n const store$ = useMemo<CmsStore>(\n () => ({\n ...(projectId !== undefined ? { projectId } : {}),\n collections,\n localeConfig,\n activeLocale,\n getCollection,\n documentsOf: (collectionId) => documents.filter((d) => d.collection === collectionId),\n getDocument,\n titleOf,\n saveDocument,\n commitFieldEdit,\n createDocument,\n ensureSingletonDocument,\n deleteDocument,\n isPublished,\n publishDocument,\n unpublishDocument,\n loadDocumentVersions,\n restoreDocumentVersion,\n importDocuments,\n validate,\n isFieldReadOnly,\n viewsOf,\n activeViewId: (collectionId) => activeViews[collectionId] ?? ALL_VIEW_ID,\n setActiveView,\n tableStateOf,\n setTableState: (collectionId, update) =>\n setTableStates((prev) => {\n const current = prev[collectionId] ?? activeViewOf(collectionId).state\n const next = typeof update === 'function' ? update(current) : update\n return { ...prev, [collectionId]: next }\n }),\n isViewDirty: (collectionId) => {\n const working = tableStates[collectionId]\n if (working === undefined) return false\n const active = activeViewOf(collectionId).state\n const collection = registry.get(collectionId)\n if (collection === undefined) return !viewStatesEqual(working, active)\n // Compare schema-resolved forms (EC-213): a column-order reconciliation\n // or a stale `hidden` entry must not read as an unsaved edit.\n return !viewStatesEqual(\n canonicalViewState(collection, working),\n canonicalViewState(collection, active),\n )\n },\n resetTableState: dropTableState,\n runBulk,\n addCollection: (def) =>\n setCollections((prev) => [...prev.filter((c) => c.id !== def.id), def]),\n persistError,\n clearPersistError: () => setPersistError(null),\n ensurePersistedBaseline: () => persisterRef.current?.ensureBaseline() ?? Promise.resolve(),\n flushPersistence: () => persisterRef.current?.flush() ?? Promise.resolve(),\n }),\n [\n projectId,\n collections,\n documents,\n localeConfig,\n activeLocale,\n getCollection,\n getDocument,\n titleOf,\n saveDocument,\n commitFieldEdit,\n createDocument,\n ensureSingletonDocument,\n deleteDocument,\n isPublished,\n publishDocument,\n unpublishDocument,\n loadDocumentVersions,\n restoreDocumentVersion,\n importDocuments,\n validate,\n isFieldReadOnly,\n viewsOf,\n activeViews,\n activeViewOf,\n tableStates,\n tableStateOf,\n setActiveView,\n dropTableState,\n runBulk,\n registry,\n persistError,\n ],\n )\n\n return <CmsContext.Provider value={store$}>{children}</CmsContext.Provider>\n}\n\nexport function useCms(): CmsStore {\n const store = useContext(CmsContext)\n if (!store) throw new Error('useCms must be used within a <CmsProvider>.')\n return store\n}\n\n/**\n * A field's display label (EC-241): resolve its (possibly localized) `form.label`,\n * falling back to the field name. **`locale` defaults to the active UI locale** —\n * a bare `fieldLabel(field)` localizes a `{ en, de }` map against the browser locale\n * (via the non-hook `localizedLabel`), so a German editor sees German labels. Pass an\n * explicit `locale` only to force a specific one (e.g. a content-locale variant view).\n */\nexport function fieldLabel(field: FieldDef, locale?: string): string {\n // A catalog-backed built-in-rail label (msgLabel) always resolves through the\n // catalog against the active UI locale, ignoring a content-locale override — a rail\n // is chrome, not localized content.\n const chrome = resolveMsgLabel(field.form?.label)\n if (chrome !== undefined) return chrome\n if (locale !== undefined) return resolveLabel(field.form?.label, locale) ?? field.name\n return localizedLabel(field.form?.label, field.name)\n}\n\nexport { primaryField }\nexport type { Locale }\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import type { FieldDef } from '@elytracms/core/cms-core';
|
|
2
3
|
export declare function CollectionTable({ projectId, collectionId }: {
|
|
3
4
|
projectId: string;
|
|
@@ -10,7 +11,13 @@ export declare function CollectionTable({ projectId, collectionId }: {
|
|
|
10
11
|
* {@link CollectionViewProvider} over its own source. `CollectionTable` is just
|
|
11
12
|
* the CMS entry point that builds a CMS source and mounts this.
|
|
12
13
|
*/
|
|
13
|
-
export declare function LoadedCollectionTable({ projectId }: {
|
|
14
|
+
export declare function LoadedCollectionTable({ projectId, toolbarExtra, }: {
|
|
14
15
|
projectId: string;
|
|
16
|
+
/**
|
|
17
|
+
* A rail-owned action rendered at the tail of the header toolbar (EC-319) —
|
|
18
|
+
* e.g. the assets rail's Upload button + grid/list toggle. Absent for every
|
|
19
|
+
* other rail today (users, redirects, CMS), so their toolbar is unchanged.
|
|
20
|
+
*/
|
|
21
|
+
toolbarExtra?: ReactNode;
|
|
15
22
|
}): import("react").JSX.Element;
|
|
16
23
|
export type { FieldDef };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link, STUDIO_PROJECT_ROUTE, studioPath, useNavigate } from '@elytracms/studio/router';
|
|
3
|
-
import { ArrowDown, ArrowUp, CornerDownRight, Download, ExternalLink, MoreHorizontal, Plus, Upload } from 'lucide-react';
|
|
3
|
+
import { ArrowDown, ArrowUp, CornerDownRight, Download, Eye, EyeOff, ExternalLink, MoreHorizontal, Pencil, Plus, Trash2, Upload, } from 'lucide-react';
|
|
4
4
|
import { useMemo, useState } from 'react';
|
|
5
5
|
import { orderHierarchically, resolveDocumentForLocale, resolveDocumentTitle, validateCollectionShape, } from '@elytracms/core/cms-core';
|
|
6
6
|
import { Button, Code, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Row, Separator, Spacer, Stack, Text, } from '@elytracms/studio/ui';
|
|
@@ -17,6 +17,8 @@ import { fieldLabel } from './cms-store';
|
|
|
17
17
|
import { cmsIssueLabel } from '@elytracms/studio/lib/persona/labels';
|
|
18
18
|
import { TriangleAlert } from 'lucide-react';
|
|
19
19
|
import { BulkBar, BulkReportPanel } from './bulk-bar';
|
|
20
|
+
import { rowActionsFor } from './row-actions';
|
|
21
|
+
import { CHECKBOX_COLUMN_WIDTH_REM, PRIMARY_COLUMN_WIDTH_REM, ROW_ACTIONS_COLUMN_WIDTH_REM, STATE_COLUMN_WIDTH_REM, URL_COLUMN_WIDTH_REM, columnWidthRem, } from './column-width';
|
|
20
22
|
import { ReferenceConfirmDialog } from './reference-confirm';
|
|
21
23
|
import { FilterControl } from './filter-builder';
|
|
22
24
|
import { DisplayMenu, ViewTabs } from './view-bar';
|
|
@@ -41,7 +43,7 @@ export function CollectionTable({ projectId, collectionId }) {
|
|
|
41
43
|
* {@link CollectionViewProvider} over its own source. `CollectionTable` is just
|
|
42
44
|
* the CMS entry point that builds a CMS source and mounts this.
|
|
43
45
|
*/
|
|
44
|
-
export function LoadedCollectionTable({ projectId }) {
|
|
46
|
+
export function LoadedCollectionTable({ projectId, toolbarExtra, }) {
|
|
45
47
|
const source = useCollectionView();
|
|
46
48
|
const collection = source.schema;
|
|
47
49
|
const navigate = useNavigate();
|
|
@@ -121,6 +123,10 @@ export function LoadedCollectionTable({ projectId }) {
|
|
|
121
123
|
// Selection is always read against the current view — rows the filters hid
|
|
122
124
|
// are never silently included in a bulk action.
|
|
123
125
|
const selectedIds = visibleSelection(selection, visibleIds);
|
|
126
|
+
// EC-316: the right-edge row menu is a capability-gated column — a rail with
|
|
127
|
+
// no detail surface AND no publish/remove capability offers nothing (users
|
|
128
|
+
// rail today has remove, so this is rarely empty; kept honest for AD-19).
|
|
129
|
+
const hasRowActions = source.detailPath !== undefined || source.capabilities.publish || source.capabilities.remove;
|
|
124
130
|
function toggleSort(field) {
|
|
125
131
|
source.setViewState((prev) => {
|
|
126
132
|
const sort = prev.sort?.field !== field
|
|
@@ -147,6 +153,27 @@ export function LoadedCollectionTable({ projectId }) {
|
|
|
147
153
|
targets: selectedIds.map((id) => ({ collection: collectionId, id })),
|
|
148
154
|
});
|
|
149
155
|
}
|
|
156
|
+
// EC-316: the row `⋮` menu dispatches through the SAME machinery as the
|
|
157
|
+
// toolbar's bulk actions — one document is just a selection of one — so
|
|
158
|
+
// there is exactly one write path for publish/unpublish/delete, never a
|
|
159
|
+
// parallel one. `open` is the row menu's own affordance (the primary-column
|
|
160
|
+
// link already offers it; this is the keyboard/menu-driven equivalent).
|
|
161
|
+
function handleRowAction(action, doc) {
|
|
162
|
+
if (action === 'open') {
|
|
163
|
+
const splat = source.detailPath?.(doc.id);
|
|
164
|
+
if (splat === undefined)
|
|
165
|
+
return;
|
|
166
|
+
navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } });
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (action === 'publish') {
|
|
170
|
+
void handleBulk(action, [doc.id]);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// unpublish/delete: the same reference-aware confirmation the bulk bar
|
|
174
|
+
// raises, scoped to this one document.
|
|
175
|
+
setPendingBulk({ action, targets: [{ collection: collectionId, id: doc.id }] });
|
|
176
|
+
}
|
|
150
177
|
async function handleBulk(action, acted, setField) {
|
|
151
178
|
if (!source.bulk)
|
|
152
179
|
return;
|
|
@@ -176,7 +203,7 @@ export function LoadedCollectionTable({ projectId }) {
|
|
|
176
203
|
a.click();
|
|
177
204
|
URL.revokeObjectURL(url);
|
|
178
205
|
}
|
|
179
|
-
return (_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsx("div", { className: "shrink-0 border-b border-border px-4 py-3 sm:px-6", children: _jsxs(Row, { gap: "2", wrap: true, children: [_jsx(ViewTabs, {}), _jsx(FilterControl, { collection: collection }), _jsx(Separator, { orientation: "vertical", className: "h-5 self-center" }), _jsx(Text, { as: "span", size: "xs", tone: "muted", className: "whitespace-nowrap tabular-nums", "data-testid": "collection-count", children: countLabel }), _jsx(Spacer, {}), source.capabilities.locales ? _jsx(LocaleSwitcher, {}) : null, _jsx(DisplayMenu, { collection: collection, hierarchical: hierarchical, treeMode: treeMode, onToggleTree: setTreeMode }), canCreate ? (_jsxs(Button, { size: "sm", onClick: handleNew, "data-testid": "new-document", children: [_jsx(Plus, {}), " ", isPageCollection ? translate('cms.list.newPage') : translate('cms.list.new')] })) : null, source.capabilities.importExport ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": translate('cms.list.moreActions'), "data-testid": "collection-actions", children: _jsx(MoreHorizontal, {}) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => setImportOpen(true), "data-testid": "action-import", children: [_jsx(Upload, {}), " ", translate('cms.list.import')] }), _jsxs(DropdownMenuItem, { onClick: exportJson, disabled: docs.length === 0, "data-testid": "action-export", children: [_jsx(Download, {}), " ", translate('cms.list.export')] })] })] })) : null] }) }), _jsx(BulkBar, { collection: collection, count: selectedIds.length, busy: bulkBusy, onAction: raiseBulk, onSetField: (setField) => void handleBulk('set-field', [...selectedIds], setField), onClear: () => setSelection(clearSelection()) }), bulkReport ? (_jsx(BulkReportPanel, { report: bulkReport, onDismiss: () => setBulkReport(null) })) : null, pendingBulk !== null ? (_jsx(ReferenceConfirmDialog, { projectId: projectId, action: pendingBulk.action, targets: pendingBulk.targets, open: true, busy: bulkBusy, onOpenChange: (open) => {
|
|
206
|
+
return (_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsx("div", { className: "shrink-0 border-b border-border px-4 py-3 sm:px-6", children: _jsxs(Row, { gap: "2", wrap: true, children: [_jsx(ViewTabs, {}), _jsx(FilterControl, { collection: collection }), _jsx(Separator, { orientation: "vertical", className: "h-5 self-center" }), _jsx(Text, { as: "span", size: "xs", tone: "muted", className: "whitespace-nowrap tabular-nums", "data-testid": "collection-count", children: countLabel }), _jsx(Spacer, {}), source.capabilities.locales ? _jsx(LocaleSwitcher, {}) : null, _jsx(DisplayMenu, { collection: collection, hierarchical: hierarchical, treeMode: treeMode, onToggleTree: setTreeMode }), canCreate ? (_jsxs(Button, { size: "sm", onClick: handleNew, "data-testid": "new-document", children: [_jsx(Plus, {}), " ", isPageCollection ? translate('cms.list.newPage') : translate('cms.list.new')] })) : null, source.capabilities.importExport ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": translate('cms.list.moreActions'), "data-testid": "collection-actions", children: _jsx(MoreHorizontal, {}) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => setImportOpen(true), "data-testid": "action-import", children: [_jsx(Upload, {}), " ", translate('cms.list.import')] }), _jsxs(DropdownMenuItem, { onClick: exportJson, disabled: docs.length === 0, "data-testid": "action-export", children: [_jsx(Download, {}), " ", translate('cms.list.export')] })] })] })) : null, toolbarExtra] }) }), _jsx(BulkBar, { collection: collection, count: selectedIds.length, busy: bulkBusy, onAction: raiseBulk, onSetField: (setField) => void handleBulk('set-field', [...selectedIds], setField), onClear: () => setSelection(clearSelection()) }), bulkReport ? (_jsx(BulkReportPanel, { report: bulkReport, onDismiss: () => setBulkReport(null) })) : null, pendingBulk !== null ? (_jsx(ReferenceConfirmDialog, { projectId: projectId, action: pendingBulk.action, targets: pendingBulk.targets, open: true, busy: bulkBusy, onOpenChange: (open) => {
|
|
180
207
|
if (!open)
|
|
181
208
|
setPendingBulk(null);
|
|
182
209
|
}, onConfirm: () => {
|
|
@@ -189,7 +216,7 @@ export function LoadedCollectionTable({ projectId }) {
|
|
|
189
216
|
noun: localizedLabel(collection.form?.labelSingular, 'document'),
|
|
190
217
|
})] })) : null] }) })) : visibleDocs.length === 0 ? (_jsx("div", { className: "grid h-full place-items-center p-8", children: _jsx(Text, { tone: "muted", "data-testid": "empty-filtered", children: translate('cms.list.emptyFiltered') }) })) : (_jsx(DocumentsGrid, { projectId: projectId, collection: collection, primary: primary, primaryFieldDef: primaryFieldDef, columns: columns, sortedDocs: orderedDocs, depthById: depthById, urlByDocId: urlByDocId, sort: viewState.sort, onSort: toggleSort, selectedIds: selectedIds, onToggleRow: (id, shift) => setSelection((prev) => toggleRow(prev, visibleIds, id, shift)), onToggleAll: () => setSelection(selectedIds.length === visibleIds.length && visibleIds.length > 0
|
|
191
218
|
? clearSelection()
|
|
192
|
-
: selectAll(visibleIds)) })) }), source.capabilities.importExport ? (_jsx(ImportDialog, { collectionId: collectionId, open: importOpen, onOpenChange: setImportOpen })) : null] }));
|
|
219
|
+
: selectAll(visibleIds)), hasRowActions: hasRowActions, onRowAction: handleRowAction })) }), source.capabilities.importExport ? (_jsx(ImportDialog, { collectionId: collectionId, open: importOpen, onOpenChange: setImportOpen })) : null] }));
|
|
193
220
|
}
|
|
194
221
|
/**
|
|
195
222
|
* The documents table with inline cell editing (EC-168). Cells edit in place
|
|
@@ -198,7 +225,7 @@ export function LoadedCollectionTable({ projectId }) {
|
|
|
198
225
|
* rollback + inline cell errors on rejection. Row checkboxes (EC-169) live in
|
|
199
226
|
* their own column, so selection clicks never collide with cell editing.
|
|
200
227
|
*/
|
|
201
|
-
function DocumentsGrid({ projectId, collection, primary, primaryFieldDef, columns, sortedDocs, depthById, urlByDocId, sort, onSort, selectedIds, onToggleRow, onToggleAll, }) {
|
|
228
|
+
function DocumentsGrid({ projectId, collection, primary, primaryFieldDef, columns, sortedDocs, depthById, urlByDocId, sort, onSort, selectedIds, onToggleRow, onToggleAll, hasRowActions, onRowAction, }) {
|
|
202
229
|
const source = useCollectionView();
|
|
203
230
|
const collectionId = collection.id;
|
|
204
231
|
const fieldByName = (name) => collection.fields.find((f) => f.name === name);
|
|
@@ -212,15 +239,40 @@ function DocumentsGrid({ projectId, collection, primary, primaryFieldDef, column
|
|
|
212
239
|
const cellEdit = useCellEdit({ collection, docs: sortedDocs, editableFields });
|
|
213
240
|
const selected = new Set(selectedIds);
|
|
214
241
|
const allSelected = sortedDocs.length > 0 && selectedIds.length === sortedDocs.length;
|
|
215
|
-
return (_jsx("div", { ref: cellEdit.containerRef, children: _jsxs("table", { className: "w-full border-collapse text-sm", children: [_jsx("thead", { className: "sticky top-0 z-10 bg-background", children: _jsxs("tr", { className: "border-b border-border", children: [_jsx("th", { className: "
|
|
242
|
+
return (_jsx("div", { ref: cellEdit.containerRef, children: _jsxs("table", { className: "w-full table-fixed border-collapse text-sm", children: [_jsxs("colgroup", { children: [_jsx("col", { style: { width: `${CHECKBOX_COLUMN_WIDTH_REM}rem` } }), _jsx("col", { style: { width: `${PRIMARY_COLUMN_WIDTH_REM}rem` } }), columns.map((name) => (_jsx("col", { style: { width: `${columnWidthRem(fieldByName(name))}rem` } }, name))), _jsx("col", { style: { width: `${STATE_COLUMN_WIDTH_REM}rem` } }), urlByDocId ? _jsx("col", { style: { width: `${URL_COLUMN_WIDTH_REM}rem` } }) : null, hasRowActions ? _jsx("col", { style: { width: `${ROW_ACTIONS_COLUMN_WIDTH_REM}rem` } }) : null] }), _jsx("thead", { className: "sticky top-0 z-10 bg-background", children: _jsxs("tr", { className: "border-b border-border", children: [_jsx("th", { className: "px-3 py-2 text-left", children: _jsx(SelectionCheckbox, { checked: allSelected, indeterminate: selectedIds.length > 0 && !allSelected, label: translate('cms.list.selectAll'), testId: "select-all", onToggle: () => onToggleAll() }) }), _jsx(HeaderCell, { field: primary, label: primaryFieldDef ? fieldLabel(primaryFieldDef) : translate('cms.list.column.title'), sort: sort, onSort: onSort }), columns.map((name) => {
|
|
216
243
|
const field = fieldByName(name);
|
|
217
244
|
return field ? (_jsx(HeaderCell, { field: name, label: fieldLabel(field), sort: sort, onSort: onSort }, name)) : null;
|
|
218
|
-
}), _jsx(HeaderCell, { field: STATE_FIELD, label: translate('cms.list.column.state'), sort: sort, onSort: onSort }), urlByDocId ? (_jsx("th", { className: "px-3 py-2 text-left text-xs font-semibold text-muted-foreground", children: translate('cms.list.column.url') })) : null] }) }), _jsx("tbody", { children: sortedDocs.map((doc) => (_jsxs("tr", { className: cn('group border-b border-border/60 hover:bg-muted/40', selected.has(doc.id) && 'bg-primary/5'), children: [_jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(SelectionCheckbox, { checked: selected.has(doc.id), label: translate('cms.list.selectRow', { id: doc.id }), testId: `select-row-${doc.id}`, onToggle: (shift) => onToggleRow(doc.id, shift) }) }), _jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(PrimaryCell, { projectId: projectId, collection: collection, doc: doc, primary: primary, depth: depthById?.get(doc.id) ?? 0, locale: source.activeLocale, config: source.localeConfig, detailPath: source.detailPath }) }), columns.map((name) => {
|
|
245
|
+
}), _jsx(HeaderCell, { field: STATE_FIELD, label: translate('cms.list.column.state'), sort: sort, onSort: onSort }), urlByDocId ? (_jsx("th", { className: "px-3 py-2 text-left text-xs font-semibold text-muted-foreground", children: translate('cms.list.column.url') })) : null, hasRowActions ? (_jsx("th", { className: "px-2 py-2 text-right", children: _jsx("span", { className: "sr-only", children: translate('cms.list.rowActionsColumnLabel') }) })) : null] }) }), _jsx("tbody", { children: sortedDocs.map((doc) => (_jsxs("tr", { className: cn('group border-b border-border/60 hover:bg-muted/40', selected.has(doc.id) && 'bg-primary/5'), children: [_jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(SelectionCheckbox, { checked: selected.has(doc.id), label: translate('cms.list.selectRow', { id: doc.id }), testId: `select-row-${doc.id}`, onToggle: (shift) => onToggleRow(doc.id, shift) }) }), _jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(PrimaryCell, { projectId: projectId, collection: collection, doc: doc, primary: primary, depth: depthById?.get(doc.id) ?? 0, locale: source.activeLocale, config: source.localeConfig, detailPath: source.detailPath }) }), columns.map((name) => {
|
|
219
246
|
const field = fieldByName(name);
|
|
220
247
|
const coord = { docId: doc.id, field: name };
|
|
221
248
|
const key = cellKey(coord);
|
|
222
249
|
return (_jsx("td", { className: "px-3 py-2 align-middle", children: field ? (_jsx(EditableCell, { collection: collection, doc: doc, field: field, editing: cellEdit.activeKey === key, busy: cellEdit.busyKey === key, errorMessage: cellEdit.errorOf(key), onStartEdit: () => cellEdit.start(coord), onCancel: () => cellEdit.cancel(coord), onCommit: (value, advance) => cellEdit.commit(coord, value, advance) })) : null }, name));
|
|
223
|
-
}), _jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(DocStateBadge, { published: source.publishing?.isPublished({ collection: collectionId, id: doc.id }) ?? false }) }), urlByDocId ? (_jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(UrlCell, { url: urlByDocId.get(doc.id) }) })) : null] }, doc.id))) })] }) }));
|
|
250
|
+
}), _jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(DocStateBadge, { published: source.publishing?.isPublished({ collection: collectionId, id: doc.id }) ?? false }) }), urlByDocId ? (_jsx("td", { className: "px-3 py-2 align-middle", children: _jsx(UrlCell, { url: urlByDocId.get(doc.id) }) })) : null, hasRowActions ? (_jsx("td", { className: "px-2 py-2 text-right align-middle", children: _jsx(RowActionsMenu, { doc: doc, published: source.publishing?.isPublished({ collection: collectionId, id: doc.id }) ?? false, hasDetailPath: source.detailPath !== undefined, onAction: (action) => onRowAction(action, doc) }) })) : null] }, doc.id))) })] }) }));
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The right-edge row `⋮` menu (EC-316): the SAME action vocabulary as the
|
|
254
|
+
* toolbar's bulk actions (`rowActionsFor`), gated by the SAME capabilities —
|
|
255
|
+
* so it degrades exactly like the rest of the list for a rail without
|
|
256
|
+
* publish/remove (AD-19). Renders nothing when the gate leaves zero actions.
|
|
257
|
+
*/
|
|
258
|
+
function RowActionsMenu({ doc, published, hasDetailPath, onAction, }) {
|
|
259
|
+
const source = useCollectionView();
|
|
260
|
+
const actions = rowActionsFor({ capabilities: source.capabilities, hasDetailPath, published });
|
|
261
|
+
if (actions.length === 0)
|
|
262
|
+
return null;
|
|
263
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": translate('cms.list.rowActionsLabel', { id: doc.id }), "data-testid": `row-actions-${doc.id}`, children: _jsx(MoreHorizontal, {}) }) }), _jsx(DropdownMenuContent, { align: "end", children: actions.map((action) => (_jsx(RowActionItem, { action: action, onSelect: () => onAction(action) }, action))) })] }));
|
|
264
|
+
}
|
|
265
|
+
function RowActionItem({ action, onSelect }) {
|
|
266
|
+
switch (action) {
|
|
267
|
+
case 'open':
|
|
268
|
+
return (_jsxs(DropdownMenuItem, { onClick: onSelect, "data-testid": "row-action-open", children: [_jsx(Pencil, {}), " ", translate('cms.list.rowAction.open')] }));
|
|
269
|
+
case 'publish':
|
|
270
|
+
return (_jsxs(DropdownMenuItem, { onClick: onSelect, "data-testid": "row-action-publish", children: [_jsx(Eye, {}), " ", translate('cms.list.bulk.publish')] }));
|
|
271
|
+
case 'unpublish':
|
|
272
|
+
return (_jsxs(DropdownMenuItem, { onClick: onSelect, "data-testid": "row-action-unpublish", children: [_jsx(EyeOff, {}), " ", translate('cms.list.bulk.unpublish')] }));
|
|
273
|
+
case 'delete':
|
|
274
|
+
return (_jsxs(DropdownMenuItem, { variant: "destructive", onClick: onSelect, "data-testid": "row-action-delete", children: [_jsx(Trash2, {}), " ", translate('common.delete')] }));
|
|
275
|
+
}
|
|
224
276
|
}
|
|
225
277
|
/**
|
|
226
278
|
* A selection checkbox (row or select-all). Its own column and focus target —
|
|
@@ -241,9 +293,9 @@ function SelectionCheckbox({ checked, indeterminate = false, label, testId, onTo
|
|
|
241
293
|
event.preventDefault();
|
|
242
294
|
} }));
|
|
243
295
|
}
|
|
244
|
-
function HeaderCell({ field, label, sort, onSort,
|
|
296
|
+
function HeaderCell({ field, label, sort, onSort, }) {
|
|
245
297
|
const active = sort?.field === field;
|
|
246
|
-
return (_jsx("th", { className:
|
|
298
|
+
return (_jsx("th", { className: "px-3 py-2 text-left text-xs font-semibold text-muted-foreground", children: _jsxs("button", { type: "button", onClick: () => onSort(field), className: "inline-flex items-center gap-1 hover:text-foreground", children: [label, active ? (sort.dir === 'asc' ? (_jsx(ArrowUp, { className: "size-3" })) : (_jsx(ArrowDown, { className: "size-3" }))) : null] }) }));
|
|
247
299
|
}
|
|
248
300
|
/**
|
|
249
301
|
* The primary (title) column cell: the document link, resolved in the
|