@elytracms/studio 0.0.85 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/convex/asset-revalidate.test.ts +186 -0
- package/convex/assets.ts +53 -19
- package/convex/cms.ts +22 -0
- package/convex/delivery.ts +54 -116
- package/convex/engine-version.test.ts +31 -0
- package/convex/functions.ts +3 -3
- package/convex/rail-write-parity.test.ts +180 -0
- package/convex/redirects.ts +33 -11
- package/convex/revalidate.ts +7 -5
- package/convex/triggers.ts +53 -3
- package/dist/components/ai/ai-chat-panel.js +13 -2
- package/dist/components/ai/ai-chat-panel.js.map +1 -1
- package/dist/components/app-views/default-modules.d.ts +20 -20
- package/dist/components/app-views/default-modules.js +27 -48
- package/dist/components/app-views/default-modules.js.map +1 -1
- package/dist/components/app-views/studio-config.d.ts +5 -6
- package/dist/components/app-views/studio-config.js.map +1 -1
- package/dist/components/assets/asset-metadata.d.ts +28 -19
- package/dist/components/assets/asset-metadata.js +24 -31
- package/dist/components/assets/asset-metadata.js.map +1 -1
- package/dist/components/assets/asset-selection.d.ts +24 -5
- package/dist/components/assets/asset-selection.js +39 -9
- package/dist/components/assets/asset-selection.js.map +1 -1
- package/dist/components/assets/assets-collection-view-source.d.ts +17 -14
- package/dist/components/assets/assets-collection-view-source.js +25 -31
- package/dist/components/assets/assets-collection-view-source.js.map +1 -1
- package/dist/components/builder/blocks-model.d.ts +5 -4
- package/dist/components/builder/blocks-model.js +5 -4
- package/dist/components/builder/blocks-model.js.map +1 -1
- package/dist/components/builder/blocks-panel.js +3 -3
- package/dist/components/builder/blocks-panel.js.map +1 -1
- package/dist/components/builder/builder-store.d.ts +25 -1
- package/dist/components/builder/builder-store.js +3 -2
- package/dist/components/builder/builder-store.js.map +1 -1
- package/dist/components/builder/canvas-chrome-css.js +0 -17
- package/dist/components/builder/canvas-chrome-css.js.map +1 -1
- package/dist/components/builder/canvas-chrome.d.ts +10 -12
- package/dist/components/builder/canvas-chrome.js +12 -13
- package/dist/components/builder/canvas-chrome.js.map +1 -1
- package/dist/components/builder/canvas-dnd.d.ts +8 -0
- package/dist/components/builder/canvas-dnd.js +5 -3
- package/dist/components/builder/canvas-dnd.js.map +1 -1
- package/dist/components/builder/canvas-render-context.d.ts +12 -24
- package/dist/components/builder/canvas-render-context.js +15 -44
- package/dist/components/builder/canvas-render-context.js.map +1 -1
- package/dist/components/builder/canvas.js +5 -11
- package/dist/components/builder/canvas.js.map +1 -1
- package/dist/components/builder/clipboard-actions.d.ts +15 -1
- package/dist/components/builder/clipboard-actions.js +35 -12
- package/dist/components/builder/clipboard-actions.js.map +1 -1
- package/dist/components/builder/composition-field-editor.d.ts +32 -26
- package/dist/components/builder/composition-field-editor.js +47 -54
- package/dist/components/builder/composition-field-editor.js.map +1 -1
- package/dist/components/builder/insert-context.d.ts +3 -1
- package/dist/components/builder/insert-context.js +19 -12
- package/dist/components/builder/insert-context.js.map +1 -1
- package/dist/components/builder/page-tree.d.ts +29 -0
- package/dist/components/builder/page-tree.js +56 -58
- package/dist/components/builder/page-tree.js.map +1 -1
- package/dist/components/builder/reuse.js +5 -2
- package/dist/components/builder/reuse.js.map +1 -1
- package/dist/components/cms/asset-field.js +20 -32
- package/dist/components/cms/asset-field.js.map +1 -1
- package/dist/components/cms/cell-edit.d.ts +7 -0
- package/dist/components/cms/cell-edit.js +9 -1
- package/dist/components/cms/cell-edit.js.map +1 -1
- package/dist/components/cms/cms-composition-validators.js +11 -2
- package/dist/components/cms/cms-composition-validators.js.map +1 -1
- package/dist/components/cms/collection-table.js +11 -0
- package/dist/components/cms/collection-table.js.map +1 -1
- package/dist/components/cms/document-url-path.d.ts +7 -4
- package/dist/components/cms/document-url-path.js +15 -1
- package/dist/components/cms/document-url-path.js.map +1 -1
- package/dist/components/cms/editable-cell.js +5 -2
- package/dist/components/cms/editable-cell.js.map +1 -1
- package/dist/components/cms/field-control.js +4 -0
- package/dist/components/cms/field-control.js.map +1 -1
- package/dist/components/cms/inline-field-errors.d.ts +36 -0
- package/dist/components/cms/inline-field-errors.js +13 -5
- package/dist/components/cms/inline-field-errors.js.map +1 -1
- package/dist/components/cms/rich-text/insert.d.ts +6 -3
- package/dist/components/cms/rich-text/insert.js +9 -6
- package/dist/components/cms/rich-text/insert.js.map +1 -1
- package/dist/components/cms/use-document-versions.js +1 -0
- package/dist/components/cms/use-document-versions.js.map +1 -1
- package/dist/components/cms/use-live-url.d.ts +18 -6
- package/dist/components/cms/use-live-url.js +10 -0
- package/dist/components/cms/use-live-url.js.map +1 -1
- package/dist/components/cms/versions-model.d.ts +0 -12
- package/dist/components/cms/versions-model.js +3 -15
- package/dist/components/cms/versions-model.js.map +1 -1
- package/dist/components/components/component-detail.js +1 -1
- package/dist/components/components/component-detail.js.map +1 -1
- package/dist/components/components/transfer-dialog.js +2 -4
- package/dist/components/components/transfer-dialog.js.map +1 -1
- package/dist/components/components/transfer.d.ts +19 -15
- package/dist/components/components/transfer.js +28 -25
- package/dist/components/components/transfer.js.map +1 -1
- package/dist/components/deployment-setup-gate.js +9 -3
- package/dist/components/deployment-setup-gate.js.map +1 -1
- package/dist/components/project-session.d.ts +9 -0
- package/dist/components/project-session.js +1 -1
- package/dist/components/project-session.js.map +1 -1
- package/dist/components/redirects/redirects-collection-view-source.d.ts +17 -2
- package/dist/components/redirects/redirects-collection-view-source.js +20 -6
- package/dist/components/redirects/redirects-collection-view-source.js.map +1 -1
- package/dist/components/section-surface.js +3 -2
- package/dist/components/section-surface.js.map +1 -1
- package/dist/components/settings-form.js +1 -2
- package/dist/components/settings-form.js.map +1 -1
- package/dist/components/studio-context.js +1 -18
- package/dist/components/studio-context.js.map +1 -1
- package/dist/components/studio-project-screen.js +3 -5
- package/dist/components/studio-project-screen.js.map +1 -1
- package/dist/lib/ai/apply-content.js +73 -29
- package/dist/lib/ai/apply-content.js.map +1 -1
- package/dist/lib/ai/constraints.d.ts +35 -0
- package/dist/lib/ai/constraints.js +155 -72
- package/dist/lib/ai/constraints.js.map +1 -1
- package/dist/lib/ai/index.d.ts +1 -0
- package/dist/lib/ai/index.js +1 -0
- package/dist/lib/ai/index.js.map +1 -1
- package/dist/lib/ai/route-fetch.d.ts +58 -0
- package/dist/lib/ai/route-fetch.js +98 -0
- package/dist/lib/ai/route-fetch.js.map +1 -0
- package/dist/lib/ai/route-provider.d.ts +5 -22
- package/dist/lib/ai/route-provider.js +23 -1
- package/dist/lib/ai/route-provider.js.map +1 -1
- package/dist/lib/ai/route.js +4 -1
- package/dist/lib/ai/route.js.map +1 -1
- package/dist/lib/ai/shape.d.ts +3 -2
- package/dist/lib/ai/shape.js +16 -24
- package/dist/lib/ai/shape.js.map +1 -1
- package/dist/lib/ai/types.d.ts +8 -0
- package/dist/lib/ai/types.js.map +1 -1
- package/dist/lib/ai/update-fields.js +33 -12
- package/dist/lib/ai/update-fields.js.map +1 -1
- package/dist/lib/assets/asset-placements.d.ts +35 -0
- package/dist/lib/assets/asset-placements.js +74 -0
- package/dist/lib/assets/asset-placements.js.map +1 -0
- package/dist/lib/assets/backfill-thumbs.d.ts +9 -8
- package/dist/lib/assets/backfill-thumbs.js +13 -25
- package/dist/lib/assets/backfill-thumbs.js.map +1 -1
- package/dist/lib/clipboard/paste-issues.d.ts +17 -15
- package/dist/lib/clipboard/paste-issues.js +8 -45
- package/dist/lib/clipboard/paste-issues.js.map +1 -1
- package/dist/lib/clipboard/paste-target.d.ts +47 -1
- package/dist/lib/clipboard/paste-target.js +19 -11
- package/dist/lib/clipboard/paste-target.js.map +1 -1
- package/dist/lib/cms/document-gate.d.ts +19 -9
- package/dist/lib/cms/document-gate.js +25 -4
- package/dist/lib/cms/document-gate.js.map +1 -1
- package/dist/lib/cms/published-documents.js +1 -0
- package/dist/lib/cms/published-documents.js.map +1 -1
- package/dist/lib/cms-views/view-model.d.ts +3 -3
- package/dist/lib/data/index.d.ts +0 -3
- package/dist/lib/data/index.js +4 -6
- package/dist/lib/data/index.js.map +1 -1
- package/dist/lib/dnd/drop-rules.d.ts +45 -2
- package/dist/lib/dnd/drop-rules.js +64 -9
- package/dist/lib/dnd/drop-rules.js.map +1 -1
- package/dist/lib/engine-version.d.ts +16 -0
- package/dist/lib/engine-version.js +17 -0
- package/dist/lib/engine-version.js.map +1 -0
- package/dist/lib/i18n/messages.de.js +8 -56
- package/dist/lib/i18n/messages.de.js.map +1 -1
- package/dist/lib/i18n/messages.en.d.ts +8 -53
- package/dist/lib/i18n/messages.en.js +15 -57
- package/dist/lib/i18n/messages.en.js.map +1 -1
- package/dist/lib/locale/fallback.js +8 -2
- package/dist/lib/locale/fallback.js.map +1 -1
- package/dist/lib/locale/index.d.ts +0 -1
- package/dist/lib/locale/index.js +0 -1
- package/dist/lib/locale/index.js.map +1 -1
- package/dist/lib/locale/locale-store.d.ts +10 -3
- package/dist/lib/locale/locale-store.js +12 -5
- package/dist/lib/locale/locale-store.js.map +1 -1
- package/dist/lib/operations/session-hydration.d.ts +9 -5
- package/dist/lib/operations/session-hydration.js +10 -10
- package/dist/lib/operations/session-hydration.js.map +1 -1
- package/dist/lib/operations/studio-operations.js +4 -2
- package/dist/lib/operations/studio-operations.js.map +1 -1
- package/dist/lib/persistence/convex-adapter.js +63 -75
- package/dist/lib/persistence/convex-adapter.js.map +1 -1
- package/dist/lib/persistence/deployment-readiness.d.ts +8 -1
- package/dist/lib/persistence/deployment-readiness.js +4 -0
- package/dist/lib/persistence/deployment-readiness.js.map +1 -1
- package/dist/lib/persona/labels.d.ts +0 -2
- package/dist/lib/persona/labels.js +1 -7
- package/dist/lib/persona/labels.js.map +1 -1
- package/dist/lib/registry/index.d.ts +4 -2
- package/dist/lib/registry/index.js +26 -21
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/project-components.js +0 -3
- package/dist/lib/registry/project-components.js.map +1 -1
- package/dist/lib/routes/route-issues.js +4 -5
- package/dist/lib/routes/route-issues.js.map +1 -1
- package/dist/lib/theme.js +3 -2
- package/dist/lib/theme.js.map +1 -1
- package/dist/lib/webhooks/tags.js +11 -14
- package/dist/lib/webhooks/tags.js.map +1 -1
- package/dist/lib/workspace/index.d.ts +1 -1
- package/dist/lib/workspace/index.js +1 -1
- package/dist/lib/workspace/index.js.map +1 -1
- package/dist/previews/enumerate.d.ts +27 -9
- package/dist/previews/enumerate.js +27 -6
- package/dist/previews/enumerate.js.map +1 -1
- package/dist/previews/manifest-format.d.ts +16 -7
- package/dist/previews/manifest-format.js +0 -21
- package/dist/previews/manifest-format.js.map +1 -1
- package/dist/router/match.d.ts +0 -2
- package/dist/router/match.js +0 -2
- package/dist/router/match.js.map +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/package.json +2 -2
- package/src/styles/studio.css +5 -4
- package/src/styles/tokens.css +72 -55
- package/convex/content.ts +0 -291
- package/dist/components/collab/collab-context.d.ts +0 -27
- package/dist/components/collab/collab-context.js +0 -39
- package/dist/components/collab/collab-context.js.map +0 -1
- package/dist/components/collab/collab-seed.d.ts +0 -15
- package/dist/components/collab/collab-seed.js +0 -20
- package/dist/components/collab/collab-seed.js.map +0 -1
- package/dist/components/extensions/extensions-view.d.ts +0 -7
- package/dist/components/extensions/extensions-view.js +0 -127
- package/dist/components/extensions/extensions-view.js.map +0 -1
- package/dist/lib/bindings/section-bindings.d.ts +0 -24
- package/dist/lib/bindings/section-bindings.js +0 -9
- package/dist/lib/bindings/section-bindings.js.map +0 -1
- package/dist/lib/data/data-store.d.ts +0 -98
- package/dist/lib/data/data-store.js +0 -211
- package/dist/lib/data/data-store.js.map +0 -1
- package/dist/lib/data/providers.d.ts +0 -143
- package/dist/lib/data/providers.js +0 -255
- package/dist/lib/data/providers.js.map +0 -1
- package/dist/lib/data/sample-capture.d.ts +0 -30
- package/dist/lib/data/sample-capture.js +0 -70
- package/dist/lib/data/sample-capture.js.map +0 -1
- package/dist/lib/data/sources-store.d.ts +0 -42
- package/dist/lib/data/sources-store.js +0 -120
- package/dist/lib/data/sources-store.js.map +0 -1
- package/dist/lib/locale/binding-fallback.d.ts +0 -35
- package/dist/lib/locale/binding-fallback.js +0 -73
- package/dist/lib/locale/binding-fallback.js.map +0 -1
- package/dist/lib/starters/kit-session.d.ts +0 -5
- package/dist/lib/starters/kit-session.js +0 -17
- package/dist/lib/starters/kit-session.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-edit.js","sourceRoot":"","sources":["../../../src/components/cms/cell-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAWlG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sCAAsC,CAAA;AAoB7C,uDAAuD;AACvD,MAAM,UAAU,OAAO,CAAC,KAAgB;IACtC,OAAO,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,CAAA;AACzC,CAAC;AAOD,MAAM,YAAY,GAAkC,IAAI,GAAG,CAAC;IAC1D,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;CACP,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAe,EAAE,QAAiB;IAC7D,IAAI,QAAQ;QAAE,OAAO,MAAM,CAAA;IAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAA;IACxE,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAA;AACzD,CAAC;AAOD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAyB,EACzB,MAAyB,EACzB,OAAkB,EAClB,SAA2B;IAE3B,MAAM,G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E,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AAChC,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,8EAA8E;IAC9E,mFAAmF;IACnF,2BAA2B;IAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACxD,OAAO,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAA;IAChD,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import { createDocumentStore, isFieldLocalized, validateDocument } from '@elytracms/core/cms-core'\nimport type {\n CmsDocument,\n CmsValidationIssue,\n CollectionDef,\n CollectionRegistry,\n DocumentRef,\n FieldDef,\n Locale,\n LocaleConfig,\n} from '@elytracms/core/cms-core'\nimport { gateValidateOptions } from './gate-validation'\nimport type { OperationError, OperationResult } from '@elytracms/studio/lib/operations'\nimport { replaceDoc } from './document-ref-utils'\nimport {\n cmsValidationIssueMessage,\n operationErrorMessage,\n operationIssueMessage,\n} from '@elytracms/studio/lib/persona/labels'\n\n/**\n * Inline cell editing for the collection table (EC-168) — the pure half.\n *\n * Everything here is plain data + functions so the cell-edit state machine is\n * testable without a DOM: which cells are editable, how Tab/Enter advance,\n * how a draft value is folded into a document (active locale only), and how a\n * commit flows through exactly one `documents.upsert` operations command with\n * optimistic apply + rollback on rejection.\n */\n\n// --- Cell identity -----------------------------------------------------------\n\n/** A cell in the collection table: one document × one field column. */\nexport interface CellCoord {\n docId: string\n field: string\n}\n\n/** Stable key for a cell (state maps, DOM lookups). */\nexport function cellKey(coord: CellCoord): string {\n return `${coord.docId}::${coord.field}`\n}\n\n// --- Editability -------------------------------------------------------------\n\n/** How a cell edits: inline control, anchored picker dialog, or not at all. */\nexport type CellEditKind = 'inline' | 'picker' | 'none'\n\nconst INLINE_TYPES: ReadonlySet<FieldDef['type']> = new Set([\n 'text',\n 'number',\n 'boolean',\n 'select',\n 'date',\n])\n\n/**\n * Classify a field's in-table editing surface. Rich text is deliberately not\n * inline-editable (the detail editor owns it); read-only fields never edit.\n */\nexport function cellEditKind(field: FieldDef, readOnly: boolean): CellEditKind {\n if (readOnly) return 'none'\n if (field.type === 'relation' || field.type === 'asset') return 'picker'\n return INLINE_TYPES.has(field.type) ? 'inline' : 'none'\n}\n\n// --- Keyboard advance --------------------------------------------------------\n\n/** Where a committed edit moves next: Tab → next, Shift-Tab → prev, Enter → down. */\nexport type AdvanceDirection = 'next' | 'prev' | 'down'\n\n/**\n * The next editable cell in the table grid, or `null` at a boundary.\n * `docIds` is the rendered row order; `fields` the editable column order.\n * 'next'/'prev' walk row-major (wrapping across rows); 'down' stays in the\n * same column.\n */\nexport function nextEditableCell(\n docIds: readonly string[],\n fields: readonly string[],\n current: CellCoord,\n direction: AdvanceDirection,\n): CellCoord | null {\n const row = docIds.indexOf(current.docId)\n const col = fields.indexOf(current.field)\n if (row < 0 || col < 0 || fields.length === 0) return null\n if (direction === 'down') {\n const nextDoc = docIds[row + 1]\n return nextDoc === undefined ? null : { docId: nextDoc, field: current.field }\n }\n const flat = row * fields.length + col + (direction === 'next' ? 1 : -1)\n if (flat < 0 || flat >= docIds.length * fields.length) return null\n const docId = docIds[Math.floor(flat / fields.length)]!\n return { docId, field: fields[flat % fields.length]! }\n}\n\n// --- Applying a draft value ----------------------------------------------------\n\n/**\n * Fold one field value into a document. Localized fields write ONLY the given\n * locale's bag (other locale variants untouched, EC-018); non-localized fields\n * write the shared `values` bag. `undefined` clears the entry.\n */\nexport function applyCellValue(\n collection: CollectionDef,\n doc: CmsDocument,\n fieldName: string,\n locale: Locale,\n value: unknown,\n): CmsDocument {\n if (isFieldLocalized(collection, fieldName)) {\n const perLocale = { ...(doc.localized?.[locale] ?? {}) }\n if (value === undefined) delete perLocale[fieldName]\n else perLocale[fieldName] = value\n return { ...doc, localized: { ...doc.localized, [locale]: perLocale } }\n }\n const values = { ...doc.values }\n if (value === undefined) delete values[fieldName]\n else values[fieldName] = value\n return { ...doc, values }\n}\n\n// --- Validation gate -----------------------------------------------------------\n\n/**\n * Error-severity issues that the edited cell itself caused. Localized fields\n * only reject on issues for the edited locale — a missing translation in some\n * *other* locale must not block this commit.\n *\n * EC-497: validates with THE bag (`gateValidateOptions`), not the `store` +\n * `localeConfig` subset it used to assemble here. A cell edit is not a weaker\n * KIND of validation — it is the same validation, FILTERED to the cell being\n * committed, which is the whole option-set contract in one function: surfaces\n * differ in what they do with the issues, never in what they validated with.\n */\nexport function cellEditIssues(\n registry: CollectionRegistry,\n documents: readonly CmsDocument[],\n localeConfig: LocaleConfig,\n collection: CollectionDef,\n next: CmsDocument,\n fieldName: string,\n locale: Locale,\n oracles: CellEditOracles = {},\n): CmsValidationIssue[] {\n // Validate against the session with the edited document swapped in, so\n // self-relations and same-document targets resolve.\n const store = createDocumentStore(replaceDoc(documents, next))\n const issues = validateDocument(\n registry,\n next,\n gateValidateOptions({\n store,\n localeConfig,\n isPublished: oracles.isPublished ?? (() => false),\n ...(oracles.assetExists ? { assetExists: oracles.assetExists } : {}),\n }),\n )\n const localized = isFieldLocalized(collection, fieldName)\n return issues.filter((issue) => {\n if (issue.severity !== 'error') return false\n if (issue.meta?.field !== fieldName) return false\n if (!localized) return true\n // Localized field paths are ['documents', key, 'localized', <locale>, <field>, …].\n const at = issue.path.indexOf('localized')\n return at < 0 || issue.path[at + 1] === locale\n })\n}\n\n// --- Commit pipeline -------------------------------------------------------------\n\n/** Outcome of one cell commit: the new document, or a structured rejection. */\nexport type CellCommitOutcome =\n | { ok: true; doc: CmsDocument }\n | { ok: false; error: OperationError }\n\nexport interface CellCommitInput {\n collection: CollectionDef\n /** The document as currently rendered (the rollback target). */\n doc: CmsDocument\n field: FieldDef\n /** The active locale at the point of edit (table locale resolution). */\n locale: Locale\n /** The committed draft value (`undefined` clears the field). */\n value: unknown\n}\n\n/**\n * The session oracles the canonical option bag needs beyond the store + locales\n * (EC-497). Optional so a fixture-only caller still gets the rest of the bag;\n * absent `isPublished` means \"nothing is published\", the engine's own default.\n */\nexport interface CellEditOracles {\n isPublished?: (ref: DocumentRef) => boolean\n assetExists?: (id: string) => boolean\n}\n\nexport interface CellCommitContext extends CellEditOracles {\n registry: CollectionRegistry\n /** Current session documents (relation/asset target resolution). */\n documents: readonly CmsDocument[]\n localeConfig: LocaleConfig\n /** Optimistically apply the edited document to the session. */\n applySession: (next: CmsDocument) => void\n /** Restore the pre-edit document after a rejected dispatch. */\n rollbackSession: (previous: CmsDocument) => void\n /**\n * Dispatch the ONE operations command for this commit\n * (`documents.upsert`, EC-141). Absent in fixture-only sessions\n * (no project scope) — the commit is session-only then.\n */\n dispatch?: (next: CmsDocument) => Promise<OperationResult<unknown>>\n}\n\n/**\n * Commit one cell edit:\n * 1. fold the value into the document (active locale only),\n * 2. gate on field validation — rejected edits dispatch NOTHING and report a\n * structured validation error for the cell,\n * 3. apply optimistically, dispatch exactly one operations command,\n * 4. roll the session back when the operation result is a rejection.\n */\nexport async function commitCellEdit(\n context: CellCommitContext,\n input: CellCommitInput,\n): Promise<CellCommitOutcome> {\n const next = applyCellValue(input.collection, input.doc, input.field.name, input.locale, input.value)\n\n const issues = cellEditIssues(\n context.registry,\n context.documents,\n context.localeConfig,\n input.collection,\n next,\n input.field.name,\n input.locale,\n {\n ...(context.isPublished ? { isPublished: context.isPublished } : {}),\n ...(context.assetExists ? { assetExists: context.assetExists } : {}),\n },\n )\n if (issues.length > 0) {\n return {\n ok: false,\n error: {\n code: 'validation',\n // EC-487/EC-494: this producer is CLIENT-side and already holds the structured\n // issue, so it resolves the message here. (Since EC-494 the wire also carries\n // the ref, which is what makes the SERVER-side publish gate localize.)\n message: cmsValidationIssueMessage(issues[0]!),\n issues: issues.map((issue) => ({\n code: issue.code,\n message: cmsValidationIssueMessage(issue),\n path: [...issue.path],\n domain: 'cms',\n })),\n },\n }\n }\n\n context.applySession(next)\n if (context.dispatch) {\n let result: OperationResult<unknown>\n try {\n result = await context.dispatch(next)\n } catch (cause) {\n // Operations never throw by contract; treat a broken transport the same\n // as a failed command so the cell still rolls back visibly.\n result = {\n ok: false,\n error: { code: 'unknown', message: cause instanceof Error ? cause.message : String(cause) },\n }\n }\n if (!result.ok) {\n context.rollbackSession(input.doc)\n return { ok: false, error: result.error }\n }\n }\n return { ok: true, doc: next }\n}\n\n/** The message the cell renders for a rejection: the first issue beats the envelope. */\nexport function cellErrorMessage(error: OperationError): string {\n // EC-494: an OperationIssue now carries its catalog ref across the wire, so a\n // rejection built SERVER-SIDE (the publish gate) localizes here too — not only the\n // studio-built ones above.\n if (error.code === 'validation' && error.issues.length > 0)\n return operationIssueMessage(error.issues[0]!)\n return operationErrorMessage(error)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cell-edit.js","sourceRoot":"","sources":["../../../src/components/cms/cell-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAWlG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sCAAsC,CAAA;AAoB7C,uDAAuD;AACvD,MAAM,UAAU,OAAO,CAAC,KAAgB;IACtC,OAAO,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,CAAA;AACzC,CAAC;AAOD,MAAM,YAAY,GAAkC,IAAI,GAAG,CAAC;IAC1D,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;CACP,CAAC,CAAA;AAEF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AI,CAAC,CAAA;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,wEAAwE;YACxE,4DAA4D;YAC5D,MAAM,GAAG;gBACP,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;aAC5F,CAAA;QACH,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAA;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AAChC,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,8EAA8E;IAC9E,mFAAmF;IACnF,2BAA2B;IAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACxD,OAAO,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAA;IAChD,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import { createDocumentStore, isFieldLocalized, validateDocument } from '@elytracms/core/cms-core'\nimport type {\n CmsDocument,\n CmsValidationIssue,\n CollectionDef,\n CollectionRegistry,\n DocumentRef,\n FieldDef,\n Locale,\n LocaleConfig,\n} from '@elytracms/core/cms-core'\nimport { gateValidateOptions } from './gate-validation'\nimport { anchorFieldName } from './inline-field-errors'\nimport type { OperationError, OperationResult } from '@elytracms/studio/lib/operations'\nimport { replaceDoc } from './document-ref-utils'\nimport {\n cmsValidationIssueMessage,\n operationErrorMessage,\n operationIssueMessage,\n} from '@elytracms/studio/lib/persona/labels'\n\n/**\n * Inline cell editing for the collection table (EC-168) — the pure half.\n *\n * Everything here is plain data + functions so the cell-edit state machine is\n * testable without a DOM: which cells are editable, how Tab/Enter advance,\n * how a draft value is folded into a document (active locale only), and how a\n * commit flows through exactly one `documents.upsert` operations command with\n * optimistic apply + rollback on rejection.\n */\n\n// --- Cell identity -----------------------------------------------------------\n\n/** A cell in the collection table: one document × one field column. */\nexport interface CellCoord {\n docId: string\n field: string\n}\n\n/** Stable key for a cell (state maps, DOM lookups). */\nexport function cellKey(coord: CellCoord): string {\n return `${coord.docId}::${coord.field}`\n}\n\n// --- Editability -------------------------------------------------------------\n\n/** How a cell edits: inline control, anchored picker dialog, or not at all. */\nexport type CellEditKind = 'inline' | 'picker' | 'none'\n\nconst INLINE_TYPES: ReadonlySet<FieldDef['type']> = new Set([\n 'text',\n 'number',\n 'boolean',\n 'select',\n 'date',\n])\n\n/**\n * Classify a field's in-table editing surface. Rich text is deliberately not\n * inline-editable (the detail editor owns it); read-only fields never edit.\n */\nexport function cellEditKind(field: FieldDef, readOnly: boolean): CellEditKind {\n if (readOnly) return 'none'\n if (field.type === 'relation' || field.type === 'asset') return 'picker'\n return INLINE_TYPES.has(field.type) ? 'inline' : 'none'\n}\n\n// --- Keyboard advance --------------------------------------------------------\n\n/** Where a committed edit moves next: Tab → next, Shift-Tab → prev, Enter → down. */\nexport type AdvanceDirection = 'next' | 'prev' | 'down'\n\n/**\n * The next editable cell in the table grid, or `null` at a boundary.\n * `docIds` is the rendered row order; `fields` the editable column order.\n * 'next'/'prev' walk row-major (wrapping across rows); 'down' stays in the\n * same column.\n */\nexport function nextEditableCell(\n docIds: readonly string[],\n fields: readonly string[],\n current: CellCoord,\n direction: AdvanceDirection,\n): CellCoord | null {\n const row = docIds.indexOf(current.docId)\n const col = fields.indexOf(current.field)\n if (row < 0 || col < 0 || fields.length === 0) return null\n if (direction === 'down') {\n const nextDoc = docIds[row + 1]\n return nextDoc === undefined ? null : { docId: nextDoc, field: current.field }\n }\n const flat = row * fields.length + col + (direction === 'next' ? 1 : -1)\n if (flat < 0 || flat >= docIds.length * fields.length) return null\n const docId = docIds[Math.floor(flat / fields.length)]!\n return { docId, field: fields[flat % fields.length]! }\n}\n\n// --- Applying a draft value ----------------------------------------------------\n\n/**\n * Fold one field value into a document. Localized fields write ONLY the given\n * locale's bag (other locale variants untouched, EC-018); non-localized fields\n * write the shared `values` bag. `undefined` clears the entry.\n */\nexport function applyCellValue(\n collection: CollectionDef,\n doc: CmsDocument,\n fieldName: string,\n locale: Locale,\n value: unknown,\n): CmsDocument {\n if (isFieldLocalized(collection, fieldName)) {\n const perLocale = { ...(doc.localized?.[locale] ?? {}) }\n if (value === undefined) delete perLocale[fieldName]\n else perLocale[fieldName] = value\n return { ...doc, localized: { ...doc.localized, [locale]: perLocale } }\n }\n const values = { ...doc.values }\n if (value === undefined) delete values[fieldName]\n else values[fieldName] = value\n return { ...doc, values }\n}\n\n// --- Validation gate -----------------------------------------------------------\n\n/**\n * Error-severity issues that the edited cell itself caused. Localized fields\n * only reject on issues for the edited locale — a missing translation in some\n * *other* locale must not block this commit.\n *\n * EC-497: validates with THE bag (`gateValidateOptions`), not the `store` +\n * `localeConfig` subset it used to assemble here. A cell edit is not a weaker\n * KIND of validation — it is the same validation, FILTERED to the cell being\n * committed, which is the whole option-set contract in one function: surfaces\n * differ in what they do with the issues, never in what they validated with.\n *\n * EC-516: an issue belongs to the edited cell when the TOP-LEVEL field its\n * `path` resolves to is the edited column — `anchorFieldName`, the grammar the\n * document form's inline errors already use. `meta.field` is never compared\n * here: `validateObject` stamps it with the LEAF subfield name, so a broken\n * `items[0].title` used to pass for a `title` issue and block an unrelated\n * `title` edit (and the owning `items` column saw nothing).\n */\nexport function cellEditIssues(\n registry: CollectionRegistry,\n documents: readonly CmsDocument[],\n localeConfig: LocaleConfig,\n collection: CollectionDef,\n next: CmsDocument,\n fieldName: string,\n locale: Locale,\n oracles: CellEditOracles = {},\n): CmsValidationIssue[] {\n // Validate against the session with the edited document swapped in, so\n // self-relations and same-document targets resolve.\n const store = createDocumentStore(replaceDoc(documents, next))\n const issues = validateDocument(\n registry,\n next,\n gateValidateOptions({\n store,\n localeConfig,\n isPublished: oracles.isPublished ?? (() => false),\n ...(oracles.assetExists ? { assetExists: oracles.assetExists } : {}),\n }),\n )\n const localized = isFieldLocalized(collection, fieldName)\n return issues.filter((issue) => {\n if (issue.severity !== 'error') return false\n if (anchorFieldName(collection, issue) !== fieldName) return false\n if (!localized) return true\n // Localized field paths are ['documents', key, 'localized', <locale>, <field>, …].\n const at = issue.path.indexOf('localized')\n return at < 0 || issue.path[at + 1] === locale\n })\n}\n\n// --- Commit pipeline -------------------------------------------------------------\n\n/** Outcome of one cell commit: the new document, or a structured rejection. */\nexport type CellCommitOutcome =\n | { ok: true; doc: CmsDocument }\n | { ok: false; error: OperationError }\n\nexport interface CellCommitInput {\n collection: CollectionDef\n /** The document as currently rendered (the rollback target). */\n doc: CmsDocument\n field: FieldDef\n /** The active locale at the point of edit (table locale resolution). */\n locale: Locale\n /** The committed draft value (`undefined` clears the field). */\n value: unknown\n}\n\n/**\n * The session oracles the canonical option bag needs beyond the store + locales\n * (EC-497). Optional so a fixture-only caller still gets the rest of the bag;\n * absent `isPublished` means \"nothing is published\", the engine's own default.\n */\nexport interface CellEditOracles {\n isPublished?: (ref: DocumentRef) => boolean\n assetExists?: (id: string) => boolean\n}\n\nexport interface CellCommitContext extends CellEditOracles {\n registry: CollectionRegistry\n /** Current session documents (relation/asset target resolution). */\n documents: readonly CmsDocument[]\n localeConfig: LocaleConfig\n /** Optimistically apply the edited document to the session. */\n applySession: (next: CmsDocument) => void\n /** Restore the pre-edit document after a rejected dispatch. */\n rollbackSession: (previous: CmsDocument) => void\n /**\n * Dispatch the ONE operations command for this commit\n * (`documents.upsert`, EC-141). Absent in fixture-only sessions\n * (no project scope) — the commit is session-only then.\n */\n dispatch?: (next: CmsDocument) => Promise<OperationResult<unknown>>\n}\n\n/**\n * Commit one cell edit:\n * 1. fold the value into the document (active locale only),\n * 2. gate on field validation — rejected edits dispatch NOTHING and report a\n * structured validation error for the cell,\n * 3. apply optimistically, dispatch exactly one operations command,\n * 4. roll the session back when the operation result is a rejection.\n */\nexport async function commitCellEdit(\n context: CellCommitContext,\n input: CellCommitInput,\n): Promise<CellCommitOutcome> {\n const next = applyCellValue(input.collection, input.doc, input.field.name, input.locale, input.value)\n\n const issues = cellEditIssues(\n context.registry,\n context.documents,\n context.localeConfig,\n input.collection,\n next,\n input.field.name,\n input.locale,\n {\n ...(context.isPublished ? { isPublished: context.isPublished } : {}),\n ...(context.assetExists ? { assetExists: context.assetExists } : {}),\n },\n )\n if (issues.length > 0) {\n return {\n ok: false,\n error: {\n code: 'validation',\n // EC-487/EC-494: this producer is CLIENT-side and already holds the structured\n // issue, so it resolves the message here. (Since EC-494 the wire also carries\n // the ref, which is what makes the SERVER-side publish gate localize.)\n message: cmsValidationIssueMessage(issues[0]!),\n issues: issues.map((issue) => ({\n code: issue.code,\n message: cmsValidationIssueMessage(issue),\n path: [...issue.path],\n domain: 'cms',\n })),\n },\n }\n }\n\n context.applySession(next)\n if (context.dispatch) {\n let result: OperationResult<unknown>\n try {\n result = await context.dispatch(next)\n } catch (cause) {\n // Operations never throw by contract; treat a broken transport the same\n // as a failed command so the cell still rolls back visibly.\n result = {\n ok: false,\n error: { code: 'unknown', message: cause instanceof Error ? cause.message : String(cause) },\n }\n }\n if (!result.ok) {\n context.rollbackSession(input.doc)\n return { ok: false, error: result.error }\n }\n }\n return { ok: true, doc: next }\n}\n\n/** The message the cell renders for a rejection: the first issue beats the envelope. */\nexport function cellErrorMessage(error: OperationError): string {\n // EC-494: an OperationIssue now carries its catalog ref across the wire, so a\n // rejection built SERVER-SIDE (the publish gate) localizes here too — not only the\n // studio-built ones above.\n if (error.code === 'validation' && error.issues.length > 0)\n return operationIssueMessage(error.issues[0]!)\n return operationErrorMessage(error)\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateCompositionValue } from '@elytracms/core/project-graph';
|
|
1
|
+
import { legacyNodeMemberIssues, validateCompositionValue } from '@elytracms/core/project-graph';
|
|
2
2
|
import { BLOCK_SEQUENCE_VERSION, classifyBlockNode, isBlockSequenceValueShape, parseBlockSequenceValue, } from '@elytracms/core/rich-text';
|
|
3
3
|
import { getStudioRegistry } from '@elytracms/studio/lib/registry';
|
|
4
4
|
/**
|
|
@@ -47,9 +47,19 @@ function validateBlockSequence(value, allow) {
|
|
|
47
47
|
},
|
|
48
48
|
];
|
|
49
49
|
}
|
|
50
|
+
// EC-574: retired node members (a render `condition`, a `kind: 'binding'` prop)
|
|
51
|
+
// are judged on the value AS STORED, before the parse below — the parser strips
|
|
52
|
+
// a stray `condition` silently and rejects a binding prop only generically, so
|
|
53
|
+
// this is the one place the stored shape is still visible to name precisely.
|
|
54
|
+
const out = legacyNodeMemberIssues(value).map((issue) => ({
|
|
55
|
+
message: issue.message,
|
|
56
|
+
severity: issue.severity,
|
|
57
|
+
nodePath: issue.path.join('/'),
|
|
58
|
+
}));
|
|
50
59
|
const parsed = parseBlockSequenceValue(value);
|
|
51
60
|
if (!parsed.ok) {
|
|
52
61
|
return [
|
|
62
|
+
...out,
|
|
53
63
|
{
|
|
54
64
|
message: `is not a valid block sequence (version ${BLOCK_SEQUENCE_VERSION})`,
|
|
55
65
|
severity: 'error',
|
|
@@ -58,7 +68,6 @@ function validateBlockSequence(value, allow) {
|
|
|
58
68
|
}
|
|
59
69
|
const components = getStudioRegistry().registry.lookup;
|
|
60
70
|
const opts = { ...(allow ? { allow } : {}), components };
|
|
61
|
-
const out = [];
|
|
62
71
|
/** `root/0/<rest>` from a single-node validation call → `<base>/<rest>`. */
|
|
63
72
|
const nestedPath = (base, path) => {
|
|
64
73
|
const rest = path.slice(2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-composition-validators.js","sourceRoot":"","sources":["../../../src/components/cms/cms-composition-validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;;;GAWG;AACH,SAAS,qBAAqB,CAC5B,KAAc,EACd,KAAoC;IAEpC,+EAA+E;IAC/E,8EAA8E;IAC9E,8EAA8E;IAC9E,qDAAqD;IACrD,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO;YACL;gBACE,OAAO,EAAE,0CAA0C,sBAAsB,GAAG;gBAC5E,QAAQ,EAAE,OAAO;aAClB;SACF,CAAA;IACH,CAAC;IACD,MAAM,MAAM,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO;YACL;gBACE,OAAO,EAAE,0CAA0C,sBAAsB,GAAG;gBAC5E,QAAQ,EAAE,OAAO;aAClB;SACF,CAAA;IACH,CAAC;IACD,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAA;IACtD,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,CAAA;IACxD,MAAM,GAAG,GAAuB,EAAE,CAAA;IAElC,4EAA4E;IAC5E,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,IAAoC,EAAU,EAAE;QAChF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAC1B,OAAO,IAAI,CAAC,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K,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC","sourcesContent":["import type { BlocksFieldDef, CompositionIssue, RichTextFieldDef } from '@elytracms/core/cms-core'\nimport { validateCompositionValue } from '@elytracms/core/project-graph'\nimport type { ComponentNode } from '@elytracms/core/project-graph'\nimport {\n BLOCK_SEQUENCE_VERSION,\n classifyBlockNode,\n isBlockSequenceValueShape,\n parseBlockSequenceValue,\n} from '@elytracms/core/rich-text'\nimport type { BlockNode } from '@elytracms/core/rich-text'\nimport { getStudioRegistry } from '@elytracms/studio/lib/registry'\n\n/**\n * Composition validator adapters (EC-326, extracted from `cms-store.tsx`) —\n * injected into `validateDocument`'s `validateComposition`/`validateRichTextEmbeds`\n * options so `@elytracms/core/cms-core` stays free of `@elytracms/core/project-graph`\n * and `@elytracms/core/rich-text`.\n *\n * EC-547 (EC-500 D1/D4): both field types now share ONE stored shape — the v2\n * block sequence `{ version: 2, content: BlockNode[] }` — and therefore ONE\n * validation walk: unwrap the envelope, validate the sequence's component nodes\n * (top-level roots AND nodes nested inside typography content) against the\n * field's `allow` vocabulary + the code-owned component registry. \"`allow`\n * means component ids insertable at this position\" is now literally the same\n * check on the same shape for `blocks` and `richText`.\n *\n * Pre-convergence shapes (the v1 `{ version, doc }` envelope, bare node lists)\n * never reach these adapters: `validateDocument`'s shape pass reports them as\n * the explicit pre-convergence issue and skips the deeper validators (EC-548\n * removed the legacy walks). A retired `componentEmbed` node riding in v2\n * content is a foreign typography node — not rendered, not validated, surfaced\n * by the renderer's unknown-node fallback (render/validate parity, EC-497).\n */\n\n/**\n * Validate the component nodes of a v2 block sequence against the field leash.\n *\n * - Top-level component roots validate in ONE `validateCompositionValue` call,\n * so cross-root checks (duplicate node ids) see the whole sequence. Their\n * `root/<k>` issue paths are re-keyed to the node's actual sequence index\n * (`content/<i>/…`).\n * - A component nested in typography content validates per-node with the SAME\n * leash, its findings prefixed with the typography path\n * (`content/<i>/content/<j>/…`).\n * - A malformed value degrades to a single finding, never a crash.\n */\nfunction validateBlockSequence(\n value: unknown,\n allow: readonly string[] | undefined,\n): CompositionIssue[] {\n // Structural gate FIRST: only the stored `{ version: 2, content }` object is a\n // sequence here. The parser alone would also accept a JSON-string encoding of\n // one — which no delivery reader accepts — and validating that clean would be\n // the invisible divergence EC-390 exists to prevent.\n if (!isBlockSequenceValueShape(value)) {\n return [\n {\n message: `is not a valid block sequence (version ${BLOCK_SEQUENCE_VERSION})`,\n severity: 'error',\n },\n ]\n }\n const parsed = parseBlockSequenceValue(value)\n if (!parsed.ok) {\n return [\n {\n message: `is not a valid block sequence (version ${BLOCK_SEQUENCE_VERSION})`,\n severity: 'error',\n },\n ]\n }\n const components = getStudioRegistry().registry.lookup\n const opts = { ...(allow ? { allow } : {}), components }\n const out: CompositionIssue[] = []\n\n /** `root/0/<rest>` from a single-node validation call → `<base>/<rest>`. */\n const nestedPath = (base: string, path: ReadonlyArray<string | number>): string => {\n const rest = path.slice(2)\n return rest.length > 0 ? `${base}/${rest.join('/')}` : base\n }\n\n const walkTypography = (nodes: readonly BlockNode[] | undefined, base: string): void => {\n nodes?.forEach((child, i) => {\n const here = `${base}/content/${i}`\n const kind = classifyBlockNode(child)\n if (kind.kind === 'component') {\n for (const issue of validateCompositionValue(kind.node, opts)) {\n out.push({ message: issue.message, severity: issue.severity, nodePath: nestedPath(here, issue.path) })\n }\n } else {\n walkTypography(kind.node.content, here)\n }\n })\n }\n\n const roots: { node: ComponentNode; index: number }[] = []\n parsed.value.content.forEach((node, index) => {\n const kind = classifyBlockNode(node)\n if (kind.kind === 'component') roots.push({ node: kind.node, index })\n else walkTypography(kind.node.content, `content/${index}`)\n })\n\n for (const issue of validateCompositionValue(roots.map((r) => r.node), opts)) {\n // path is `['root', <k>, ...rest]` — re-key <k> to the sequence index.\n const [, k, ...rest] = issue.path\n const index = typeof k === 'number' ? (roots[k]?.index ?? k) : k\n out.push({\n message: issue.message,\n severity: issue.severity,\n nodePath: ['content', ...(index === undefined ? [] : [index]), ...rest].join('/'),\n })\n }\n return out\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. Never throws — a malformed value degrades to\n * a single finding, matching the \"validation is first-class, never a crash\"\n * rule.\n */\nexport function validateComposition(value: unknown, field: BlocksFieldDef): CompositionIssue[] {\n if (value == null) return []\n return validateBlockSequence(value, field.allow)\n}\n\n/**\n * EC-189: validate the composition nodes inside a `richText` field value with\n * the SAME leash a `blocks` field uses — since EC-547 literally the same walk\n * over the same shape: the value's `elytra/component` nodes ARE sequence\n * citizens, at the top level and nested in typography content.\n */\nexport function validateRichTextEmbeds(value: unknown, field: RichTextFieldDef): CompositionIssue[] {\n if (value == null) return []\n return validateBlockSequence(value, field.allow)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cms-composition-validators.js","sourceRoot":"","sources":["../../../src/components/cms/cms-composition-validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAEhG,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;;;GAWG;AACH,SAAS,qBAAqB,CAC5B,KAAc,EACd,KAAoC;IAEpC,+EAA+E;IAC/E,8EAA8E;IAC9E,8EAA8E;IAC9E,qDAAqD;IACrD,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO;YACL;gBACE,OAAO,EAAE,0CAA0C,sBAAsB,GAAG;gBAC5E,QAAQ,EAAE,OAAO;aAClB;SACF,CAAA;IACH,CAAC;IACD,gFAAgF;IAChF,gFAAgF;IAChF,+EAA+E;IAC/E,6EAA6E;IAC7E,MAAM,GAAG,GAAuB,sBAAsB,CAAC,KAAK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AAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAChE,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SAClF,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,KAAqB;IACvE,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,EAAE,CAAA;IAC5B,OAAO,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc,EAAE,KAAuB;IAC5E,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,EAAE,CAAA;IAC5B,OAAO,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC","sourcesContent":["import type { BlocksFieldDef, CompositionIssue, RichTextFieldDef } from '@elytracms/core/cms-core'\nimport { legacyNodeMemberIssues, validateCompositionValue } from '@elytracms/core/project-graph'\nimport type { ComponentNode } from '@elytracms/core/project-graph'\nimport {\n BLOCK_SEQUENCE_VERSION,\n classifyBlockNode,\n isBlockSequenceValueShape,\n parseBlockSequenceValue,\n} from '@elytracms/core/rich-text'\nimport type { BlockNode } from '@elytracms/core/rich-text'\nimport { getStudioRegistry } from '@elytracms/studio/lib/registry'\n\n/**\n * Composition validator adapters (EC-326, extracted from `cms-store.tsx`) —\n * injected into `validateDocument`'s `validateComposition`/`validateRichTextEmbeds`\n * options so `@elytracms/core/cms-core` stays free of `@elytracms/core/project-graph`\n * and `@elytracms/core/rich-text`.\n *\n * EC-547 (EC-500 D1/D4): both field types now share ONE stored shape — the v2\n * block sequence `{ version: 2, content: BlockNode[] }` — and therefore ONE\n * validation walk: unwrap the envelope, validate the sequence's component nodes\n * (top-level roots AND nodes nested inside typography content) against the\n * field's `allow` vocabulary + the code-owned component registry. \"`allow`\n * means component ids insertable at this position\" is now literally the same\n * check on the same shape for `blocks` and `richText`.\n *\n * Pre-convergence shapes (the v1 `{ version, doc }` envelope, bare node lists)\n * never reach these adapters: `validateDocument`'s shape pass reports them as\n * the explicit pre-convergence issue and skips the deeper validators (EC-548\n * removed the legacy walks). A retired `componentEmbed` node riding in v2\n * content is a foreign typography node — not rendered, not validated, surfaced\n * by the renderer's unknown-node fallback (render/validate parity, EC-497).\n */\n\n/**\n * Validate the component nodes of a v2 block sequence against the field leash.\n *\n * - Top-level component roots validate in ONE `validateCompositionValue` call,\n * so cross-root checks (duplicate node ids) see the whole sequence. Their\n * `root/<k>` issue paths are re-keyed to the node's actual sequence index\n * (`content/<i>/…`).\n * - A component nested in typography content validates per-node with the SAME\n * leash, its findings prefixed with the typography path\n * (`content/<i>/content/<j>/…`).\n * - A malformed value degrades to a single finding, never a crash.\n */\nfunction validateBlockSequence(\n value: unknown,\n allow: readonly string[] | undefined,\n): CompositionIssue[] {\n // Structural gate FIRST: only the stored `{ version: 2, content }` object is a\n // sequence here. The parser alone would also accept a JSON-string encoding of\n // one — which no delivery reader accepts — and validating that clean would be\n // the invisible divergence EC-390 exists to prevent.\n if (!isBlockSequenceValueShape(value)) {\n return [\n {\n message: `is not a valid block sequence (version ${BLOCK_SEQUENCE_VERSION})`,\n severity: 'error',\n },\n ]\n }\n // EC-574: retired node members (a render `condition`, a `kind: 'binding'` prop)\n // are judged on the value AS STORED, before the parse below — the parser strips\n // a stray `condition` silently and rejects a binding prop only generically, so\n // this is the one place the stored shape is still visible to name precisely.\n const out: CompositionIssue[] = legacyNodeMemberIssues(value).map((issue) => ({\n message: issue.message,\n severity: issue.severity,\n nodePath: issue.path.join('/'),\n }))\n const parsed = parseBlockSequenceValue(value)\n if (!parsed.ok) {\n return [\n ...out,\n {\n message: `is not a valid block sequence (version ${BLOCK_SEQUENCE_VERSION})`,\n severity: 'error',\n },\n ]\n }\n const components = getStudioRegistry().registry.lookup\n const opts = { ...(allow ? { allow } : {}), components }\n\n /** `root/0/<rest>` from a single-node validation call → `<base>/<rest>`. */\n const nestedPath = (base: string, path: ReadonlyArray<string | number>): string => {\n const rest = path.slice(2)\n return rest.length > 0 ? `${base}/${rest.join('/')}` : base\n }\n\n const walkTypography = (nodes: readonly BlockNode[] | undefined, base: string): void => {\n nodes?.forEach((child, i) => {\n const here = `${base}/content/${i}`\n const kind = classifyBlockNode(child)\n if (kind.kind === 'component') {\n for (const issue of validateCompositionValue(kind.node, opts)) {\n out.push({ message: issue.message, severity: issue.severity, nodePath: nestedPath(here, issue.path) })\n }\n } else {\n walkTypography(kind.node.content, here)\n }\n })\n }\n\n const roots: { node: ComponentNode; index: number }[] = []\n parsed.value.content.forEach((node, index) => {\n const kind = classifyBlockNode(node)\n if (kind.kind === 'component') roots.push({ node: kind.node, index })\n else walkTypography(kind.node.content, `content/${index}`)\n })\n\n for (const issue of validateCompositionValue(roots.map((r) => r.node), opts)) {\n // path is `['root', <k>, ...rest]` — re-key <k> to the sequence index.\n const [, k, ...rest] = issue.path\n const index = typeof k === 'number' ? (roots[k]?.index ?? k) : k\n out.push({\n message: issue.message,\n severity: issue.severity,\n nodePath: ['content', ...(index === undefined ? [] : [index]), ...rest].join('/'),\n })\n }\n return out\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. Never throws — a malformed value degrades to\n * a single finding, matching the \"validation is first-class, never a crash\"\n * rule.\n */\nexport function validateComposition(value: unknown, field: BlocksFieldDef): CompositionIssue[] {\n if (value == null) return []\n return validateBlockSequence(value, field.allow)\n}\n\n/**\n * EC-189: validate the composition nodes inside a `richText` field value with\n * the SAME leash a `blocks` field uses — since EC-547 literally the same walk\n * over the same shape: the value's `elytra/component` nodes ARE sequence\n * citizens, at the top level and nested in typography content.\n */\nexport function validateRichTextEmbeds(value: unknown, field: RichTextFieldDef): CompositionIssue[] {\n if (value == null) return []\n return validateBlockSequence(value, field.allow)\n}\n"]}
|
|
@@ -27,6 +27,7 @@ import { FilterControl } from './filter-builder.js';
|
|
|
27
27
|
import { DisplayMenu, ViewTabs } from './view-bar.js';
|
|
28
28
|
import { DocStateDot, docStateOf } from './doc-state.js';
|
|
29
29
|
import { useSetBreadcrumb } from '../breadcrumb-context.js';
|
|
30
|
+
import { issueSeverityIcon, issueSeverityStyle } from '../issue-severity.js';
|
|
30
31
|
import { useCmsCollectionViewSource } from '../collection-view/cms-collection-view-source.js';
|
|
31
32
|
import { CollectionViewProvider, useCollectionView } from '../collection-view/collection-view-context.js';
|
|
32
33
|
export function CollectionTable({ projectId, collectionId }) {
|
|
@@ -457,11 +458,21 @@ function EmDash() {
|
|
|
457
458
|
* published documents have a `url` here (the URL is derived from the published
|
|
458
459
|
* pool, EC-205), so an unpublished document — having no live page — shows a dash.
|
|
459
460
|
* The URL is always derived, never stored.
|
|
461
|
+
*
|
|
462
|
+
* EC-518: a URL the engine computed as NOT `addressable` (EC-492 — no request
|
|
463
|
+
* reaches the document through it) is never a link, `href` or not: the path stays
|
|
464
|
+
* readable, and the shared `warning` glyph (EC-507) + the same label the Issues
|
|
465
|
+
* pane uses replace the open-live icon, so the row and the form agree.
|
|
460
466
|
*/
|
|
461
467
|
function UrlCell({ url }) {
|
|
462
468
|
if (!url) {
|
|
463
469
|
return (_jsx(Text, { size: "xs", tone: "subtle", children: "\u2014" }));
|
|
464
470
|
}
|
|
471
|
+
if (!url.addressable) {
|
|
472
|
+
const title = translate('cms.issue.unaddressable-url');
|
|
473
|
+
const Icon = issueSeverityIcon('warning');
|
|
474
|
+
return (_jsxs(Text, { as: "span", size: "xs", tone: "muted", className: "inline-flex max-w-[18rem] items-center gap-1", title: title, "aria-label": title, "data-live-severity": "warning", children: [_jsx("span", { className: "truncate", children: url.path }), _jsx(Icon, { className: cn('size-3 shrink-0', issueSeverityStyle('warning').text), "aria-hidden": true })] }));
|
|
475
|
+
}
|
|
465
476
|
if (url.href) {
|
|
466
477
|
return (_jsxs("a", { href: url.href, target: "_blank", rel: "noreferrer", title: url.href, className: "inline-flex max-w-[18rem] items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground", children: [_jsx("span", { className: "truncate", children: url.path }), _jsx(ExternalLink, { className: "size-3 shrink-0", "aria-hidden": true })] }));
|
|
467
478
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-table.js","sourceRoot":"","sources":["../../../src/components/cms/collection-table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,IAAI,EACJ,eAAe,EACf,QAAQ,EACR,GAAG,EACH,MAAM,EACN,YAAY,EACZ,cAAc,EACd,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,GAAG,EACH,SAAS,EACT,MAAM,EACN,KAAK,EACL,IAAI,EACJ,KAAK,GACN,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EA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Navigate } from '@elytracms/studio/router'\nimport {\n ArrowDown,\n ArrowUp,\n CircleDot,\n Copy,\n CornerDownRight,\n Download,\n Eye,\n EyeOff,\n ExternalLink,\n MoreHorizontal,\n Pencil,\n Plus,\n Trash2,\n Upload,\n} from 'lucide-react'\nimport { useMemo, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport type { CmsDocument, CollectionDef, DocumentUrl, FieldDef, Locale, LocaleConfig } from '@elytracms/core/cms-core'\nimport {\n orderHierarchically,\n resolveDocumentForLocale,\n resolveDocumentTitle,\n validateCollectionShape,\n} from '@elytracms/core/cms-core'\nimport {\n Button,\n Code,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n Row,\n Separator,\n Spacer,\n Stack,\n Text,\n toast,\n} from '@elytracms/studio/ui'\nimport { cn } from '@elytracms/studio/lib/utils'\nimport { localizedLabel, translate } from '@elytracms/studio/lib/i18n'\nimport { LocaleSwitcher, resolveDisplayedValue } from '@elytracms/studio/lib/locale'\nimport {\n EMPTY_SELECTION,\n PUBLISHED_AT_FIELD,\n STATE_FIELD,\n UPDATED_AT_FIELD,\n URL_FIELD,\n applyViewState,\n clearSelection,\n isPseudoColumn,\n primaryColumn,\n selectAll,\n toggleRow,\n visibleColumns,\n visibleSelection,\n} from '@elytracms/studio/lib/cms-views'\nimport type { SelectionState, ViewSort } from '@elytracms/studio/lib/cms-views'\nimport { pseudoColumnsForSource } from '@elytracms/studio/lib/collection-view/collection-view-source'\nimport type { DocumentTimestampsCapability } from '@elytracms/studio/lib/collection-view/collection-view-source'\nimport { cellEditKind, cellKey } from './cell-edit'\nimport { FallbackChip } from './cell'\nimport { EditableCell } from './editable-cell'\nimport { useCellEdit } from './use-cell-edit'\nimport { ImportDialog } from './import-export'\nimport { AssetThumb, useAssetRecord } from '../assets/asset-thumb'\nimport { fieldLabel, pseudoColumnLabel } from './cms-labels'\nimport { cmsIssueLabel, cmsValidationIssueMessage } from '@elytracms/studio/lib/persona/labels'\nimport { TriangleAlert } from 'lucide-react'\nimport type { BulkAction, BulkReport, BulkSetField } from './bulk-actions'\nimport { BulkBar, BulkReportPanel } from './bulk-bar'\nimport { rowActionsFor } from './row-actions'\nimport type { RowAction } from './row-actions'\nimport { duplicateFromSource } from './duplicate-document'\nimport {\n CHECKBOX_COLUMN_WIDTH_REM,\n PRIMARY_COLUMN_WIDTH_REM,\n ROW_ACTIONS_COLUMN_WIDTH_REM,\n STATUS_DOT_COLUMN_WIDTH_REM,\n columnWidthRem,\n pseudoColumnWidthRem,\n} from './column-width'\nimport { ReferenceConfirmDialog } from './reference-confirm'\nimport { FilterControl } from './filter-builder'\nimport { DisplayMenu, ViewTabs } from './view-bar'\nimport { DocStateDot, docStateOf } from './doc-state'\nimport { useSetBreadcrumb } from '../breadcrumb-context'\nimport { useCmsCollectionViewSource } from '../collection-view/cms-collection-view-source'\nimport { CollectionViewProvider, useCollectionView } from '../collection-view/collection-view-context'\n\nexport function CollectionTable({ projectId, collectionId }: { projectId: string; collectionId: string }) {\n // AD-19: render over the portable CollectionViewSource, not `useCms()` directly,\n // so the SAME list surface serves the users rail (EC-240), redirects (EC-303), …\n const source = useCmsCollectionViewSource(collectionId)\n\n if (!source) {\n return (\n <div className=\"grid h-full place-items-center p-8\">\n <Text tone=\"muted\">\n Unknown collection <Code tone=\"muted\">{collectionId}</Code>.\n </Text>\n </div>\n )\n }\n\n // Keyed per collection so selection/report state never leaks across collections.\n return (\n <CollectionViewProvider source={source}>\n <LoadedCollectionTable key={collectionId} projectId={projectId} />\n </CollectionViewProvider>\n )\n}\n\n/**\n * The portable list surface (AD-19). Renders entirely over the ambient\n * {@link useCollectionView} source — no `useCms`, no `CmsProvider` required — so\n * any rail (the users rail, redirects, …) reuses it by wrapping it in a\n * {@link CollectionViewProvider} over its own source. `CollectionTable` is just\n * the CMS entry point that builds a CMS source and mounts this.\n */\nexport function LoadedCollectionTable({\n projectId,\n toolbarExtra,\n}: {\n projectId: string\n /**\n * A rail-owned action rendered at the tail of the header toolbar (EC-319) —\n * e.g. the assets rail's Upload button + grid/list toggle. Absent for every\n * other rail today (users, redirects, CMS), so their toolbar is unchanged.\n */\n toolbarExtra?: ReactNode\n}) {\n const source = useCollectionView()\n const collection = source.schema\n const navigate = useNavigate()\n const collectionId = source.collectionId\n // EC-214: the collection is the active record — the global header breadcrumb\n // names it, replacing the per-view title heading.\n useSetBreadcrumb([{ label: localizedLabel(collection.form?.label, collectionId) }])\n const [importOpen, setImportOpen] = useState(false)\n const [selection, setSelection] = useState<SelectionState>(EMPTY_SELECTION)\n const [bulkBusy, setBulkBusy] = useState(false)\n const [bulkReport, setBulkReport] = useState<BulkReport | null>(null)\n // EC-173: bulk unpublish/delete go through the reference-aware confirmation\n // with a snapshot of the selection taken when the action was raised.\n const [pendingBulk, setPendingBulk] = useState<{\n action: 'unpublish' | 'delete'\n targets: { collection: string; id: string }[]\n } | null>(null)\n\n // The working view state (EC-169): filters + sort + columns, possibly dirty\n // against the active saved view. The table renders exactly this state.\n const viewState = source.viewState()\n // EC-445: the reserved pseudo-columns this source surfaces ($state/$url/$updatedAt),\n // folded into the column universe so they order/hide alongside real fields. The\n // SAME list drives the Display picker (view-bar), so the universe never drifts.\n const pseudo = pseudoColumnsForSource(source)\n // EC-213: the title/link column is the first visible column; the rest follow\n // in the view's column order. No separate primary-column selector.\n const primary = primaryColumn(collection, viewState, pseudo)\n const columns = visibleColumns(collection, viewState, pseudo).filter((name) => name !== primary)\n const primaryFieldDef = collection.fields.find((f) => f.name === primary)\n\n const docs = source.documents()\n\n // EC-274/EC-284: collection-shape drift (a singleton with > 1 document; later\n // duplicate/unknown/unfilled aliases). When the data has drifted from the lens's\n // expected shape the studio shows this list instead of skipping — surfacing the\n // conflicts here as a \"for review\" banner so an editor resolves them without a\n // developer (keep/delete the outliers), after which the lens applies again.\n const shapeIssues = useMemo(() => validateCollectionShape(collection, docs), [collection, docs])\n\n // EC-216 + EC-205 (\"live = published\"): each routable document's LIVE URL,\n // derived from the PUBLISHED pool (never draft rows), memoised inside the\n // source. `null` when the collection is not routable → the column is hidden.\n const urlByDocId = source.publishing?.liveUrls?.() ?? null\n\n const visibleDocs = useMemo(\n // EC-224: the `$state` filter/sort sources published-ness from the version\n // POINTER (`source.publishing.isPublished`), not a flat `state` field.\n // EC-445: the pseudo-DATE columns sort by the source's materialized timestamps.\n () =>\n applyViewState(\n collection,\n docs,\n source.localeConfig,\n viewState,\n (doc) => source.publishing?.isPublished({ collection: doc.collection, id: doc.id }) ?? false,\n {\n updatedAt: (doc) =>\n source.timestamps?.updatedAt({ collection: doc.collection, id: doc.id }),\n publishedAt: (doc) =>\n source.timestamps?.publishedAt({ collection: doc.collection, id: doc.id }),\n },\n ).docs,\n [collection, docs, source.localeConfig, viewState, source.publishing, source.timestamps],\n )\n\n // EC-218: a collection with a `parent` self-relation can render as a nested\n // tree (parents above their children, indented). Tree mode reorders the\n // already-filtered rows depth-first — filters/sort still order siblings.\n const hierarchical = source.capabilities.hierarchy\n const [treeMode, setTreeMode] = useState(hierarchical)\n const treeRows = useMemo(\n () => (hierarchical && treeMode ? orderHierarchically(visibleDocs) : null),\n [hierarchical, treeMode, visibleDocs],\n )\n const orderedDocs = treeRows ? treeRows.map((row) => row.doc) : visibleDocs\n const depthById = useMemo(\n () => (treeRows ? new Map(treeRows.map((row) => [row.doc.id, row.depth])) : undefined),\n [treeRows],\n )\n\n // EC-246a header derivations. The count reads with the collection's own noun\n // (pluralized via the config labels), not a bare number or the generic kind.\n const pluralLabel = localizedLabel(collection.form?.label, `${collectionId}s`)\n const singularLabel = localizedLabel(collection.form?.labelSingular, collectionId)\n const countLabel =\n visibleDocs.length === docs.length\n ? translate('cms.list.count', {\n count: docs.length,\n noun: docs.length === 1 ? singularLabel : pluralLabel,\n })\n : translate('cms.list.countFiltered', {\n visible: visibleDocs.length,\n total: docs.length,\n noun: pluralLabel,\n })\n\n // EC-246d: New creates an empty draft and opens its editor directly — no\n // interstitial modal, for pages or any other collection. Id is auto-generated;\n // the slug/title (and, for pages, the parent) are typed in the form, and a\n // missing/duplicate slug surfaces as a Publish-gating issue, never blocks the\n // draft. Routes are config-sourced (EC-207), so nothing else is written here.\n const isPageCollection = collectionId === 'page'\n // Creation is a capability (a credential rail like users mints identities via\n // sign-up, not here), and the detail route is rail-owned (never the CMS route).\n const canCreate = source.capabilities.create && source.detailPath !== undefined\n const handleNew = () => {\n const ref = source.create()\n const splat = source.detailPath?.(ref.id)\n if (splat === undefined) return\n navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } })\n }\n const visibleIds = orderedDocs.map((doc) => doc.id)\n // Selection is always read against the current view — rows the filters hid\n // are never silently included in a bulk action.\n const selectedIds = visibleSelection(selection, visibleIds)\n // EC-316: the right-edge row menu is a capability-gated column — a rail with\n // no detail surface AND no publish/remove capability offers nothing (users\n // rail today has remove, so this is rarely empty; kept honest for AD-19).\n const hasRowActions = source.detailPath !== undefined || source.capabilities.publish || source.capabilities.remove\n\n function toggleSort(field: string) {\n source.setViewState((prev) => {\n const sort: ViewSort | null =\n prev.sort?.field !== field\n ? { field, dir: 'asc' }\n : prev.sort.dir === 'asc'\n ? { field, dir: 'desc' }\n : null\n return { ...prev, sort }\n })\n }\n\n function raiseBulk(action: BulkAction) {\n if (action === 'publish') {\n void handleBulk(action, [...selectedIds])\n return\n }\n // Set-field is composed + raised through the bulk bar's own panel\n // (onSetField), never this state-action path.\n if (action === 'set-field') return\n // Unpublish/delete first enumerate inbound references (EC-173): the\n // dialog shows the aggregate \"N documents, M references will break\".\n setPendingBulk({\n action,\n targets: selectedIds.map((id) => ({ collection: collectionId, id })),\n })\n }\n\n // EC-316: the row `⋮` menu dispatches through the SAME machinery as the\n // toolbar's bulk actions — one document is just a selection of one — so\n // there is exactly one write path for publish/unpublish/delete, never a\n // parallel one. `open` is the row menu's own affordance (the primary-column\n // link already offers it; this is the keyboard/menu-driven equivalent).\n function handleRowAction(action: RowAction, doc: CmsDocument) {\n if (action === 'open') {\n const splat = source.detailPath?.(doc.id)\n if (splat === undefined) return\n navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } })\n return\n }\n // EC-442: duplicate the row's draft into a fresh DRAFT document (never\n // auto-published) through the seam's existing create+save write paths,\n // then land on the new draft's editor — the same navigation `+ New` takes.\n // The action is offered iff `capabilities.create` + a detail surface\n // (`rowActionsFor`), the New button's exact gate.\n if (action === 'duplicate') {\n const newRef = duplicateFromSource(source, doc)\n toast.success(translate('cms.editor.duplicateCreated'))\n const splat = source.detailPath?.(newRef.id)\n if (splat === undefined) return\n navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } })\n return\n }\n if (action === 'publish') {\n void handleBulk(action, [doc.id])\n return\n }\n // unpublish/delete: the same reference-aware confirmation the bulk bar\n // raises, scoped to this one document.\n setPendingBulk({ action, targets: [{ collection: collectionId, id: doc.id }] })\n }\n\n async function handleBulk(action: BulkAction, acted: readonly string[], setField?: BulkSetField) {\n // Defensive: with the capability gates below (`source.bulk` presence gates\n // the bar, per-action capabilities gate its buttons) this is unreachable —\n // but a confirmed action must NEVER silently no-op (EC-433: the assets\n // rail's bulk delete used to die exactly here), so a missing runner still\n // reports one honest failure per item.\n if (!source.bulk) {\n setBulkReport({\n action,\n ...(setField ? { setField } : {}),\n results: acted.map((id) => ({\n ref: { collection: collectionId, id },\n title: source.titleOf({ collection: collectionId, id }),\n ok: false,\n reason: 'Bulk actions are not available in this view.',\n error: { code: 'unknown', message: 'Bulk actions are not available in this view.' },\n })),\n })\n return\n }\n setBulkBusy(true)\n try {\n const report = await source.bulk([...acted], action, setField)\n setBulkReport(report)\n // Succeeded items deselect; failed items stay selected for a retry.\n const actedSet = new Set(acted)\n const failed = new Set(report.results.filter((r) => !r.ok).map((r) => r.ref.id))\n setSelection((prev) => ({\n ids: prev.ids.filter((id) => !actedSet.has(id) || failed.has(id)),\n anchorId: null,\n }))\n } finally {\n setBulkBusy(false)\n }\n }\n\n function exportJson() {\n const data = JSON.stringify(source.documents(), null, 2)\n const blob = new Blob([data], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${collectionId}.json`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {/* Header (EC-246a redesign). One toolbar: identity + refine on the left,\n lens + actions on the right; a transient filter bar drops below only\n while refining. The header breadcrumb (EC-214) names the collection —\n no title here. Locale is a lens; column/layout config lives behind the\n far-right Display control; shared views are config-as-code (EC-246b). */}\n <div className=\"shrink-0 border-b border-border px-4 py-3 sm:px-6\">\n <Row gap=\"2\" wrap>\n {/* Left — which view (only when >1), then the transient refine. */}\n <ViewTabs />\n {/* Transient ad-hoc refine — a chip beside the view tabs, editor in a\n popover (EC-246b); the chip's ✕ clears it, so no separate Reset. */}\n <FilterControl collection={collection} />\n {/* The working-set count is the RESULT of the view + filter above, so it\n reads last, set off by a divider and sized like its neighbours. */}\n <Separator orientation=\"vertical\" className=\"h-5 self-center\" />\n <Text\n as=\"span\"\n size=\"xs\"\n tone=\"muted\"\n className=\"whitespace-nowrap tabular-nums\"\n data-testid=\"collection-count\"\n >\n {countLabel}\n </Text>\n\n <Spacer />\n\n {/* Right — the ambient locale lens (EC-176; hidden for single-locale AND\n for a non-localized rail like users), then display config + write actions. */}\n {source.capabilities.locales ? <LocaleSwitcher /> : null}\n <DisplayMenu\n collection={collection}\n hierarchical={hierarchical}\n treeMode={treeMode}\n onToggleTree={setTreeMode}\n />\n {canCreate ? (\n <Button size=\"sm\" onClick={handleNew} data-testid=\"new-document\">\n <Plus /> {isPageCollection ? translate('cms.list.newPage') : translate('cms.list.new')}\n </Button>\n ) : null}\n {/* EC-213: import/export fold into one action menu, off the header.\n AD-19: a capability — absent on credential rails (users), so identity\n records are never dumped to / loaded from raw JSON. */}\n {source.capabilities.importExport ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={translate('cms.list.moreActions')}\n data-testid=\"collection-actions\"\n >\n <MoreHorizontal />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem onClick={() => setImportOpen(true)} data-testid=\"action-import\">\n <Upload /> {translate('cms.list.import')}\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={exportJson}\n disabled={docs.length === 0}\n data-testid=\"action-export\"\n >\n <Download /> {translate('cms.list.export')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n {toolbarExtra}\n </Row>\n </div>\n\n {/* Bulk actions over the selection (EC-169). Mounted only when the source\n actually carries a bulk runner (present iff `capabilities.bulk`,\n EC-433) and each action button is capability-gated inside — a bar\n whose confirmed actions can't dispatch is never offered. */}\n {source.bulk ? (\n <BulkBar\n collection={collection}\n capabilities={source.capabilities}\n count={selectedIds.length}\n busy={bulkBusy}\n onAction={raiseBulk}\n onSetField={(setField) => void handleBulk('set-field', [...selectedIds], setField)}\n onClear={() => setSelection(clearSelection())}\n />\n ) : null}\n {bulkReport ? (\n <BulkReportPanel report={bulkReport} onDismiss={() => setBulkReport(null)} />\n ) : null}\n\n {/* Reference-aware bulk unpublish/delete confirmation (EC-173). */}\n {pendingBulk !== null ? (\n <ReferenceConfirmDialog\n projectId={projectId}\n action={pendingBulk.action}\n targets={pendingBulk.targets}\n open\n busy={bulkBusy}\n onOpenChange={(open) => {\n if (!open) setPendingBulk(null)\n }}\n onConfirm={() => {\n const { action, targets } = pendingBulk\n setPendingBulk(null)\n void handleBulk(\n action,\n targets.map((target) => target.id),\n )\n }}\n />\n ) : null}\n\n {/* EC-274/EC-284: \"for review\" lane — the collection has drifted from its\n lens's expected shape; surface each conflict so an editor can resolve it. */}\n {shapeIssues.length > 0 ? (\n <div\n className=\"shrink-0 border-b border-warning/30 bg-warning/10 px-4 py-2 sm:px-6\"\n data-testid=\"shape-review-banner\"\n >\n <Stack gap=\"1\">\n {shapeIssues.map((issue, i) => (\n <Row key={`${issue.code}:${i}`} gap=\"2\" align=\"start\">\n <TriangleAlert className=\"mt-0.5 size-3.5 shrink-0 text-warning\" aria-hidden />\n <Stack gap=\"none\" className=\"min-w-0\">\n <Text size=\"xs\" weight=\"semibold\" tone=\"default\" title={issue.code}>\n {translate('cms.list.forReview')} · {cmsIssueLabel(issue.code, issue.severity)}\n </Text>\n <Text size=\"xs\" tone=\"muted\">\n {cmsValidationIssueMessage(issue)}\n </Text>\n </Stack>\n </Row>\n ))}\n </Stack>\n </div>\n ) : null}\n\n {/* Table */}\n <div className=\"min-h-0 flex-1 overflow-auto\">\n {docs.length === 0 ? (\n <div className=\"grid h-full place-items-center p-8\">\n <Stack gap=\"2\" align=\"center\" className=\"text-center\">\n <Text tone=\"muted\">{translate('cms.list.emptyNone', { noun: pluralLabel.toLowerCase() })}</Text>\n {canCreate ? (\n <Button size=\"sm\" onClick={handleNew}>\n <Plus />{' '}\n {isPageCollection\n ? translate('cms.list.newPage')\n : translate('cms.list.newNamed', {\n noun: localizedLabel(collection.form?.labelSingular, 'document'),\n })}\n </Button>\n ) : null}\n </Stack>\n </div>\n ) : visibleDocs.length === 0 ? (\n <div className=\"grid h-full place-items-center p-8\">\n <Text tone=\"muted\" data-testid=\"empty-filtered\">\n {translate('cms.list.emptyFiltered')}\n </Text>\n </div>\n ) : (\n <DocumentsGrid\n projectId={projectId}\n collection={collection}\n primary={primary}\n primaryFieldDef={primaryFieldDef}\n columns={columns}\n sortedDocs={orderedDocs}\n depthById={depthById}\n urlByDocId={urlByDocId}\n sort={viewState.sort}\n onSort={toggleSort}\n selectedIds={selectedIds}\n onToggleRow={(id, shift) =>\n setSelection((prev) => toggleRow(prev, visibleIds, id, shift))\n }\n onToggleAll={() =>\n setSelection(\n selectedIds.length === visibleIds.length && visibleIds.length > 0\n ? clearSelection()\n : selectAll(visibleIds),\n )\n }\n hasRowActions={hasRowActions}\n onRowAction={handleRowAction}\n />\n )}\n </div>\n\n {source.capabilities.importExport ? (\n <ImportDialog collectionId={collectionId} open={importOpen} onOpenChange={setImportOpen} />\n ) : null}\n </div>\n )\n}\n\n/**\n * The documents table with inline cell editing (EC-168). Cells edit in place\n * (text/number/boolean/select/date) or open pickers (relation/asset); each\n * commit is one operations command via the cell-edit controller, with\n * rollback + inline cell errors on rejection. Row checkboxes (EC-169) live in\n * their own column, so selection clicks never collide with cell editing.\n */\nfunction DocumentsGrid({\n projectId,\n collection,\n primary,\n primaryFieldDef,\n columns,\n sortedDocs,\n depthById,\n urlByDocId,\n sort,\n onSort,\n selectedIds,\n onToggleRow,\n onToggleAll,\n hasRowActions,\n onRowAction,\n}: {\n projectId: string\n collection: CollectionDef\n primary: string\n primaryFieldDef: FieldDef | undefined\n columns: string[]\n sortedDocs: CmsDocument[]\n /** EC-218: nesting depth per doc id when rendering the hierarchy (tree mode). */\n depthById?: Map<string, number>\n /** EC-216: each routable doc's derived URL; `null` hides the URL column. */\n urlByDocId?: Map<string, DocumentUrl> | null\n sort: ViewSort | null\n onSort: (field: string) => void\n selectedIds: readonly string[]\n onToggleRow: (id: string, shift: boolean) => void\n onToggleAll: () => void\n /** EC-316: whether the right-edge row `⋮` menu has anything to offer at all. */\n hasRowActions: boolean\n onRowAction: (action: RowAction, doc: CmsDocument) => void\n}) {\n const source = useCollectionView()\n const collectionId = collection.id\n // EC-346: a rail with no publish lifecycle (assets/redirects/users) has no\n // state to show — the column is omitted entirely (header + cells), never a\n // badge defaulted to \"draft\" via `?? false`. `source.publishing` presence IS\n // the gate (mirrors the capability contract: the group is present iff the\n // flag is set), narrowed once here so every render site below is type-safe.\n const publishing = source.publishing\n // EC-448: `$state` is a FIXED structural leading column (checkbox → status-dot →\n // title) — always present, not draggable, not in the Display picker — gated by the\n // SAME publish-lifecycle signal that used to gate the reorderable state column\n // (EC-346): a rail with no publish lifecycle (assets/users/redirects) shows no\n // status column at all, never an empty one.\n const hasStatus = publishing !== undefined\n // EC-445: per-document timestamps behind the $updatedAt/$publishedAt pseudo-cells.\n const timestamps = source.timestamps\n const fieldByName = (name: string) => collection.fields.find((f) => f.name === name)\n // Inline editing is a capability: a read-only rail yields no editable cells.\n const editableFields = source.capabilities.inlineEdit\n ? columns.filter((name) => {\n const field = fieldByName(name)\n return field ? cellEditKind(field, source.isFieldReadOnly(field)) !== 'none' : false\n })\n : []\n const cellEdit = useCellEdit({ collection, docs: sortedDocs, editableFields })\n const selected = new Set(selectedIds)\n const allSelected = sortedDocs.length > 0 && selectedIds.length === sortedDocs.length\n\n return (\n <div ref={cellEdit.containerRef}>\n {/* EC-316: `table-fixed` + an explicit `<colgroup>` fix every column's\n width from the SCHEMA alone, before any row renders. Under the\n browser's default `table-layout: auto` a cell's INTRINSIC content\n width feeds back into its column — so swapping a cell's rendered\n value for its inline editor (a wider `<input>`) reflowed the whole\n grid. Fixed layout makes a column's width immune to its cells'\n content; `columnWidthRem` only sets relative proportions, so the\n grid still scales naturally with the container (never with a cell). */}\n <table className=\"w-full table-fixed border-collapse text-sm\">\n <colgroup>\n <col style={{ width: `${CHECKBOX_COLUMN_WIDTH_REM}rem` }} />\n {/* EC-448: the fixed narrow status-dot column, sized for a dot (never the\n state TEXT) so the title's left edge stays consistent across collections. */}\n {hasStatus ? <col style={{ width: `${STATUS_DOT_COLUMN_WIDTH_REM}rem` }} /> : null}\n <col style={{ width: `${PRIMARY_COLUMN_WIDTH_REM}rem` }} />\n {columns.map((name) => (\n <col\n key={name}\n style={{\n width: `${isPseudoColumn(name) ? pseudoColumnWidthRem(name) : columnWidthRem(fieldByName(name))}rem`,\n }}\n />\n ))}\n {hasRowActions ? <col style={{ width: `${ROW_ACTIONS_COLUMN_WIDTH_REM}rem` }} /> : null}\n </colgroup>\n <thead className=\"sticky top-0 z-10 bg-background\">\n <tr className=\"border-b border-border\">\n {/* EC-448: the two leading columns (checkbox, status) are width-constrained\n (`w-10`/`w-11` + `whitespace-nowrap`, matching the colgroup rem) so they\n never flex with content and the title starts at a consistent left edge. */}\n <th className=\"w-10 whitespace-nowrap px-3 py-2 text-left\">\n <SelectionCheckbox\n checked={allSelected}\n indeterminate={selectedIds.length > 0 && !allSelected}\n label={translate('cms.list.selectAll')}\n testId=\"select-all\"\n onToggle={() => onToggleAll()}\n />\n </th>\n {hasStatus ? (\n <th\n className=\"w-11 whitespace-nowrap px-2 py-2 text-center\"\n data-testid=\"status-column\"\n >\n <StatusHeader sort={sort} onSort={onSort} />\n </th>\n ) : null}\n <HeaderCell\n field={primary}\n label={primaryFieldDef ? fieldLabel(primaryFieldDef) : translate('cms.list.column.title')}\n sort={sort}\n onSort={onSort}\n />\n {/* EC-445: schema fields AND the reserved pseudo-columns render through\n the SAME columns map (order/hide alongside real fields), dispatched by\n the `$`-name — replacing the old hardcoded trailing state/url blocks. */}\n {columns.map((name) => {\n if (isPseudoColumn(name)) {\n // $url is a derived value — not sortable (EC-216), so a plain header.\n if (name === URL_FIELD) {\n return (\n <th\n key={name}\n className=\"px-3 py-2 text-left text-xs font-semibold text-muted-foreground\"\n >\n {translate('cms.list.column.url')}\n </th>\n )\n }\n return (\n <HeaderCell\n key={name}\n field={name}\n label={pseudoColumnLabel(name)}\n sort={sort}\n onSort={onSort}\n />\n )\n }\n const field = fieldByName(name)\n return field ? (\n <HeaderCell key={name} field={name} label={fieldLabel(field)} sort={sort} onSort={onSort} />\n ) : null\n })}\n {hasRowActions ? (\n <th className=\"px-2 py-2 text-right\">\n <span className=\"sr-only\">{translate('cms.list.rowActionsColumnLabel')}</span>\n </th>\n ) : null}\n </tr>\n </thead>\n <tbody>\n {sortedDocs.map((doc) => (\n <tr\n key={doc.id}\n className={cn(\n 'group border-b border-border/60 hover:bg-muted/40',\n selected.has(doc.id) && 'bg-primary/5',\n )}\n >\n <td className=\"w-10 whitespace-nowrap px-3 py-2 align-middle\">\n <SelectionCheckbox\n checked={selected.has(doc.id)}\n // EC-463: the row's TITLE, not the internal draft key — an\n // accessible name has to identify the thing a human (or an\n // agent editor) sees. \"Select new-docPage-1\" identified nothing.\n label={translate('cms.list.selectRow', {\n title: source.titleOf({ collection: collectionId, id: doc.id }),\n })}\n testId={`select-row-${doc.id}`}\n onToggle={(shift) => onToggleRow(doc.id, shift)}\n />\n </td>\n {hasStatus ? (\n <td className=\"w-11 whitespace-nowrap px-2 py-2 text-center align-middle\">\n {/* EC-448: the compact status dot replaces the DocStateBadge in the\n list. EC-449: three-way — `changed` (amber) comes from the cheap\n materialized per-row hasUnpublishedChanges signal (computed once\n at the write chokepoint, never a per-row snapshot compare); a\n source without the signal degrades to published/draft. */}\n <DocStateDot\n state={docStateOf(\n publishing!.isPublished({ collection: collectionId, id: doc.id }),\n publishing!.hasUnpublishedChanges?.({\n collection: collectionId,\n id: doc.id,\n }) ?? false,\n )}\n />\n </td>\n ) : null}\n <td className=\"px-3 py-2 align-middle\">\n <PrimaryCell\n projectId={projectId}\n collection={collection}\n doc={doc}\n primary={primary}\n depth={depthById?.get(doc.id) ?? 0}\n locale={source.activeLocale}\n config={source.localeConfig}\n detailPath={source.detailPath}\n />\n </td>\n {columns.map((name) => {\n if (isPseudoColumn(name)) {\n return (\n <td key={name} className=\"px-3 py-2 align-middle\">\n <PseudoCell\n name={name}\n docId={doc.id}\n collectionId={collectionId}\n timestamps={timestamps}\n url={urlByDocId?.get(doc.id)}\n locale={source.activeLocale}\n />\n </td>\n )\n }\n const field = fieldByName(name)\n const coord = { docId: doc.id, field: name }\n const key = cellKey(coord)\n return (\n <td key={name} className=\"px-3 py-2 align-middle\">\n {field ? (\n <EditableCell\n collection={collection}\n doc={doc}\n field={field}\n editing={cellEdit.activeKey === key}\n busy={cellEdit.busyKey === key}\n errorMessage={cellEdit.errorOf(key)}\n onStartEdit={() => cellEdit.start(coord)}\n onCancel={() => cellEdit.cancel(coord)}\n onCommit={(value, advance) => cellEdit.commit(coord, value, advance)}\n />\n ) : null}\n </td>\n )\n })}\n {hasRowActions ? (\n <td className=\"px-2 py-2 text-right align-middle\">\n <RowActionsMenu\n doc={doc}\n published={source.publishing?.isPublished({ collection: collectionId, id: doc.id }) ?? false}\n hasDetailPath={source.detailPath !== undefined}\n onAction={(action) => onRowAction(action, doc)}\n />\n </td>\n ) : null}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n}\n\n/**\n * The right-edge row `⋮` menu (EC-316): the SAME action vocabulary as the\n * toolbar's bulk actions (`rowActionsFor`), gated by the SAME capabilities —\n * so it degrades exactly like the rest of the list for a rail without\n * publish/remove (AD-19). Renders nothing when the gate leaves zero actions.\n */\nfunction RowActionsMenu({\n doc,\n published,\n hasDetailPath,\n onAction,\n}: {\n doc: CmsDocument\n published: boolean\n hasDetailPath: boolean\n onAction: (action: RowAction) => void\n}) {\n const source = useCollectionView()\n const actions = rowActionsFor({ capabilities: source.capabilities, hasDetailPath, published })\n if (actions.length === 0) return null\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={translate('cms.list.rowActionsLabel', { id: doc.id })}\n data-testid={`row-actions-${doc.id}`}\n >\n <MoreHorizontal />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {actions.map((action) => (\n <RowActionItem key={action} action={action} onSelect={() => onAction(action)} />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nfunction RowActionItem({ action, onSelect }: { action: RowAction; onSelect: () => void }) {\n switch (action) {\n case 'open':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-open\">\n <Pencil /> {translate('cms.list.rowAction.open')}\n </DropdownMenuItem>\n )\n case 'duplicate':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-duplicate\">\n <Copy /> {translate('common.duplicate')}\n </DropdownMenuItem>\n )\n case 'publish':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-publish\">\n <Eye /> {translate('cms.list.bulk.publish')}\n </DropdownMenuItem>\n )\n case 'unpublish':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-unpublish\">\n <EyeOff /> {translate('cms.list.bulk.unpublish')}\n </DropdownMenuItem>\n )\n case 'delete':\n return (\n <DropdownMenuItem\n variant=\"destructive\"\n onClick={onSelect}\n data-testid=\"row-action-delete\"\n >\n <Trash2 /> {translate('common.delete')}\n </DropdownMenuItem>\n )\n }\n}\n\n/**\n * A selection checkbox (row or select-all). Its own column and focus target —\n * it never participates in the cell-edit keyboard flow. Shift-click selects\n * the anchor→row range (the mousedown guard stops text selection).\n */\nfunction SelectionCheckbox({\n checked,\n indeterminate = false,\n label,\n testId,\n onToggle,\n}: {\n checked: boolean\n indeterminate?: boolean\n label: string\n testId: string\n onToggle: (shift: boolean) => void\n}) {\n return (\n <input\n ref={(el) => {\n if (el) el.indeterminate = indeterminate && !checked\n }}\n type=\"checkbox\"\n className=\"size-4 cursor-pointer accent-primary align-middle\"\n checked={checked}\n readOnly\n aria-label={label}\n data-testid={testId}\n onClick={(event) => onToggle(event.shiftKey)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n onToggle(event.shiftKey)\n }\n }}\n onMouseDown={(event) => {\n if (event.shiftKey) event.preventDefault()\n }}\n />\n )\n}\n\nfunction HeaderCell({\n field,\n label,\n sort,\n onSort,\n}: {\n field: string\n label: string\n sort: ViewSort | null\n onSort: (field: string) => void\n}) {\n const active = sort?.field === field\n return (\n <th className=\"px-3 py-2 text-left text-xs font-semibold text-muted-foreground\">\n <button type=\"button\" onClick={() => onSort(field)} className=\"inline-flex items-center gap-1 hover:text-foreground\">\n {label}\n {active ? (\n sort!.dir === 'asc' ? (\n <ArrowUp className=\"size-3\" />\n ) : (\n <ArrowDown className=\"size-3\" />\n )\n ) : null}\n </button>\n </th>\n )\n}\n\n/**\n * The FIXED status column's header (EC-448): a small status/indicator ICON, not a\n * text header (the column is a glanceable dot lane, kept narrow). The `aria-label` /\n * `title` carries the localized \"Status\" name. Clicking sorts by `$state` — reusing\n * EC-445's existing `$state` sort branch (`scalarOf`), so sort-by-state falls out for\n * free with no new machinery; the sort arrow shows when `$state` is the active sort.\n */\nfunction StatusHeader({ sort, onSort }: { sort: ViewSort | null; onSort: (field: string) => void }) {\n const active = sort?.field === STATE_FIELD\n const label = translate('cms.list.column.statusHeader')\n return (\n <button\n type=\"button\"\n onClick={() => onSort(STATE_FIELD)}\n aria-label={label}\n title={label}\n className=\"inline-flex items-center justify-center gap-1 text-muted-foreground hover:text-foreground\"\n data-testid=\"status-header\"\n >\n <CircleDot className=\"size-3.5\" aria-hidden />\n {active ? (\n sort!.dir === 'asc' ? <ArrowUp className=\"size-3\" /> : <ArrowDown className=\"size-3\" />\n ) : null}\n </button>\n )\n}\n\n/**\n * The primary (title) column cell: the document link, resolved in the\n * ambient active locale with a visible fallback chip when the shown title is\n * untranslated (EC-176).\n */\nfunction PrimaryCell({\n projectId,\n collection,\n doc,\n primary,\n depth = 0,\n locale,\n config,\n detailPath,\n}: {\n projectId: string\n collection: CollectionDef\n doc: CmsDocument\n primary: string\n /** EC-218: nesting depth in the hierarchy (tree mode) — indents the title. */\n depth?: number\n locale: Locale\n config: LocaleConfig\n /** Rail-owned detail route splat (AD-19); absent ⇒ the rail has no detail surface. */\n detailPath?: (id: string) => string\n}) {\n // EC-242: the title cell renders the document identity (resolveDocumentTitle) —\n // a string `titleField` or a function pattern — over the fallback-resolved\n // values, NOT the raw `primary` column value. The untranslated-title chip applies\n // only to a field-backed title (a function pattern has no single source field).\n const title = resolveDocumentTitle(\n collection,\n resolveDocumentForLocale(collection, doc, locale, config),\n doc.id,\n )\n const fallback =\n typeof collection.titleField === 'function'\n ? null\n : resolveDisplayedValue(collection, doc, primary, locale, config).fallback\n const splat = detailPath?.(doc.id)\n return (\n <Row gap=\"2\" align=\"center\" className=\"min-w-0\" style={{ paddingLeft: depth * 20 }}>\n {depth > 0 ? (\n <CornerDownRight className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n ) : null}\n {/* 0.0.39: assets get a leading, fixed-size preview in the filename column —\n an image thumbnail (object-cover) for image assets, the file-type placeholder\n otherwise. Fixed box, so it never reflows the EC-316 fixed column widths. */}\n {collection.kind === 'asset' ? <AssetThumbCell assetId={doc.id} alt={title} /> : null}\n {splat !== undefined ? (\n <Link\n to={STUDIO_PROJECT_ROUTE}\n params={{ projectId, _splat: splat }}\n className=\"truncate font-medium text-foreground hover:text-primary hover:underline\"\n >\n {title}\n </Link>\n ) : (\n <Text as=\"span\" className=\"truncate font-medium text-foreground\">\n {title}\n </Text>\n )}\n <FallbackChip fallback={fallback} testId={`cell-fallback-${doc.id}-${primary}`} />\n </Row>\n )\n}\n\n/**\n * The leading asset preview in the filename column (0.0.39). Resolves the asset\n * record from the ambient library and renders {@link AssetThumb} — an image preview\n * for image assets, the file-type placeholder for the rest. Mounted only for\n * `kind:'asset'` collections (which are always under an `<AssetsProvider>`), so the\n * `useAssetRecord` hook is never called on a rail without a library.\n */\nfunction AssetThumbCell({ assetId, alt }: { assetId: string; alt: string }) {\n const record = useAssetRecord(assetId)\n return <AssetThumb record={record} alt={alt} className=\"size-8 shrink-0\" />\n}\n\n/** A compact absolute date for a dense table cell (EC-445), localized; the full ISO\n * value rides the cell's `title`. Falls back to the raw value when unparseable. */\nfunction formatListDate(value: string, locale: Locale): string {\n const ms = Date.parse(value)\n if (Number.isNaN(ms)) return value\n return new Date(ms).toLocaleDateString(locale)\n}\n\n/**\n * A reserved REORDERABLE pseudo-column body cell (EC-445), dispatched by its `$`-key\n * — folding what used to be the table's hardcoded trailing url block into the columns\n * model. `$url` reuses {@link UrlCell}; the date columns render a compact locale date.\n * `$state` is NO LONGER dispatched here — EC-448 made it a fixed structural leading\n * column ({@link DocStateDot}), so it never flows through the reorderable columns.\n */\nfunction PseudoCell({\n name,\n docId,\n collectionId,\n timestamps,\n url,\n locale,\n}: {\n name: string\n docId: string\n collectionId: string\n timestamps: DocumentTimestampsCapability | undefined\n url: DocumentUrl | undefined\n locale: Locale\n}) {\n const ref = { collection: collectionId, id: docId }\n switch (name) {\n case URL_FIELD:\n return <UrlCell url={url} />\n case UPDATED_AT_FIELD:\n case PUBLISHED_AT_FIELD: {\n const value =\n name === UPDATED_AT_FIELD ? timestamps?.updatedAt(ref) : timestamps?.publishedAt(ref)\n if (!value) return <EmDash />\n return (\n <Text size=\"xs\" tone=\"muted\" className=\"tabular-nums\" title={value}>\n {formatListDate(value, locale)}\n </Text>\n )\n }\n default:\n return null\n }\n}\n\n/** The empty-value dash shared by the derived pseudo-cells (URL / dates). */\nfunction EmDash() {\n return (\n <Text size=\"xs\" tone=\"subtle\">\n —\n </Text>\n )\n}\n\n/**\n * The read-only URL column cell (EC-216): the document's LIVE (published) path,\n * linking to the absolute live URL when a `frontendUrl` is configured. Only\n * published documents have a `url` here (the URL is derived from the published\n * pool, EC-205), so an unpublished document — having no live page — shows a dash.\n * The URL is always derived, never stored.\n */\nfunction UrlCell({ url }: { url?: DocumentUrl }) {\n if (!url) {\n return (\n <Text size=\"xs\" tone=\"subtle\">\n —\n </Text>\n )\n }\n if (url.href) {\n return (\n <a\n href={url.href}\n target=\"_blank\"\n rel=\"noreferrer\"\n title={url.href}\n className=\"inline-flex max-w-[18rem] items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span className=\"truncate\">{url.path}</span>\n <ExternalLink className=\"size-3 shrink-0\" aria-hidden />\n </a>\n )\n }\n return (\n <Text size=\"xs\" tone=\"muted\" className=\"max-w-[18rem] truncate\" title={url.path}>\n {url.path}\n </Text>\n )\n}\n\nexport type { FieldDef }\n"]}
|
|
1
|
+
{"version":3,"file":"collection-table.js","sourceRoot":"","sources":["../../../src/components/cms/collection-table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,IAAI,EACJ,eAAe,EACf,QAAQ,EACR,GAAG,EACH,MAAM,EACN,YAAY,EACZ,cAAc,EACd,MAAM,EACN,IAAI,EACJ,MAAM,E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AM,IAAI,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACzC,OAAO,CACL,MAAC,IAAI,IACH,EAAE,EAAC,MAAM,EACT,IAAI,EAAC,IAAI,EACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,8CAA8C,EACxD,KAAK,EAAE,KAAK,gBACA,KAAK,wBACE,SAAS,aAE5B,eAAM,SAAS,EAAC,UAAU,YAAE,GAAG,CAAC,IAAI,GAAQ,EAC5C,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,wBAAgB,IACrF,CACR,CAAA;IACH,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,OAAO,CACL,aACE,IAAI,EAAE,GAAG,CAAC,IAAI,EACd,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,EAChB,KAAK,EAAE,GAAG,CAAC,IAAI,EACf,SAAS,EAAC,oHAAoH,aAE9H,eAAM,SAAS,EAAC,UAAU,YAAE,GAAG,CAAC,IAAI,GAAQ,EAC5C,KAAC,YAAY,IAAC,SAAS,EAAC,iBAAiB,wBAAe,IACtD,CACL,CAAA;IACH,CAAC;IACD,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,wBAAwB,EAAC,KAAK,EAAE,GAAG,CAAC,IAAI,YAC5E,GAAG,CAAC,IAAI,GACJ,CACR,CAAA;AACH,CAAC","sourcesContent":["import { Link, STUDIO_PROJECT_ROUTE, useNavigate } from '@elytracms/studio/router'\nimport {\n ArrowDown,\n ArrowUp,\n CircleDot,\n Copy,\n CornerDownRight,\n Download,\n Eye,\n EyeOff,\n ExternalLink,\n MoreHorizontal,\n Pencil,\n Plus,\n Trash2,\n Upload,\n} from 'lucide-react'\nimport { useMemo, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport type { CmsDocument, CollectionDef, DocumentUrl, FieldDef, Locale, LocaleConfig } from '@elytracms/core/cms-core'\nimport {\n orderHierarchically,\n resolveDocumentForLocale,\n resolveDocumentTitle,\n validateCollectionShape,\n} from '@elytracms/core/cms-core'\nimport {\n Button,\n Code,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n Row,\n Separator,\n Spacer,\n Stack,\n Text,\n toast,\n} from '@elytracms/studio/ui'\nimport { cn } from '@elytracms/studio/lib/utils'\nimport { localizedLabel, translate } from '@elytracms/studio/lib/i18n'\nimport { LocaleSwitcher, resolveDisplayedValue } from '@elytracms/studio/lib/locale'\nimport {\n EMPTY_SELECTION,\n PUBLISHED_AT_FIELD,\n STATE_FIELD,\n UPDATED_AT_FIELD,\n URL_FIELD,\n applyViewState,\n clearSelection,\n isPseudoColumn,\n primaryColumn,\n selectAll,\n toggleRow,\n visibleColumns,\n visibleSelection,\n} from '@elytracms/studio/lib/cms-views'\nimport type { SelectionState, ViewSort } from '@elytracms/studio/lib/cms-views'\nimport { pseudoColumnsForSource } from '@elytracms/studio/lib/collection-view/collection-view-source'\nimport type { DocumentTimestampsCapability } from '@elytracms/studio/lib/collection-view/collection-view-source'\nimport { cellEditKind, cellKey } from './cell-edit'\nimport { FallbackChip } from './cell'\nimport { EditableCell } from './editable-cell'\nimport { useCellEdit } from './use-cell-edit'\nimport { ImportDialog } from './import-export'\nimport { AssetThumb, useAssetRecord } from '../assets/asset-thumb'\nimport { fieldLabel, pseudoColumnLabel } from './cms-labels'\nimport { cmsIssueLabel, cmsValidationIssueMessage } from '@elytracms/studio/lib/persona/labels'\nimport { TriangleAlert } from 'lucide-react'\nimport type { BulkAction, BulkReport, BulkSetField } from './bulk-actions'\nimport { BulkBar, BulkReportPanel } from './bulk-bar'\nimport { rowActionsFor } from './row-actions'\nimport type { RowAction } from './row-actions'\nimport { duplicateFromSource } from './duplicate-document'\nimport {\n CHECKBOX_COLUMN_WIDTH_REM,\n PRIMARY_COLUMN_WIDTH_REM,\n ROW_ACTIONS_COLUMN_WIDTH_REM,\n STATUS_DOT_COLUMN_WIDTH_REM,\n columnWidthRem,\n pseudoColumnWidthRem,\n} from './column-width'\nimport { ReferenceConfirmDialog } from './reference-confirm'\nimport { FilterControl } from './filter-builder'\nimport { DisplayMenu, ViewTabs } from './view-bar'\nimport { DocStateDot, docStateOf } from './doc-state'\nimport { useSetBreadcrumb } from '../breadcrumb-context'\nimport { issueSeverityIcon, issueSeverityStyle } from '../issue-severity'\nimport { useCmsCollectionViewSource } from '../collection-view/cms-collection-view-source'\nimport { CollectionViewProvider, useCollectionView } from '../collection-view/collection-view-context'\n\nexport function CollectionTable({ projectId, collectionId }: { projectId: string; collectionId: string }) {\n // AD-19: render over the portable CollectionViewSource, not `useCms()` directly,\n // so the SAME list surface serves the users rail (EC-240), redirects (EC-303), …\n const source = useCmsCollectionViewSource(collectionId)\n\n if (!source) {\n return (\n <div className=\"grid h-full place-items-center p-8\">\n <Text tone=\"muted\">\n Unknown collection <Code tone=\"muted\">{collectionId}</Code>.\n </Text>\n </div>\n )\n }\n\n // Keyed per collection so selection/report state never leaks across collections.\n return (\n <CollectionViewProvider source={source}>\n <LoadedCollectionTable key={collectionId} projectId={projectId} />\n </CollectionViewProvider>\n )\n}\n\n/**\n * The portable list surface (AD-19). Renders entirely over the ambient\n * {@link useCollectionView} source — no `useCms`, no `CmsProvider` required — so\n * any rail (the users rail, redirects, …) reuses it by wrapping it in a\n * {@link CollectionViewProvider} over its own source. `CollectionTable` is just\n * the CMS entry point that builds a CMS source and mounts this.\n */\nexport function LoadedCollectionTable({\n projectId,\n toolbarExtra,\n}: {\n projectId: string\n /**\n * A rail-owned action rendered at the tail of the header toolbar (EC-319) —\n * e.g. the assets rail's Upload button + grid/list toggle. Absent for every\n * other rail today (users, redirects, CMS), so their toolbar is unchanged.\n */\n toolbarExtra?: ReactNode\n}) {\n const source = useCollectionView()\n const collection = source.schema\n const navigate = useNavigate()\n const collectionId = source.collectionId\n // EC-214: the collection is the active record — the global header breadcrumb\n // names it, replacing the per-view title heading.\n useSetBreadcrumb([{ label: localizedLabel(collection.form?.label, collectionId) }])\n const [importOpen, setImportOpen] = useState(false)\n const [selection, setSelection] = useState<SelectionState>(EMPTY_SELECTION)\n const [bulkBusy, setBulkBusy] = useState(false)\n const [bulkReport, setBulkReport] = useState<BulkReport | null>(null)\n // EC-173: bulk unpublish/delete go through the reference-aware confirmation\n // with a snapshot of the selection taken when the action was raised.\n const [pendingBulk, setPendingBulk] = useState<{\n action: 'unpublish' | 'delete'\n targets: { collection: string; id: string }[]\n } | null>(null)\n\n // The working view state (EC-169): filters + sort + columns, possibly dirty\n // against the active saved view. The table renders exactly this state.\n const viewState = source.viewState()\n // EC-445: the reserved pseudo-columns this source surfaces ($state/$url/$updatedAt),\n // folded into the column universe so they order/hide alongside real fields. The\n // SAME list drives the Display picker (view-bar), so the universe never drifts.\n const pseudo = pseudoColumnsForSource(source)\n // EC-213: the title/link column is the first visible column; the rest follow\n // in the view's column order. No separate primary-column selector.\n const primary = primaryColumn(collection, viewState, pseudo)\n const columns = visibleColumns(collection, viewState, pseudo).filter((name) => name !== primary)\n const primaryFieldDef = collection.fields.find((f) => f.name === primary)\n\n const docs = source.documents()\n\n // EC-274/EC-284: collection-shape drift (a singleton with > 1 document; later\n // duplicate/unknown/unfilled aliases). When the data has drifted from the lens's\n // expected shape the studio shows this list instead of skipping — surfacing the\n // conflicts here as a \"for review\" banner so an editor resolves them without a\n // developer (keep/delete the outliers), after which the lens applies again.\n const shapeIssues = useMemo(() => validateCollectionShape(collection, docs), [collection, docs])\n\n // EC-216 + EC-205 (\"live = published\"): each routable document's LIVE URL,\n // derived from the PUBLISHED pool (never draft rows), memoised inside the\n // source. `null` when the collection is not routable → the column is hidden.\n const urlByDocId = source.publishing?.liveUrls?.() ?? null\n\n const visibleDocs = useMemo(\n // EC-224: the `$state` filter/sort sources published-ness from the version\n // POINTER (`source.publishing.isPublished`), not a flat `state` field.\n // EC-445: the pseudo-DATE columns sort by the source's materialized timestamps.\n () =>\n applyViewState(\n collection,\n docs,\n source.localeConfig,\n viewState,\n (doc) => source.publishing?.isPublished({ collection: doc.collection, id: doc.id }) ?? false,\n {\n updatedAt: (doc) =>\n source.timestamps?.updatedAt({ collection: doc.collection, id: doc.id }),\n publishedAt: (doc) =>\n source.timestamps?.publishedAt({ collection: doc.collection, id: doc.id }),\n },\n ).docs,\n [collection, docs, source.localeConfig, viewState, source.publishing, source.timestamps],\n )\n\n // EC-218: a collection with a `parent` self-relation can render as a nested\n // tree (parents above their children, indented). Tree mode reorders the\n // already-filtered rows depth-first — filters/sort still order siblings.\n const hierarchical = source.capabilities.hierarchy\n const [treeMode, setTreeMode] = useState(hierarchical)\n const treeRows = useMemo(\n () => (hierarchical && treeMode ? orderHierarchically(visibleDocs) : null),\n [hierarchical, treeMode, visibleDocs],\n )\n const orderedDocs = treeRows ? treeRows.map((row) => row.doc) : visibleDocs\n const depthById = useMemo(\n () => (treeRows ? new Map(treeRows.map((row) => [row.doc.id, row.depth])) : undefined),\n [treeRows],\n )\n\n // EC-246a header derivations. The count reads with the collection's own noun\n // (pluralized via the config labels), not a bare number or the generic kind.\n const pluralLabel = localizedLabel(collection.form?.label, `${collectionId}s`)\n const singularLabel = localizedLabel(collection.form?.labelSingular, collectionId)\n const countLabel =\n visibleDocs.length === docs.length\n ? translate('cms.list.count', {\n count: docs.length,\n noun: docs.length === 1 ? singularLabel : pluralLabel,\n })\n : translate('cms.list.countFiltered', {\n visible: visibleDocs.length,\n total: docs.length,\n noun: pluralLabel,\n })\n\n // EC-246d: New creates an empty draft and opens its editor directly — no\n // interstitial modal, for pages or any other collection. Id is auto-generated;\n // the slug/title (and, for pages, the parent) are typed in the form, and a\n // missing/duplicate slug surfaces as a Publish-gating issue, never blocks the\n // draft. Routes are config-sourced (EC-207), so nothing else is written here.\n const isPageCollection = collectionId === 'page'\n // Creation is a capability (a credential rail like users mints identities via\n // sign-up, not here), and the detail route is rail-owned (never the CMS route).\n const canCreate = source.capabilities.create && source.detailPath !== undefined\n const handleNew = () => {\n const ref = source.create()\n const splat = source.detailPath?.(ref.id)\n if (splat === undefined) return\n navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } })\n }\n const visibleIds = orderedDocs.map((doc) => doc.id)\n // Selection is always read against the current view — rows the filters hid\n // are never silently included in a bulk action.\n const selectedIds = visibleSelection(selection, visibleIds)\n // EC-316: the right-edge row menu is a capability-gated column — a rail with\n // no detail surface AND no publish/remove capability offers nothing (users\n // rail today has remove, so this is rarely empty; kept honest for AD-19).\n const hasRowActions = source.detailPath !== undefined || source.capabilities.publish || source.capabilities.remove\n\n function toggleSort(field: string) {\n source.setViewState((prev) => {\n const sort: ViewSort | null =\n prev.sort?.field !== field\n ? { field, dir: 'asc' }\n : prev.sort.dir === 'asc'\n ? { field, dir: 'desc' }\n : null\n return { ...prev, sort }\n })\n }\n\n function raiseBulk(action: BulkAction) {\n if (action === 'publish') {\n void handleBulk(action, [...selectedIds])\n return\n }\n // Set-field is composed + raised through the bulk bar's own panel\n // (onSetField), never this state-action path.\n if (action === 'set-field') return\n // Unpublish/delete first enumerate inbound references (EC-173): the\n // dialog shows the aggregate \"N documents, M references will break\".\n setPendingBulk({\n action,\n targets: selectedIds.map((id) => ({ collection: collectionId, id })),\n })\n }\n\n // EC-316: the row `⋮` menu dispatches through the SAME machinery as the\n // toolbar's bulk actions — one document is just a selection of one — so\n // there is exactly one write path for publish/unpublish/delete, never a\n // parallel one. `open` is the row menu's own affordance (the primary-column\n // link already offers it; this is the keyboard/menu-driven equivalent).\n function handleRowAction(action: RowAction, doc: CmsDocument) {\n if (action === 'open') {\n const splat = source.detailPath?.(doc.id)\n if (splat === undefined) return\n navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } })\n return\n }\n // EC-442: duplicate the row's draft into a fresh DRAFT document (never\n // auto-published) through the seam's existing create+save write paths,\n // then land on the new draft's editor — the same navigation `+ New` takes.\n // The action is offered iff `capabilities.create` + a detail surface\n // (`rowActionsFor`), the New button's exact gate.\n if (action === 'duplicate') {\n const newRef = duplicateFromSource(source, doc)\n toast.success(translate('cms.editor.duplicateCreated'))\n const splat = source.detailPath?.(newRef.id)\n if (splat === undefined) return\n navigate({ to: STUDIO_PROJECT_ROUTE, params: { projectId, _splat: splat } })\n return\n }\n if (action === 'publish') {\n void handleBulk(action, [doc.id])\n return\n }\n // unpublish/delete: the same reference-aware confirmation the bulk bar\n // raises, scoped to this one document.\n setPendingBulk({ action, targets: [{ collection: collectionId, id: doc.id }] })\n }\n\n async function handleBulk(action: BulkAction, acted: readonly string[], setField?: BulkSetField) {\n // Defensive: with the capability gates below (`source.bulk` presence gates\n // the bar, per-action capabilities gate its buttons) this is unreachable —\n // but a confirmed action must NEVER silently no-op (EC-433: the assets\n // rail's bulk delete used to die exactly here), so a missing runner still\n // reports one honest failure per item.\n if (!source.bulk) {\n setBulkReport({\n action,\n ...(setField ? { setField } : {}),\n results: acted.map((id) => ({\n ref: { collection: collectionId, id },\n title: source.titleOf({ collection: collectionId, id }),\n ok: false,\n reason: 'Bulk actions are not available in this view.',\n error: { code: 'unknown', message: 'Bulk actions are not available in this view.' },\n })),\n })\n return\n }\n setBulkBusy(true)\n try {\n const report = await source.bulk([...acted], action, setField)\n setBulkReport(report)\n // Succeeded items deselect; failed items stay selected for a retry.\n const actedSet = new Set(acted)\n const failed = new Set(report.results.filter((r) => !r.ok).map((r) => r.ref.id))\n setSelection((prev) => ({\n ids: prev.ids.filter((id) => !actedSet.has(id) || failed.has(id)),\n anchorId: null,\n }))\n } finally {\n setBulkBusy(false)\n }\n }\n\n function exportJson() {\n const data = JSON.stringify(source.documents(), null, 2)\n const blob = new Blob([data], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = `${collectionId}.json`\n a.click()\n URL.revokeObjectURL(url)\n }\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {/* Header (EC-246a redesign). One toolbar: identity + refine on the left,\n lens + actions on the right; a transient filter bar drops below only\n while refining. The header breadcrumb (EC-214) names the collection —\n no title here. Locale is a lens; column/layout config lives behind the\n far-right Display control; shared views are config-as-code (EC-246b). */}\n <div className=\"shrink-0 border-b border-border px-4 py-3 sm:px-6\">\n <Row gap=\"2\" wrap>\n {/* Left — which view (only when >1), then the transient refine. */}\n <ViewTabs />\n {/* Transient ad-hoc refine — a chip beside the view tabs, editor in a\n popover (EC-246b); the chip's ✕ clears it, so no separate Reset. */}\n <FilterControl collection={collection} />\n {/* The working-set count is the RESULT of the view + filter above, so it\n reads last, set off by a divider and sized like its neighbours. */}\n <Separator orientation=\"vertical\" className=\"h-5 self-center\" />\n <Text\n as=\"span\"\n size=\"xs\"\n tone=\"muted\"\n className=\"whitespace-nowrap tabular-nums\"\n data-testid=\"collection-count\"\n >\n {countLabel}\n </Text>\n\n <Spacer />\n\n {/* Right — the ambient locale lens (EC-176; hidden for single-locale AND\n for a non-localized rail like users), then display config + write actions. */}\n {source.capabilities.locales ? <LocaleSwitcher /> : null}\n <DisplayMenu\n collection={collection}\n hierarchical={hierarchical}\n treeMode={treeMode}\n onToggleTree={setTreeMode}\n />\n {canCreate ? (\n <Button size=\"sm\" onClick={handleNew} data-testid=\"new-document\">\n <Plus /> {isPageCollection ? translate('cms.list.newPage') : translate('cms.list.new')}\n </Button>\n ) : null}\n {/* EC-213: import/export fold into one action menu, off the header.\n AD-19: a capability — absent on credential rails (users), so identity\n records are never dumped to / loaded from raw JSON. */}\n {source.capabilities.importExport ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={translate('cms.list.moreActions')}\n data-testid=\"collection-actions\"\n >\n <MoreHorizontal />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem onClick={() => setImportOpen(true)} data-testid=\"action-import\">\n <Upload /> {translate('cms.list.import')}\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={exportJson}\n disabled={docs.length === 0}\n data-testid=\"action-export\"\n >\n <Download /> {translate('cms.list.export')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n {toolbarExtra}\n </Row>\n </div>\n\n {/* Bulk actions over the selection (EC-169). Mounted only when the source\n actually carries a bulk runner (present iff `capabilities.bulk`,\n EC-433) and each action button is capability-gated inside — a bar\n whose confirmed actions can't dispatch is never offered. */}\n {source.bulk ? (\n <BulkBar\n collection={collection}\n capabilities={source.capabilities}\n count={selectedIds.length}\n busy={bulkBusy}\n onAction={raiseBulk}\n onSetField={(setField) => void handleBulk('set-field', [...selectedIds], setField)}\n onClear={() => setSelection(clearSelection())}\n />\n ) : null}\n {bulkReport ? (\n <BulkReportPanel report={bulkReport} onDismiss={() => setBulkReport(null)} />\n ) : null}\n\n {/* Reference-aware bulk unpublish/delete confirmation (EC-173). */}\n {pendingBulk !== null ? (\n <ReferenceConfirmDialog\n projectId={projectId}\n action={pendingBulk.action}\n targets={pendingBulk.targets}\n open\n busy={bulkBusy}\n onOpenChange={(open) => {\n if (!open) setPendingBulk(null)\n }}\n onConfirm={() => {\n const { action, targets } = pendingBulk\n setPendingBulk(null)\n void handleBulk(\n action,\n targets.map((target) => target.id),\n )\n }}\n />\n ) : null}\n\n {/* EC-274/EC-284: \"for review\" lane — the collection has drifted from its\n lens's expected shape; surface each conflict so an editor can resolve it. */}\n {shapeIssues.length > 0 ? (\n <div\n className=\"shrink-0 border-b border-warning/30 bg-warning/10 px-4 py-2 sm:px-6\"\n data-testid=\"shape-review-banner\"\n >\n <Stack gap=\"1\">\n {shapeIssues.map((issue, i) => (\n <Row key={`${issue.code}:${i}`} gap=\"2\" align=\"start\">\n <TriangleAlert className=\"mt-0.5 size-3.5 shrink-0 text-warning\" aria-hidden />\n <Stack gap=\"none\" className=\"min-w-0\">\n <Text size=\"xs\" weight=\"semibold\" tone=\"default\" title={issue.code}>\n {translate('cms.list.forReview')} · {cmsIssueLabel(issue.code, issue.severity)}\n </Text>\n <Text size=\"xs\" tone=\"muted\">\n {cmsValidationIssueMessage(issue)}\n </Text>\n </Stack>\n </Row>\n ))}\n </Stack>\n </div>\n ) : null}\n\n {/* Table */}\n <div className=\"min-h-0 flex-1 overflow-auto\">\n {docs.length === 0 ? (\n <div className=\"grid h-full place-items-center p-8\">\n <Stack gap=\"2\" align=\"center\" className=\"text-center\">\n <Text tone=\"muted\">{translate('cms.list.emptyNone', { noun: pluralLabel.toLowerCase() })}</Text>\n {canCreate ? (\n <Button size=\"sm\" onClick={handleNew}>\n <Plus />{' '}\n {isPageCollection\n ? translate('cms.list.newPage')\n : translate('cms.list.newNamed', {\n noun: localizedLabel(collection.form?.labelSingular, 'document'),\n })}\n </Button>\n ) : null}\n </Stack>\n </div>\n ) : visibleDocs.length === 0 ? (\n <div className=\"grid h-full place-items-center p-8\">\n <Text tone=\"muted\" data-testid=\"empty-filtered\">\n {translate('cms.list.emptyFiltered')}\n </Text>\n </div>\n ) : (\n <DocumentsGrid\n projectId={projectId}\n collection={collection}\n primary={primary}\n primaryFieldDef={primaryFieldDef}\n columns={columns}\n sortedDocs={orderedDocs}\n depthById={depthById}\n urlByDocId={urlByDocId}\n sort={viewState.sort}\n onSort={toggleSort}\n selectedIds={selectedIds}\n onToggleRow={(id, shift) =>\n setSelection((prev) => toggleRow(prev, visibleIds, id, shift))\n }\n onToggleAll={() =>\n setSelection(\n selectedIds.length === visibleIds.length && visibleIds.length > 0\n ? clearSelection()\n : selectAll(visibleIds),\n )\n }\n hasRowActions={hasRowActions}\n onRowAction={handleRowAction}\n />\n )}\n </div>\n\n {source.capabilities.importExport ? (\n <ImportDialog collectionId={collectionId} open={importOpen} onOpenChange={setImportOpen} />\n ) : null}\n </div>\n )\n}\n\n/**\n * The documents table with inline cell editing (EC-168). Cells edit in place\n * (text/number/boolean/select/date) or open pickers (relation/asset); each\n * commit is one operations command via the cell-edit controller, with\n * rollback + inline cell errors on rejection. Row checkboxes (EC-169) live in\n * their own column, so selection clicks never collide with cell editing.\n */\nfunction DocumentsGrid({\n projectId,\n collection,\n primary,\n primaryFieldDef,\n columns,\n sortedDocs,\n depthById,\n urlByDocId,\n sort,\n onSort,\n selectedIds,\n onToggleRow,\n onToggleAll,\n hasRowActions,\n onRowAction,\n}: {\n projectId: string\n collection: CollectionDef\n primary: string\n primaryFieldDef: FieldDef | undefined\n columns: string[]\n sortedDocs: CmsDocument[]\n /** EC-218: nesting depth per doc id when rendering the hierarchy (tree mode). */\n depthById?: Map<string, number>\n /** EC-216: each routable doc's derived URL; `null` hides the URL column. */\n urlByDocId?: Map<string, DocumentUrl> | null\n sort: ViewSort | null\n onSort: (field: string) => void\n selectedIds: readonly string[]\n onToggleRow: (id: string, shift: boolean) => void\n onToggleAll: () => void\n /** EC-316: whether the right-edge row `⋮` menu has anything to offer at all. */\n hasRowActions: boolean\n onRowAction: (action: RowAction, doc: CmsDocument) => void\n}) {\n const source = useCollectionView()\n const collectionId = collection.id\n // EC-346: a rail with no publish lifecycle (assets/redirects/users) has no\n // state to show — the column is omitted entirely (header + cells), never a\n // badge defaulted to \"draft\" via `?? false`. `source.publishing` presence IS\n // the gate (mirrors the capability contract: the group is present iff the\n // flag is set), narrowed once here so every render site below is type-safe.\n const publishing = source.publishing\n // EC-448: `$state` is a FIXED structural leading column (checkbox → status-dot →\n // title) — always present, not draggable, not in the Display picker — gated by the\n // SAME publish-lifecycle signal that used to gate the reorderable state column\n // (EC-346): a rail with no publish lifecycle (assets/users/redirects) shows no\n // status column at all, never an empty one.\n const hasStatus = publishing !== undefined\n // EC-445: per-document timestamps behind the $updatedAt/$publishedAt pseudo-cells.\n const timestamps = source.timestamps\n const fieldByName = (name: string) => collection.fields.find((f) => f.name === name)\n // Inline editing is a capability: a read-only rail yields no editable cells.\n const editableFields = source.capabilities.inlineEdit\n ? columns.filter((name) => {\n const field = fieldByName(name)\n return field ? cellEditKind(field, source.isFieldReadOnly(field)) !== 'none' : false\n })\n : []\n const cellEdit = useCellEdit({ collection, docs: sortedDocs, editableFields })\n const selected = new Set(selectedIds)\n const allSelected = sortedDocs.length > 0 && selectedIds.length === sortedDocs.length\n\n return (\n <div ref={cellEdit.containerRef}>\n {/* EC-316: `table-fixed` + an explicit `<colgroup>` fix every column's\n width from the SCHEMA alone, before any row renders. Under the\n browser's default `table-layout: auto` a cell's INTRINSIC content\n width feeds back into its column — so swapping a cell's rendered\n value for its inline editor (a wider `<input>`) reflowed the whole\n grid. Fixed layout makes a column's width immune to its cells'\n content; `columnWidthRem` only sets relative proportions, so the\n grid still scales naturally with the container (never with a cell). */}\n <table className=\"w-full table-fixed border-collapse text-sm\">\n <colgroup>\n <col style={{ width: `${CHECKBOX_COLUMN_WIDTH_REM}rem` }} />\n {/* EC-448: the fixed narrow status-dot column, sized for a dot (never the\n state TEXT) so the title's left edge stays consistent across collections. */}\n {hasStatus ? <col style={{ width: `${STATUS_DOT_COLUMN_WIDTH_REM}rem` }} /> : null}\n <col style={{ width: `${PRIMARY_COLUMN_WIDTH_REM}rem` }} />\n {columns.map((name) => (\n <col\n key={name}\n style={{\n width: `${isPseudoColumn(name) ? pseudoColumnWidthRem(name) : columnWidthRem(fieldByName(name))}rem`,\n }}\n />\n ))}\n {hasRowActions ? <col style={{ width: `${ROW_ACTIONS_COLUMN_WIDTH_REM}rem` }} /> : null}\n </colgroup>\n <thead className=\"sticky top-0 z-10 bg-background\">\n <tr className=\"border-b border-border\">\n {/* EC-448: the two leading columns (checkbox, status) are width-constrained\n (`w-10`/`w-11` + `whitespace-nowrap`, matching the colgroup rem) so they\n never flex with content and the title starts at a consistent left edge. */}\n <th className=\"w-10 whitespace-nowrap px-3 py-2 text-left\">\n <SelectionCheckbox\n checked={allSelected}\n indeterminate={selectedIds.length > 0 && !allSelected}\n label={translate('cms.list.selectAll')}\n testId=\"select-all\"\n onToggle={() => onToggleAll()}\n />\n </th>\n {hasStatus ? (\n <th\n className=\"w-11 whitespace-nowrap px-2 py-2 text-center\"\n data-testid=\"status-column\"\n >\n <StatusHeader sort={sort} onSort={onSort} />\n </th>\n ) : null}\n <HeaderCell\n field={primary}\n label={primaryFieldDef ? fieldLabel(primaryFieldDef) : translate('cms.list.column.title')}\n sort={sort}\n onSort={onSort}\n />\n {/* EC-445: schema fields AND the reserved pseudo-columns render through\n the SAME columns map (order/hide alongside real fields), dispatched by\n the `$`-name — replacing the old hardcoded trailing state/url blocks. */}\n {columns.map((name) => {\n if (isPseudoColumn(name)) {\n // $url is a derived value — not sortable (EC-216), so a plain header.\n if (name === URL_FIELD) {\n return (\n <th\n key={name}\n className=\"px-3 py-2 text-left text-xs font-semibold text-muted-foreground\"\n >\n {translate('cms.list.column.url')}\n </th>\n )\n }\n return (\n <HeaderCell\n key={name}\n field={name}\n label={pseudoColumnLabel(name)}\n sort={sort}\n onSort={onSort}\n />\n )\n }\n const field = fieldByName(name)\n return field ? (\n <HeaderCell key={name} field={name} label={fieldLabel(field)} sort={sort} onSort={onSort} />\n ) : null\n })}\n {hasRowActions ? (\n <th className=\"px-2 py-2 text-right\">\n <span className=\"sr-only\">{translate('cms.list.rowActionsColumnLabel')}</span>\n </th>\n ) : null}\n </tr>\n </thead>\n <tbody>\n {sortedDocs.map((doc) => (\n <tr\n key={doc.id}\n className={cn(\n 'group border-b border-border/60 hover:bg-muted/40',\n selected.has(doc.id) && 'bg-primary/5',\n )}\n >\n <td className=\"w-10 whitespace-nowrap px-3 py-2 align-middle\">\n <SelectionCheckbox\n checked={selected.has(doc.id)}\n // EC-463: the row's TITLE, not the internal draft key — an\n // accessible name has to identify the thing a human (or an\n // agent editor) sees. \"Select new-docPage-1\" identified nothing.\n label={translate('cms.list.selectRow', {\n title: source.titleOf({ collection: collectionId, id: doc.id }),\n })}\n testId={`select-row-${doc.id}`}\n onToggle={(shift) => onToggleRow(doc.id, shift)}\n />\n </td>\n {hasStatus ? (\n <td className=\"w-11 whitespace-nowrap px-2 py-2 text-center align-middle\">\n {/* EC-448: the compact status dot replaces the DocStateBadge in the\n list. EC-449: three-way — `changed` (amber) comes from the cheap\n materialized per-row hasUnpublishedChanges signal (computed once\n at the write chokepoint, never a per-row snapshot compare); a\n source without the signal degrades to published/draft. */}\n <DocStateDot\n state={docStateOf(\n publishing!.isPublished({ collection: collectionId, id: doc.id }),\n publishing!.hasUnpublishedChanges?.({\n collection: collectionId,\n id: doc.id,\n }) ?? false,\n )}\n />\n </td>\n ) : null}\n <td className=\"px-3 py-2 align-middle\">\n <PrimaryCell\n projectId={projectId}\n collection={collection}\n doc={doc}\n primary={primary}\n depth={depthById?.get(doc.id) ?? 0}\n locale={source.activeLocale}\n config={source.localeConfig}\n detailPath={source.detailPath}\n />\n </td>\n {columns.map((name) => {\n if (isPseudoColumn(name)) {\n return (\n <td key={name} className=\"px-3 py-2 align-middle\">\n <PseudoCell\n name={name}\n docId={doc.id}\n collectionId={collectionId}\n timestamps={timestamps}\n url={urlByDocId?.get(doc.id)}\n locale={source.activeLocale}\n />\n </td>\n )\n }\n const field = fieldByName(name)\n const coord = { docId: doc.id, field: name }\n const key = cellKey(coord)\n return (\n <td key={name} className=\"px-3 py-2 align-middle\">\n {field ? (\n <EditableCell\n collection={collection}\n doc={doc}\n field={field}\n editing={cellEdit.activeKey === key}\n busy={cellEdit.busyKey === key}\n errorMessage={cellEdit.errorOf(key)}\n onStartEdit={() => cellEdit.start(coord)}\n onCancel={() => cellEdit.cancel(coord)}\n onCommit={(value, advance) => cellEdit.commit(coord, value, advance)}\n />\n ) : null}\n </td>\n )\n })}\n {hasRowActions ? (\n <td className=\"px-2 py-2 text-right align-middle\">\n <RowActionsMenu\n doc={doc}\n published={source.publishing?.isPublished({ collection: collectionId, id: doc.id }) ?? false}\n hasDetailPath={source.detailPath !== undefined}\n onAction={(action) => onRowAction(action, doc)}\n />\n </td>\n ) : null}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n}\n\n/**\n * The right-edge row `⋮` menu (EC-316): the SAME action vocabulary as the\n * toolbar's bulk actions (`rowActionsFor`), gated by the SAME capabilities —\n * so it degrades exactly like the rest of the list for a rail without\n * publish/remove (AD-19). Renders nothing when the gate leaves zero actions.\n */\nfunction RowActionsMenu({\n doc,\n published,\n hasDetailPath,\n onAction,\n}: {\n doc: CmsDocument\n published: boolean\n hasDetailPath: boolean\n onAction: (action: RowAction) => void\n}) {\n const source = useCollectionView()\n const actions = rowActionsFor({ capabilities: source.capabilities, hasDetailPath, published })\n if (actions.length === 0) return null\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={translate('cms.list.rowActionsLabel', { id: doc.id })}\n data-testid={`row-actions-${doc.id}`}\n >\n <MoreHorizontal />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {actions.map((action) => (\n <RowActionItem key={action} action={action} onSelect={() => onAction(action)} />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nfunction RowActionItem({ action, onSelect }: { action: RowAction; onSelect: () => void }) {\n switch (action) {\n case 'open':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-open\">\n <Pencil /> {translate('cms.list.rowAction.open')}\n </DropdownMenuItem>\n )\n case 'duplicate':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-duplicate\">\n <Copy /> {translate('common.duplicate')}\n </DropdownMenuItem>\n )\n case 'publish':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-publish\">\n <Eye /> {translate('cms.list.bulk.publish')}\n </DropdownMenuItem>\n )\n case 'unpublish':\n return (\n <DropdownMenuItem onClick={onSelect} data-testid=\"row-action-unpublish\">\n <EyeOff /> {translate('cms.list.bulk.unpublish')}\n </DropdownMenuItem>\n )\n case 'delete':\n return (\n <DropdownMenuItem\n variant=\"destructive\"\n onClick={onSelect}\n data-testid=\"row-action-delete\"\n >\n <Trash2 /> {translate('common.delete')}\n </DropdownMenuItem>\n )\n }\n}\n\n/**\n * A selection checkbox (row or select-all). Its own column and focus target —\n * it never participates in the cell-edit keyboard flow. Shift-click selects\n * the anchor→row range (the mousedown guard stops text selection).\n */\nfunction SelectionCheckbox({\n checked,\n indeterminate = false,\n label,\n testId,\n onToggle,\n}: {\n checked: boolean\n indeterminate?: boolean\n label: string\n testId: string\n onToggle: (shift: boolean) => void\n}) {\n return (\n <input\n ref={(el) => {\n if (el) el.indeterminate = indeterminate && !checked\n }}\n type=\"checkbox\"\n className=\"size-4 cursor-pointer accent-primary align-middle\"\n checked={checked}\n readOnly\n aria-label={label}\n data-testid={testId}\n onClick={(event) => onToggle(event.shiftKey)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n onToggle(event.shiftKey)\n }\n }}\n onMouseDown={(event) => {\n if (event.shiftKey) event.preventDefault()\n }}\n />\n )\n}\n\nfunction HeaderCell({\n field,\n label,\n sort,\n onSort,\n}: {\n field: string\n label: string\n sort: ViewSort | null\n onSort: (field: string) => void\n}) {\n const active = sort?.field === field\n return (\n <th className=\"px-3 py-2 text-left text-xs font-semibold text-muted-foreground\">\n <button type=\"button\" onClick={() => onSort(field)} className=\"inline-flex items-center gap-1 hover:text-foreground\">\n {label}\n {active ? (\n sort!.dir === 'asc' ? (\n <ArrowUp className=\"size-3\" />\n ) : (\n <ArrowDown className=\"size-3\" />\n )\n ) : null}\n </button>\n </th>\n )\n}\n\n/**\n * The FIXED status column's header (EC-448): a small status/indicator ICON, not a\n * text header (the column is a glanceable dot lane, kept narrow). The `aria-label` /\n * `title` carries the localized \"Status\" name. Clicking sorts by `$state` — reusing\n * EC-445's existing `$state` sort branch (`scalarOf`), so sort-by-state falls out for\n * free with no new machinery; the sort arrow shows when `$state` is the active sort.\n */\nfunction StatusHeader({ sort, onSort }: { sort: ViewSort | null; onSort: (field: string) => void }) {\n const active = sort?.field === STATE_FIELD\n const label = translate('cms.list.column.statusHeader')\n return (\n <button\n type=\"button\"\n onClick={() => onSort(STATE_FIELD)}\n aria-label={label}\n title={label}\n className=\"inline-flex items-center justify-center gap-1 text-muted-foreground hover:text-foreground\"\n data-testid=\"status-header\"\n >\n <CircleDot className=\"size-3.5\" aria-hidden />\n {active ? (\n sort!.dir === 'asc' ? <ArrowUp className=\"size-3\" /> : <ArrowDown className=\"size-3\" />\n ) : null}\n </button>\n )\n}\n\n/**\n * The primary (title) column cell: the document link, resolved in the\n * ambient active locale with a visible fallback chip when the shown title is\n * untranslated (EC-176).\n */\nfunction PrimaryCell({\n projectId,\n collection,\n doc,\n primary,\n depth = 0,\n locale,\n config,\n detailPath,\n}: {\n projectId: string\n collection: CollectionDef\n doc: CmsDocument\n primary: string\n /** EC-218: nesting depth in the hierarchy (tree mode) — indents the title. */\n depth?: number\n locale: Locale\n config: LocaleConfig\n /** Rail-owned detail route splat (AD-19); absent ⇒ the rail has no detail surface. */\n detailPath?: (id: string) => string\n}) {\n // EC-242: the title cell renders the document identity (resolveDocumentTitle) —\n // a string `titleField` or a function pattern — over the fallback-resolved\n // values, NOT the raw `primary` column value. The untranslated-title chip applies\n // only to a field-backed title (a function pattern has no single source field).\n const title = resolveDocumentTitle(\n collection,\n resolveDocumentForLocale(collection, doc, locale, config),\n doc.id,\n )\n const fallback =\n typeof collection.titleField === 'function'\n ? null\n : resolveDisplayedValue(collection, doc, primary, locale, config).fallback\n const splat = detailPath?.(doc.id)\n return (\n <Row gap=\"2\" align=\"center\" className=\"min-w-0\" style={{ paddingLeft: depth * 20 }}>\n {depth > 0 ? (\n <CornerDownRight className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n ) : null}\n {/* 0.0.39: assets get a leading, fixed-size preview in the filename column —\n an image thumbnail (object-cover) for image assets, the file-type placeholder\n otherwise. Fixed box, so it never reflows the EC-316 fixed column widths. */}\n {collection.kind === 'asset' ? <AssetThumbCell assetId={doc.id} alt={title} /> : null}\n {splat !== undefined ? (\n <Link\n to={STUDIO_PROJECT_ROUTE}\n params={{ projectId, _splat: splat }}\n className=\"truncate font-medium text-foreground hover:text-primary hover:underline\"\n >\n {title}\n </Link>\n ) : (\n <Text as=\"span\" className=\"truncate font-medium text-foreground\">\n {title}\n </Text>\n )}\n <FallbackChip fallback={fallback} testId={`cell-fallback-${doc.id}-${primary}`} />\n </Row>\n )\n}\n\n/**\n * The leading asset preview in the filename column (0.0.39). Resolves the asset\n * record from the ambient library and renders {@link AssetThumb} — an image preview\n * for image assets, the file-type placeholder for the rest. Mounted only for\n * `kind:'asset'` collections (which are always under an `<AssetsProvider>`), so the\n * `useAssetRecord` hook is never called on a rail without a library.\n */\nfunction AssetThumbCell({ assetId, alt }: { assetId: string; alt: string }) {\n const record = useAssetRecord(assetId)\n return <AssetThumb record={record} alt={alt} className=\"size-8 shrink-0\" />\n}\n\n/** A compact absolute date for a dense table cell (EC-445), localized; the full ISO\n * value rides the cell's `title`. Falls back to the raw value when unparseable. */\nfunction formatListDate(value: string, locale: Locale): string {\n const ms = Date.parse(value)\n if (Number.isNaN(ms)) return value\n return new Date(ms).toLocaleDateString(locale)\n}\n\n/**\n * A reserved REORDERABLE pseudo-column body cell (EC-445), dispatched by its `$`-key\n * — folding what used to be the table's hardcoded trailing url block into the columns\n * model. `$url` reuses {@link UrlCell}; the date columns render a compact locale date.\n * `$state` is NO LONGER dispatched here — EC-448 made it a fixed structural leading\n * column ({@link DocStateDot}), so it never flows through the reorderable columns.\n */\nfunction PseudoCell({\n name,\n docId,\n collectionId,\n timestamps,\n url,\n locale,\n}: {\n name: string\n docId: string\n collectionId: string\n timestamps: DocumentTimestampsCapability | undefined\n url: DocumentUrl | undefined\n locale: Locale\n}) {\n const ref = { collection: collectionId, id: docId }\n switch (name) {\n case URL_FIELD:\n return <UrlCell url={url} />\n case UPDATED_AT_FIELD:\n case PUBLISHED_AT_FIELD: {\n const value =\n name === UPDATED_AT_FIELD ? timestamps?.updatedAt(ref) : timestamps?.publishedAt(ref)\n if (!value) return <EmDash />\n return (\n <Text size=\"xs\" tone=\"muted\" className=\"tabular-nums\" title={value}>\n {formatListDate(value, locale)}\n </Text>\n )\n }\n default:\n return null\n }\n}\n\n/** The empty-value dash shared by the derived pseudo-cells (URL / dates). */\nfunction EmDash() {\n return (\n <Text size=\"xs\" tone=\"subtle\">\n —\n </Text>\n )\n}\n\n/**\n * The read-only URL column cell (EC-216): the document's LIVE (published) path,\n * linking to the absolute live URL when a `frontendUrl` is configured. Only\n * published documents have a `url` here (the URL is derived from the published\n * pool, EC-205), so an unpublished document — having no live page — shows a dash.\n * The URL is always derived, never stored.\n *\n * EC-518: a URL the engine computed as NOT `addressable` (EC-492 — no request\n * reaches the document through it) is never a link, `href` or not: the path stays\n * readable, and the shared `warning` glyph (EC-507) + the same label the Issues\n * pane uses replace the open-live icon, so the row and the form agree.\n */\nfunction UrlCell({ url }: { url?: DocumentUrl }) {\n if (!url) {\n return (\n <Text size=\"xs\" tone=\"subtle\">\n —\n </Text>\n )\n }\n if (!url.addressable) {\n const title = translate('cms.issue.unaddressable-url')\n const Icon = issueSeverityIcon('warning')\n return (\n <Text\n as=\"span\"\n size=\"xs\"\n tone=\"muted\"\n className=\"inline-flex max-w-[18rem] items-center gap-1\"\n title={title}\n aria-label={title}\n data-live-severity=\"warning\"\n >\n <span className=\"truncate\">{url.path}</span>\n <Icon className={cn('size-3 shrink-0', issueSeverityStyle('warning').text)} aria-hidden />\n </Text>\n )\n }\n if (url.href) {\n return (\n <a\n href={url.href}\n target=\"_blank\"\n rel=\"noreferrer\"\n title={url.href}\n className=\"inline-flex max-w-[18rem] items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span className=\"truncate\">{url.path}</span>\n <ExternalLink className=\"size-3 shrink-0\" aria-hidden />\n </a>\n )\n }\n return (\n <Text size=\"xs\" tone=\"muted\" className=\"max-w-[18rem] truncate\" title={url.path}>\n {url.path}\n </Text>\n )\n}\n\nexport type { FieldDef }\n"]}
|