@elytracms/studio 0.0.100 → 0.0.102
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/analytics-cost.test.ts +1 -1
- package/convex/asset-meta-patch.test.ts +7 -27
- package/convex/assets.ts +6 -41
- package/convex/cms.ts +2 -29
- package/convex/delivery.ts +2 -2
- package/convex/record-functions.ts +15 -82
- package/convex/redirects.ts +11 -116
- package/convex/schema.ts +4 -23
- package/convex/shared-capture.convex.test.ts +165 -0
- package/convex/triggers.ts +7 -14
- package/dist/components/ai/ai-chat-panel-lazy.js +7 -2
- package/dist/components/ai/ai-chat-panel-lazy.js.map +1 -1
- package/dist/components/ai/ai-chat-panel.js +8 -5
- package/dist/components/ai/ai-chat-panel.js.map +1 -1
- package/dist/components/ai/proposal-card.js +2 -1
- package/dist/components/ai/proposal-card.js.map +1 -1
- package/dist/components/ai/proposal-unfilled.d.ts +14 -0
- package/dist/components/ai/proposal-unfilled.js +33 -0
- package/dist/components/ai/proposal-unfilled.js.map +1 -0
- package/dist/components/ai/translate-document-action.js +8 -6
- package/dist/components/ai/translate-document-action.js.map +1 -1
- package/dist/components/ai/translate-skipped.js +1 -0
- package/dist/components/ai/translate-skipped.js.map +1 -1
- package/dist/components/app-views/studio-config.d.ts +12 -12
- package/dist/components/app-views/studio-config.js.map +1 -1
- package/dist/components/assets/asset-detail.js +1 -2
- package/dist/components/assets/asset-detail.js.map +1 -1
- package/dist/components/assets/asset-metadata.d.ts +2 -9
- package/dist/components/assets/asset-metadata.js +3 -10
- package/dist/components/assets/asset-metadata.js.map +1 -1
- package/dist/components/assets/asset-search.js +1 -1
- package/dist/components/assets/asset-search.js.map +1 -1
- package/dist/components/assets/asset-selection.js +2 -2
- package/dist/components/assets/asset-selection.js.map +1 -1
- package/dist/components/assets/assets-collection-view-source.d.ts +2 -3
- package/dist/components/assets/assets-collection-view-source.js +2 -3
- package/dist/components/assets/assets-collection-view-source.js.map +1 -1
- package/dist/components/builder/__fixtures__/reuse-race.d.ts +30 -0
- package/dist/components/builder/__fixtures__/reuse-race.js +77 -0
- package/dist/components/builder/__fixtures__/reuse-race.js.map +1 -0
- package/dist/components/builder/builder-store.d.ts +37 -1
- package/dist/components/builder/builder-store.js +21 -6
- package/dist/components/builder/builder-store.js.map +1 -1
- package/dist/components/builder/canvas-chrome-css.d.ts +1 -1
- package/dist/components/builder/canvas-chrome-css.js +1 -1
- package/dist/components/builder/canvas-chrome-css.js.map +1 -1
- package/dist/components/builder/canvas-chrome.d.ts +1 -1
- package/dist/components/builder/canvas-chrome.js +1 -1
- package/dist/components/builder/canvas-chrome.js.map +1 -1
- package/dist/components/builder/canvas-rebase.d.ts +4 -4
- package/dist/components/builder/canvas-rebase.js +3 -2
- package/dist/components/builder/canvas-rebase.js.map +1 -1
- package/dist/components/builder/canvas-render-context.d.ts +1 -1
- package/dist/components/builder/canvas-render-context.js +1 -1
- package/dist/components/builder/canvas-render-context.js.map +1 -1
- package/dist/components/builder/composition-field-editor-lazy.js +2 -1
- package/dist/components/builder/composition-field-editor-lazy.js.map +1 -1
- package/dist/components/builder/composition-field-editor.js +3 -3
- package/dist/components/builder/composition-field-editor.js.map +1 -1
- package/dist/components/builder/reuse-context.d.ts +9 -2
- package/dist/components/builder/reuse-context.js +46 -6
- package/dist/components/builder/reuse-context.js.map +1 -1
- package/dist/components/builder/reuse.d.ts +113 -70
- package/dist/components/builder/reuse.js +123 -108
- package/dist/components/builder/reuse.js.map +1 -1
- package/dist/components/cms/asset-field.js +1 -3
- package/dist/components/cms/asset-field.js.map +1 -1
- package/dist/components/cms/cell.d.ts +2 -2
- package/dist/components/cms/cell.js +8 -18
- package/dist/components/cms/cell.js.map +1 -1
- package/dist/components/cms/cms-store.d.ts +9 -1
- package/dist/components/cms/cms-store.js +1 -0
- package/dist/components/cms/cms-store.js.map +1 -1
- package/dist/components/cms/detail-editor.js +15 -14
- package/dist/components/cms/detail-editor.js.map +1 -1
- package/dist/components/cms/field-control.js +13 -1
- package/dist/components/cms/field-control.js.map +1 -1
- package/dist/components/cms/prop-fields.js +1 -1
- package/dist/components/cms/prop-fields.js.map +1 -1
- package/dist/components/cms/rich-text/lazy.js +2 -1
- package/dist/components/cms/rich-text/lazy.js.map +1 -1
- package/dist/components/cms/rich-text/toolbar-state.d.ts +1 -1
- package/dist/components/cms/rich-text/toolbar-state.js +1 -1
- package/dist/components/cms/rich-text/toolbar-state.js.map +1 -1
- package/dist/components/cms/use-field-focus.js +3 -3
- package/dist/components/cms/use-field-focus.js.map +1 -1
- package/dist/components/cms/version-compare-lazy.js +2 -1
- package/dist/components/cms/version-compare-lazy.js.map +1 -1
- package/dist/components/components/components-index.js +1 -1
- package/dist/components/components/components-index.js.map +1 -1
- package/dist/components/deployment-setup-gate.d.ts +1 -1
- package/dist/components/deployment-setup-gate.js +1 -1
- package/dist/components/deployment-setup-gate.js.map +1 -1
- package/dist/components/load-failure.d.ts +62 -0
- package/dist/components/load-failure.js +110 -0
- package/dist/components/load-failure.js.map +1 -0
- package/dist/components/notifications/shell-findings.js +3 -3
- package/dist/components/notifications/shell-findings.js.map +1 -1
- package/dist/customization.d.ts +3 -3
- package/dist/customization.js.map +1 -1
- package/dist/lib/ai/apply-content.js +99 -28
- package/dist/lib/ai/apply-content.js.map +1 -1
- package/dist/lib/ai/chat-context.d.ts +77 -7
- package/dist/lib/ai/chat-context.js +139 -14
- package/dist/lib/ai/chat-context.js.map +1 -1
- package/dist/lib/ai/chat-state.d.ts +7 -1
- package/dist/lib/ai/chat-state.js.map +1 -1
- package/dist/lib/ai/constraints.d.ts +5 -0
- package/dist/lib/ai/constraints.js +21 -6
- package/dist/lib/ai/constraints.js.map +1 -1
- package/dist/lib/ai/fake-provider.d.ts +76 -26
- package/dist/lib/ai/fake-provider.js +210 -66
- package/dist/lib/ai/fake-provider.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/keyless-assistant.d.ts +37 -0
- package/dist/lib/ai/keyless-assistant.js +193 -0
- package/dist/lib/ai/keyless-assistant.js.map +1 -0
- package/dist/lib/ai/knowledge.d.ts +9 -9
- package/dist/lib/ai/knowledge.js +22 -0
- package/dist/lib/ai/knowledge.js.map +1 -1
- package/dist/lib/ai/shape.d.ts +25 -2
- package/dist/lib/ai/shape.js +58 -7
- package/dist/lib/ai/shape.js.map +1 -1
- package/dist/lib/ai/tools.d.ts +18 -1
- package/dist/lib/ai/tools.js +74 -11
- package/dist/lib/ai/tools.js.map +1 -1
- package/dist/lib/ai/translate-document.d.ts +8 -1
- package/dist/lib/ai/translate-document.js +25 -9
- package/dist/lib/ai/translate-document.js.map +1 -1
- package/dist/lib/ai/types.d.ts +22 -7
- package/dist/lib/ai/types.js.map +1 -1
- package/dist/lib/ai/update-fields.js +13 -17
- package/dist/lib/ai/update-fields.js.map +1 -1
- package/dist/lib/ai/writer-form.d.ts +72 -3
- package/dist/lib/ai/writer-form.js +320 -42
- package/dist/lib/ai/writer-form.js.map +1 -1
- package/dist/lib/assets/upload.d.ts +1 -2
- package/dist/lib/assets/upload.js +1 -2
- package/dist/lib/assets/upload.js.map +1 -1
- package/dist/lib/auth-errors.d.ts +1 -1
- package/dist/lib/auth-errors.js +1 -1
- package/dist/lib/auth-errors.js.map +1 -1
- package/dist/lib/engine-version.d.ts +1 -1
- package/dist/lib/engine-version.js +1 -1
- package/dist/lib/engine-version.js.map +1 -1
- package/dist/lib/i18n/messages.de.d.ts +1 -1
- package/dist/lib/i18n/messages.de.js +32 -8
- package/dist/lib/i18n/messages.de.js.map +1 -1
- package/dist/lib/i18n/messages.en.d.ts +25 -3
- package/dist/lib/i18n/messages.en.js +40 -10
- package/dist/lib/i18n/messages.en.js.map +1 -1
- package/dist/lib/operations/cms-persistence.d.ts +28 -0
- package/dist/lib/operations/cms-persistence.js +55 -0
- package/dist/lib/operations/cms-persistence.js.map +1 -1
- package/dist/lib/persistence/convex-adapter.js +7 -2
- package/dist/lib/persistence/convex-adapter.js.map +1 -1
- package/dist/lib/workspace/index.d.ts +3 -3
- package/dist/lib/workspace/index.js +3 -3
- package/dist/lib/workspace/index.js.map +1 -1
- package/dist/router/navigate-once.d.ts +1 -1
- package/dist/router/navigate-once.js.map +1 -1
- package/dist/router/root.d.ts +3 -2
- package/dist/router/root.js +25 -4
- package/dist/router/root.js.map +1 -1
- package/package.json +3 -3
- package/convex/asset-alt-migration.test.ts +0 -127
- package/convex/redirect-migration.test.ts +0 -205
- package/convex/version-kind-stamping.test.ts +0 -118
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-field.js","sourceRoot":"","sources":["../../../src/components/cms/asset-field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAC9G,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,KAAK,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,KAAK,EACL,IAAI,GACL,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,M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,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GACvC,IAVG,CAAC,CAAC,IAAI,CAWL,CACT,CAAC,EACD,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,MAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,mGAE3B,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,qBAAY,QAAE,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,0BAAiB,wBAC9D,CACR,CAAC,CAAC,CAAC,IAAI,IACF,IACF,CACT,CAAA;AACH,CAAC","sourcesContent":["import { GripVertical, ImagePlus, Link2, RotateCcw, SlidersHorizontal, Trash2, Upload, X } from 'lucide-react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport type { AssetFieldDef, FieldDef } from '@elytracms/core/cms-core'\nimport { assetAlt } from '@elytracms/core/persistence'\nimport type { AssetReadLocale, AssetRecord } from '@elytracms/core/persistence'\nimport {\n assetNode,\n assetSubfieldsOf,\n moveAssetPlacement,\n readAssetId,\n removeAssetPlacementAt,\n selfTypeFieldValue,\n} from '@elytracms/core/cms-core'\nimport {\n Button,\n Card,\n Code,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n Field,\n Heading,\n Row,\n Separator,\n Spacer,\n Stack,\n Text,\n} from '@elytracms/studio/ui'\nimport { Link, STUDIO_PROJECT_ROUTE, studioPath } from '@elytracms/studio/router'\nimport { cn } from '../../lib/utils'\nimport { localizedLabel, translate } from '../../lib/i18n'\nimport {\n appendAssetSelections,\n applyAssetSelection,\n assetIdsOf,\n singleAssetIdOf,\n} from '../assets/asset-selection'\nimport { useOptionalAssets } from '../assets/assets-store'\nimport { AssetThumb, FocalCropPreviews, FocalPointPicker, useAssetRecord } from '../assets/asset-thumb'\nimport { assetPickerBinding, batchAttachment, splitByAccept, uploadBatchProgress } from './asset-picker-core'\nimport type { UploadBatch } from './asset-picker-core'\nimport {\n assetMetaDraft,\n assetMetaDraftPatch,\n assetMetaFieldsOf,\n assetMetaFormValues,\n setAssetMetaField,\n} from '../assets/asset-metadata'\nimport type { AssetMetaDraft } from '../assets/asset-metadata'\nimport { useAssetReadLocale } from '../assets/asset-locale'\nimport { AssetMetaFieldLabel } from '../assets/asset-meta-label'\nimport { ReplaceFileButton } from '../assets/replace-file'\nimport { useCollectionView } from '../collection-view/collection-view-context'\nimport { useFieldDensity } from './field-density'\nimport { AssetPicker, AssetRejectedNotice } from './asset-picker'\nimport { FieldControl } from './field-control'\nimport { ObjectItemForm } from './object-array-field'\nimport { FieldPathContext, useFieldPath } from './field-anchors'\n\n/** The draft before the dialog seeds (EC-632) — nothing open, nothing to diff. */\nconst EMPTY_DRAFT: AssetMetaDraft = { meta: {}, localizedMeta: {} }\n\n/**\n * The asset-field family (EC-152 + EC-248 + EC-301) — split from\n * `field-control.tsx` (EC-330): the {@link AssetField} control plus its\n * preview/gallery/options sub-components. Per-use sub-fields and the options\n * dialog's metadata form render through the shared object item form /\n * `FieldControl`, so asset metadata stays schema-driven.\n */\n\n/**\n * The asset field (EC-152 + EC-248). Beyond picking from the library it now shows\n * a focal-point-aware preview, uploads directly from the field (reusing the EC-152\n * upload path — no parallel uploader), and edits the selected image's alt + focal\n * point inline (persisted on the asset document, where delivery reads them, EC-230).\n * With no `<AssetsProvider>` (a fixture-only session — every project, the playground\n * included, mounts one, `studio-project-screen.tsx`) it degrades to the labelled-badge\n * picker — no preview/upload — so it stays usable without a real library.\n */\nexport function AssetField({\n field,\n value: stored,\n onChange,\n readOnly,\n}: {\n field: AssetFieldDef\n value: unknown\n onChange: (value: unknown) => void\n readOnly: boolean\n}) {\n // EC-586/EC-581 (ASSETS D4): the field reads its value through THE canonicaliser — the\n // one cardinality rule — so a lone placement left in a field since declared `multiple`\n // shows as a one-item gallery (and the next pick keeps it) instead of an empty one that\n // drops it; picks and removes then write from that canonical list.\n const value = useMemo(() => selfTypeFieldValue(field, stored), [field, stored])\n const source = useCollectionView()\n const assets = useOptionalAssets()\n const density = useFieldDensity()\n const compact = density === 'compact'\n // EC-582 / EC-572 #1: the anchor prefix of this field — a gallery placement's sub-field\n // inputs are stamped `<field>/<entry index>/<sub-field>`, the path the validator gives\n // their issues (a single placement's are `<field>/<sub-field>`, stamped by the form).\n const fieldPath = useFieldPath()\n const [open, setOpen] = useState(false)\n // The placement whose image options dialog is open (EC-588 2i: every placement of a\n // gallery has one, not only a single field's): its gallery index, or `null` for a\n // single field's one placement.\n const [editing, setEditing] = useState<{ index: number | null } | null>(null)\n const [dragging, setDragging] = useState(false)\n // Reorder by drag (EC-588 2i): the gallery index being dragged and the one under it.\n const [moveFrom, setMoveFrom] = useState<number | null>(null)\n const [moveOver, setMoveOver] = useState<number | null>(null)\n // Names of files a drop/pick rejected against the field's `accept` (EC-301) — shown\n // as a transient inline issue, cleared on the next valid upload. Never a silent drop.\n const [rejected, setRejected] = useState<string[]>([])\n // The active upload BATCH (EC-460): exactly the upload ids this field's drop\n // started (EC-588 A7), so the effect below attaches the WHOLE batch and nothing\n // another tab or a sibling field uploaded meanwhile.\n const pendingRef = useRef<UploadBatch | null>(null)\n const assetCollectionId = source.assetCollectionId ?? 'asset'\n const many = field.multiple\n const ids = many ? assetIdsOf(value) : []\n const single = !many ? singleAssetIdOf(value) : null\n // EC-301 per-use sub-fields: the value stores asset ENVELOPES (`{ type:'asset', id }`,\n // EC-586 — the canonical form, sub-fields or not) carrying any sub-field siblings\n // (`caption`). Picks/edits/removes preserve every other placement's sub-fields.\n const subFields = field.fields ?? []\n const hasSub = subFields.length > 0\n // The raw `many` entries (envelopes or bare ids), index-aligned with `ids`, so each\n // gallery item can read/write its own sub-fields.\n const entries = many && Array.isArray(value) ? (value as unknown[]) : []\n\n // Auto-select what an upload FROM this field added once it lands in the\n // library. EC-460: a `many` field attaches EVERY batch arrival as it lands\n // (the batch stays armed until it settles), so dropping N files attaches all\n // N — the old flow disarmed on the FIRST arrival and silently stranded the\n // rest in the library. A `one` field keeps the first-to-land selection.\n useEffect(() => {\n const batch = pendingRef.current\n if (!batch || !assets) return\n // EC-588 2i: the one batch-attach rule (the picker runs it too) — a `many` field\n // appends the whole batch once it settles, IN FILE ORDER; a single field takes the\n // first arrival.\n const { attach, disarm } = batchAttachment(uploadBatchProgress(batch, assets, field.accept), many)\n if (disarm) pendingRef.current = null\n if (attach.length === 0) return\n const next = many ? appendAssetSelections(value, attach) : applyAssetSelection(value, attach[0]!, false)\n if (next !== value) onChange(next)\n // Reacts to the assets store changing (an upload landing in the library, the\n // queue draining) — `value`/`onChange` are read from the closure on purpose.\n }, [assets, field.accept, many, onChange, value])\n\n function uploadFiles(files: File[]) {\n if (!assets || files.length === 0) return\n // EC-301 → EC-588: the drop rule the picker applies too — a drag-drop bypasses\n // the file dialog's `accept` filter, so re-check each file and name the rejects in\n // a visible notice instead of silently uploading the wrong kind.\n const { accepted, rejected: refused } = splitByAccept(files, field.accept)\n setRejected(refused)\n if (accepted.length === 0) return\n pendingRef.current = { uploadIds: assets.upload(accepted) }\n }\n\n // The picker is configured from the field — the SAME binding the table cell uses\n // (EC-570 #1 → EC-588): `accept`, `multiple`, and a pick through the carry rule\n // (EC-558) so a placement's per-use sub-fields (EC-301) survive a swap or an append.\n const pickerBinding = assetPickerBinding(field, value, (next) => {\n if (next !== value) onChange(next)\n })\n\n const canUpload = !readOnly && assets !== null\n\n // The open dialog's placement: which asset it shows, and — when the field declares\n // per-use sub-fields — the placement form it edits (\"In this place\").\n const editTarget = ((): { assetId: string; placement?: PlacementForm } | null => {\n if (!editing) return null\n if (editing.index === null) {\n if (!single) return null\n if (!hasSub) return { assetId: single }\n return {\n assetId: single,\n placement: {\n fields: subFields,\n value: assetSubfieldsOf(value),\n onChange: (next: Record<string, unknown>) => onChange(assetNode(single, next)),\n },\n }\n }\n if (!hasSub) {\n const aid = ids[editing.index]\n return aid ? { assetId: aid } : null\n }\n const entry = entries.filter((e) => readAssetId(e) !== undefined)[editing.index]\n const aid = readAssetId(entry)\n if (!aid) return null\n const raw = entries.indexOf(entry)\n return {\n assetId: aid,\n placement: {\n fields: subFields,\n value: assetSubfieldsOf(entry),\n onChange: (next: Record<string, unknown>) => {\n const nextEntries = entries.slice()\n nextEntries[raw] = assetNode(aid, next)\n onChange(nextEntries)\n },\n },\n }\n })()\n\n // Drag-to-upload onto the field (EC-301): a depth counter keeps the overlay\n // steady as the pointer crosses child element boundaries. `dragenter`/`dragleave`\n // fire per descendant, so toggling on a bare `dragleave` blinks constantly; we\n // only hide the overlay when the counter returns to zero (the pointer has truly\n // left the field). The overlay is pointer-events-none, so it never fires its own\n // enter/leave to confuse the count.\n const dragDepth = useRef(0)\n // Only a FILE drag is an upload: a gallery reorder drag (EC-588) is not.\n const isFileDrag = (e: React.DragEvent) => Array.from(e.dataTransfer.types).includes('Files')\n function onDragEnter(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n e.preventDefault()\n dragDepth.current += 1\n if (!dragging) setDragging(true)\n }\n function onDragOver(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n e.preventDefault() // required so a drop is allowed\n }\n function onDragLeave(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n dragDepth.current -= 1\n if (dragDepth.current <= 0) {\n dragDepth.current = 0\n setDragging(false)\n }\n }\n function onDrop(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n e.preventDefault()\n dragDepth.current = 0\n setDragging(false)\n uploadFiles(Array.from(e.dataTransfer.files))\n }\n // While the picker is open the field is behind the modal, so any drop is happening\n // INSIDE the dialog — detach the field's drag handlers entirely so a drop there can\n // only be handled by the picker, never double-counted by the field too (EC-301). This\n // is the belt to the picker's stopPropagation braces: the field cannot react at all.\n const dragProps = canUpload && !open ? { onDragEnter, onDragOver, onDragLeave, onDrop } : {}\n\n // Reorder by drag (EC-588 2i): one placement moves, every entry verbatim — core's\n // `moveAssetPlacement`, the same index counting as the remove.\n const reorderable = many && !readOnly && ids.length > 1\n function reorderProps(i: number) {\n if (!reorderable) return {}\n return {\n onDragOver: (e: React.DragEvent) => {\n if (moveFrom === null) return\n e.preventDefault()\n if (moveOver !== i) setMoveOver(i)\n },\n onDrop: (e: React.DragEvent) => {\n if (moveFrom === null) return\n e.preventDefault()\n const next = moveAssetPlacement(value, moveFrom, i)\n setMoveFrom(null)\n setMoveOver(null)\n if (next !== value) onChange(next)\n },\n }\n }\n function moveHandle(i: number): ReactNode {\n if (!reorderable) return null\n return (\n <span\n draggable\n onDragStart={(e) => {\n e.dataTransfer.effectAllowed = 'move'\n e.dataTransfer.setData('text/plain', String(i))\n setMoveFrom(i)\n }}\n onDragEnd={() => {\n setMoveFrom(null)\n setMoveOver(null)\n }}\n aria-label={translate('cms.field.dragToReorder')}\n className=\"cursor-grab text-muted-foreground/60 hover:text-muted-foreground active:cursor-grabbing\"\n >\n <GripVertical className=\"size-3.5\" />\n </span>\n )\n }\n const moveTint = (i: number) =>\n cn(moveFrom === i && 'opacity-50', moveOver === i && moveFrom !== null && moveFrom !== i && 'ring-2 ring-primary/50')\n\n const selectButton = !readOnly ? (\n <Button variant=\"outline\" size=\"sm\" onClick={() => setOpen(true)}>\n <ImagePlus /> {translate('common.select')}\n </Button>\n ) : null\n\n return (\n <Stack\n gap=\"2\"\n className={cn(\n 'relative rounded-lg transition-shadow',\n dragging && 'ring-2 ring-primary ring-offset-2 ring-offset-background',\n )}\n {...dragProps}\n >\n {many && hasSub ? (\n // Gallery with per-use sub-fields (EC-301): a card per placement — thumbnail +\n // its own sub-field form — reusing the object/repeater item rendering.\n <Stack gap=\"2\">\n {entries.length > 0 ? (\n <Stack gap=\"2\">\n {entries.map((entry, i) => {\n const aid = readAssetId(entry)\n if (!aid) return null\n // The gallery position of this placement (readable entries only) — the\n // index the one remove rule counts (core `removeAssetPlacementAt`).\n const galleryIndex = entries.slice(0, i).filter((e) => readAssetId(e) !== undefined).length\n return (\n <div key={`${aid}-${i}`} className={cn('rounded-lg', moveTint(galleryIndex))} {...reorderProps(galleryIndex)}>\n <FieldPathContext.Provider value={fieldPath === null ? null : `${fieldPath}/${i}`}>\n <AssetGalleryItem\n assetId={aid}\n collectionId={assetCollectionId}\n fields={subFields}\n value={assetSubfieldsOf(entry)}\n readOnly={readOnly}\n idPrefix={`asset-${i}`}\n handle={moveHandle(galleryIndex)}\n onChangeSubs={(next) => {\n const nextEntries = entries.slice()\n nextEntries[i] = assetNode(aid, next)\n onChange(nextEntries)\n }}\n onEdit={assets ? () => setEditing({ index: galleryIndex }) : undefined}\n onRemove={readOnly ? undefined : () => onChange(removeAssetPlacementAt(value, galleryIndex))}\n />\n </FieldPathContext.Provider>\n </div>\n )\n })}\n </Stack>\n ) : (\n <EmptyAssetState\n compact={compact}\n canUpload={canUpload}\n readOnly={readOnly}\n onSelect={() => setOpen(true)}\n />\n )}\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n </Row>\n </Stack>\n ) : many ? (\n // Gallery: a grid of focal-aware previews + the single Select entry.\n <Stack gap=\"2\">\n {ids.length > 0 ? (\n <div\n className={cn(\n 'grid gap-2',\n compact ? 'grid-cols-2' : 'grid-cols-3 sm:grid-cols-4',\n )}\n >\n {ids.map((aid, i) => (\n <div key={`${aid}-${i}`} className={cn('rounded-lg', moveTint(i))} {...reorderProps(i)}>\n <AssetChip\n assetId={aid}\n collectionId={assetCollectionId}\n handle={moveHandle(i)}\n onEdit={assets ? () => setEditing({ index: i }) : undefined}\n onRemove={readOnly ? undefined : () => onChange(removeAssetPlacementAt(value, i))}\n />\n </div>\n ))}\n </div>\n ) : (\n <EmptyAssetState\n compact={compact}\n canUpload={canUpload}\n readOnly={readOnly}\n onSelect={() => setOpen(true)}\n />\n )}\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n </Row>\n </Stack>\n ) : single && hasSub ? (\n // With per-use sub-fields the asset + its fields read as ONE grouped unit\n // (like an object), so it's clear they belong together (EC-301 feedback).\n <Card className=\"border-l-2 border-l-border p-3\">\n <Stack gap=\"3\">\n <AssetSinglePreview\n assetId={single}\n compact={compact}\n readOnly={readOnly}\n hasLibrary={assets !== null}\n fallbackTitle={source.titleOf({ collection: assetCollectionId, id: single })}\n selectButton={selectButton}\n onEdit={() => setEditing({ index: null })}\n onRemove={() => onChange(applyAssetSelection(value, null, many))}\n />\n <div className=\"border-t border-border/60 pt-3\">\n <ObjectItemForm\n fields={subFields}\n value={assetSubfieldsOf(value)}\n readOnly={readOnly}\n idPrefix=\"asset-sub\"\n onChange={(next) => onChange(assetNode(single, next))}\n />\n </div>\n </Stack>\n </Card>\n ) : single ? (\n <AssetSinglePreview\n assetId={single}\n compact={compact}\n readOnly={readOnly}\n hasLibrary={assets !== null}\n fallbackTitle={source.titleOf({ collection: assetCollectionId, id: single })}\n selectButton={selectButton}\n onEdit={() => setEditing({ index: null })}\n onRemove={() => onChange(applyAssetSelection(value, null, many))}\n />\n ) : (\n <Stack gap=\"2\">\n <EmptyAssetState\n compact={compact}\n canUpload={canUpload}\n readOnly={readOnly}\n onSelect={() => setOpen(true)}\n />\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n </Row>\n </Stack>\n )}\n\n {/* Image options (EC-301 → EC-588 2i): the placement's own sub-fields (\"In this\n place\") apart from the asset's facts (\"About this image\", shared by every use),\n for a single field's placement and for each placement of a gallery. */}\n {editTarget && assets ? (\n <AssetOptionsDialog\n assetId={editTarget.assetId}\n readOnly={readOnly}\n open\n onOpenChange={(next) => {\n if (!next) setEditing(null)\n }}\n {...(editTarget.placement ? { placement: editTarget.placement } : {})}\n />\n ) : null}\n\n <AssetPicker open={open} onOpenChange={setOpen} {...pickerBinding} />\n\n <AssetRejectedNotice rejected={rejected} accept={field.accept} />\n\n {dragging ? (\n <div className=\"pointer-events-none absolute inset-0 z-10 grid place-items-center rounded-lg border-2 border-dashed border-primary bg-background/85\">\n <Row gap=\"2\" align=\"center\">\n <Upload className=\"size-4 text-primary\" />\n <Text size=\"sm\" className=\"font-medium\">\n {translate('cms.asset.dropToUpload')}\n </Text>\n </Row>\n </div>\n ) : null}\n </Stack>\n )\n}\n\n/**\n * Empty-state placeholder shown when an asset field has no selection (EC-301).\n *\n * EC-395: this was the one asset-field affordance that ignored `readOnly` — every\n * sibling control (`selectButton`, the per-item remove/change actions) already\n * degraded, but the empty-state tile stayed a clickable `<button>` that opened the\n * picker regardless. A locked, empty asset field must be as inert as a filled one:\n * read-only renders a plain (non-interactive, non-focusable) `div` with the same\n * frame — no `onClick`, no hover affordance — instead of a `<button>`.\n */\nfunction EmptyAssetState({\n compact,\n canUpload,\n readOnly,\n onSelect,\n}: {\n compact: boolean\n canUpload: boolean\n readOnly: boolean\n onSelect: () => void\n}) {\n const frame = cn(\n 'grid w-full place-items-center gap-1 rounded-lg border border-dashed border-border bg-muted/30 text-center text-muted-foreground',\n compact ? 'aspect-video' : 'aspect-[5/2]',\n )\n if (readOnly) {\n return <div className={frame}>{emptyAssetStateBody(canUpload)}</div>\n }\n return (\n <button type=\"button\" onClick={onSelect} className={cn(frame, 'transition-colors hover:bg-muted/60')}>\n {emptyAssetStateBody(canUpload)}\n </button>\n )\n}\n\nfunction emptyAssetStateBody(canUpload: boolean) {\n return (\n <>\n <ImagePlus className=\"size-6\" aria-hidden />\n <Text size=\"xs\" tone=\"muted\">\n {canUpload ? translate('cms.asset.selectOrDrop') : translate('cms.asset.selectAsset')}\n </Text>\n </>\n )\n}\n\n/** A large focal-aware preview of the selected asset (EC-301). */\nfunction AssetPreview({ assetId }: { assetId: string }) {\n const record = useAssetRecord(assetId)\n return <AssetThumb record={record} className=\"aspect-[4/3] w-full\" />\n}\n\n/** Filename + dimensions/type for the selected asset — the id is never shown (EC-301). */\nfunction AssetInfo({ assetId, fallbackTitle }: { assetId: string; fallbackTitle?: string }) {\n const record = useAssetRecord(assetId)\n const name = record?.title ?? record?.filename ?? fallbackTitle ?? assetId\n const dims = record?.width && record?.height ? `${record.width}×${record.height}` : null\n const kind = record?.contentType?.split('/')[1]?.toUpperCase()\n const meta = [dims, kind].filter(Boolean).join(' · ')\n return (\n <Stack gap=\"1\">\n <Text size=\"sm\" className=\"truncate font-medium\" title={name}>\n {name}\n </Text>\n {meta ? (\n <Text size=\"xs\" tone=\"subtle\">\n {meta}\n </Text>\n ) : null}\n </Stack>\n )\n}\n\n/**\n * The selected image's alt text shown in the field (EC-301) — what an editor most\n * wants at a glance; edited in the options dialog. Read through THE reader (EC-587),\n * so the field shows exactly what delivery serves.\n */\nfunction AssetAltLine({ assetId }: { assetId: string }) {\n const record = useAssetRecord(assetId)\n // EC-632: in the studio's locale — a localized alt shows the open locale's translation.\n const at = useAssetReadLocale()\n const alt = record ? assetAlt(record, at) : null\n return (\n <Row gap=\"1\" align=\"baseline\" className=\"min-w-0\">\n <Text size=\"xs\" tone=\"subtle\" className=\"shrink-0\">\n {translate('cms.asset.altLabel')}\n </Text>\n <Text\n size=\"xs\"\n tone={alt ? 'muted' : 'subtle'}\n className={cn('min-w-0 truncate', !alt && 'italic')}\n title={alt ?? undefined}\n >\n {alt || translate('cms.asset.notSet')}\n </Text>\n </Row>\n )\n}\n\n/**\n * A single asset reference: focal-aware thumbnail + title, with an optional drag\n * handle (reorder, EC-588), image options and remove.\n */\nfunction AssetChip({\n assetId,\n collectionId,\n handle,\n onEdit,\n onRemove,\n}: {\n assetId: string\n collectionId: string\n handle?: ReactNode\n onEdit?: () => void\n onRemove?: () => void\n}) {\n const source = useCollectionView()\n const record = useAssetRecord(assetId)\n const title = source.titleOf({ collection: collectionId, id: assetId })\n return (\n <div className=\"group relative overflow-hidden rounded-lg border border-border bg-muted/40\">\n <AssetThumb record={record} alt={title} className=\"aspect-square w-full rounded-none border-0\" />\n <Row gap=\"1\" align=\"center\" className=\"px-2 py-1\">\n {handle}\n <Text size=\"xs\" tone=\"subtle\" className=\"min-w-0 flex-1 truncate\" title={title}>\n {title}\n </Text>\n {onEdit ? (\n <button\n type=\"button\"\n aria-label={translate('cms.asset.imageOptions.title')}\n onClick={onEdit}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n <SlidersHorizontal className=\"size-3.5\" />\n </button>\n ) : null}\n {onRemove ? (\n <button\n type=\"button\"\n aria-label={translate('common.remove')}\n onClick={onRemove}\n className=\"text-muted-foreground hover:text-destructive\"\n >\n <X className=\"size-3.5\" />\n </button>\n ) : null}\n </Row>\n </div>\n )\n}\n\n/**\n * The selected single asset's preview row (EC-301): large focal-aware preview + info\n * column (filename/dimensions, Select/Edit/Remove, alt). Extracted so it renders either\n * bare (a plain asset field) or inside the grouping card when the field carries per-use\n * sub-fields — the asset + its fields then read as one unit.\n */\nfunction AssetSinglePreview({\n assetId,\n compact,\n readOnly,\n hasLibrary,\n fallbackTitle,\n selectButton,\n onEdit,\n onRemove,\n}: {\n assetId: string\n compact: boolean\n readOnly: boolean\n hasLibrary: boolean\n fallbackTitle?: string\n selectButton: React.ReactNode\n onEdit: () => void\n onRemove: () => void\n}) {\n return (\n <div className={compact ? 'flex flex-col gap-3' : 'flex gap-4'}>\n <div className={compact ? 'w-full' : 'w-1/2 shrink-0'}>\n <AssetPreview assetId={assetId} />\n </div>\n <Stack gap=\"2\" className={cn('min-w-0', !compact && 'flex-1')}>\n <AssetInfo assetId={assetId} fallbackTitle={fallbackTitle} />\n {!readOnly ? (\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n {hasLibrary ? (\n <Button variant=\"outline\" size=\"sm\" onClick={onEdit}>\n <SlidersHorizontal /> {translate('common.edit')}\n </Button>\n ) : null}\n <Button variant=\"ghost\" size=\"sm\" onClick={onRemove}>\n <Trash2 /> {translate('common.remove')}\n </Button>\n </Row>\n ) : null}\n <AssetAltLine assetId={assetId} />\n </Stack>\n </div>\n )\n}\n\n/**\n * One gallery placement when a `many` asset field declares per-use sub-fields (EC-301):\n * a thumbnail + filename + remove header over the placement's own sub-field form,\n * modelled on a repeater item card so a gallery's placements read as grouped units.\n */\nfunction AssetGalleryItem({\n assetId,\n collectionId,\n fields,\n value,\n onChangeSubs,\n handle,\n onEdit,\n onRemove,\n readOnly,\n idPrefix,\n}: {\n assetId: string\n collectionId: string\n fields: readonly FieldDef[]\n value: Record<string, unknown>\n onChangeSubs: (value: Record<string, unknown>) => void\n handle?: ReactNode\n onEdit?: () => void\n onRemove?: () => void\n readOnly: boolean\n idPrefix: string\n}) {\n const source = useCollectionView()\n const record = useAssetRecord(assetId)\n const title = source.titleOf({ collection: collectionId, id: assetId })\n return (\n <Card className=\"border-l-2 border-l-border p-0\">\n <Row gap=\"2\" align=\"center\" className=\"border-b border-border/60 bg-muted/30 px-2 py-1.5\">\n {handle}\n <AssetThumb record={record} alt={title} className=\"size-10 shrink-0\" />\n <Text size=\"sm\" className=\"min-w-0 flex-1 truncate font-medium\" title={title}>\n {title}\n </Text>\n {onEdit ? (\n <Button variant=\"ghost\" size=\"sm\" aria-label={translate('cms.asset.imageOptions.title')} onClick={onEdit}>\n <SlidersHorizontal className=\"size-3.5\" />\n </Button>\n ) : null}\n {onRemove ? (\n <Button variant=\"ghost\" size=\"sm\" aria-label={translate('common.remove')} onClick={onRemove}>\n <Trash2 className=\"size-3.5\" />\n </Button>\n ) : null}\n </Row>\n <div className=\"px-3 pb-3\">\n <ObjectItemForm\n fields={fields}\n value={value}\n onChange={onChangeSubs}\n readOnly={readOnly}\n idPrefix={idPrefix}\n />\n </div>\n </Card>\n )\n}\n\n/** A placement's own form (EC-588 2i): the asset field's per-use sub-fields and their value. */\nexport interface PlacementForm {\n fields: readonly FieldDef[]\n value: Record<string, unknown>\n onChange: (value: Record<string, unknown>) => void\n}\n\n/**\n * The image options dialog (EC-301 → EC-588, ratified 2i): the two schemas an image\n * has, shown apart (`EC-565` § \"2i widened\").\n * - **In this place** — the PLACEMENT schema: the asset field's (or prop's) per-use\n * sub-fields (a caption, a badge layout), true of this one use only; written into the\n * field value. Present only when the field declares sub-fields.\n * - **About this image — applies everywhere it is used** — the ASSET schema: the focal\n * point and the `kind:'asset'` collection's fields over the asset's `meta` bag (alt,\n * copyright, credit, …), rendered through the generic field engine documents use;\n * persisted on the asset, so it changes every use — the Where-used panel (the asset's\n * library page) is one click away.\n * Asset metadata is buffered locally and committed once on close (one write); the\n * focal point commits immediately (it drives a live visual); the placement form writes\n * through to the field as it is edited. No-ops without a library.\n */\nfunction AssetOptionsDialog({\n assetId,\n readOnly,\n open,\n onOpenChange,\n placement,\n}: {\n assetId: string\n readOnly: boolean\n open: boolean\n onOpenChange: (open: boolean) => void\n placement?: PlacementForm\n}) {\n const source = useCollectionView()\n const assets = useOptionalAssets()\n const record = useAssetRecord(assetId)\n const metaFields = useMemo(() => {\n const assetCollectionId = source.assetCollectionId ?? 'asset'\n const collection = source.collections.find((c) => c.id === assetCollectionId)\n return collection ? assetMetaFieldsOf(collection) : []\n }, [source])\n\n // Local edit buffers, seeded once per open from the record (so an external edit\n // still wins between opens). EC-632: the draft is the document shape (shared bag +\n // per-locale buckets), shown in the studio's locale — the one the document around it\n // is open in — so a localized field (alt) edits that locale's translation.\n const at = useAssetReadLocale()\n const [draft, setDraft] = useState<AssetMetaDraft>(EMPTY_DRAFT)\n // EC-634: the draft as seeded at open — the base the commit is diffed against, so only\n // the keys (and locales) edited here are written and another session's change survives.\n const opened = useRef<AssetMetaDraft>(EMPTY_DRAFT)\n const [focal, setFocal] = useState<{ x: number; y: number } | undefined>(undefined)\n const dirty = useRef(false)\n const seeded = useRef(false)\n useEffect(() => {\n if (!open) {\n seeded.current = false\n return\n }\n if (seeded.current || !record) return\n // Seed from the stored bags with a legacy `alt` column lifted in (EC-587,\n // `assetMetaDraft`): a not-yet-migrated asset shows its alt; the write rule moves it to\n // `meta.alt` and clears the column when the commit's patch is applied.\n const seed = assetMetaDraft(record)\n opened.current = seed\n setDraft(seed)\n setFocal(record.focalPoint)\n dirty.current = false\n seeded.current = true\n }, [open, record])\n\n function handleOpenChange(next: boolean) {\n // Commit the buffered metadata once, on close (one write, not per keystroke).\n if (!next && !readOnly && assets && dirty.current) {\n void assets.updateMetadata(assetId, assetMetaDraftPatch(opened.current, draft))\n dirty.current = false\n }\n onOpenChange(next)\n }\n\n function setField(name: string, value: unknown) {\n const field = metaFields.find((f) => f.name === name)\n if (!field) return\n dirty.current = true\n setDraft((d) => setAssetMetaField(d, field, at, value))\n }\n\n // The focal point drives a live crop preview → commit immediately (optimistic\n // marker), not deferred to close.\n function commitFocal(point: { x: number; y: number } | null) {\n if (readOnly || !assets) return\n setFocal(point ?? undefined)\n void assets.updateMetadata(assetId, { focalPoint: point })\n }\n\n // EC-568: Replace file, from the dialog. Pending metadata edits are committed FIRST, so\n // the buffer cannot overwrite what the new file brings; the focal point is kept and the\n // dialog says to check it (the ticket's recommendation for open question 1).\n const [replaced, setReplaced] = useState(false)\n const replaceAction = record ? (\n <ReplaceFileButton\n record={record}\n disabled={readOnly}\n beforeReplace={async () => {\n if (assets && dirty.current) {\n dirty.current = false\n await assets.updateMetadata(assetId, assetMetaDraftPatch(opened.current, draft))\n }\n }}\n onReplaced={(asset) => {\n const seed = assetMetaDraft(asset)\n opened.current = seed\n setDraft(seed)\n setFocal(asset.focalPoint)\n dirty.current = false\n setReplaced(true)\n }}\n />\n ) : null\n\n const whereUsed =\n source.projectId !== undefined ? (\n <Link\n to={STUDIO_PROJECT_ROUTE}\n params={{ projectId: source.projectId, _splat: studioPath.asset(assetId) }}\n className=\"inline-flex items-center gap-1 text-xs text-primary hover:underline\"\n >\n <Link2 className=\"size-3\" /> {translate('cms.asset.imageOptions.whereUsed')}\n </Link>\n ) : null\n\n return (\n <Dialog open={open} onOpenChange={handleOpenChange}>\n <DialogContent className=\"max-w-lg\">\n <DialogHeader>\n <DialogTitle>{translate('cms.asset.imageOptions.title')}</DialogTitle>\n <DialogDescription>{translate('cms.asset.imageOptions.description')}</DialogDescription>\n </DialogHeader>\n <AssetOptionsSections\n record={record}\n readOnly={readOnly}\n metaFields={metaFields}\n meta={assetMetaFormValues(draft, metaFields, at)}\n metaLocale={at}\n onMetaField={setField}\n focal={focal}\n onFocalCommit={commitFocal}\n onFocalPreview={setFocal}\n whereUsed={whereUsed}\n replaceAction={replaceAction}\n replaced={replaced}\n {...(placement ? { placement } : {})}\n />\n </DialogContent>\n </Dialog>\n )\n}\n\n/**\n * The two sections of the image options dialog (EC-588 2i), stateless — exported so a\n * node smoke render can pin the split (the dialog itself portals, `null` in node).\n */\nexport function AssetOptionsSections({\n record,\n readOnly,\n metaFields,\n meta,\n metaLocale = null,\n onMetaField,\n focal,\n onFocalCommit,\n onFocalPreview,\n placement,\n whereUsed,\n replaceAction,\n replaced,\n}: {\n record: AssetRecord | undefined\n readOnly: boolean\n metaFields: readonly FieldDef[]\n /** The asset metadata form's values, in {@link metaLocale} (EC-632). */\n meta: Record<string, unknown>\n /** The locale a `localized: true` field is edited in (EC-632) — shown on its label. */\n metaLocale?: AssetReadLocale | null\n onMetaField: (name: string, value: unknown) => void\n focal: { x: number; y: number } | undefined\n onFocalCommit: (point: { x: number; y: number } | null) => void\n onFocalPreview: (point: { x: number; y: number } | undefined) => void\n placement?: PlacementForm\n whereUsed?: ReactNode\n /** EC-568: the \"Replace file\" action of the asset section. */\n replaceAction?: ReactNode\n /** EC-568: the file was just replaced — the kept focal point needs a look. */\n replaced?: boolean\n}) {\n return (\n <Stack gap=\"4\">\n {placement && placement.fields.length > 0 ? (\n <Stack gap=\"2\" data-ec-asset-options=\"placement\">\n <Stack gap=\"1\">\n <Heading level={3} size=\"h4\">\n {translate('cms.asset.imageOptions.placementTitle')}\n </Heading>\n <Text size=\"xs\" tone=\"subtle\">\n {translate('cms.asset.imageOptions.placementHint')}\n </Text>\n </Stack>\n <ObjectItemForm\n fields={placement.fields}\n value={placement.value}\n readOnly={readOnly}\n idPrefix=\"asset-options-placement\"\n onChange={placement.onChange}\n />\n <Separator />\n </Stack>\n ) : null}\n <Stack gap=\"3\" data-ec-asset-options=\"asset\">\n <Stack gap=\"1\">\n <Row align=\"center\">\n <Heading level={3} size=\"h4\">\n {translate('cms.asset.imageOptions.assetTitle')}\n </Heading>\n <Spacer />\n {whereUsed}\n </Row>\n <Text size=\"xs\" tone=\"subtle\">\n {translate('cms.asset.imageOptions.assetHint')}\n </Text>\n {replaceAction ? <Row gap=\"2\" align=\"center\" wrap>{replaceAction}</Row> : null}\n </Stack>\n <Stack gap=\"2\">\n <Row align=\"center\">\n <Text size=\"sm\" className=\"font-medium\">\n {translate('cms.asset.focalPoint')}\n </Text>\n <Spacer />\n {focal && !readOnly ? (\n <Button variant=\"ghost\" size=\"sm\" onClick={() => onFocalCommit(null)}>\n <RotateCcw /> {translate('cms.asset.resetToCentre')}\n </Button>\n ) : null}\n </Row>\n <FocalPointPicker\n record={record}\n point={focal}\n onChange={onFocalCommit}\n onPreview={onFocalPreview}\n disabled={readOnly}\n />\n {replaced ? (\n <Text size=\"xs\" className=\"font-medium\" data-ec-asset-options=\"replaced\">\n {translate('cms.asset.replacedCheckFocal')}\n </Text>\n ) : null}\n <Text size=\"xs\" tone=\"subtle\">\n {translate('cms.asset.focalPointHint')}\n </Text>\n <FocalCropPreviews record={record} point={focal} />\n </Stack>\n {metaFields.map((f) => (\n <Field\n key={f.name}\n label={<AssetMetaFieldLabel field={f} at={metaLocale} />}\n hint={localizedLabel(f.form?.description) || undefined}\n >\n <FieldControl\n id={`asset-meta-${f.name}`}\n field={f}\n value={meta[f.name]}\n readOnly={readOnly}\n onChange={(v) => onMetaField(f.name, v)}\n />\n </Field>\n ))}\n {metaFields.length === 0 ? (\n <Text size=\"sm\" tone=\"subtle\">\n No editable metadata fields are declared on the asset collection. Add fields (e.g.\n <Code tone=\"muted\"> alt</Code>, <Code tone=\"muted\">copyright</Code>) to it in code.\n </Text>\n ) : null}\n </Stack>\n </Stack>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"file":"asset-field.js","sourceRoot":"","sources":["../../../src/components/cms/asset-field.tsx"],"names":[],"mappings":";AAAA,OAA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sourcesContent":["import { GripVertical, ImagePlus, Link2, RotateCcw, SlidersHorizontal, Trash2, Upload, X } from 'lucide-react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport type { AssetFieldDef, FieldDef } from '@elytracms/core/cms-core'\nimport { assetAlt } from '@elytracms/core/persistence'\nimport type { AssetReadLocale, AssetRecord } from '@elytracms/core/persistence'\nimport {\n assetNode,\n assetSubfieldsOf,\n moveAssetPlacement,\n readAssetId,\n removeAssetPlacementAt,\n selfTypeFieldValue,\n} from '@elytracms/core/cms-core'\nimport {\n Button,\n Card,\n Code,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n Field,\n Heading,\n Row,\n Separator,\n Spacer,\n Stack,\n Text,\n} from '@elytracms/studio/ui'\nimport { Link, STUDIO_PROJECT_ROUTE, studioPath } from '@elytracms/studio/router'\nimport { cn } from '../../lib/utils'\nimport { localizedLabel, translate } from '../../lib/i18n'\nimport {\n appendAssetSelections,\n applyAssetSelection,\n assetIdsOf,\n singleAssetIdOf,\n} from '../assets/asset-selection'\nimport { useOptionalAssets } from '../assets/assets-store'\nimport { AssetThumb, FocalCropPreviews, FocalPointPicker, useAssetRecord } from '../assets/asset-thumb'\nimport { assetPickerBinding, batchAttachment, splitByAccept, uploadBatchProgress } from './asset-picker-core'\nimport type { UploadBatch } from './asset-picker-core'\nimport {\n assetMetaDraft,\n assetMetaDraftPatch,\n assetMetaFieldsOf,\n assetMetaFormValues,\n setAssetMetaField,\n} from '../assets/asset-metadata'\nimport type { AssetMetaDraft } from '../assets/asset-metadata'\nimport { useAssetReadLocale } from '../assets/asset-locale'\nimport { AssetMetaFieldLabel } from '../assets/asset-meta-label'\nimport { ReplaceFileButton } from '../assets/replace-file'\nimport { useCollectionView } from '../collection-view/collection-view-context'\nimport { useFieldDensity } from './field-density'\nimport { AssetPicker, AssetRejectedNotice } from './asset-picker'\nimport { FieldControl } from './field-control'\nimport { ObjectItemForm } from './object-array-field'\nimport { FieldPathContext, useFieldPath } from './field-anchors'\n\n/** The draft before the dialog seeds (EC-632) — nothing open, nothing to diff. */\nconst EMPTY_DRAFT: AssetMetaDraft = { meta: {}, localizedMeta: {} }\n\n/**\n * The asset-field family (EC-152 + EC-248 + EC-301) — split from\n * `field-control.tsx` (EC-330): the {@link AssetField} control plus its\n * preview/gallery/options sub-components. Per-use sub-fields and the options\n * dialog's metadata form render through the shared object item form /\n * `FieldControl`, so asset metadata stays schema-driven.\n */\n\n/**\n * The asset field (EC-152 + EC-248). Beyond picking from the library it now shows\n * a focal-point-aware preview, uploads directly from the field (reusing the EC-152\n * upload path — no parallel uploader), and edits the selected image's alt + focal\n * point inline (persisted on the asset document, where delivery reads them, EC-230).\n * With no `<AssetsProvider>` (a fixture-only session — every project, the playground\n * included, mounts one, `studio-project-screen.tsx`) it degrades to the labelled-badge\n * picker — no preview/upload — so it stays usable without a real library.\n */\nexport function AssetField({\n field,\n value: stored,\n onChange,\n readOnly,\n}: {\n field: AssetFieldDef\n value: unknown\n onChange: (value: unknown) => void\n readOnly: boolean\n}) {\n // EC-586/EC-581 (ASSETS D4): the field reads its value through THE canonicaliser — the\n // one cardinality rule — so a lone placement left in a field since declared `multiple`\n // shows as a one-item gallery (and the next pick keeps it) instead of an empty one that\n // drops it; picks and removes then write from that canonical list.\n const value = useMemo(() => selfTypeFieldValue(field, stored), [field, stored])\n const source = useCollectionView()\n const assets = useOptionalAssets()\n const density = useFieldDensity()\n const compact = density === 'compact'\n // EC-582 / EC-572 #1: the anchor prefix of this field — a gallery placement's sub-field\n // inputs are stamped `<field>/<entry index>/<sub-field>`, the path the validator gives\n // their issues (a single placement's are `<field>/<sub-field>`, stamped by the form).\n const fieldPath = useFieldPath()\n const [open, setOpen] = useState(false)\n // The placement whose image options dialog is open (EC-588 2i: every placement of a\n // gallery has one, not only a single field's): its gallery index, or `null` for a\n // single field's one placement.\n const [editing, setEditing] = useState<{ index: number | null } | null>(null)\n const [dragging, setDragging] = useState(false)\n // Reorder by drag (EC-588 2i): the gallery index being dragged and the one under it.\n const [moveFrom, setMoveFrom] = useState<number | null>(null)\n const [moveOver, setMoveOver] = useState<number | null>(null)\n // Names of files a drop/pick rejected against the field's `accept` (EC-301) — shown\n // as a transient inline issue, cleared on the next valid upload. Never a silent drop.\n const [rejected, setRejected] = useState<string[]>([])\n // The active upload BATCH (EC-460): exactly the upload ids this field's drop\n // started (EC-588 A7), so the effect below attaches the WHOLE batch and nothing\n // another tab or a sibling field uploaded meanwhile.\n const pendingRef = useRef<UploadBatch | null>(null)\n const assetCollectionId = source.assetCollectionId ?? 'asset'\n const many = field.multiple\n const ids = many ? assetIdsOf(value) : []\n const single = !many ? singleAssetIdOf(value) : null\n // EC-301 per-use sub-fields: the value stores asset ENVELOPES (`{ type:'asset', id }`,\n // EC-586 — the canonical form, sub-fields or not) carrying any sub-field siblings\n // (`caption`). Picks/edits/removes preserve every other placement's sub-fields.\n const subFields = field.fields ?? []\n const hasSub = subFields.length > 0\n // The raw `many` entries (envelopes or bare ids), index-aligned with `ids`, so each\n // gallery item can read/write its own sub-fields.\n const entries = many && Array.isArray(value) ? (value as unknown[]) : []\n\n // Auto-select what an upload FROM this field added once it lands in the\n // library. EC-460: a `many` field attaches EVERY batch arrival as it lands\n // (the batch stays armed until it settles), so dropping N files attaches all\n // N — the old flow disarmed on the FIRST arrival and silently stranded the\n // rest in the library. A `one` field keeps the first-to-land selection.\n useEffect(() => {\n const batch = pendingRef.current\n if (!batch || !assets) return\n // EC-588 2i: the one batch-attach rule (the picker runs it too) — a `many` field\n // appends the whole batch once it settles, IN FILE ORDER; a single field takes the\n // first arrival.\n const { attach, disarm } = batchAttachment(uploadBatchProgress(batch, assets, field.accept), many)\n if (disarm) pendingRef.current = null\n if (attach.length === 0) return\n const next = many ? appendAssetSelections(value, attach) : applyAssetSelection(value, attach[0]!, false)\n if (next !== value) onChange(next)\n // Reacts to the assets store changing (an upload landing in the library, the\n // queue draining) — `value`/`onChange` are read from the closure on purpose.\n }, [assets, field.accept, many, onChange, value])\n\n function uploadFiles(files: File[]) {\n if (!assets || files.length === 0) return\n // EC-301 → EC-588: the drop rule the picker applies too — a drag-drop bypasses\n // the file dialog's `accept` filter, so re-check each file and name the rejects in\n // a visible notice instead of silently uploading the wrong kind.\n const { accepted, rejected: refused } = splitByAccept(files, field.accept)\n setRejected(refused)\n if (accepted.length === 0) return\n pendingRef.current = { uploadIds: assets.upload(accepted) }\n }\n\n // The picker is configured from the field — the SAME binding the table cell uses\n // (EC-570 #1 → EC-588): `accept`, `multiple`, and a pick through the carry rule\n // (EC-558) so a placement's per-use sub-fields (EC-301) survive a swap or an append.\n const pickerBinding = assetPickerBinding(field, value, (next) => {\n if (next !== value) onChange(next)\n })\n\n const canUpload = !readOnly && assets !== null\n\n // The open dialog's placement: which asset it shows, and — when the field declares\n // per-use sub-fields — the placement form it edits (\"In this place\").\n const editTarget = ((): { assetId: string; placement?: PlacementForm } | null => {\n if (!editing) return null\n if (editing.index === null) {\n if (!single) return null\n if (!hasSub) return { assetId: single }\n return {\n assetId: single,\n placement: {\n fields: subFields,\n value: assetSubfieldsOf(value),\n onChange: (next: Record<string, unknown>) => onChange(assetNode(single, next)),\n },\n }\n }\n if (!hasSub) {\n const aid = ids[editing.index]\n return aid ? { assetId: aid } : null\n }\n const entry = entries.filter((e) => readAssetId(e) !== undefined)[editing.index]\n const aid = readAssetId(entry)\n if (!aid) return null\n const raw = entries.indexOf(entry)\n return {\n assetId: aid,\n placement: {\n fields: subFields,\n value: assetSubfieldsOf(entry),\n onChange: (next: Record<string, unknown>) => {\n const nextEntries = entries.slice()\n nextEntries[raw] = assetNode(aid, next)\n onChange(nextEntries)\n },\n },\n }\n })()\n\n // Drag-to-upload onto the field (EC-301): a depth counter keeps the overlay\n // steady as the pointer crosses child element boundaries. `dragenter`/`dragleave`\n // fire per descendant, so toggling on a bare `dragleave` blinks constantly; we\n // only hide the overlay when the counter returns to zero (the pointer has truly\n // left the field). The overlay is pointer-events-none, so it never fires its own\n // enter/leave to confuse the count.\n const dragDepth = useRef(0)\n // Only a FILE drag is an upload: a gallery reorder drag (EC-588) is not.\n const isFileDrag = (e: React.DragEvent) => Array.from(e.dataTransfer.types).includes('Files')\n function onDragEnter(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n e.preventDefault()\n dragDepth.current += 1\n if (!dragging) setDragging(true)\n }\n function onDragOver(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n e.preventDefault() // required so a drop is allowed\n }\n function onDragLeave(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n dragDepth.current -= 1\n if (dragDepth.current <= 0) {\n dragDepth.current = 0\n setDragging(false)\n }\n }\n function onDrop(e: React.DragEvent) {\n if (!canUpload || !isFileDrag(e)) return\n e.preventDefault()\n dragDepth.current = 0\n setDragging(false)\n uploadFiles(Array.from(e.dataTransfer.files))\n }\n // While the picker is open the field is behind the modal, so any drop is happening\n // INSIDE the dialog — detach the field's drag handlers entirely so a drop there can\n // only be handled by the picker, never double-counted by the field too (EC-301). This\n // is the belt to the picker's stopPropagation braces: the field cannot react at all.\n const dragProps = canUpload && !open ? { onDragEnter, onDragOver, onDragLeave, onDrop } : {}\n\n // Reorder by drag (EC-588 2i): one placement moves, every entry verbatim — core's\n // `moveAssetPlacement`, the same index counting as the remove.\n const reorderable = many && !readOnly && ids.length > 1\n function reorderProps(i: number) {\n if (!reorderable) return {}\n return {\n onDragOver: (e: React.DragEvent) => {\n if (moveFrom === null) return\n e.preventDefault()\n if (moveOver !== i) setMoveOver(i)\n },\n onDrop: (e: React.DragEvent) => {\n if (moveFrom === null) return\n e.preventDefault()\n const next = moveAssetPlacement(value, moveFrom, i)\n setMoveFrom(null)\n setMoveOver(null)\n if (next !== value) onChange(next)\n },\n }\n }\n function moveHandle(i: number): ReactNode {\n if (!reorderable) return null\n return (\n <span\n draggable\n onDragStart={(e) => {\n e.dataTransfer.effectAllowed = 'move'\n e.dataTransfer.setData('text/plain', String(i))\n setMoveFrom(i)\n }}\n onDragEnd={() => {\n setMoveFrom(null)\n setMoveOver(null)\n }}\n aria-label={translate('cms.field.dragToReorder')}\n className=\"cursor-grab text-muted-foreground/60 hover:text-muted-foreground active:cursor-grabbing\"\n >\n <GripVertical className=\"size-3.5\" />\n </span>\n )\n }\n const moveTint = (i: number) =>\n cn(moveFrom === i && 'opacity-50', moveOver === i && moveFrom !== null && moveFrom !== i && 'ring-2 ring-primary/50')\n\n const selectButton = !readOnly ? (\n <Button variant=\"outline\" size=\"sm\" onClick={() => setOpen(true)}>\n <ImagePlus /> {translate('common.select')}\n </Button>\n ) : null\n\n return (\n <Stack\n gap=\"2\"\n className={cn(\n 'relative rounded-lg transition-shadow',\n dragging && 'ring-2 ring-primary ring-offset-2 ring-offset-background',\n )}\n {...dragProps}\n >\n {many && hasSub ? (\n // Gallery with per-use sub-fields (EC-301): a card per placement — thumbnail +\n // its own sub-field form — reusing the object/repeater item rendering.\n <Stack gap=\"2\">\n {entries.length > 0 ? (\n <Stack gap=\"2\">\n {entries.map((entry, i) => {\n const aid = readAssetId(entry)\n if (!aid) return null\n // The gallery position of this placement (readable entries only) — the\n // index the one remove rule counts (core `removeAssetPlacementAt`).\n const galleryIndex = entries.slice(0, i).filter((e) => readAssetId(e) !== undefined).length\n return (\n <div key={`${aid}-${i}`} className={cn('rounded-lg', moveTint(galleryIndex))} {...reorderProps(galleryIndex)}>\n <FieldPathContext.Provider value={fieldPath === null ? null : `${fieldPath}/${i}`}>\n <AssetGalleryItem\n assetId={aid}\n collectionId={assetCollectionId}\n fields={subFields}\n value={assetSubfieldsOf(entry)}\n readOnly={readOnly}\n idPrefix={`asset-${i}`}\n handle={moveHandle(galleryIndex)}\n onChangeSubs={(next) => {\n const nextEntries = entries.slice()\n nextEntries[i] = assetNode(aid, next)\n onChange(nextEntries)\n }}\n onEdit={assets ? () => setEditing({ index: galleryIndex }) : undefined}\n onRemove={readOnly ? undefined : () => onChange(removeAssetPlacementAt(value, galleryIndex))}\n />\n </FieldPathContext.Provider>\n </div>\n )\n })}\n </Stack>\n ) : (\n <EmptyAssetState\n compact={compact}\n canUpload={canUpload}\n readOnly={readOnly}\n onSelect={() => setOpen(true)}\n />\n )}\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n </Row>\n </Stack>\n ) : many ? (\n // Gallery: a grid of focal-aware previews + the single Select entry.\n <Stack gap=\"2\">\n {ids.length > 0 ? (\n <div\n className={cn(\n 'grid gap-2',\n compact ? 'grid-cols-2' : 'grid-cols-3 sm:grid-cols-4',\n )}\n >\n {ids.map((aid, i) => (\n <div key={`${aid}-${i}`} className={cn('rounded-lg', moveTint(i))} {...reorderProps(i)}>\n <AssetChip\n assetId={aid}\n collectionId={assetCollectionId}\n handle={moveHandle(i)}\n onEdit={assets ? () => setEditing({ index: i }) : undefined}\n onRemove={readOnly ? undefined : () => onChange(removeAssetPlacementAt(value, i))}\n />\n </div>\n ))}\n </div>\n ) : (\n <EmptyAssetState\n compact={compact}\n canUpload={canUpload}\n readOnly={readOnly}\n onSelect={() => setOpen(true)}\n />\n )}\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n </Row>\n </Stack>\n ) : single && hasSub ? (\n // With per-use sub-fields the asset + its fields read as ONE grouped unit\n // (like an object), so it's clear they belong together (EC-301 feedback).\n <Card className=\"border-l-2 border-l-border p-3\">\n <Stack gap=\"3\">\n <AssetSinglePreview\n assetId={single}\n compact={compact}\n readOnly={readOnly}\n hasLibrary={assets !== null}\n fallbackTitle={source.titleOf({ collection: assetCollectionId, id: single })}\n selectButton={selectButton}\n onEdit={() => setEditing({ index: null })}\n onRemove={() => onChange(applyAssetSelection(value, null, many))}\n />\n <div className=\"border-t border-border/60 pt-3\">\n <ObjectItemForm\n fields={subFields}\n value={assetSubfieldsOf(value)}\n readOnly={readOnly}\n idPrefix=\"asset-sub\"\n onChange={(next) => onChange(assetNode(single, next))}\n />\n </div>\n </Stack>\n </Card>\n ) : single ? (\n <AssetSinglePreview\n assetId={single}\n compact={compact}\n readOnly={readOnly}\n hasLibrary={assets !== null}\n fallbackTitle={source.titleOf({ collection: assetCollectionId, id: single })}\n selectButton={selectButton}\n onEdit={() => setEditing({ index: null })}\n onRemove={() => onChange(applyAssetSelection(value, null, many))}\n />\n ) : (\n <Stack gap=\"2\">\n <EmptyAssetState\n compact={compact}\n canUpload={canUpload}\n readOnly={readOnly}\n onSelect={() => setOpen(true)}\n />\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n </Row>\n </Stack>\n )}\n\n {/* Image options (EC-301 → EC-588 2i): the placement's own sub-fields (\"In this\n place\") apart from the asset's facts (\"About this image\", shared by every use),\n for a single field's placement and for each placement of a gallery. */}\n {editTarget && assets ? (\n <AssetOptionsDialog\n assetId={editTarget.assetId}\n readOnly={readOnly}\n open\n onOpenChange={(next) => {\n if (!next) setEditing(null)\n }}\n {...(editTarget.placement ? { placement: editTarget.placement } : {})}\n />\n ) : null}\n\n <AssetPicker open={open} onOpenChange={setOpen} {...pickerBinding} />\n\n <AssetRejectedNotice rejected={rejected} accept={field.accept} />\n\n {dragging ? (\n <div className=\"pointer-events-none absolute inset-0 z-10 grid place-items-center rounded-lg border-2 border-dashed border-primary bg-background/85\">\n <Row gap=\"2\" align=\"center\">\n <Upload className=\"size-4 text-primary\" />\n <Text size=\"sm\" className=\"font-medium\">\n {translate('cms.asset.dropToUpload')}\n </Text>\n </Row>\n </div>\n ) : null}\n </Stack>\n )\n}\n\n/**\n * Empty-state placeholder shown when an asset field has no selection (EC-301).\n *\n * EC-395: this was the one asset-field affordance that ignored `readOnly` — every\n * sibling control (`selectButton`, the per-item remove/change actions) already\n * degraded, but the empty-state tile stayed a clickable `<button>` that opened the\n * picker regardless. A locked, empty asset field must be as inert as a filled one:\n * read-only renders a plain (non-interactive, non-focusable) `div` with the same\n * frame — no `onClick`, no hover affordance — instead of a `<button>`.\n */\nfunction EmptyAssetState({\n compact,\n canUpload,\n readOnly,\n onSelect,\n}: {\n compact: boolean\n canUpload: boolean\n readOnly: boolean\n onSelect: () => void\n}) {\n const frame = cn(\n 'grid w-full place-items-center gap-1 rounded-lg border border-dashed border-border bg-muted/30 text-center text-muted-foreground',\n compact ? 'aspect-video' : 'aspect-[5/2]',\n )\n if (readOnly) {\n return <div className={frame}>{emptyAssetStateBody(canUpload)}</div>\n }\n return (\n <button type=\"button\" onClick={onSelect} className={cn(frame, 'transition-colors hover:bg-muted/60')}>\n {emptyAssetStateBody(canUpload)}\n </button>\n )\n}\n\nfunction emptyAssetStateBody(canUpload: boolean) {\n return (\n <>\n <ImagePlus className=\"size-6\" aria-hidden />\n <Text size=\"xs\" tone=\"muted\">\n {canUpload ? translate('cms.asset.selectOrDrop') : translate('cms.asset.selectAsset')}\n </Text>\n </>\n )\n}\n\n/** A large focal-aware preview of the selected asset (EC-301). */\nfunction AssetPreview({ assetId }: { assetId: string }) {\n const record = useAssetRecord(assetId)\n return <AssetThumb record={record} className=\"aspect-[4/3] w-full\" />\n}\n\n/** Filename + dimensions/type for the selected asset — the id is never shown (EC-301). */\nfunction AssetInfo({ assetId, fallbackTitle }: { assetId: string; fallbackTitle?: string }) {\n const record = useAssetRecord(assetId)\n const name = record?.title ?? record?.filename ?? fallbackTitle ?? assetId\n const dims = record?.width && record?.height ? `${record.width}×${record.height}` : null\n const kind = record?.contentType?.split('/')[1]?.toUpperCase()\n const meta = [dims, kind].filter(Boolean).join(' · ')\n return (\n <Stack gap=\"1\">\n <Text size=\"sm\" className=\"truncate font-medium\" title={name}>\n {name}\n </Text>\n {meta ? (\n <Text size=\"xs\" tone=\"subtle\">\n {meta}\n </Text>\n ) : null}\n </Stack>\n )\n}\n\n/**\n * The selected image's alt text shown in the field (EC-301) — what an editor most\n * wants at a glance; edited in the options dialog. Read through THE reader (EC-587),\n * so the field shows exactly what delivery serves.\n */\nfunction AssetAltLine({ assetId }: { assetId: string }) {\n const record = useAssetRecord(assetId)\n // EC-632: in the studio's locale — a localized alt shows the open locale's translation.\n const at = useAssetReadLocale()\n const alt = record ? assetAlt(record, at) : null\n return (\n <Row gap=\"1\" align=\"baseline\" className=\"min-w-0\">\n <Text size=\"xs\" tone=\"subtle\" className=\"shrink-0\">\n {translate('cms.asset.altLabel')}\n </Text>\n <Text\n size=\"xs\"\n tone={alt ? 'muted' : 'subtle'}\n className={cn('min-w-0 truncate', !alt && 'italic')}\n title={alt ?? undefined}\n >\n {alt || translate('cms.asset.notSet')}\n </Text>\n </Row>\n )\n}\n\n/**\n * A single asset reference: focal-aware thumbnail + title, with an optional drag\n * handle (reorder, EC-588), image options and remove.\n */\nfunction AssetChip({\n assetId,\n collectionId,\n handle,\n onEdit,\n onRemove,\n}: {\n assetId: string\n collectionId: string\n handle?: ReactNode\n onEdit?: () => void\n onRemove?: () => void\n}) {\n const source = useCollectionView()\n const record = useAssetRecord(assetId)\n const title = source.titleOf({ collection: collectionId, id: assetId })\n return (\n <div className=\"group relative overflow-hidden rounded-lg border border-border bg-muted/40\">\n <AssetThumb record={record} alt={title} className=\"aspect-square w-full rounded-none border-0\" />\n <Row gap=\"1\" align=\"center\" className=\"px-2 py-1\">\n {handle}\n <Text size=\"xs\" tone=\"subtle\" className=\"min-w-0 flex-1 truncate\" title={title}>\n {title}\n </Text>\n {onEdit ? (\n <button\n type=\"button\"\n aria-label={translate('cms.asset.imageOptions.title')}\n onClick={onEdit}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n <SlidersHorizontal className=\"size-3.5\" />\n </button>\n ) : null}\n {onRemove ? (\n <button\n type=\"button\"\n aria-label={translate('common.remove')}\n onClick={onRemove}\n className=\"text-muted-foreground hover:text-destructive\"\n >\n <X className=\"size-3.5\" />\n </button>\n ) : null}\n </Row>\n </div>\n )\n}\n\n/**\n * The selected single asset's preview row (EC-301): large focal-aware preview + info\n * column (filename/dimensions, Select/Edit/Remove, alt). Extracted so it renders either\n * bare (a plain asset field) or inside the grouping card when the field carries per-use\n * sub-fields — the asset + its fields then read as one unit.\n */\nfunction AssetSinglePreview({\n assetId,\n compact,\n readOnly,\n hasLibrary,\n fallbackTitle,\n selectButton,\n onEdit,\n onRemove,\n}: {\n assetId: string\n compact: boolean\n readOnly: boolean\n hasLibrary: boolean\n fallbackTitle?: string\n selectButton: React.ReactNode\n onEdit: () => void\n onRemove: () => void\n}) {\n return (\n <div className={compact ? 'flex flex-col gap-3' : 'flex gap-4'}>\n <div className={compact ? 'w-full' : 'w-1/2 shrink-0'}>\n <AssetPreview assetId={assetId} />\n </div>\n <Stack gap=\"2\" className={cn('min-w-0', !compact && 'flex-1')}>\n <AssetInfo assetId={assetId} fallbackTitle={fallbackTitle} />\n {!readOnly ? (\n <Row gap=\"2\" wrap align=\"center\">\n {selectButton}\n {hasLibrary ? (\n <Button variant=\"outline\" size=\"sm\" onClick={onEdit}>\n <SlidersHorizontal /> {translate('common.edit')}\n </Button>\n ) : null}\n <Button variant=\"ghost\" size=\"sm\" onClick={onRemove}>\n <Trash2 /> {translate('common.remove')}\n </Button>\n </Row>\n ) : null}\n <AssetAltLine assetId={assetId} />\n </Stack>\n </div>\n )\n}\n\n/**\n * One gallery placement when a `many` asset field declares per-use sub-fields (EC-301):\n * a thumbnail + filename + remove header over the placement's own sub-field form,\n * modelled on a repeater item card so a gallery's placements read as grouped units.\n */\nfunction AssetGalleryItem({\n assetId,\n collectionId,\n fields,\n value,\n onChangeSubs,\n handle,\n onEdit,\n onRemove,\n readOnly,\n idPrefix,\n}: {\n assetId: string\n collectionId: string\n fields: readonly FieldDef[]\n value: Record<string, unknown>\n onChangeSubs: (value: Record<string, unknown>) => void\n handle?: ReactNode\n onEdit?: () => void\n onRemove?: () => void\n readOnly: boolean\n idPrefix: string\n}) {\n const source = useCollectionView()\n const record = useAssetRecord(assetId)\n const title = source.titleOf({ collection: collectionId, id: assetId })\n return (\n <Card className=\"border-l-2 border-l-border p-0\">\n <Row gap=\"2\" align=\"center\" className=\"border-b border-border/60 bg-muted/30 px-2 py-1.5\">\n {handle}\n <AssetThumb record={record} alt={title} className=\"size-10 shrink-0\" />\n <Text size=\"sm\" className=\"min-w-0 flex-1 truncate font-medium\" title={title}>\n {title}\n </Text>\n {onEdit ? (\n <Button variant=\"ghost\" size=\"sm\" aria-label={translate('cms.asset.imageOptions.title')} onClick={onEdit}>\n <SlidersHorizontal className=\"size-3.5\" />\n </Button>\n ) : null}\n {onRemove ? (\n <Button variant=\"ghost\" size=\"sm\" aria-label={translate('common.remove')} onClick={onRemove}>\n <Trash2 className=\"size-3.5\" />\n </Button>\n ) : null}\n </Row>\n <div className=\"px-3 pb-3\">\n <ObjectItemForm\n fields={fields}\n value={value}\n onChange={onChangeSubs}\n readOnly={readOnly}\n idPrefix={idPrefix}\n />\n </div>\n </Card>\n )\n}\n\n/** A placement's own form (EC-588 2i): the asset field's per-use sub-fields and their value. */\nexport interface PlacementForm {\n fields: readonly FieldDef[]\n value: Record<string, unknown>\n onChange: (value: Record<string, unknown>) => void\n}\n\n/**\n * The image options dialog (EC-301 → EC-588, ratified 2i): the two schemas an image\n * has, shown apart (`EC-565` § \"2i widened\").\n * - **In this place** — the PLACEMENT schema: the asset field's (or prop's) per-use\n * sub-fields (a caption, a badge layout), true of this one use only; written into the\n * field value. Present only when the field declares sub-fields.\n * - **About this image — applies everywhere it is used** — the ASSET schema: the focal\n * point and the `kind:'asset'` collection's fields over the asset's `meta` bag (alt,\n * copyright, credit, …), rendered through the generic field engine documents use;\n * persisted on the asset, so it changes every use — the Where-used panel (the asset's\n * library page) is one click away.\n * Asset metadata is buffered locally and committed once on close (one write); the\n * focal point commits immediately (it drives a live visual); the placement form writes\n * through to the field as it is edited. No-ops without a library.\n */\nfunction AssetOptionsDialog({\n assetId,\n readOnly,\n open,\n onOpenChange,\n placement,\n}: {\n assetId: string\n readOnly: boolean\n open: boolean\n onOpenChange: (open: boolean) => void\n placement?: PlacementForm\n}) {\n const source = useCollectionView()\n const assets = useOptionalAssets()\n const record = useAssetRecord(assetId)\n const metaFields = useMemo(() => {\n const assetCollectionId = source.assetCollectionId ?? 'asset'\n const collection = source.collections.find((c) => c.id === assetCollectionId)\n return collection ? assetMetaFieldsOf(collection) : []\n }, [source])\n\n // Local edit buffers, seeded once per open from the record (so an external edit\n // still wins between opens). EC-632: the draft is the document shape (shared bag +\n // per-locale buckets), shown in the studio's locale — the one the document around it\n // is open in — so a localized field (alt) edits that locale's translation.\n const at = useAssetReadLocale()\n const [draft, setDraft] = useState<AssetMetaDraft>(EMPTY_DRAFT)\n // EC-634: the draft as seeded at open — the base the commit is diffed against, so only\n // the keys (and locales) edited here are written and another session's change survives.\n const opened = useRef<AssetMetaDraft>(EMPTY_DRAFT)\n const [focal, setFocal] = useState<{ x: number; y: number } | undefined>(undefined)\n const dirty = useRef(false)\n const seeded = useRef(false)\n useEffect(() => {\n if (!open) {\n seeded.current = false\n return\n }\n if (seeded.current || !record) return\n // Seed from the stored bags (`assetMetaDraft`; the alt is `meta.alt`, EC-587).\n const seed = assetMetaDraft(record)\n opened.current = seed\n setDraft(seed)\n setFocal(record.focalPoint)\n dirty.current = false\n seeded.current = true\n }, [open, record])\n\n function handleOpenChange(next: boolean) {\n // Commit the buffered metadata once, on close (one write, not per keystroke).\n if (!next && !readOnly && assets && dirty.current) {\n void assets.updateMetadata(assetId, assetMetaDraftPatch(opened.current, draft))\n dirty.current = false\n }\n onOpenChange(next)\n }\n\n function setField(name: string, value: unknown) {\n const field = metaFields.find((f) => f.name === name)\n if (!field) return\n dirty.current = true\n setDraft((d) => setAssetMetaField(d, field, at, value))\n }\n\n // The focal point drives a live crop preview → commit immediately (optimistic\n // marker), not deferred to close.\n function commitFocal(point: { x: number; y: number } | null) {\n if (readOnly || !assets) return\n setFocal(point ?? undefined)\n void assets.updateMetadata(assetId, { focalPoint: point })\n }\n\n // EC-568: Replace file, from the dialog. Pending metadata edits are committed FIRST, so\n // the buffer cannot overwrite what the new file brings; the focal point is kept and the\n // dialog says to check it (the ticket's recommendation for open question 1).\n const [replaced, setReplaced] = useState(false)\n const replaceAction = record ? (\n <ReplaceFileButton\n record={record}\n disabled={readOnly}\n beforeReplace={async () => {\n if (assets && dirty.current) {\n dirty.current = false\n await assets.updateMetadata(assetId, assetMetaDraftPatch(opened.current, draft))\n }\n }}\n onReplaced={(asset) => {\n const seed = assetMetaDraft(asset)\n opened.current = seed\n setDraft(seed)\n setFocal(asset.focalPoint)\n dirty.current = false\n setReplaced(true)\n }}\n />\n ) : null\n\n const whereUsed =\n source.projectId !== undefined ? (\n <Link\n to={STUDIO_PROJECT_ROUTE}\n params={{ projectId: source.projectId, _splat: studioPath.asset(assetId) }}\n className=\"inline-flex items-center gap-1 text-xs text-primary hover:underline\"\n >\n <Link2 className=\"size-3\" /> {translate('cms.asset.imageOptions.whereUsed')}\n </Link>\n ) : null\n\n return (\n <Dialog open={open} onOpenChange={handleOpenChange}>\n <DialogContent className=\"max-w-lg\">\n <DialogHeader>\n <DialogTitle>{translate('cms.asset.imageOptions.title')}</DialogTitle>\n <DialogDescription>{translate('cms.asset.imageOptions.description')}</DialogDescription>\n </DialogHeader>\n <AssetOptionsSections\n record={record}\n readOnly={readOnly}\n metaFields={metaFields}\n meta={assetMetaFormValues(draft, metaFields, at)}\n metaLocale={at}\n onMetaField={setField}\n focal={focal}\n onFocalCommit={commitFocal}\n onFocalPreview={setFocal}\n whereUsed={whereUsed}\n replaceAction={replaceAction}\n replaced={replaced}\n {...(placement ? { placement } : {})}\n />\n </DialogContent>\n </Dialog>\n )\n}\n\n/**\n * The two sections of the image options dialog (EC-588 2i), stateless — exported so a\n * node smoke render can pin the split (the dialog itself portals, `null` in node).\n */\nexport function AssetOptionsSections({\n record,\n readOnly,\n metaFields,\n meta,\n metaLocale = null,\n onMetaField,\n focal,\n onFocalCommit,\n onFocalPreview,\n placement,\n whereUsed,\n replaceAction,\n replaced,\n}: {\n record: AssetRecord | undefined\n readOnly: boolean\n metaFields: readonly FieldDef[]\n /** The asset metadata form's values, in {@link metaLocale} (EC-632). */\n meta: Record<string, unknown>\n /** The locale a `localized: true` field is edited in (EC-632) — shown on its label. */\n metaLocale?: AssetReadLocale | null\n onMetaField: (name: string, value: unknown) => void\n focal: { x: number; y: number } | undefined\n onFocalCommit: (point: { x: number; y: number } | null) => void\n onFocalPreview: (point: { x: number; y: number } | undefined) => void\n placement?: PlacementForm\n whereUsed?: ReactNode\n /** EC-568: the \"Replace file\" action of the asset section. */\n replaceAction?: ReactNode\n /** EC-568: the file was just replaced — the kept focal point needs a look. */\n replaced?: boolean\n}) {\n return (\n <Stack gap=\"4\">\n {placement && placement.fields.length > 0 ? (\n <Stack gap=\"2\" data-ec-asset-options=\"placement\">\n <Stack gap=\"1\">\n <Heading level={3} size=\"h4\">\n {translate('cms.asset.imageOptions.placementTitle')}\n </Heading>\n <Text size=\"xs\" tone=\"subtle\">\n {translate('cms.asset.imageOptions.placementHint')}\n </Text>\n </Stack>\n <ObjectItemForm\n fields={placement.fields}\n value={placement.value}\n readOnly={readOnly}\n idPrefix=\"asset-options-placement\"\n onChange={placement.onChange}\n />\n <Separator />\n </Stack>\n ) : null}\n <Stack gap=\"3\" data-ec-asset-options=\"asset\">\n <Stack gap=\"1\">\n <Row align=\"center\">\n <Heading level={3} size=\"h4\">\n {translate('cms.asset.imageOptions.assetTitle')}\n </Heading>\n <Spacer />\n {whereUsed}\n </Row>\n <Text size=\"xs\" tone=\"subtle\">\n {translate('cms.asset.imageOptions.assetHint')}\n </Text>\n {replaceAction ? <Row gap=\"2\" align=\"center\" wrap>{replaceAction}</Row> : null}\n </Stack>\n <Stack gap=\"2\">\n <Row align=\"center\">\n <Text size=\"sm\" className=\"font-medium\">\n {translate('cms.asset.focalPoint')}\n </Text>\n <Spacer />\n {focal && !readOnly ? (\n <Button variant=\"ghost\" size=\"sm\" onClick={() => onFocalCommit(null)}>\n <RotateCcw /> {translate('cms.asset.resetToCentre')}\n </Button>\n ) : null}\n </Row>\n <FocalPointPicker\n record={record}\n point={focal}\n onChange={onFocalCommit}\n onPreview={onFocalPreview}\n disabled={readOnly}\n />\n {replaced ? (\n <Text size=\"xs\" className=\"font-medium\" data-ec-asset-options=\"replaced\">\n {translate('cms.asset.replacedCheckFocal')}\n </Text>\n ) : null}\n <Text size=\"xs\" tone=\"subtle\">\n {translate('cms.asset.focalPointHint')}\n </Text>\n <FocalCropPreviews record={record} point={focal} />\n </Stack>\n {metaFields.map((f) => (\n <Field\n key={f.name}\n label={<AssetMetaFieldLabel field={f} at={metaLocale} />}\n hint={localizedLabel(f.form?.description) || undefined}\n >\n <FieldControl\n id={`asset-meta-${f.name}`}\n field={f}\n value={meta[f.name]}\n readOnly={readOnly}\n onChange={(v) => onMetaField(f.name, v)}\n />\n </Field>\n ))}\n {metaFields.length === 0 ? (\n <Text size=\"sm\" tone=\"subtle\">\n No editable metadata fields are declared on the asset collection. Add fields (e.g.\n <Code tone=\"muted\"> alt</Code>, <Code tone=\"muted\">copyright</Code>) to it in code.\n </Text>\n ) : null}\n </Stack>\n </Stack>\n )\n}\n"]}
|
|
@@ -23,7 +23,7 @@ export declare function FallbackChip({ fallback, testId, }: {
|
|
|
23
23
|
export declare function fallbackTitle(fallback: DisplayedFallback): string;
|
|
24
24
|
/**
|
|
25
25
|
* Normalize a relation value (single ref or array of refs) into an array of
|
|
26
|
-
* `DocumentRef`s. EC-277: unwraps self-typed `{ type:'reference', ... }`
|
|
27
|
-
*
|
|
26
|
+
* `DocumentRef`s. EC-277 / EC-589: unwraps the self-typed `{ type:'reference', ... }`
|
|
27
|
+
* envelopes; anything else is no reference.
|
|
28
28
|
*/
|
|
29
29
|
export declare function toRefArray(value: unknown): DocumentRef[];
|
|
@@ -93,7 +93,7 @@ function BlocksCell({ value }) {
|
|
|
93
93
|
function AssetCell({ value }) {
|
|
94
94
|
const source = useCollectionView();
|
|
95
95
|
const assetCollectionId = source.assetCollectionId ?? 'asset';
|
|
96
|
-
//
|
|
96
|
+
// An asset value is the self-typed `{ type:'asset', id }` envelope (EC-277).
|
|
97
97
|
const ids = (Array.isArray(value) ? value : [value])
|
|
98
98
|
.map(readAssetId)
|
|
99
99
|
.filter((id) => id !== undefined);
|
|
@@ -144,30 +144,20 @@ function AssetPreview({ record, label }) {
|
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Normalize a relation value (single ref or array of refs) into an array of
|
|
147
|
-
* `DocumentRef`s. EC-277: unwraps self-typed `{ type:'reference', ... }`
|
|
148
|
-
*
|
|
147
|
+
* `DocumentRef`s. EC-277 / EC-589: unwraps the self-typed `{ type:'reference', ... }`
|
|
148
|
+
* envelopes; anything else is no reference.
|
|
149
149
|
*/
|
|
150
150
|
export function toRefArray(value) {
|
|
151
151
|
const list = Array.isArray(value) ? value : [value];
|
|
152
152
|
return list.map(readDocumentRef).filter((ref) => ref !== undefined);
|
|
153
153
|
}
|
|
154
|
-
function stripHtml(html) {
|
|
155
|
-
return html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
|
|
156
|
-
}
|
|
157
154
|
/**
|
|
158
|
-
*
|
|
159
|
-
* (`
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* string (pre-EC-314 content, or any other non-envelope string) still goes
|
|
163
|
-
* through `stripHtml` as before; anything else (garbage, wrong field-type data)
|
|
164
|
-
* yields `''` so the cell's placeholder shows — never a crash, never
|
|
165
|
-
* `[object Object]`.
|
|
155
|
+
* A richText field's cell summary: the stored rich-text value's plain text
|
|
156
|
+
* (`richTextPlainText`, EC-348). Anything that is no rich-text value — a plain or HTML
|
|
157
|
+
* string, garbage, wrong field-type data — yields `''`, so the cell's placeholder shows
|
|
158
|
+
* (the validator names the value); never a crash, never `[object Object]`.
|
|
166
159
|
*/
|
|
167
160
|
function richTextCellSummary(value) {
|
|
168
|
-
|
|
169
|
-
if (extracted !== undefined)
|
|
170
|
-
return extracted;
|
|
171
|
-
return typeof value === 'string' ? stripHtml(value) : '';
|
|
161
|
+
return richTextPlainText(value) ?? '';
|
|
172
162
|
}
|
|
173
163
|
//# sourceMappingURL=cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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K,GACD,IACF,CACR,CAAA;IACH,CAAC;IACD,OAAO,CACL,MAAC,KAAK,IAAC,OAAO,EAAC,SAAS,aACtB,KAAC,KAAK,IAAC,SAAS,EAAC,QAAQ,GAAG,OAAE,KAAK,IAC7B,CACT,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACnD,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAsB,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAAA;AACzF,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AAClE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAC1C,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC1D,CAAC","sourcesContent":["import { Boxes, Check, Image, Link2, Minus } from 'lucide-react'\nimport { readAssetId, readDocumentRef } from '@elytracms/core/cms-core'\nimport type { CmsDocument, CollectionDef, DocumentRef, FieldDef } from '@elytracms/core/cms-core'\nimport { blockRootsOf } from '@elytracms/core/project-graph'\nimport { richTextPlainText } from '@elytracms/core/rich-text'\nimport { Badge, Text } from '@elytracms/studio/ui'\nimport { translate } from '../../lib/i18n'\nimport { localeChipLabel, resolveDisplayedValue } from '../../lib/locale'\nimport type { DisplayedFallback } from '../../lib/locale'\nimport type { AssetDisplay } from '../../lib/collection-view/collection-view-source'\nimport { isDisplayableAssetUrl } from '../../lib/assets'\nimport { useCollectionView } from '../collection-view/collection-view-context'\nimport { AssetThumb, useAssetRecord } from '../assets/asset-thumb'\n\n/**\n * Render a document's field value for a table cell, by field type (brief\n * §8.4, EC-070), resolved in the studio's ambient active locale (EC-176).\n * A value served via EC-018 locale fallback carries a visible chip — never\n * silently mixed in as if it were translated.\n */\nexport function CellValue({\n collection,\n doc,\n field,\n}: {\n collection: CollectionDef\n doc: CmsDocument\n field: FieldDef\n}) {\n const source = useCollectionView()\n const { value, fallback } = resolveDisplayedValue(\n collection,\n doc,\n field.name,\n source.activeLocale,\n source.localeConfig,\n )\n\n if (value === undefined || value === null || value === '') {\n return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n }\n\n return (\n <span className=\"inline-flex min-w-0 max-w-full items-center gap-1.5\">\n <TypedCellValue field={field} value={value} />\n <FallbackChip fallback={fallback} testId={`cell-fallback-${doc.id}-${field.name}`} />\n </span>\n )\n}\n\n/**\n * Subtle source-locale chip on a fallback-displayed value (EC-176): e.g. a\n * German view showing untranslated English content gets an \"EN\" marker.\n */\nexport function FallbackChip({\n fallback,\n testId,\n}: {\n fallback: DisplayedFallback | null\n testId: string\n}) {\n if (fallback === null) return null\n return (\n <Badge\n variant=\"outline\"\n data-testid={testId}\n title={fallbackTitle(fallback)}\n className=\"shrink-0 px-1 py-0 text-[0.6rem] uppercase tracking-wide text-muted-foreground\"\n >\n {localeChipLabel(fallback.sourceLocale)}\n </Badge>\n )\n}\n\n/** Plain-language tooltip of a fallback chip. */\nexport function fallbackTitle(fallback: DisplayedFallback): string {\n return translate('cms.cell.fallbackTitle', {\n source: localeChipLabel(fallback.sourceLocale),\n requested: localeChipLabel(fallback.requestedLocale),\n })\n}\n\nfunction TypedCellValue({ field, value }: { field: FieldDef; value: unknown }) {\n switch (field.type) {\n case 'boolean':\n return value === true ? (\n <Check className=\"size-4 text-success\" />\n ) : (\n <Minus className=\"size-3.5 text-muted-foreground/50\" />\n )\n case 'select':\n return <Badge variant=\"outline\">{String(value)}</Badge>\n case 'number':\n return <Text size=\"sm\" mono>{String(value)}</Text>\n case 'date':\n return (\n <Text size=\"sm\" tone=\"muted\" mono>\n {String(value).slice(0, 10)}\n </Text>\n )\n case 'richText':\n return (\n <Text size=\"xs\" tone=\"subtle\">\n {richTextCellSummary(value).slice(0, 40) || translate('cms.cell.richText')}\n </Text>\n )\n case 'relation':\n return <RelationCell value={value} />\n case 'asset':\n return <AssetCell value={value} />\n case 'blocks':\n return <BlocksCell value={value} />\n case 'object': {\n // EC-253: list-view summary, never `[object Object]`. A repeater shows its\n // item count; a single object is edited in the detail form, not the cell.\n if (field.multiple) {\n const count = Array.isArray(value) ? value.length : 0\n return (\n <Badge variant=\"outline\">\n {translate(count === 1 ? 'cms.cell.itemCount.one' : 'cms.cell.itemCount.other', { count })}\n </Badge>\n )\n }\n return (\n <Text size=\"xs\" tone=\"subtle\">\n {value && typeof value === 'object' ? translate('cms.cell.object') : '—'}\n </Text>\n )\n }\n default:\n return (\n <Text size=\"sm\" className=\"truncate\">\n {String(value)}\n </Text>\n )\n }\n}\n\nfunction RelationCell({ value }: { value: unknown }) {\n const source = useCollectionView()\n const refs = toRefArray(value)\n if (refs.length === 0) return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n // EC-246c: calm de-pilled read — a single muted link glyph + the title(s), not\n // a row of info pills. Matches the relation FIELD's row treatment; the pill was\n // a design cue the list doesn't need.\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1.5 text-sm\">\n <Link2 className=\"size-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"min-w-0 truncate\">\n {refs.slice(0, 3).map((ref) => source.titleOf(ref)).join(', ')}\n </span>\n {refs.length > 3 ? (\n <Text size=\"xs\" tone=\"subtle\" className=\"shrink-0\">\n +{refs.length - 3}\n </Text>\n ) : null}\n </span>\n )\n}\n\n/**\n * A blocks/composition cell: a count of TOP-LEVEL blocks (EC-212) — matching\n * what the canvas/page-tree present as the block list, never `[object Object]`.\n */\nfunction BlocksCell({ value }: { value: unknown }) {\n const count = blockRootsOf(value).length\n if (count === 0) return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n return (\n <Badge variant=\"outline\">\n <Boxes className=\"size-3\" />{' '}\n {translate(count === 1 ? 'cms.cell.blockCount.one' : 'cms.cell.blockCount.other', { count })}\n </Badge>\n )\n}\n\nfunction AssetCell({ value }: { value: unknown }) {\n const source = useCollectionView()\n const assetCollectionId = source.assetCollectionId ?? 'asset'\n // EC-277: tolerate self-typed `{ type:'asset', id }` envelopes and legacy bare ids.\n const ids = (Array.isArray(value) ? value : [value])\n .map(readAssetId)\n .filter((id): id is string => id !== undefined)\n if (ids.length === 0) return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n // EC-346: multiple assets show the first, plus a \"+N\" count for the rest —\n // this IS the field cell, not a gallery editor.\n const first = ids[0]!\n return (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n <AssetFieldThumb assetId={first} assetCollectionId={assetCollectionId} />\n {ids.length > 1 ? <Text size=\"xs\" tone=\"subtle\">+{ids.length - 1}</Text> : null}\n </div>\n )\n}\n\n/**\n * EC-346 — an asset-type FIELD column's cell in a document list: a small\n * thumbnail (`size-8`, matching the 0.0.39 filename-column pattern), reusing the\n * SAME {@link AssetThumb} the assets rail uses so a focal point (EC-230/248)\n * crops the preview identically everywhere it appears. Resolves the full record\n * from the ambient asset library (`useAssetRecord` — ProjectProviders already\n * mounts an `<AssetsProvider>` at the project level, EC-195, so every CMS list\n * surface sees it) and prefers it over the source's own summary because only the\n * ambient record carries the focal point. Falls back to the source's\n * `resolveAsset` label/best-effort-image (the AD-19 \"no `<AssetsProvider>`\"\n * degradation a portable rail — or a test double — without a mounted library\n * still needs) so this never regresses the prior behaviour. Never crashes on an\n * id that resolves to nothing — both paths render a placeholder, never a badge\n * defaulted from a missing record.\n */\nfunction AssetFieldThumb({\n assetId,\n assetCollectionId,\n}: {\n assetId: string\n assetCollectionId: string\n}) {\n const source = useCollectionView()\n const ambient = useAssetRecord(assetId)\n if (ambient) return <AssetThumb record={ambient} className=\"size-8 shrink-0\" />\n const resolved = source.resolveAsset?.(assetId)\n const label =\n resolved?.title ?? resolved?.filename ?? source.titleOf({ collection: assetCollectionId, id: assetId })\n return <AssetPreview record={resolved} label={label} />\n}\n\n/**\n * The pre-EC-346 fallback preview: an image thumbnail for image assets with a\n * resolvable URL (EC-212), otherwise the labelled icon badge (and the same\n * badge whenever the source can't resolve the record — e.g. no asset backend).\n * Used only when no ambient asset library is mounted (see {@link AssetFieldThumb}).\n */\nfunction AssetPreview({ record, label }: { record: AssetDisplay | undefined; label: string }) {\n const isImage = record?.contentType?.startsWith('image/') ?? false\n const url = record?.url\n if (isImage && isDisplayableAssetUrl(url)) {\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1.5\">\n <img\n src={url}\n alt={record?.alt ?? label}\n loading=\"lazy\"\n className=\"size-7 shrink-0 rounded border border-border bg-muted object-cover\"\n />\n <Text size=\"xs\" tone=\"subtle\" className=\"max-w-[10rem] truncate\">\n {label}\n </Text>\n </span>\n )\n }\n return (\n <Badge variant=\"outline\">\n <Image className=\"size-3\" /> {label}\n </Badge>\n )\n}\n\n/**\n * Normalize a relation value (single ref or array of refs) into an array of\n * `DocumentRef`s. EC-277: unwraps self-typed `{ type:'reference', ... }` envelopes\n * and legacy bare `{ collection, id }` via the shared tolerant reader.\n */\nexport function toRefArray(value: unknown): DocumentRef[] {\n const list = Array.isArray(value) ? value : [value]\n return list.map(readDocumentRef).filter((ref): ref is DocumentRef => ref !== undefined)\n}\n\nfunction stripHtml(html: string): string {\n return html.replace(/<[^>]*>/g, ' ').replace(/\\s+/g, ' ').trim()\n}\n\n/**\n * EC-348 — a richText field's stored value is the rich-text envelope\n * (`{ version, doc }` TipTap JSON, EC-314), not an HTML string: `stripHtml`\n * alone here yielded the literal `[object Object]`. Fallback chain: a valid\n * envelope extracts to plain text (`richTextPlainText`); a legacy plain/HTML\n * string (pre-EC-314 content, or any other non-envelope string) still goes\n * through `stripHtml` as before; anything else (garbage, wrong field-type data)\n * yields `''` so the cell's placeholder shows — never a crash, never\n * `[object Object]`.\n */\nfunction richTextCellSummary(value: unknown): string {\n const extracted = richTextPlainText(value)\n if (extracted !== undefined) return extracted\n return typeof value === 'string' ? stripHtml(value) : ''\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../../../src/components/cms/cell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAGzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAElE;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,UAAU,EACV,GAAG,EACH,KAAK,GAKN;IACC,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,qBAAqB,CAC/C,UAAU,EACV,GAAG,EACH,KAAK,CAAC,IAAI,EACV,M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AqB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,CACL,gBAAM,SAAS,EAAC,0CAA0C,aACxD,cACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,KAAK,EACzB,OAAO,EAAC,MAAM,EACd,SAAS,EAAC,oEAAoE,GAC9E,EACF,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,wBAAwB,YAC7D,KAAK,GACD,IACF,CACR,CAAA;IACH,CAAC;IACD,OAAO,CACL,MAAC,KAAK,IAAC,OAAO,EAAC,SAAS,aACtB,KAAC,KAAK,IAAC,SAAS,EAAC,QAAQ,GAAG,OAAE,KAAK,IAC7B,CACT,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACnD,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAsB,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAAA;AACzF,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;AACvC,CAAC","sourcesContent":["import { Boxes, Check, Image, Link2, Minus } from 'lucide-react'\nimport { readAssetId, readDocumentRef } from '@elytracms/core/cms-core'\nimport type { CmsDocument, CollectionDef, DocumentRef, FieldDef } from '@elytracms/core/cms-core'\nimport { blockRootsOf } from '@elytracms/core/project-graph'\nimport { richTextPlainText } from '@elytracms/core/rich-text'\nimport { Badge, Text } from '@elytracms/studio/ui'\nimport { translate } from '../../lib/i18n'\nimport { localeChipLabel, resolveDisplayedValue } from '../../lib/locale'\nimport type { DisplayedFallback } from '../../lib/locale'\nimport type { AssetDisplay } from '../../lib/collection-view/collection-view-source'\nimport { isDisplayableAssetUrl } from '../../lib/assets'\nimport { useCollectionView } from '../collection-view/collection-view-context'\nimport { AssetThumb, useAssetRecord } from '../assets/asset-thumb'\n\n/**\n * Render a document's field value for a table cell, by field type (brief\n * §8.4, EC-070), resolved in the studio's ambient active locale (EC-176).\n * A value served via EC-018 locale fallback carries a visible chip — never\n * silently mixed in as if it were translated.\n */\nexport function CellValue({\n collection,\n doc,\n field,\n}: {\n collection: CollectionDef\n doc: CmsDocument\n field: FieldDef\n}) {\n const source = useCollectionView()\n const { value, fallback } = resolveDisplayedValue(\n collection,\n doc,\n field.name,\n source.activeLocale,\n source.localeConfig,\n )\n\n if (value === undefined || value === null || value === '') {\n return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n }\n\n return (\n <span className=\"inline-flex min-w-0 max-w-full items-center gap-1.5\">\n <TypedCellValue field={field} value={value} />\n <FallbackChip fallback={fallback} testId={`cell-fallback-${doc.id}-${field.name}`} />\n </span>\n )\n}\n\n/**\n * Subtle source-locale chip on a fallback-displayed value (EC-176): e.g. a\n * German view showing untranslated English content gets an \"EN\" marker.\n */\nexport function FallbackChip({\n fallback,\n testId,\n}: {\n fallback: DisplayedFallback | null\n testId: string\n}) {\n if (fallback === null) return null\n return (\n <Badge\n variant=\"outline\"\n data-testid={testId}\n title={fallbackTitle(fallback)}\n className=\"shrink-0 px-1 py-0 text-[0.6rem] uppercase tracking-wide text-muted-foreground\"\n >\n {localeChipLabel(fallback.sourceLocale)}\n </Badge>\n )\n}\n\n/** Plain-language tooltip of a fallback chip. */\nexport function fallbackTitle(fallback: DisplayedFallback): string {\n return translate('cms.cell.fallbackTitle', {\n source: localeChipLabel(fallback.sourceLocale),\n requested: localeChipLabel(fallback.requestedLocale),\n })\n}\n\nfunction TypedCellValue({ field, value }: { field: FieldDef; value: unknown }) {\n switch (field.type) {\n case 'boolean':\n return value === true ? (\n <Check className=\"size-4 text-success\" />\n ) : (\n <Minus className=\"size-3.5 text-muted-foreground/50\" />\n )\n case 'select':\n return <Badge variant=\"outline\">{String(value)}</Badge>\n case 'number':\n return <Text size=\"sm\" mono>{String(value)}</Text>\n case 'date':\n return (\n <Text size=\"sm\" tone=\"muted\" mono>\n {String(value).slice(0, 10)}\n </Text>\n )\n case 'richText':\n return (\n <Text size=\"xs\" tone=\"subtle\">\n {richTextCellSummary(value).slice(0, 40) || translate('cms.cell.richText')}\n </Text>\n )\n case 'relation':\n return <RelationCell value={value} />\n case 'asset':\n return <AssetCell value={value} />\n case 'blocks':\n return <BlocksCell value={value} />\n case 'object': {\n // EC-253: list-view summary, never `[object Object]`. A repeater shows its\n // item count; a single object is edited in the detail form, not the cell.\n if (field.multiple) {\n const count = Array.isArray(value) ? value.length : 0\n return (\n <Badge variant=\"outline\">\n {translate(count === 1 ? 'cms.cell.itemCount.one' : 'cms.cell.itemCount.other', { count })}\n </Badge>\n )\n }\n return (\n <Text size=\"xs\" tone=\"subtle\">\n {value && typeof value === 'object' ? translate('cms.cell.object') : '—'}\n </Text>\n )\n }\n default:\n return (\n <Text size=\"sm\" className=\"truncate\">\n {String(value)}\n </Text>\n )\n }\n}\n\nfunction RelationCell({ value }: { value: unknown }) {\n const source = useCollectionView()\n const refs = toRefArray(value)\n if (refs.length === 0) return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n // EC-246c: calm de-pilled read — a single muted link glyph + the title(s), not\n // a row of info pills. Matches the relation FIELD's row treatment; the pill was\n // a design cue the list doesn't need.\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1.5 text-sm\">\n <Link2 className=\"size-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"min-w-0 truncate\">\n {refs.slice(0, 3).map((ref) => source.titleOf(ref)).join(', ')}\n </span>\n {refs.length > 3 ? (\n <Text size=\"xs\" tone=\"subtle\" className=\"shrink-0\">\n +{refs.length - 3}\n </Text>\n ) : null}\n </span>\n )\n}\n\n/**\n * A blocks/composition cell: a count of TOP-LEVEL blocks (EC-212) — matching\n * what the canvas/page-tree present as the block list, never `[object Object]`.\n */\nfunction BlocksCell({ value }: { value: unknown }) {\n const count = blockRootsOf(value).length\n if (count === 0) return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n return (\n <Badge variant=\"outline\">\n <Boxes className=\"size-3\" />{' '}\n {translate(count === 1 ? 'cms.cell.blockCount.one' : 'cms.cell.blockCount.other', { count })}\n </Badge>\n )\n}\n\nfunction AssetCell({ value }: { value: unknown }) {\n const source = useCollectionView()\n const assetCollectionId = source.assetCollectionId ?? 'asset'\n // An asset value is the self-typed `{ type:'asset', id }` envelope (EC-277).\n const ids = (Array.isArray(value) ? value : [value])\n .map(readAssetId)\n .filter((id): id is string => id !== undefined)\n if (ids.length === 0) return <Minus className=\"size-3.5 text-muted-foreground/50\" />\n // EC-346: multiple assets show the first, plus a \"+N\" count for the rest —\n // this IS the field cell, not a gallery editor.\n const first = ids[0]!\n return (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n <AssetFieldThumb assetId={first} assetCollectionId={assetCollectionId} />\n {ids.length > 1 ? <Text size=\"xs\" tone=\"subtle\">+{ids.length - 1}</Text> : null}\n </div>\n )\n}\n\n/**\n * EC-346 — an asset-type FIELD column's cell in a document list: a small\n * thumbnail (`size-8`, matching the 0.0.39 filename-column pattern), reusing the\n * SAME {@link AssetThumb} the assets rail uses so a focal point (EC-230/248)\n * crops the preview identically everywhere it appears. Resolves the full record\n * from the ambient asset library (`useAssetRecord` — ProjectProviders already\n * mounts an `<AssetsProvider>` at the project level, EC-195, so every CMS list\n * surface sees it) and prefers it over the source's own summary because only the\n * ambient record carries the focal point. Falls back to the source's\n * `resolveAsset` label/best-effort-image (the AD-19 \"no `<AssetsProvider>`\"\n * degradation a portable rail — or a test double — without a mounted library\n * still needs) so this never regresses the prior behaviour. Never crashes on an\n * id that resolves to nothing — both paths render a placeholder, never a badge\n * defaulted from a missing record.\n */\nfunction AssetFieldThumb({\n assetId,\n assetCollectionId,\n}: {\n assetId: string\n assetCollectionId: string\n}) {\n const source = useCollectionView()\n const ambient = useAssetRecord(assetId)\n if (ambient) return <AssetThumb record={ambient} className=\"size-8 shrink-0\" />\n const resolved = source.resolveAsset?.(assetId)\n const label =\n resolved?.title ?? resolved?.filename ?? source.titleOf({ collection: assetCollectionId, id: assetId })\n return <AssetPreview record={resolved} label={label} />\n}\n\n/**\n * The pre-EC-346 fallback preview: an image thumbnail for image assets with a\n * resolvable URL (EC-212), otherwise the labelled icon badge (and the same\n * badge whenever the source can't resolve the record — e.g. no asset backend).\n * Used only when no ambient asset library is mounted (see {@link AssetFieldThumb}).\n */\nfunction AssetPreview({ record, label }: { record: AssetDisplay | undefined; label: string }) {\n const isImage = record?.contentType?.startsWith('image/') ?? false\n const url = record?.url\n if (isImage && isDisplayableAssetUrl(url)) {\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1.5\">\n <img\n src={url}\n alt={record?.alt ?? label}\n loading=\"lazy\"\n className=\"size-7 shrink-0 rounded border border-border bg-muted object-cover\"\n />\n <Text size=\"xs\" tone=\"subtle\" className=\"max-w-[10rem] truncate\">\n {label}\n </Text>\n </span>\n )\n }\n return (\n <Badge variant=\"outline\">\n <Image className=\"size-3\" /> {label}\n </Badge>\n )\n}\n\n/**\n * Normalize a relation value (single ref or array of refs) into an array of\n * `DocumentRef`s. EC-277 / EC-589: unwraps the self-typed `{ type:'reference', ... }`\n * envelopes; anything else is no reference.\n */\nexport function toRefArray(value: unknown): DocumentRef[] {\n const list = Array.isArray(value) ? value : [value]\n return list.map(readDocumentRef).filter((ref): ref is DocumentRef => ref !== undefined)\n}\n\n/**\n * A richText field's cell summary: the stored rich-text value's plain text\n * (`richTextPlainText`, EC-348). Anything that is no rich-text value — a plain or HTML\n * string, garbage, wrong field-type data — yields `''`, so the cell's placeholder shows\n * (the validator names the value); never a crash, never `[object Object]`.\n */\nfunction richTextCellSummary(value: unknown): string {\n return richTextPlainText(value) ?? ''\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import type { CmsDocument, CmsValidationIssue, CollectionDef, CollectionRegistry, DocumentPatch, DocumentRef, FieldDef, ValuePath, Locale, LocaleConfig, LocalizedString, RestoreScope, ValidateDocumentOptions } from '@elytracms/core/cms-core';
|
|
3
3
|
import type { CmsDocumentRecord, DocumentVersionRecord, IdFactory, PresenceEntry } from '@elytracms/core/persistence';
|
|
4
4
|
import type { ImportRejection } from './import-batch.js';
|
|
5
|
-
import type { CommitOutcome, DocumentConflict, OperationError, OperationsClient } from '../../lib/operations/index.js';
|
|
5
|
+
import type { CommitOutcome, DeleteCreatedOutcome, DocumentConflict, OperationError, OperationsClient } from '../../lib/operations/index.js';
|
|
6
6
|
import type { TableViewState } from '../../lib/cms-views/index.js';
|
|
7
7
|
import type { CellCommitInput, CellCommitOutcome } from './cell-edit.js';
|
|
8
8
|
import type { BulkAction, BulkReport, BulkSetField } from './bulk-actions.js';
|
|
@@ -123,6 +123,14 @@ export interface CmsStore {
|
|
|
123
123
|
*/
|
|
124
124
|
replaceDocument(doc: CmsDocument, revision: number | undefined, authoredOn?: CmsDocument): void;
|
|
125
125
|
deleteDocument(ref: DocumentRef): void;
|
|
126
|
+
/**
|
|
127
|
+
* EC-728 — delete a document this session created, only while it is exactly as created
|
|
128
|
+
* (the persister's `deleteCreated`: conditioned on its create receipt, refused by the
|
|
129
|
+
* store on any write since or a strict referrer). The session drops it only once deleted;
|
|
130
|
+
* a refusal is returned, never reported. A fixture session (no persister) answers
|
|
131
|
+
* `not-created` — nothing is judged there, so nothing is deleted.
|
|
132
|
+
*/
|
|
133
|
+
deleteCreatedDocument(ref: DocumentRef): Promise<DeleteCreatedOutcome>;
|
|
126
134
|
/**
|
|
127
135
|
* Is this document currently published? Sourced from the version POINTER
|
|
128
136
|
* (EC-224), not the flat `state` enum — seeded from hydration and updated by
|
|
@@ -1053,6 +1053,7 @@ function CmsSession({ children, projectId, initialCollections, initialDocuments,
|
|
|
1053
1053
|
persistError,
|
|
1054
1054
|
clearPersistError: () => setPersistError(null),
|
|
1055
1055
|
flushPersistence: (ref) => persisterRef.current?.flush(ref) ?? Promise.resolve(),
|
|
1056
|
+
deleteCreatedDocument: (ref) => persisterRef.current?.deleteCreated(ref) ?? Promise.resolve('not-created'),
|
|
1056
1057
|
}), [
|
|
1057
1058
|
projectId,
|
|
1058
1059
|
collections,
|