@elytracms/studio 0.0.94 → 0.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/convex/asset-alt-migration.test.ts +2 -2
- package/convex/asset-meta-patch.test.ts +218 -0
- package/convex/asset-replace-delete-race.test.ts +127 -0
- package/convex/assets.ts +27 -2
- package/convex/cms.ts +124 -8
- package/convex/delivery-redirects.test.ts +167 -0
- package/convex/delivery.ts +15 -5
- package/convex/rail-write-parity.test.ts +6 -6
- package/convex/redirects.ts +1 -1
- package/convex/schema.ts +6 -0
- package/convex/strict-reference-race.test.ts +139 -0
- package/dist/addon.d.ts +1 -1
- package/dist/addon.js.map +1 -1
- package/dist/components/ai/ai-chat-panel.js +15 -2
- package/dist/components/ai/ai-chat-panel.js.map +1 -1
- package/dist/components/ai/translate-document-action.d.ts +6 -0
- package/dist/components/ai/translate-document-action.js.map +1 -1
- package/dist/components/ai/translate-document-dialog.d.ts +1 -1
- package/dist/components/ai/translate-document-dialog.js +5 -5
- package/dist/components/ai/translate-document-dialog.js.map +1 -1
- package/dist/components/assets/asset-detail.js +29 -11
- package/dist/components/assets/asset-detail.js.map +1 -1
- package/dist/components/assets/asset-locale.d.ts +16 -0
- package/dist/components/assets/asset-locale.js +30 -0
- package/dist/components/assets/asset-locale.js.map +1 -0
- package/dist/components/assets/asset-meta-drift-notice.d.ts +13 -0
- package/dist/components/assets/asset-meta-drift-notice.js +22 -0
- package/dist/components/assets/asset-meta-drift-notice.js.map +1 -0
- package/dist/components/assets/asset-meta-label.d.ts +13 -0
- package/dist/components/assets/asset-meta-label.js +17 -0
- package/dist/components/assets/asset-meta-label.js.map +1 -0
- package/dist/components/assets/asset-metadata.d.ts +89 -15
- package/dist/components/assets/asset-metadata.js +123 -11
- package/dist/components/assets/asset-metadata.js.map +1 -1
- package/dist/components/assets/asset-search.d.ts +6 -2
- package/dist/components/assets/asset-search.js +19 -3
- package/dist/components/assets/asset-search.js.map +1 -1
- package/dist/components/assets/asset-thumb.js +6 -2
- package/dist/components/assets/asset-thumb.js.map +1 -1
- package/dist/components/assets/assets-collection-view-source.d.ts +25 -9
- package/dist/components/assets/assets-collection-view-source.js +80 -26
- package/dist/components/assets/assets-collection-view-source.js.map +1 -1
- package/dist/components/assets/assets-store.js +17 -4
- package/dist/components/assets/assets-store.js.map +1 -1
- package/dist/components/builder/builder-store.d.ts +21 -0
- package/dist/components/builder/builder-store.js +22 -0
- package/dist/components/builder/builder-store.js.map +1 -1
- package/dist/components/builder/canvas-commit-boundary.d.ts +22 -0
- package/dist/components/builder/canvas-commit-boundary.js +27 -0
- package/dist/components/builder/canvas-commit-boundary.js.map +1 -0
- package/dist/components/builder/canvas-rebase.d.ts +101 -0
- package/dist/components/builder/canvas-rebase.js +179 -0
- package/dist/components/builder/canvas-rebase.js.map +1 -0
- package/dist/components/builder/canvas-render-context.d.ts +6 -3
- package/dist/components/builder/canvas-render-context.js +17 -8
- package/dist/components/builder/canvas-render-context.js.map +1 -1
- package/dist/components/builder/composition-field-editor.d.ts +26 -2
- package/dist/components/builder/composition-field-editor.js +46 -27
- package/dist/components/builder/composition-field-editor.js.map +1 -1
- package/dist/components/builder/node-factory.js +15 -3
- package/dist/components/builder/node-factory.js.map +1 -1
- package/dist/components/builder/property-inspector.js +3 -1
- package/dist/components/builder/property-inspector.js.map +1 -1
- package/dist/components/builder/run-inspector.js +10 -6
- package/dist/components/builder/run-inspector.js.map +1 -1
- package/dist/components/cms/asset-field.d.ts +5 -2
- package/dist/components/cms/asset-field.js +34 -17
- package/dist/components/cms/asset-field.js.map +1 -1
- package/dist/components/cms/asset-picker-core.d.ts +2 -2
- package/dist/components/cms/asset-picker-core.js +2 -2
- package/dist/components/cms/asset-picker-core.js.map +1 -1
- package/dist/components/cms/asset-picker.js +6 -2
- package/dist/components/cms/asset-picker.js.map +1 -1
- package/dist/components/cms/canvas-commit.d.ts +62 -0
- package/dist/components/cms/canvas-commit.js +39 -0
- package/dist/components/cms/canvas-commit.js.map +1 -0
- package/dist/components/cms/cms-store.d.ts +21 -8
- package/dist/components/cms/cms-store.js +19 -10
- package/dist/components/cms/cms-store.js.map +1 -1
- package/dist/components/cms/collection-table.js +27 -18
- package/dist/components/cms/collection-table.js.map +1 -1
- package/dist/components/cms/commit-policy.d.ts +6 -2
- package/dist/components/cms/commit-policy.js +1 -1
- package/dist/components/cms/commit-policy.js.map +1 -1
- package/dist/components/cms/detail-editor.js +12 -2
- package/dist/components/cms/detail-editor.js.map +1 -1
- package/dist/components/cms/draft-commit.d.ts +16 -3
- package/dist/components/cms/draft-commit.js +3 -2
- package/dist/components/cms/draft-commit.js.map +1 -1
- package/dist/components/cms/use-document-draft.d.ts +121 -5
- package/dist/components/cms/use-document-draft.js +197 -54
- package/dist/components/cms/use-document-draft.js.map +1 -1
- package/dist/components/cms/use-live-url.d.ts +6 -1
- package/dist/components/cms/use-live-url.js +12 -9
- package/dist/components/cms/use-live-url.js.map +1 -1
- package/dist/components/collection-view/cms-collection-view-source.js +11 -5
- package/dist/components/collection-view/cms-collection-view-source.js.map +1 -1
- package/dist/components/components/transfer-dialog.js +6 -4
- package/dist/components/components/transfer-dialog.js.map +1 -1
- package/dist/components/deployment-setup-gate.js +10 -1
- package/dist/components/deployment-setup-gate.js.map +1 -1
- package/dist/components/records/record-lens.js +3 -8
- package/dist/components/records/record-lens.js.map +1 -1
- package/dist/lib/ai/chat-state.d.ts +7 -0
- package/dist/lib/ai/chat-state.js.map +1 -1
- package/dist/lib/ai/tools.d.ts +8 -0
- package/dist/lib/ai/tools.js +4 -0
- package/dist/lib/ai/tools.js.map +1 -1
- package/dist/lib/assets/upload.d.ts +25 -7
- package/dist/lib/assets/upload.js +30 -21
- package/dist/lib/assets/upload.js.map +1 -1
- package/dist/lib/cms/published-documents.d.ts +24 -6
- package/dist/lib/cms/published-documents.js +39 -6
- package/dist/lib/cms/published-documents.js.map +1 -1
- package/dist/lib/cms-views/view-model.d.ts +25 -105
- package/dist/lib/cms-views/view-model.js +36 -103
- package/dist/lib/cms-views/view-model.js.map +1 -1
- package/dist/lib/collection-view/__fixtures__/document-writes.js +1 -0
- package/dist/lib/collection-view/__fixtures__/document-writes.js.map +1 -1
- package/dist/lib/collection-view/collection-view-source.d.ts +21 -8
- package/dist/lib/collection-view/collection-view-source.js.map +1 -1
- package/dist/lib/data/collection-content.js +5 -0
- package/dist/lib/data/collection-content.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.js +20 -4
- package/dist/lib/i18n/messages.de.js.map +1 -1
- package/dist/lib/i18n/messages.en.d.ts +16 -1
- package/dist/lib/i18n/messages.en.js +22 -5
- package/dist/lib/i18n/messages.en.js.map +1 -1
- package/dist/lib/operations/cms-persistence.d.ts +80 -35
- package/dist/lib/operations/cms-persistence.js +348 -85
- package/dist/lib/operations/cms-persistence.js.map +1 -1
- package/dist/lib/operations/config-manifest-lookup.d.ts +1 -1
- package/dist/lib/operations/config-manifest-lookup.js +3 -3
- package/dist/lib/operations/config-manifest-lookup.js.map +1 -1
- package/dist/lib/persistence/convex-adapter.js +54 -8
- package/dist/lib/persistence/convex-adapter.js.map +1 -1
- package/dist/lib/persistence/deployment-readiness.js +14 -11
- package/dist/lib/persistence/deployment-readiness.js.map +1 -1
- package/dist/lib/persona/labels.js +2 -0
- package/dist/lib/persona/labels.js.map +1 -1
- package/dist/lib/query/index.d.ts +2 -2
- package/dist/lib/query/index.js +1 -1
- package/dist/lib/query/index.js.map +1 -1
- package/dist/lib/query/operations-query.d.ts +26 -0
- package/dist/lib/query/operations-query.js +12 -0
- package/dist/lib/query/operations-query.js.map +1 -1
- package/dist/lib/registry/index.js +2 -2
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/preview.d.ts +10 -0
- package/dist/lib/registry/preview.js +13 -4
- package/dist/lib/registry/preview.js.map +1 -1
- package/dist/lib/routes/route-issues.js +6 -3
- package/dist/lib/routes/route-issues.js.map +1 -1
- package/dist/lib/workspace/workspace-source.js +6 -7
- package/dist/lib/workspace/workspace-source.js.map +1 -1
- package/dist/previews/entry-node.d.ts +14 -0
- package/dist/previews/entry-node.js +22 -0
- package/dist/previews/entry-node.js.map +1 -0
- package/dist/previews/harness.js +2 -16
- package/dist/previews/harness.js.map +1 -1
- package/package.json +3 -3
|
@@ -11,15 +11,18 @@ import { appendAssetSelections, applyAssetSelection, assetIdsOf, singleAssetIdOf
|
|
|
11
11
|
import { useOptionalAssets } from '../assets/assets-store.js';
|
|
12
12
|
import { AssetThumb, FocalCropPreviews, FocalPointPicker, useAssetRecord } from '../assets/asset-thumb.js';
|
|
13
13
|
import { assetPickerBinding, batchAttachment, splitByAccept, uploadBatchProgress } from './asset-picker-core.js';
|
|
14
|
-
import { assetMetaFieldsOf,
|
|
14
|
+
import { assetMetaDraft, assetMetaDraftPatch, assetMetaFieldsOf, assetMetaFormValues, setAssetMetaField, } from '../assets/asset-metadata.js';
|
|
15
|
+
import { useAssetReadLocale } from '../assets/asset-locale.js';
|
|
16
|
+
import { AssetMetaFieldLabel } from '../assets/asset-meta-label.js';
|
|
15
17
|
import { ReplaceFileButton } from '../assets/replace-file.js';
|
|
16
|
-
import { fieldLabel } from './cms-labels.js';
|
|
17
18
|
import { useCollectionView } from '../collection-view/collection-view-context.js';
|
|
18
19
|
import { useFieldDensity } from './field-density.js';
|
|
19
20
|
import { AssetPicker, AssetRejectedNotice } from './asset-picker.js';
|
|
20
21
|
import { FieldControl } from './field-control.js';
|
|
21
22
|
import { ObjectItemForm } from './object-array-field.js';
|
|
22
23
|
import { FieldPathContext, useFieldPath } from './field-anchors.js';
|
|
24
|
+
/** The draft before the dialog seeds (EC-632) — nothing open, nothing to diff. */
|
|
25
|
+
const EMPTY_DRAFT = { meta: {}, localizedMeta: {} };
|
|
23
26
|
/**
|
|
24
27
|
* The asset-field family (EC-152 + EC-248 + EC-301) — split from
|
|
25
28
|
* `field-control.tsx` (EC-330): the {@link AssetField} control plus its
|
|
@@ -304,7 +307,9 @@ function AssetInfo({ assetId, fallbackTitle }) {
|
|
|
304
307
|
*/
|
|
305
308
|
function AssetAltLine({ assetId }) {
|
|
306
309
|
const record = useAssetRecord(assetId);
|
|
307
|
-
|
|
310
|
+
// EC-632: in the studio's locale — a localized alt shows the open locale's translation.
|
|
311
|
+
const at = useAssetReadLocale();
|
|
312
|
+
const alt = record ? assetAlt(record, at) : null;
|
|
308
313
|
return (_jsxs(Row, { gap: "1", align: "baseline", className: "min-w-0", children: [_jsx(Text, { size: "xs", tone: "subtle", className: "shrink-0", children: translate('cms.asset.altLabel') }), _jsx(Text, { size: "xs", tone: alt ? 'muted' : 'subtle', className: cn('min-w-0 truncate', !alt && 'italic'), title: alt ?? undefined, children: alt || translate('cms.asset.notSet') })] }));
|
|
309
314
|
}
|
|
310
315
|
/**
|
|
@@ -362,9 +367,14 @@ function AssetOptionsDialog({ assetId, readOnly, open, onOpenChange, placement,
|
|
|
362
367
|
return collection ? assetMetaFieldsOf(collection) : [];
|
|
363
368
|
}, [source]);
|
|
364
369
|
// Local edit buffers, seeded once per open from the record (so an external edit
|
|
365
|
-
// still wins between opens).
|
|
366
|
-
//
|
|
367
|
-
|
|
370
|
+
// still wins between opens). EC-632: the draft is the document shape (shared bag +
|
|
371
|
+
// per-locale buckets), shown in the studio's locale — the one the document around it
|
|
372
|
+
// is open in — so a localized field (alt) edits that locale's translation.
|
|
373
|
+
const at = useAssetReadLocale();
|
|
374
|
+
const [draft, setDraft] = useState(EMPTY_DRAFT);
|
|
375
|
+
// EC-634: the draft as seeded at open — the base the commit is diffed against, so only
|
|
376
|
+
// the keys (and locales) edited here are written and another session's change survives.
|
|
377
|
+
const opened = useRef(EMPTY_DRAFT);
|
|
368
378
|
const [focal, setFocal] = useState(undefined);
|
|
369
379
|
const dirty = useRef(false);
|
|
370
380
|
const seeded = useRef(false);
|
|
@@ -375,10 +385,12 @@ function AssetOptionsDialog({ assetId, readOnly, open, onOpenChange, placement,
|
|
|
375
385
|
}
|
|
376
386
|
if (seeded.current || !record)
|
|
377
387
|
return;
|
|
378
|
-
// Seed from the
|
|
379
|
-
// `
|
|
380
|
-
//
|
|
381
|
-
|
|
388
|
+
// Seed from the stored bags with a legacy `alt` column lifted in (EC-587,
|
|
389
|
+
// `assetMetaDraft`): a not-yet-migrated asset shows its alt; the write rule moves it to
|
|
390
|
+
// `meta.alt` and clears the column when the commit's patch is applied.
|
|
391
|
+
const seed = assetMetaDraft(record);
|
|
392
|
+
opened.current = seed;
|
|
393
|
+
setDraft(seed);
|
|
382
394
|
setFocal(record.focalPoint);
|
|
383
395
|
dirty.current = false;
|
|
384
396
|
seeded.current = true;
|
|
@@ -386,14 +398,17 @@ function AssetOptionsDialog({ assetId, readOnly, open, onOpenChange, placement,
|
|
|
386
398
|
function handleOpenChange(next) {
|
|
387
399
|
// Commit the buffered metadata once, on close (one write, not per keystroke).
|
|
388
400
|
if (!next && !readOnly && assets && dirty.current) {
|
|
389
|
-
void assets.updateMetadata(assetId,
|
|
401
|
+
void assets.updateMetadata(assetId, assetMetaDraftPatch(opened.current, draft));
|
|
390
402
|
dirty.current = false;
|
|
391
403
|
}
|
|
392
404
|
onOpenChange(next);
|
|
393
405
|
}
|
|
394
406
|
function setField(name, value) {
|
|
407
|
+
const field = metaFields.find((f) => f.name === name);
|
|
408
|
+
if (!field)
|
|
409
|
+
return;
|
|
395
410
|
dirty.current = true;
|
|
396
|
-
|
|
411
|
+
setDraft((d) => setAssetMetaField(d, field, at, value));
|
|
397
412
|
}
|
|
398
413
|
// The focal point drives a live crop preview → commit immediately (optimistic
|
|
399
414
|
// marker), not deferred to close.
|
|
@@ -410,22 +425,24 @@ function AssetOptionsDialog({ assetId, readOnly, open, onOpenChange, placement,
|
|
|
410
425
|
const replaceAction = record ? (_jsx(ReplaceFileButton, { record: record, disabled: readOnly, beforeReplace: async () => {
|
|
411
426
|
if (assets && dirty.current) {
|
|
412
427
|
dirty.current = false;
|
|
413
|
-
await assets.updateMetadata(assetId,
|
|
428
|
+
await assets.updateMetadata(assetId, assetMetaDraftPatch(opened.current, draft));
|
|
414
429
|
}
|
|
415
430
|
}, onReplaced: (asset) => {
|
|
416
|
-
|
|
431
|
+
const seed = assetMetaDraft(asset);
|
|
432
|
+
opened.current = seed;
|
|
433
|
+
setDraft(seed);
|
|
417
434
|
setFocal(asset.focalPoint);
|
|
418
435
|
dirty.current = false;
|
|
419
436
|
setReplaced(true);
|
|
420
437
|
} })) : null;
|
|
421
438
|
const whereUsed = source.projectId !== undefined ? (_jsxs(Link, { to: STUDIO_PROJECT_ROUTE, params: { projectId: source.projectId, _splat: studioPath.asset(assetId) }, className: "inline-flex items-center gap-1 text-xs text-primary hover:underline", children: [_jsx(Link2, { className: "size-3" }), " ", translate('cms.asset.imageOptions.whereUsed')] })) : null;
|
|
422
|
-
return (_jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: translate('cms.asset.imageOptions.title') }), _jsx(DialogDescription, { children: translate('cms.asset.imageOptions.description') })] }), _jsx(AssetOptionsSections, { record: record, readOnly: readOnly, metaFields: metaFields, meta:
|
|
439
|
+
return (_jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: translate('cms.asset.imageOptions.title') }), _jsx(DialogDescription, { children: translate('cms.asset.imageOptions.description') })] }), _jsx(AssetOptionsSections, { record: record, readOnly: readOnly, metaFields: metaFields, meta: assetMetaFormValues(draft, metaFields, at), metaLocale: at, onMetaField: setField, focal: focal, onFocalCommit: commitFocal, onFocalPreview: setFocal, whereUsed: whereUsed, replaceAction: replaceAction, replaced: replaced, ...(placement ? { placement } : {}) })] }) }));
|
|
423
440
|
}
|
|
424
441
|
/**
|
|
425
442
|
* The two sections of the image options dialog (EC-588 2i), stateless — exported so a
|
|
426
443
|
* node smoke render can pin the split (the dialog itself portals, `null` in node).
|
|
427
444
|
*/
|
|
428
|
-
export function AssetOptionsSections({ record, readOnly, metaFields, meta, onMetaField, focal, onFocalCommit, onFocalPreview, placement, whereUsed, replaceAction, replaced, }) {
|
|
429
|
-
return (_jsxs(Stack, { gap: "4", children: [placement && placement.fields.length > 0 ? (_jsxs(Stack, { gap: "2", "data-ec-asset-options": "placement", children: [_jsxs(Stack, { gap: "1", children: [_jsx(Heading, { level: 3, size: "h4", children: translate('cms.asset.imageOptions.placementTitle') }), _jsx(Text, { size: "xs", tone: "subtle", children: translate('cms.asset.imageOptions.placementHint') })] }), _jsx(ObjectItemForm, { fields: placement.fields, value: placement.value, readOnly: readOnly, idPrefix: "asset-options-placement", onChange: placement.onChange }), _jsx(Separator, {})] })) : null, _jsxs(Stack, { gap: "3", "data-ec-asset-options": "asset", children: [_jsxs(Stack, { gap: "1", children: [_jsxs(Row, { align: "center", children: [_jsx(Heading, { level: 3, size: "h4", children: translate('cms.asset.imageOptions.assetTitle') }), _jsx(Spacer, {}), whereUsed] }), _jsx(Text, { size: "xs", tone: "subtle", children: translate('cms.asset.imageOptions.assetHint') }), replaceAction ? _jsx(Row, { gap: "2", align: "center", wrap: true, children: replaceAction }) : null] }), _jsxs(Stack, { gap: "2", children: [_jsxs(Row, { align: "center", children: [_jsx(Text, { size: "sm", className: "font-medium", children: translate('cms.asset.focalPoint') }), _jsx(Spacer, {}), focal && !readOnly ? (_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => onFocalCommit(null), children: [_jsx(RotateCcw, {}), " ", translate('cms.asset.resetToCentre')] })) : null] }), _jsx(FocalPointPicker, { record: record, point: focal, onChange: onFocalCommit, onPreview: onFocalPreview, disabled: readOnly }), replaced ? (_jsx(Text, { size: "xs", className: "font-medium", "data-ec-asset-options": "replaced", children: translate('cms.asset.replacedCheckFocal') })) : null, _jsx(Text, { size: "xs", tone: "subtle", children: translate('cms.asset.focalPointHint') }), _jsx(FocalCropPreviews, { record: record, point: focal })] }), metaFields.map((f) => (_jsx(Field, { label:
|
|
445
|
+
export function AssetOptionsSections({ record, readOnly, metaFields, meta, metaLocale = null, onMetaField, focal, onFocalCommit, onFocalPreview, placement, whereUsed, replaceAction, replaced, }) {
|
|
446
|
+
return (_jsxs(Stack, { gap: "4", children: [placement && placement.fields.length > 0 ? (_jsxs(Stack, { gap: "2", "data-ec-asset-options": "placement", children: [_jsxs(Stack, { gap: "1", children: [_jsx(Heading, { level: 3, size: "h4", children: translate('cms.asset.imageOptions.placementTitle') }), _jsx(Text, { size: "xs", tone: "subtle", children: translate('cms.asset.imageOptions.placementHint') })] }), _jsx(ObjectItemForm, { fields: placement.fields, value: placement.value, readOnly: readOnly, idPrefix: "asset-options-placement", onChange: placement.onChange }), _jsx(Separator, {})] })) : null, _jsxs(Stack, { gap: "3", "data-ec-asset-options": "asset", children: [_jsxs(Stack, { gap: "1", children: [_jsxs(Row, { align: "center", children: [_jsx(Heading, { level: 3, size: "h4", children: translate('cms.asset.imageOptions.assetTitle') }), _jsx(Spacer, {}), whereUsed] }), _jsx(Text, { size: "xs", tone: "subtle", children: translate('cms.asset.imageOptions.assetHint') }), replaceAction ? _jsx(Row, { gap: "2", align: "center", wrap: true, children: replaceAction }) : null] }), _jsxs(Stack, { gap: "2", children: [_jsxs(Row, { align: "center", children: [_jsx(Text, { size: "sm", className: "font-medium", children: translate('cms.asset.focalPoint') }), _jsx(Spacer, {}), focal && !readOnly ? (_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => onFocalCommit(null), children: [_jsx(RotateCcw, {}), " ", translate('cms.asset.resetToCentre')] })) : null] }), _jsx(FocalPointPicker, { record: record, point: focal, onChange: onFocalCommit, onPreview: onFocalPreview, disabled: readOnly }), replaced ? (_jsx(Text, { size: "xs", className: "font-medium", "data-ec-asset-options": "replaced", children: translate('cms.asset.replacedCheckFocal') })) : null, _jsx(Text, { size: "xs", tone: "subtle", children: translate('cms.asset.focalPointHint') }), _jsx(FocalCropPreviews, { record: record, point: focal })] }), metaFields.map((f) => (_jsx(Field, { label: _jsx(AssetMetaFieldLabel, { field: f, at: metaLocale }), hint: localizedLabel(f.form?.description) || undefined, children: _jsx(FieldControl, { id: `asset-meta-${f.name}`, field: f, value: meta[f.name], readOnly: readOnly, onChange: (v) => onMetaField(f.name, v) }) }, f.name))), metaFields.length === 0 ? (_jsxs(Text, { size: "sm", tone: "subtle", children: ["No editable metadata fields are declared on the asset collection. Add fields (e.g.", _jsx(Code, { tone: "muted", children: " alt" }), ", ", _jsx(Code, { tone: "muted", children: "copyright" }), ") to it in code."] })) : null] })] }));
|
|
430
447
|
}
|
|
431
448
|
//# sourceMappingURL=asset-field.js.map
|
|
@@ -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,O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IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,YAC1B,SAAS,CAAC,0BAA0B,CAAC,GACjC,EACP,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,IAC7C,EACP,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACrB,KAAC,KAAK,IAAc,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,SAAS,YAC9F,KAAC,YAAY,IACX,EAAE,EAAE,cAAc,CAAC,CAAC,IAAI,EAAE,EAC1B,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,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,IAPQ,CAAC,CAAC,IAAI,CAQV,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 { 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 { assetMetaFieldsOf, assetMetaSeed, pruneMeta } from '../assets/asset-metadata'\nimport { ReplaceFileButton } from '../assets/replace-file'\nimport { fieldLabel } from './cms-labels'\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/**\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 const alt = record ? assetAlt(record) : 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). Metadata is non-localized in v1 (the asset\n // resolution path is locale-agnostic) — localized asset metadata is EC-565 2a.\n const [meta, setMeta] = useState<Record<string, unknown>>({})\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 meta bag with a legacy `alt` column lifted in (EC-587,\n // `assetMetaSeed`): a not-yet-migrated asset shows its alt, and the save writes it\n // to `meta.alt` and clears the column (`assetMetadataWrite`).\n setMeta(assetMetaSeed(record))\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, { meta: pruneMeta(meta) })\n dirty.current = false\n }\n onOpenChange(next)\n }\n\n function setField(name: string, value: unknown) {\n dirty.current = true\n setMeta((m) => ({ ...m, [name]: 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, { meta: pruneMeta(meta) })\n }\n }}\n onReplaced={(asset) => {\n setMeta(assetMetaSeed(asset))\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={meta}\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 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 meta: Record<string, unknown>\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 key={f.name} label={fieldLabel(f)} hint={localizedLabel(f.form?.description) || undefined}>\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,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,6B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,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,YAC1B,SAAS,CAAC,0BAA0B,CAAC,GACjC,EACP,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,IAC7C,EACP,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACrB,KAAC,KAAK,IAEJ,KAAK,EAAE,KAAC,mBAAmB,IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,GAAI,EACxD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,SAAS,YAEtD,KAAC,YAAY,IACX,EAAE,EAAE,cAAc,CAAC,CAAC,IAAI,EAAE,EAC1B,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,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,5 +1,5 @@
|
|
|
1
1
|
import type { AssetFieldDef } from '@elytracms/core/cms-core';
|
|
2
|
-
import type { AssetRecord } from '@elytracms/core/persistence';
|
|
2
|
+
import type { AssetReadLocale, AssetRecord } from '@elytracms/core/persistence';
|
|
3
3
|
/**
|
|
4
4
|
* Pure selection/filter core for the asset picker (EC-432). DOM-free and
|
|
5
5
|
* side-effect-free so the media browser's "what shows", "what an upload may send" and
|
|
@@ -25,7 +25,7 @@ export declare const ASSET_PICKER_STAGE_PRESET: "grid";
|
|
|
25
25
|
* the `accept` filter (EC-432) — an image field's picker browses only images,
|
|
26
26
|
* never the project's PDFs. Order follows the library.
|
|
27
27
|
*/
|
|
28
|
-
export declare function visiblePickerAssets(assets: readonly AssetRecord[], query: string, accept: readonly string[] | undefined): AssetRecord[];
|
|
28
|
+
export declare function visiblePickerAssets(assets: readonly AssetRecord[], query: string, accept: readonly string[] | undefined, at: AssetReadLocale | null): AssetRecord[];
|
|
29
29
|
/**
|
|
30
30
|
* THE drop rule (EC-301 → EC-588): split files about to be uploaded into the ones the
|
|
31
31
|
* field's `accept` admits and the NAMES of the ones it refuses. A drag-drop bypasses
|
|
@@ -26,8 +26,8 @@ export const ASSET_PICKER_STAGE_PRESET = 'grid';
|
|
|
26
26
|
* the `accept` filter (EC-432) — an image field's picker browses only images,
|
|
27
27
|
* never the project's PDFs. Order follows the library.
|
|
28
28
|
*/
|
|
29
|
-
export function visiblePickerAssets(assets, query, accept) {
|
|
30
|
-
return filterAssets(assets, query).filter((asset) => assetMatchesAccept(asset, accept));
|
|
29
|
+
export function visiblePickerAssets(assets, query, accept, at) {
|
|
30
|
+
return filterAssets(assets, query, at).filter((asset) => assetMatchesAccept(asset, accept));
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* THE drop rule (EC-301 → EC-588): split files about to be uploaded into the ones the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-picker-core.js","sourceRoot":"","sources":["../../../src/components/cms/asset-picker-core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,GAChB,MAAM,2BAA2B,CAAA;AAElC;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAe,CAAA;AAExD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAA8B,EAC9B,KAAa,EACb,MAAqC;IAErC,OAAO,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;AACzF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAmB,EACnB,MAAqC;IAErC,MAAM,QAAQ,GAAQ,EAAE,CAAA;IACxB,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,kBAAkB,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,E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,KAA8B;IAE9B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;IAC/B,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;QAC/C,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,QAAQ;QACR,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACzE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,MAAgB,EAAE,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzG,CAAA;AACH,CAAC","sourcesContent":["import type { AssetFieldDef } from '@elytracms/core/cms-core'\nimport type { AssetRecord } from '@elytracms/core/persistence'\nimport { assetMatchesAccept } from '@elytracms/core/cms-core'\nimport { filterAssets } from '../assets/asset-search'\nimport {\n appendAssetSelections,\n applyAssetSelection,\n singleAssetIdOf,\n} from '../assets/asset-selection'\n\n/**\n * Pure selection/filter core for the asset picker (EC-432). DOM-free and\n * side-effect-free so the media browser's \"what shows\", \"what an upload may send\" and\n * \"what a pick/upload commits\" are unit-testable without a browser — the picker\n * component is just the stage shell around these.\n *\n * EC-588: the picker takes the field's STRUCTURED `accept` list — the one shape the\n * schema declares — and derives everything from it here or in core: the grid filter\n * ({@link visiblePickerAssets}), the drop/upload split ({@link splitByAccept}), the\n * file-input attribute (`assetAcceptAttr`, core), and the commit filter\n * ({@link uploadBatchProgress}). An absent `accept` is unrestricted everywhere; there is\n * no hidden `image/*` default.\n */\n\n/**\n * The stage width preset the media browser mounts with (EC-432 / EC-431 AD-A):\n * the roomy `grid` measure (`min(1240px, 94vw)`) — browsing assets is spatial.\n * Exported so the geometry contract is pinnable without rendering the portal\n * (which is `null` in the node test env).\n */\nexport const ASSET_PICKER_STAGE_PRESET = 'grid' as const\n\n/**\n * The assets shown in the picker grid: the shipped search filter (EC-152) then\n * the `accept` filter (EC-432) — an image field's picker browses only images,\n * never the project's PDFs. Order follows the library.\n */\nexport function visiblePickerAssets(\n assets: readonly AssetRecord[],\n query: string,\n accept: readonly string[] | undefined,\n): AssetRecord[] {\n return filterAssets(assets, query).filter((asset) => assetMatchesAccept(asset, accept))\n}\n\n/**\n * THE drop rule (EC-301 → EC-588): split files about to be uploaded into the ones the\n * field's `accept` admits and the NAMES of the ones it refuses. A drag-drop bypasses\n * the file dialog's soft filter, so every upload path — the field's drop zone, a drop\n * into the open picker, the picker's Upload dialog — passes through this, and the\n * caller names the refused files in a visible notice instead of uploading them.\n */\nexport function splitByAccept<F extends { name: string; type: string }>(\n files: readonly F[],\n accept: readonly string[] | undefined,\n): { accepted: F[]; rejected: string[] } {\n const accepted: F[] = []\n const rejected: string[] = []\n for (const file of files) {\n if (assetMatchesAccept({ contentType: file.type, filename: file.name }, accept)) accepted.push(file)\n else rejected.push(file.name)\n }\n return { accepted, rejected }\n}\n\n/**\n * One upload BATCH (EC-460): the upload-queue ids THIS interaction started.\n *\n * EC-588 A7: it used to be a pre-upload library snapshot, and whatever the library\n * gained since was committed — so an upload from another tab (re-listed with ours) or\n * from a sibling field's drop could land in this field. A batch now names exactly its\n * own uploads, and the store reports which asset each one landed as.\n */\nexport interface UploadBatch {\n uploadIds: readonly string[]\n}\n\n/** What batch progress reads from the assets store (`AssetsStore` satisfies it). */\nexport interface UploadSource {\n assets: readonly AssetRecord[]\n uploads: readonly { id: string; state: { phase: string } }[]\n /** The asset id an upload landed as, once its record is confirmed. */\n landedAssetId(uploadId: string): string | undefined\n}\n\nexport interface UploadBatchProgress {\n /** The batch's landed asset ids that the field accepts, in upload order. */\n added: string[]\n /**\n * The batch is finished: none of its uploads is still running, and every one that\n * landed is in the library. A failed (or dismissed) upload is terminal — it stays in\n * the queue for retry and is never awaited forever. Commit/attach decisions happen\n * only once settled for `many` targets; a single-select target commits on the first\n * arrival.\n */\n settled: boolean\n}\n\n/**\n * Where a batch stands. An upload is in one of four states: running (in the queue,\n * not failed), landed-but-not-listed (the store confirmed it, the library re-list has\n * not arrived), landed (attachable), or terminal (failed / dismissed). Only landed\n * uploads whose RECORD satisfies `accept` are `added` (A7: the commit is filtered,\n * not just the dialog). Pure — the picker and the asset field both drive their\n * effects with this.\n */\nexport function uploadBatchProgress(\n batch: UploadBatch,\n source: UploadSource,\n accept: readonly string[] | undefined,\n): UploadBatchProgress {\n const running = new Set(source.uploads.filter((u) => u.state.phase !== 'failed').map((u) => u.id))\n const library = new Map(source.assets.map((asset) => [asset.id, asset]))\n const added: string[] = []\n let pending = false\n for (const uploadId of batch.uploadIds) {\n if (running.has(uploadId)) {\n pending = true\n continue\n }\n const assetId = source.landedAssetId(uploadId)\n if (assetId === undefined) continue // failed or dismissed — terminal\n const record = library.get(assetId)\n if (!record) {\n pending = true // confirmed, but the library re-list has not landed yet\n continue\n }\n if (assetMatchesAccept(record, accept)) added.push(assetId)\n }\n return { added, settled: !pending }\n}\n\n/**\n * THE batch-attach rule (EC-588, ratified 2i: N files → N uploads → N placements\n * APPENDED, in the order the files were given), for every surface that uploads into a\n * field — the field's own drop zone and the picker's Upload / drop. What to attach now,\n * and whether the batch is done (disarm):\n * - a `many` target attaches nothing until the batch settles, then every landed upload\n * the field accepts, in upload order ({@link uploadBatchProgress}'s `added`). The\n * field's drop used to attach each arrival as it landed, so a second file landing\n * before the first was appended first (measured on the base: `[a2, a1]`);\n * - a single target takes the first accepted arrival at once (the rest stay in the\n * library, where they are visible), and disarms when the batch ends with none.\n */\nexport function batchAttachment(\n progress: UploadBatchProgress,\n many: boolean,\n): { attach: string[]; disarm: boolean } {\n if (many) return progress.settled ? { attach: progress.added, disarm: true } : { attach: [], disarm: false }\n const first = progress.added[0]\n if (first !== undefined) return { attach: [first], disarm: true }\n return { attach: [], disarm: progress.settled }\n}\n\n/** The picker's commit callbacks — a pick fires `onChange` then closes the stage. */\nexport interface PickerCommit {\n onChange: (assetId: string | null) => void\n onOpenChange: (open: boolean) => void\n}\n\n/**\n * Commit a picked asset (or a clear, `assetId === null`) and close the picker —\n * the selection semantic (click = pick, fire `onChange`, close). Both the grid\n * card and the Clear affordance route through this.\n */\nexport function commitPickerSelection(assetId: string | null, { onChange, onOpenChange }: PickerCommit): void {\n onChange(assetId)\n onOpenChange(false)\n}\n\n/** The multi-commit callbacks (EC-460): a settled upload batch on a `many` field. */\nexport interface PickerCommitMany {\n onChangeMany: (assetIds: string[]) => void\n onOpenChange: (open: boolean) => void\n}\n\n/**\n * Commit EVERY asset a settled upload batch added (EC-460) and close the picker —\n * the `many`-field counterpart of {@link commitPickerSelection}, so selecting N\n * files in one picker interaction attaches all N, not just the first to land.\n */\nexport function commitPickerSelectionMany(\n assetIds: string[],\n { onChangeMany, onOpenChange }: PickerCommitMany,\n): void {\n onChangeMany(assetIds)\n onOpenChange(false)\n}\n\n/**\n * The picker props a field's value position needs, derived from the field alone\n * (EC-570 #1 → EC-588): the selected id, the field's structured `accept`, whether it\n * holds many, and the commits — a pick through the carry rule (EC-558), a settled\n * upload batch appended for a `many` field (EC-460).\n */\nexport interface AssetPickerBinding {\n value: string | null\n accept?: readonly string[]\n multiple: boolean\n onChange: (assetId: string | null) => void\n onChangeMany?: (assetIds: string[]) => void\n}\n\n/**\n * ONE picker configuration for every surface that edits an asset field — the detail\n * editor and the table cell — so the two cannot drift. Before, the cell opened the\n * picker with no `accept`, no `multiple` and no batch commit: its grid offered PDFs to\n * an image field and an N-file upload attached one (EC-570 #1). `write` receives the\n * next stored value; the caller decides how to land it (form state, cell commit).\n */\nexport function assetPickerBinding(\n field: Pick<AssetFieldDef, 'multiple' | 'accept' | 'fields'>,\n value: unknown,\n write: (next: unknown) => void,\n): AssetPickerBinding {\n const multiple = field.multiple\n return {\n value: multiple ? null : singleAssetIdOf(value),\n ...(field.accept ? { accept: field.accept } : {}),\n multiple,\n onChange: (picked) => write(applyAssetSelection(value, picked, multiple)),\n ...(multiple ? { onChangeMany: (picked: string[]) => write(appendAssetSelections(value, picked)) } : {}),\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"asset-picker-core.js","sourceRoot":"","sources":["../../../src/components/cms/asset-picker-core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,GAChB,MAAM,2BAA2B,CAAA;AAElC;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAe,CAAA;AAExD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAA8B,EAC9B,KAAa,EACb,MAAqC,EACrC,EAA0B;IAE1B,OAAO,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;AAC7F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAmB,EACnB,MAAqC;IAErC,MAAM,QAAQ,GAAQ,EAAE,CAAA;IACxB,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,kBAAkB,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;;YAC/F,QAAQ,CAAC,IAAI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AAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;QAC/C,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,QAAQ;QACR,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACzE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,MAAgB,EAAE,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzG,CAAA;AACH,CAAC","sourcesContent":["import type { AssetFieldDef } from '@elytracms/core/cms-core'\nimport type { AssetReadLocale, AssetRecord } from '@elytracms/core/persistence'\nimport { assetMatchesAccept } from '@elytracms/core/cms-core'\nimport { filterAssets } from '../assets/asset-search'\nimport {\n appendAssetSelections,\n applyAssetSelection,\n singleAssetIdOf,\n} from '../assets/asset-selection'\n\n/**\n * Pure selection/filter core for the asset picker (EC-432). DOM-free and\n * side-effect-free so the media browser's \"what shows\", \"what an upload may send\" and\n * \"what a pick/upload commits\" are unit-testable without a browser — the picker\n * component is just the stage shell around these.\n *\n * EC-588: the picker takes the field's STRUCTURED `accept` list — the one shape the\n * schema declares — and derives everything from it here or in core: the grid filter\n * ({@link visiblePickerAssets}), the drop/upload split ({@link splitByAccept}), the\n * file-input attribute (`assetAcceptAttr`, core), and the commit filter\n * ({@link uploadBatchProgress}). An absent `accept` is unrestricted everywhere; there is\n * no hidden `image/*` default.\n */\n\n/**\n * The stage width preset the media browser mounts with (EC-432 / EC-431 AD-A):\n * the roomy `grid` measure (`min(1240px, 94vw)`) — browsing assets is spatial.\n * Exported so the geometry contract is pinnable without rendering the portal\n * (which is `null` in the node test env).\n */\nexport const ASSET_PICKER_STAGE_PRESET = 'grid' as const\n\n/**\n * The assets shown in the picker grid: the shipped search filter (EC-152) then\n * the `accept` filter (EC-432) — an image field's picker browses only images,\n * never the project's PDFs. Order follows the library.\n */\nexport function visiblePickerAssets(\n assets: readonly AssetRecord[],\n query: string,\n accept: readonly string[] | undefined,\n at: AssetReadLocale | null,\n): AssetRecord[] {\n return filterAssets(assets, query, at).filter((asset) => assetMatchesAccept(asset, accept))\n}\n\n/**\n * THE drop rule (EC-301 → EC-588): split files about to be uploaded into the ones the\n * field's `accept` admits and the NAMES of the ones it refuses. A drag-drop bypasses\n * the file dialog's soft filter, so every upload path — the field's drop zone, a drop\n * into the open picker, the picker's Upload dialog — passes through this, and the\n * caller names the refused files in a visible notice instead of uploading them.\n */\nexport function splitByAccept<F extends { name: string; type: string }>(\n files: readonly F[],\n accept: readonly string[] | undefined,\n): { accepted: F[]; rejected: string[] } {\n const accepted: F[] = []\n const rejected: string[] = []\n for (const file of files) {\n if (assetMatchesAccept({ contentType: file.type, filename: file.name }, accept)) accepted.push(file)\n else rejected.push(file.name)\n }\n return { accepted, rejected }\n}\n\n/**\n * One upload BATCH (EC-460): the upload-queue ids THIS interaction started.\n *\n * EC-588 A7: it used to be a pre-upload library snapshot, and whatever the library\n * gained since was committed — so an upload from another tab (re-listed with ours) or\n * from a sibling field's drop could land in this field. A batch now names exactly its\n * own uploads, and the store reports which asset each one landed as.\n */\nexport interface UploadBatch {\n uploadIds: readonly string[]\n}\n\n/** What batch progress reads from the assets store (`AssetsStore` satisfies it). */\nexport interface UploadSource {\n assets: readonly AssetRecord[]\n uploads: readonly { id: string; state: { phase: string } }[]\n /** The asset id an upload landed as, once its record is confirmed. */\n landedAssetId(uploadId: string): string | undefined\n}\n\nexport interface UploadBatchProgress {\n /** The batch's landed asset ids that the field accepts, in upload order. */\n added: string[]\n /**\n * The batch is finished: none of its uploads is still running, and every one that\n * landed is in the library. A failed (or dismissed) upload is terminal — it stays in\n * the queue for retry and is never awaited forever. Commit/attach decisions happen\n * only once settled for `many` targets; a single-select target commits on the first\n * arrival.\n */\n settled: boolean\n}\n\n/**\n * Where a batch stands. An upload is in one of four states: running (in the queue,\n * not failed), landed-but-not-listed (the store confirmed it, the library re-list has\n * not arrived), landed (attachable), or terminal (failed / dismissed). Only landed\n * uploads whose RECORD satisfies `accept` are `added` (A7: the commit is filtered,\n * not just the dialog). Pure — the picker and the asset field both drive their\n * effects with this.\n */\nexport function uploadBatchProgress(\n batch: UploadBatch,\n source: UploadSource,\n accept: readonly string[] | undefined,\n): UploadBatchProgress {\n const running = new Set(source.uploads.filter((u) => u.state.phase !== 'failed').map((u) => u.id))\n const library = new Map(source.assets.map((asset) => [asset.id, asset]))\n const added: string[] = []\n let pending = false\n for (const uploadId of batch.uploadIds) {\n if (running.has(uploadId)) {\n pending = true\n continue\n }\n const assetId = source.landedAssetId(uploadId)\n if (assetId === undefined) continue // failed or dismissed — terminal\n const record = library.get(assetId)\n if (!record) {\n pending = true // confirmed, but the library re-list has not landed yet\n continue\n }\n if (assetMatchesAccept(record, accept)) added.push(assetId)\n }\n return { added, settled: !pending }\n}\n\n/**\n * THE batch-attach rule (EC-588, ratified 2i: N files → N uploads → N placements\n * APPENDED, in the order the files were given), for every surface that uploads into a\n * field — the field's own drop zone and the picker's Upload / drop. What to attach now,\n * and whether the batch is done (disarm):\n * - a `many` target attaches nothing until the batch settles, then every landed upload\n * the field accepts, in upload order ({@link uploadBatchProgress}'s `added`). The\n * field's drop used to attach each arrival as it landed, so a second file landing\n * before the first was appended first (measured on the base: `[a2, a1]`);\n * - a single target takes the first accepted arrival at once (the rest stay in the\n * library, where they are visible), and disarms when the batch ends with none.\n */\nexport function batchAttachment(\n progress: UploadBatchProgress,\n many: boolean,\n): { attach: string[]; disarm: boolean } {\n if (many) return progress.settled ? { attach: progress.added, disarm: true } : { attach: [], disarm: false }\n const first = progress.added[0]\n if (first !== undefined) return { attach: [first], disarm: true }\n return { attach: [], disarm: progress.settled }\n}\n\n/** The picker's commit callbacks — a pick fires `onChange` then closes the stage. */\nexport interface PickerCommit {\n onChange: (assetId: string | null) => void\n onOpenChange: (open: boolean) => void\n}\n\n/**\n * Commit a picked asset (or a clear, `assetId === null`) and close the picker —\n * the selection semantic (click = pick, fire `onChange`, close). Both the grid\n * card and the Clear affordance route through this.\n */\nexport function commitPickerSelection(assetId: string | null, { onChange, onOpenChange }: PickerCommit): void {\n onChange(assetId)\n onOpenChange(false)\n}\n\n/** The multi-commit callbacks (EC-460): a settled upload batch on a `many` field. */\nexport interface PickerCommitMany {\n onChangeMany: (assetIds: string[]) => void\n onOpenChange: (open: boolean) => void\n}\n\n/**\n * Commit EVERY asset a settled upload batch added (EC-460) and close the picker —\n * the `many`-field counterpart of {@link commitPickerSelection}, so selecting N\n * files in one picker interaction attaches all N, not just the first to land.\n */\nexport function commitPickerSelectionMany(\n assetIds: string[],\n { onChangeMany, onOpenChange }: PickerCommitMany,\n): void {\n onChangeMany(assetIds)\n onOpenChange(false)\n}\n\n/**\n * The picker props a field's value position needs, derived from the field alone\n * (EC-570 #1 → EC-588): the selected id, the field's structured `accept`, whether it\n * holds many, and the commits — a pick through the carry rule (EC-558), a settled\n * upload batch appended for a `many` field (EC-460).\n */\nexport interface AssetPickerBinding {\n value: string | null\n accept?: readonly string[]\n multiple: boolean\n onChange: (assetId: string | null) => void\n onChangeMany?: (assetIds: string[]) => void\n}\n\n/**\n * ONE picker configuration for every surface that edits an asset field — the detail\n * editor and the table cell — so the two cannot drift. Before, the cell opened the\n * picker with no `accept`, no `multiple` and no batch commit: its grid offered PDFs to\n * an image field and an N-file upload attached one (EC-570 #1). `write` receives the\n * next stored value; the caller decides how to land it (form state, cell commit).\n */\nexport function assetPickerBinding(\n field: Pick<AssetFieldDef, 'multiple' | 'accept' | 'fields'>,\n value: unknown,\n write: (next: unknown) => void,\n): AssetPickerBinding {\n const multiple = field.multiple\n return {\n value: multiple ? null : singleAssetIdOf(value),\n ...(field.accept ? { accept: field.accept } : {}),\n multiple,\n onChange: (picked) => write(applyAssetSelection(value, picked, multiple)),\n ...(multiple ? { onChangeMany: (picked: string[]) => write(appendAssetSelections(value, picked)) } : {}),\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { Button, Dialog, DialogContent, DialogDescription, DialogHeader, DialogT
|
|
|
7
7
|
import { cn } from '../../lib/utils.js';
|
|
8
8
|
import { translate } from '../../lib/i18n/index.js';
|
|
9
9
|
import { AssetThumb } from '../assets/asset-thumb.js';
|
|
10
|
+
import { useAssetReadLocale } from '../assets/asset-locale.js';
|
|
10
11
|
import { AssetsProvider, useAssets, useOptionalAssets } from '../assets/assets-store.js';
|
|
11
12
|
import { useCollectionView } from '../collection-view/collection-view-context.js';
|
|
12
13
|
import { ASSET_PICKER_STAGE_PRESET, commitPickerSelection, batchAttachment, commitPickerSelectionMany, splitByAccept, uploadBatchProgress, visiblePickerAssets, } from './asset-picker-core.js';
|
|
@@ -84,7 +85,9 @@ export function AssetPickerBrowser({ store, value, onOpenChange, onChange, onCha
|
|
|
84
85
|
// child boundaries — the same per-element dragenter/dragleave flicker the field
|
|
85
86
|
// fixes. Only hide when the count returns to zero.
|
|
86
87
|
const dragDepth = useRef(0);
|
|
87
|
-
|
|
88
|
+
// EC-659: the search reads the alts the picker shows — through the studio's asset lens.
|
|
89
|
+
const searchLocale = useAssetReadLocale();
|
|
90
|
+
const assets = visiblePickerAssets(store.assets, query, accept, searchLocale);
|
|
88
91
|
// Auto-select what an in-picker upload added, then close. A `many` consumer
|
|
89
92
|
// (multiple + onChangeMany) waits for the batch to SETTLE and commits every
|
|
90
93
|
// added id — uploading 2 files attaches 2 (EC-460); a single consumer keeps
|
|
@@ -170,6 +173,7 @@ export function AssetRejectedNotice({ rejected, accept, }) {
|
|
|
170
173
|
/** One selectable asset: EC-400 thumb tile + title/filename + alt text. The
|
|
171
174
|
* internal asset id is intentionally not shown — it's noise to editors (EC-301). */
|
|
172
175
|
function AssetPickerCard({ asset, selected, onPick, }) {
|
|
173
|
-
|
|
176
|
+
const alt = assetAlt(asset, useAssetReadLocale());
|
|
177
|
+
return (_jsxs("button", { type: "button", onClick: onPick, className: cn('flex flex-col gap-1.5 rounded-lg border p-2 text-left transition-colors', selected ? 'border-primary bg-primary/5' : 'border-border hover:bg-muted'), "data-testid": "asset-picker-card", "aria-pressed": selected, children: [_jsxs("span", { className: "relative block", children: [_jsx(AssetThumb, { record: asset, className: "aspect-video w-full" }), selected ? (_jsx("span", { className: "absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-primary text-primary-foreground shadow", children: _jsx(Check, { className: "size-3" }) })) : null] }), _jsx(Text, { size: "xs", className: "min-w-0 truncate font-medium", children: asset.title ?? asset.filename }), _jsx(Text, { size: "xs", tone: alt ? 'muted' : 'subtle', className: "truncate", children: alt || translate('cms.asset.noAltText') })] }));
|
|
174
178
|
}
|
|
175
179
|
//# sourceMappingURL=asset-picker.js.map
|