@conloca/cms-spa 0.2.1 → 0.2.3
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/README.md +26 -0
- package/dist/spa/main.css +240 -4
- package/dist/ts/.build-inputs.json +178 -0
- package/dist/ts/App.d.ts +10 -2
- package/dist/ts/App.d.ts.map +1 -1
- package/dist/ts/App.js +20 -8
- package/dist/ts/App.js.map +1 -1
- package/dist/ts/CmsSpaApp.d.ts.map +1 -1
- package/dist/ts/CmsSpaApp.js +4 -1
- package/dist/ts/CmsSpaApp.js.map +1 -1
- package/dist/ts/components/CMSDashboard.d.ts.map +1 -1
- package/dist/ts/components/CMSDashboard.js +6 -2
- package/dist/ts/components/CMSDashboard.js.map +1 -1
- package/dist/ts/components/RouteErrorPage.d.ts +11 -0
- package/dist/ts/components/RouteErrorPage.d.ts.map +1 -0
- package/dist/ts/components/RouteErrorPage.js +44 -0
- package/dist/ts/components/RouteErrorPage.js.map +1 -0
- package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -1
- package/dist/ts/components/dashboard/RecentActivity.js +2 -8
- package/dist/ts/components/dashboard/RecentActivity.js.map +1 -1
- package/dist/ts/components/dialogs/CreateDataDialog.js +2 -2
- package/dist/ts/components/dialogs/CreateDataDialog.js.map +1 -1
- package/dist/ts/components/dialogs/CreateFolderDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/CreateFolderDialog.js +2 -1
- package/dist/ts/components/dialogs/CreateFolderDialog.js.map +1 -1
- package/dist/ts/components/dialogs/CreatePageFlow.d.ts +13 -0
- package/dist/ts/components/dialogs/CreatePageFlow.d.ts.map +1 -0
- package/dist/ts/components/dialogs/CreatePageFlow.js +100 -0
- package/dist/ts/components/dialogs/CreatePageFlow.js.map +1 -0
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.js +2 -2
- package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +2 -2
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +2 -12
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/PageMetadataDialog.js +3 -21
- package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.js +46 -55
- package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
- package/dist/ts/components/editor/DrawerItemOverride.d.ts +2 -0
- package/dist/ts/components/editor/DrawerItemOverride.d.ts.map +1 -1
- package/dist/ts/components/editor/DrawerItemOverride.js +4 -3
- package/dist/ts/components/editor/DrawerItemOverride.js.map +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts +6 -7
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.js +124 -34
- package/dist/ts/components/editor/PageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.js +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.js +48 -12
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
- package/dist/ts/components/editor/draft-media-config.d.ts +22 -0
- package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -0
- package/dist/ts/components/editor/draft-media-config.js +186 -0
- package/dist/ts/components/editor/draft-media-config.js.map +1 -0
- package/dist/ts/components/editor/preview-availability.d.ts +6 -5
- package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.js +6 -5
- package/dist/ts/components/editor/preview-availability.js.map +1 -1
- package/dist/ts/components/editors/DataEditor.d.ts +2 -2
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
- package/dist/ts/components/forms/HintForm.js +8 -5
- package/dist/ts/components/forms/HintForm.js.map +1 -1
- package/dist/ts/components/forms/SchemaForm.d.ts +17 -5
- package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -1
- package/dist/ts/components/forms/SchemaForm.js +16 -9
- package/dist/ts/components/forms/SchemaForm.js.map +1 -1
- package/dist/ts/components/media/AssetCard.d.ts.map +1 -1
- package/dist/ts/components/media/AssetCard.js +3 -2
- package/dist/ts/components/media/AssetCard.js.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.js +4 -2
- package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
- package/dist/ts/components/media/FolderTreeSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/FolderTreeSidebar.js +4 -1
- package/dist/ts/components/media/FolderTreeSidebar.js.map +1 -1
- package/dist/ts/components/pages/PageList.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.js +13 -99
- package/dist/ts/components/pages/PageList.js.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.js +36 -5
- package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -1
- package/dist/ts/content-form-fields.d.ts +41 -0
- package/dist/ts/content-form-fields.d.ts.map +1 -0
- package/dist/ts/content-form-fields.js +70 -0
- package/dist/ts/content-form-fields.js.map +1 -0
- package/dist/ts/content-wrapper.d.ts +65 -0
- package/dist/ts/content-wrapper.d.ts.map +1 -0
- package/dist/ts/content-wrapper.js +190 -0
- package/dist/ts/content-wrapper.js.map +1 -0
- package/dist/ts/data-schemas.d.ts +4 -3
- package/dist/ts/data-schemas.d.ts.map +1 -1
- package/dist/ts/data-schemas.js.map +1 -1
- package/dist/ts/frame/channel.d.ts +40 -0
- package/dist/ts/frame/channel.d.ts.map +1 -0
- package/dist/ts/frame/channel.js +233 -0
- package/dist/ts/frame/channel.js.map +1 -0
- package/dist/ts/frame/editor-frame.d.ts +23 -0
- package/dist/ts/frame/editor-frame.d.ts.map +1 -0
- package/dist/ts/frame/editor-frame.js +154 -0
- package/dist/ts/frame/editor-frame.js.map +1 -0
- package/dist/ts/frame/media-cache.d.ts +26 -0
- package/dist/ts/frame/media-cache.d.ts.map +1 -0
- package/dist/ts/frame/media-cache.js +123 -0
- package/dist/ts/frame/media-cache.js.map +1 -0
- package/dist/ts/frame/memory-router.d.ts +10 -0
- package/dist/ts/frame/memory-router.d.ts.map +1 -0
- package/dist/ts/frame/memory-router.js +39 -0
- package/dist/ts/frame/memory-router.js.map +1 -0
- package/dist/ts/frame/parent-hello.d.ts +11 -0
- package/dist/ts/frame/parent-hello.d.ts.map +1 -0
- package/dist/ts/frame/parent-hello.js +53 -0
- package/dist/ts/frame/parent-hello.js.map +1 -0
- package/dist/ts/frame/protocol.d.ts +201 -0
- package/dist/ts/frame/protocol.d.ts.map +1 -0
- package/dist/ts/frame/protocol.js +195 -0
- package/dist/ts/frame/protocol.js.map +1 -0
- package/dist/ts/frame/rpc-content-client.d.ts +10 -0
- package/dist/ts/frame/rpc-content-client.d.ts.map +1 -0
- package/dist/ts/frame/rpc-content-client.js +51 -0
- package/dist/ts/frame/rpc-content-client.js.map +1 -0
- package/dist/ts/frame/save-shortcut.d.ts +8 -0
- package/dist/ts/frame/save-shortcut.d.ts.map +1 -0
- package/dist/ts/frame/save-shortcut.js +26 -0
- package/dist/ts/frame/save-shortcut.js.map +1 -0
- package/dist/ts/host-schema.d.ts +73 -0
- package/dist/ts/host-schema.d.ts.map +1 -0
- package/dist/ts/host-schema.js +66 -0
- package/dist/ts/host-schema.js.map +1 -0
- package/dist/ts/host-style-probe.d.ts +32 -37
- package/dist/ts/host-style-probe.d.ts.map +1 -1
- package/dist/ts/host-style-probe.js +102 -68
- package/dist/ts/host-style-probe.js.map +1 -1
- package/dist/ts/index.d.ts +4 -2
- package/dist/ts/index.d.ts.map +1 -1
- package/dist/ts/index.js +6 -2
- package/dist/ts/index.js.map +1 -1
- package/dist/ts/main-spa.d.ts.map +1 -1
- package/dist/ts/main-spa.js +2 -1
- package/dist/ts/main-spa.js.map +1 -1
- package/dist/ts/page-schema-define.d.ts +14 -12
- package/dist/ts/page-schema-define.d.ts.map +1 -1
- package/dist/ts/page-schema-define.js +8 -5
- package/dist/ts/page-schema-define.js.map +1 -1
- package/dist/ts/prose-surface-css.d.ts +3 -5
- package/dist/ts/prose-surface-css.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.js +3 -5
- package/dist/ts/prose-surface-css.js.map +1 -1
- package/dist/ts/site-styles.d.ts +4 -21
- package/dist/ts/site-styles.d.ts.map +1 -1
- package/dist/ts/site-styles.js.map +1 -1
- package/dist/ts/ui-config.d.ts +52 -1
- package/dist/ts/ui-config.d.ts.map +1 -1
- package/dist/ts/ui-config.js +4 -0
- package/dist/ts/ui-config.js.map +1 -1
- package/dist/ts/utils/asset-url.d.ts +2 -0
- package/dist/ts/utils/asset-url.d.ts.map +1 -1
- package/dist/ts/utils/asset-url.js +7 -0
- package/dist/ts/utils/asset-url.js.map +1 -1
- package/dist/ts/utils/pageMetadata.d.ts.map +1 -1
- package/dist/ts/utils/pageMetadata.js +27 -10
- package/dist/ts/utils/pageMetadata.js.map +1 -1
- package/dist/ts/utils/schema-fields.d.ts +23 -0
- package/dist/ts/utils/schema-fields.d.ts.map +1 -0
- package/dist/ts/utils/schema-fields.js +82 -0
- package/dist/ts/utils/schema-fields.js.map +1 -0
- package/package.json +56 -18
- package/src/App.tsx +35 -14
- package/src/CmsSpaApp.tsx +5 -1
- package/src/components/CMSDashboard.tsx +12 -4
- package/src/components/RouteErrorPage.tsx +75 -0
- package/src/components/dashboard/RecentActivity.tsx +3 -7
- package/src/components/dialogs/CreateDataDialog.tsx +2 -2
- package/src/components/dialogs/CreateFolderDialog.tsx +2 -1
- package/src/components/dialogs/CreatePageFlow.tsx +117 -0
- package/src/components/dialogs/DataPropertiesDialog.tsx +3 -2
- package/src/components/dialogs/FragmentPropertiesDialog.tsx +3 -2
- package/src/components/dialogs/PageMetadataDialog.tsx +5 -28
- package/src/components/editor/CMSMDXEditor.tsx +49 -69
- package/src/components/editor/DrawerItemOverride.tsx +14 -8
- package/src/components/editor/PageEditor.tsx +135 -36
- package/src/components/editor/PageEditorHeaderActions.tsx +1 -1
- package/src/components/editor/PageEditorWrapper.tsx +51 -12
- package/src/components/editor/draft-media-config.ts +197 -0
- package/src/components/editor/preview-availability.ts +6 -5
- package/src/components/editors/DataEditor.tsx +2 -2
- package/src/components/forms/HintForm.tsx +7 -5
- package/src/components/forms/SchemaForm.tsx +41 -12
- package/src/components/media/AssetCard.tsx +10 -7
- package/src/components/media/AssetDetailSidebar.tsx +6 -6
- package/src/components/media/FolderTreeSidebar.tsx +3 -1
- package/src/components/pages/PageList.tsx +17 -119
- package/src/components/sandbox/ContentSandbox.tsx +34 -5
- package/src/content-form-fields.ts +79 -0
- package/src/content-wrapper.ts +284 -0
- package/src/data-schemas.ts +4 -3
- package/src/frame/channel.ts +258 -0
- package/src/frame/editor-frame.ts +180 -0
- package/src/frame/media-cache.ts +144 -0
- package/src/frame/memory-router.ts +39 -0
- package/src/frame/parent-hello.ts +62 -0
- package/src/frame/protocol.ts +323 -0
- package/src/frame/rpc-content-client.ts +58 -0
- package/src/frame/save-shortcut.ts +25 -0
- package/src/host-schema.ts +122 -0
- package/src/host-style-probe.ts +120 -90
- package/src/index.ts +7 -2
- package/src/main-spa.tsx +2 -0
- package/src/main.css +12 -8
- package/src/page-schema-define.ts +29 -17
- package/src/prose-surface-css.ts +3 -5
- package/src/site-styles.ts +4 -22
- package/src/ui-config.ts +54 -1
- package/src/utils/asset-url.ts +8 -0
- package/src/utils/pageMetadata.ts +27 -10
- package/src/utils/schema-fields.ts +106 -0
- package/dist/ts/host-discovery.d.ts +0 -40
- package/dist/ts/host-discovery.d.ts.map +0 -1
- package/dist/ts/host-discovery.js +0 -39
- package/dist/ts/host-discovery.js.map +0 -1
- package/dist/ts/utils/zodIntrospect.d.ts +0 -19
- package/dist/ts/utils/zodIntrospect.d.ts.map +0 -1
- package/dist/ts/utils/zodIntrospect.js +0 -95
- package/dist/ts/utils/zodIntrospect.js.map +0 -1
- package/src/host-discovery.ts +0 -77
- package/src/utils/zodIntrospect.ts +0 -136
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { Loader2 } from 'lucide-react';
|
|
2
2
|
import { useId } from 'react';
|
|
3
|
-
import type
|
|
4
|
-
import { toDatetimeLocalValue } from '../../utils/pageMetadata.js';
|
|
5
|
-
import { type FieldInfo,
|
|
3
|
+
import { type HostSchema, isHostSchema } from '../../host-schema.js';
|
|
4
|
+
import { fromDatetimeLocalValue, toDatetimeLocalValue } from '../../utils/pageMetadata.js';
|
|
5
|
+
import { type FieldInfo, type FormFields, fieldsOfHostSchema } from '../../utils/schema-fields.js';
|
|
6
6
|
import { ImageFieldRender } from '../fields/ImageField.js';
|
|
7
7
|
import { Input, Select, Textarea } from '../ui/index.js';
|
|
8
8
|
import { ChipArrayField } from './ChipArrayField.js';
|
|
9
9
|
|
|
10
10
|
interface SchemaFormProps {
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A host-declared schema, rendered from its generated JSON Schema metadata.
|
|
13
|
+
* This is the dynamic path: a site's `pageSchemas`/`dataSchemas` entry exists
|
|
14
|
+
* only at runtime, so its field shape is read off the metadata it carries.
|
|
15
|
+
*/
|
|
16
|
+
schema?: HostSchema | null;
|
|
17
|
+
/**
|
|
18
|
+
* An already-resolved field record — how the CMS's own metadata sections are
|
|
19
|
+
* declared now that they are no longer schema objects (`content-form-fields`).
|
|
20
|
+
* Takes precedence over `schema` when both are given.
|
|
21
|
+
*/
|
|
22
|
+
fields?: FormFields | null;
|
|
12
23
|
values: Record<string, unknown>;
|
|
13
24
|
onChange: (values: Record<string, unknown>) => void;
|
|
14
25
|
isLoading?: boolean;
|
|
@@ -16,10 +27,10 @@ interface SchemaFormProps {
|
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
/**
|
|
19
|
-
* Renders a form
|
|
20
|
-
* Fields are rendered automatically based on
|
|
30
|
+
* Renders a form from a host schema or a field record.
|
|
31
|
+
* Fields are rendered automatically based on their {@link FieldInfo}.
|
|
21
32
|
*/
|
|
22
|
-
export function SchemaForm({ schema, values, onChange, isLoading, className }: SchemaFormProps) {
|
|
33
|
+
export function SchemaForm({ schema, fields, values, onChange, isLoading, className }: SchemaFormProps) {
|
|
23
34
|
const handleFieldChange = (field: string, value: unknown) => {
|
|
24
35
|
onChange({ ...values, [field]: value });
|
|
25
36
|
};
|
|
@@ -32,7 +43,25 @@ export function SchemaForm({ schema, values, onChange, isLoading, className }: S
|
|
|
32
43
|
);
|
|
33
44
|
}
|
|
34
45
|
|
|
35
|
-
if (!schema) {
|
|
46
|
+
if (!fields && schema && !isHostSchema(schema)) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
role="alert"
|
|
50
|
+
data-testid="schema-form-outdated-schema"
|
|
51
|
+
className="text-center py-8 text-grey-04 dark:text-grey-07"
|
|
52
|
+
>
|
|
53
|
+
<p className="mb-2 font-medium text-grey-01 dark:text-grey-12">This form cannot be shown.</p>
|
|
54
|
+
<p>
|
|
55
|
+
This schema is out of date: it is not a generated host schema. Ask whoever maintains the site to declare it
|
|
56
|
+
with defineHostSchema and Typia, then rebuild the site.
|
|
57
|
+
</p>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const resolvedFields = fields ?? (schema ? fieldsOfHostSchema(schema) : null);
|
|
63
|
+
|
|
64
|
+
if (!resolvedFields) {
|
|
36
65
|
return (
|
|
37
66
|
<div className="text-center py-8 text-grey-04 dark:text-grey-07">
|
|
38
67
|
<p>No schema defined.</p>
|
|
@@ -40,12 +69,10 @@ export function SchemaForm({ schema, values, onChange, isLoading, className }: S
|
|
|
40
69
|
);
|
|
41
70
|
}
|
|
42
71
|
|
|
43
|
-
const fields = getZodShape(schema);
|
|
44
|
-
|
|
45
72
|
return (
|
|
46
73
|
<div className={className}>
|
|
47
74
|
<div className="space-y-6">
|
|
48
|
-
{Object.entries(
|
|
75
|
+
{Object.entries(resolvedFields).map(([fieldName, fieldInfo]) => (
|
|
49
76
|
// Names the field, so a dialog can open at it (see PageMetadataDialog's focusField).
|
|
50
77
|
<div key={fieldName} data-field-name={fieldName}>
|
|
51
78
|
<SchemaField
|
|
@@ -86,7 +113,9 @@ function SchemaField({ name, fieldInfo, value, onChange }: SchemaFieldProps) {
|
|
|
86
113
|
id={inputId}
|
|
87
114
|
type="datetime-local"
|
|
88
115
|
value={formatDateValue(value)}
|
|
89
|
-
|
|
116
|
+
// The input's wall-clock digits carry no zone or seconds; a host's `Format<'date-time'>`
|
|
117
|
+
// validator needs a full timestamp, so the value saved is the instant those digits name.
|
|
118
|
+
onChange={(e) => onChange(fromDatetimeLocalValue(e.target.value)?.toISOString())}
|
|
90
119
|
/>
|
|
91
120
|
{description && <p className="mt-1 text-sm text-grey-04 dark:text-grey-07">{description}</p>}
|
|
92
121
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { useAssetServeSrc } from '../../frame/media-cache.js';
|
|
1
2
|
import type { AssetEntry } from '../../hooks/index.js';
|
|
2
3
|
import { AssetScopePill } from '../../media/AssetScopePill.js';
|
|
3
4
|
import { MediaIssueBadge } from '../../media/MediaIssueBadge.js';
|
|
4
5
|
import { useAssetScope } from '../../media/use-asset-scope.js';
|
|
5
6
|
import { useMediaIssue } from '../../media/use-media-issue.js';
|
|
6
|
-
import { buildAssetServeUrl } from '../../utils/asset-url.js';
|
|
7
7
|
import { cn } from '../../utils/cn.js';
|
|
8
8
|
|
|
9
9
|
interface AssetCardProps {
|
|
@@ -33,6 +33,7 @@ export function AssetCard({
|
|
|
33
33
|
// reports. Returns null when the host has no opinion — surfaces
|
|
34
34
|
// degrade exactly like the scope pill in standalone mounts.
|
|
35
35
|
const issue = useMediaIssue(asset.filename, asset.folder);
|
|
36
|
+
const src = useAssetServeSrc(assetsBasePath, asset.folder, asset.filename);
|
|
36
37
|
|
|
37
38
|
const handleClick = () => {
|
|
38
39
|
onClick?.();
|
|
@@ -55,12 +56,14 @@ export function AssetCard({
|
|
|
55
56
|
>
|
|
56
57
|
{/* Thumbnail */}
|
|
57
58
|
<div className="relative aspect-square bg-grey-11 dark:bg-grey-03 flex items-center justify-center overflow-hidden">
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
{src ? (
|
|
60
|
+
<img
|
|
61
|
+
src={src}
|
|
62
|
+
alt={asset.alt || asset.originalName}
|
|
63
|
+
className="w-full h-full object-contain"
|
|
64
|
+
loading="lazy"
|
|
65
|
+
/>
|
|
66
|
+
) : null}
|
|
64
67
|
{/* Scope pill — renders only when a host bridge supplied a
|
|
65
68
|
non-null scope. Top-left corner so it sits above the
|
|
66
69
|
asset's own visual focus point without clipping the
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { formatFileSize } from '@conloca/content-api-client';
|
|
2
2
|
import { FolderInput, Loader2, Trash2, X } from 'lucide-react';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
+
import { useAssetServeSrc } from '../../frame/media-cache.js';
|
|
4
5
|
import type { AssetEntry } from '../../hooks/index.js';
|
|
5
6
|
import { useAssetUsage, useDeleteAsset, useMoveAssets, useUpdateAssetMetadata } from '../../hooks/index.js';
|
|
6
7
|
import { AssetScopePill } from '../../media/AssetScopePill.js';
|
|
7
8
|
import { MediaIssueBadge } from '../../media/MediaIssueBadge.js';
|
|
8
9
|
import { useAssetScope } from '../../media/use-asset-scope.js';
|
|
9
10
|
import { useMediaIssue } from '../../media/use-media-issue.js';
|
|
10
|
-
import { buildAssetPath
|
|
11
|
+
import { buildAssetPath } from '../../utils/asset-url.js';
|
|
11
12
|
import { MoveFolderDialog } from '../dialogs/index.js';
|
|
12
13
|
import { Button, IconButton, Input } from '../ui/index.js';
|
|
13
14
|
|
|
@@ -55,6 +56,7 @@ export function AssetDetailSidebar({
|
|
|
55
56
|
// Returns null when the host has no opinion or the asset is
|
|
56
57
|
// healthy; the badge collapses to nothing in either case.
|
|
57
58
|
const issue = useMediaIssue(asset.filename, asset.folder);
|
|
59
|
+
const src = useAssetServeSrc(assetsBasePath, asset.folder, asset.filename);
|
|
58
60
|
// Folder + filename is the asset identity used by metadata, usage and delete routes.
|
|
59
61
|
const path = useMemo(() => buildAssetPath(asset.folder, asset.filename), [asset.folder, asset.filename]);
|
|
60
62
|
|
|
@@ -177,11 +179,9 @@ export function AssetDetailSidebar({
|
|
|
177
179
|
<div className="flex-1 overflow-y-auto">
|
|
178
180
|
{/* Thumbnail preview */}
|
|
179
181
|
<div className="aspect-square bg-subtle flex items-center justify-center overflow-hidden border-b border-line">
|
|
180
|
-
|
|
181
|
-
src={
|
|
182
|
-
|
|
183
|
-
className="max-w-full max-h-full object-contain"
|
|
184
|
-
/>
|
|
182
|
+
{src ? (
|
|
183
|
+
<img src={src} alt={asset.alt || asset.originalName} className="max-w-full max-h-full object-contain" />
|
|
184
|
+
) : null}
|
|
185
185
|
</div>
|
|
186
186
|
|
|
187
187
|
{/* File info (read-only) */}
|
|
@@ -99,7 +99,9 @@ export function FolderTreeSidebar({ currentFolder, onFolderSelect, dropTargetFol
|
|
|
99
99
|
<button
|
|
100
100
|
type="button"
|
|
101
101
|
onClick={() => {
|
|
102
|
-
|
|
102
|
+
// Resetting an in-flight mutation detaches its success callback, so a reopened
|
|
103
|
+
// dialog would stay open with Create enabled after the folder was made.
|
|
104
|
+
if (!createFolder.isPending) createFolder.reset();
|
|
103
105
|
setShowCreateFolderDialog(true);
|
|
104
106
|
}}
|
|
105
107
|
className="p-1.5 rounded-md hover:bg-grey-11 dark:hover:bg-grey-03 transition-colors"
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
APIClientError,
|
|
3
|
-
isContentPublished,
|
|
4
|
-
localesOf,
|
|
5
|
-
useCreateContent,
|
|
6
|
-
useDeleteContent,
|
|
7
|
-
useSitePages,
|
|
8
|
-
} from '@conloca/content-api-client';
|
|
1
|
+
import { localesOf, pageStatusOf, useDeleteContent, useSitePages } from '@conloca/content-api-client';
|
|
9
2
|
import { AlertCircle, Clock, Edit, FileCode, FileText, Loader2, Plus, Search, Trash2 } from 'lucide-react';
|
|
10
3
|
import { useMemo, useState } from 'react';
|
|
11
4
|
import { useNavigate } from 'react-router-dom';
|
|
12
5
|
import { useErrorModal, useSiteBaseUrl } from '../../hooks/index.js';
|
|
13
|
-
import type {
|
|
6
|
+
import type { Page } from '../../types.js';
|
|
14
7
|
import { getUIConfig } from '../../ui-config.js';
|
|
15
8
|
import { contentFailureMessage, isStaleWrite } from '../../utils/content-failure.js';
|
|
16
9
|
import { formatDate } from '../../utils/format-date.js';
|
|
17
|
-
import {
|
|
10
|
+
import { CreatePageFlow } from '../dialogs/CreatePageFlow.js';
|
|
18
11
|
import { DeleteConfirmDialog } from '../dialogs/DeleteConfirmDialog.js';
|
|
19
12
|
import { ErrorModal } from '../dialogs/ErrorModal.js';
|
|
20
13
|
import { Tooltip } from '../ui/Tooltip.js';
|
|
@@ -44,12 +37,18 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
44
37
|
const { buildUrl } = useSiteBaseUrl();
|
|
45
38
|
|
|
46
39
|
const navigate = useNavigate();
|
|
47
|
-
const createContent = useCreateContent();
|
|
48
40
|
const deleteContent = useDeleteContent();
|
|
49
41
|
|
|
50
|
-
const
|
|
42
|
+
const openLiveSite = (pagePath: string) => {
|
|
43
|
+
const openSiteUrl = getUIConfig().openSiteUrl;
|
|
44
|
+
if (openSiteUrl) {
|
|
45
|
+
void openSiteUrl({ path: pagePath }).catch((error: unknown) =>
|
|
46
|
+
console.error('[PageList] openSiteUrl failed:', error),
|
|
47
|
+
);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
51
50
|
const previewUrl = buildUrl(pagePath);
|
|
52
|
-
|
|
51
|
+
window.open(`${previewUrl}${previewUrl.includes('?') ? '&' : '?'}_t=${Date.now()}`, '_blank');
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
// Use provided site or default
|
|
@@ -83,7 +82,7 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
83
82
|
title: firstLocale.meta.title || entry.id,
|
|
84
83
|
path: firstLocale.pathname || '/',
|
|
85
84
|
type: entry.type === 'mdx' ? 'mdx' : 'puck',
|
|
86
|
-
status:
|
|
85
|
+
status: pageStatusOf(entry),
|
|
87
86
|
modified: new Date(firstLocale.modified),
|
|
88
87
|
locales: Array.from(localesOf(entry)).map((v) => v.locale),
|
|
89
88
|
etags: {},
|
|
@@ -94,7 +93,6 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
94
93
|
|
|
95
94
|
const page = pageMap.get(entry.id)!;
|
|
96
95
|
|
|
97
|
-
// Update status based on publish dates
|
|
98
96
|
for (const localeData of localesOf(entry)) {
|
|
99
97
|
// Store etag for each locale
|
|
100
98
|
page.etags[localeData.locale] = localeData.etag;
|
|
@@ -102,16 +100,6 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
102
100
|
page.localeTitles[localeData.locale] = localeData.meta.title || entry.id;
|
|
103
101
|
// Store path for each locale
|
|
104
102
|
page.localePaths[localeData.locale] = localeData.pathname || '/';
|
|
105
|
-
|
|
106
|
-
const now = new Date();
|
|
107
|
-
const publishAt = localeData.publishAt ? new Date(localeData.publishAt) : null;
|
|
108
|
-
|
|
109
|
-
if (publishAt && publishAt > now) {
|
|
110
|
-
page.status = 'scheduled';
|
|
111
|
-
} else if (!isContentPublished(localeData, now)) {
|
|
112
|
-
page.status = 'draft';
|
|
113
|
-
}
|
|
114
|
-
|
|
115
103
|
// Update modified date to the most recent
|
|
116
104
|
const modifiedDate = new Date(localeData.modified);
|
|
117
105
|
if (modifiedDate > page.modified) {
|
|
@@ -213,91 +201,6 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
213
201
|
setShowCreateDialog(true);
|
|
214
202
|
};
|
|
215
203
|
|
|
216
|
-
const createTemplateContent = (componentName: string) => [
|
|
217
|
-
{
|
|
218
|
-
type: componentName,
|
|
219
|
-
props: {
|
|
220
|
-
id: `${componentName}-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
];
|
|
224
|
-
|
|
225
|
-
const handleCreatePage = async (data: CreatePageData) => {
|
|
226
|
-
try {
|
|
227
|
-
const config = getUIConfig();
|
|
228
|
-
const templateConfig = config.templates?.[data.template];
|
|
229
|
-
|
|
230
|
-
// Shared metadata. Description is only added when MDX picked it
|
|
231
|
-
// up — Puck pages don't render it today, so the manifest stays
|
|
232
|
-
// clean for them.
|
|
233
|
-
const meta: { title: string; description?: string } = { title: data.title };
|
|
234
|
-
if (data.format === 'mdx' && data.description) {
|
|
235
|
-
meta.description = data.description;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Build a type-specific content payload. MDX pages send an empty
|
|
239
|
-
// body — the editor opens to a blank canvas. Puck pages keep the
|
|
240
|
-
// existing template-driven payload.
|
|
241
|
-
const templateContent =
|
|
242
|
-
data.format !== 'mdx' && templateConfig?.component ? createTemplateContent(templateConfig.component) : [];
|
|
243
|
-
const result = await (data.format === 'mdx'
|
|
244
|
-
? createContent.mutateAsync({
|
|
245
|
-
kind: 'page',
|
|
246
|
-
site: currentSite,
|
|
247
|
-
collection: 'pages',
|
|
248
|
-
type: 'mdx',
|
|
249
|
-
meta,
|
|
250
|
-
locales: {
|
|
251
|
-
[data.locale]: {
|
|
252
|
-
meta,
|
|
253
|
-
pathname: data.path,
|
|
254
|
-
// Empty body — backend stamps id/created/modified into
|
|
255
|
-
// frontmatter automatically (see
|
|
256
|
-
// filesystem-content-api.ts createContent, type === 'mdx'
|
|
257
|
-
// branch).
|
|
258
|
-
content: { mdx: '' },
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
})
|
|
262
|
-
: createContent.mutateAsync({
|
|
263
|
-
kind: 'page',
|
|
264
|
-
site: currentSite,
|
|
265
|
-
collection: 'pages',
|
|
266
|
-
type: 'puck',
|
|
267
|
-
meta,
|
|
268
|
-
locales: {
|
|
269
|
-
[data.locale]: {
|
|
270
|
-
meta,
|
|
271
|
-
pathname: data.path,
|
|
272
|
-
content: {
|
|
273
|
-
puckData: {
|
|
274
|
-
root: {},
|
|
275
|
-
content: templateContent,
|
|
276
|
-
zones: {},
|
|
277
|
-
},
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
}));
|
|
282
|
-
|
|
283
|
-
if (result.success && result.id) {
|
|
284
|
-
// Navigate to the new page editor with the actual ID.
|
|
285
|
-
// PageEditorWrapper dispatches by content.type so MDX pages
|
|
286
|
-
// land on MdxPageEditor and Puck pages on the Puck canvas.
|
|
287
|
-
navigate(`/pages/${result.id}`);
|
|
288
|
-
} else {
|
|
289
|
-
// The dialog has already closed, so this is the author's only answer:
|
|
290
|
-
// say why (a path taken since the check), not just "try again".
|
|
291
|
-
showError(contentFailureMessage(result, 'Failed to create page. Please try again.'), result.error);
|
|
292
|
-
}
|
|
293
|
-
} catch (error) {
|
|
294
|
-
console.error('Failed to create page:', error);
|
|
295
|
-
// The content-API router answers a refusal, such as a path another page took since the check,
|
|
296
|
-
// with an error status, which the client throws: say why, as for a refusal the result carries.
|
|
297
|
-
showError(error instanceof APIClientError ? error.message : 'Failed to create page. Please try again.', error);
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
|
|
301
204
|
const handleEditPage = (pageId: string) => {
|
|
302
205
|
// Navigate with the actual content ID
|
|
303
206
|
navigate(`/pages/${pageId}`);
|
|
@@ -503,7 +406,7 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
503
406
|
data-testid={`page-title-${page.id}`}
|
|
504
407
|
onClick={(e) => {
|
|
505
408
|
e.preventDefault();
|
|
506
|
-
|
|
409
|
+
openLiveSite(page.path);
|
|
507
410
|
}}
|
|
508
411
|
>
|
|
509
412
|
{page.title}
|
|
@@ -534,7 +437,7 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
534
437
|
className="text-grey-04 dark:text-grey-07 hover:text-azure-04 dark:hover:text-azure-06 hover:underline transition-colors font-mono text-xs"
|
|
535
438
|
onClick={(e) => {
|
|
536
439
|
e.preventDefault();
|
|
537
|
-
|
|
440
|
+
openLiveSite(page.path);
|
|
538
441
|
}}
|
|
539
442
|
>
|
|
540
443
|
{page.path}
|
|
@@ -651,13 +554,8 @@ export function PageList({ selectedSite, selectedLocale: initialLocale }: PageLi
|
|
|
651
554
|
</div>
|
|
652
555
|
)}
|
|
653
556
|
|
|
654
|
-
{/* Create Page
|
|
655
|
-
<
|
|
656
|
-
open={showCreateDialog}
|
|
657
|
-
onOpenChange={setShowCreateDialog}
|
|
658
|
-
onCreatePage={handleCreatePage}
|
|
659
|
-
site={currentSite}
|
|
660
|
-
/>
|
|
557
|
+
{/* Create Page Flow: the dialog plus its own create-error modal */}
|
|
558
|
+
<CreatePageFlow open={showCreateDialog} onOpenChange={setShowCreateDialog} site={currentSite} />
|
|
661
559
|
|
|
662
560
|
{/* Delete Confirmation Dialog */}
|
|
663
561
|
<DeleteConfirmDialog
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import cn from 'clsx';
|
|
2
2
|
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { getUIConfig } from '../../ui-config.js';
|
|
4
|
+
import { draftImageData } from '../editor/draft-media-config.js';
|
|
3
5
|
import { SANDBOX_FRAME_PATH, type SandboxOutboundMessage } from './frame-runtime.js';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -22,10 +24,31 @@ function ensureSandboxHeightBus(win: Window): void {
|
|
|
22
24
|
if (!data.k || !(data.px > 0)) return;
|
|
23
25
|
const doc = win.document;
|
|
24
26
|
const el = doc.querySelector(`iframe[data-sandbox-k="${data.k}"]`) as HTMLIFrameElement | null;
|
|
25
|
-
if (el) el.style.height = `${Math.ceil(data.px)}px`;
|
|
27
|
+
if (el && event.source === el.contentWindow) el.style.height = `${Math.ceil(data.px)}px`;
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Data URLs of the draft images in `code`, which the opaque-origin frame cannot fetch from the site or read as
|
|
33
|
+
* this page's blob URLs; `null` while they load (bounded by `draftImageData`), `undefined` when `code` is `undefined`.
|
|
34
|
+
*/
|
|
35
|
+
function useDraftImageData(code: string | undefined): Record<string, string> | null | undefined {
|
|
36
|
+
const [loaded, setLoaded] = useState<{ code: string; images: Record<string, string> }>();
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let live = true;
|
|
39
|
+
if (code !== undefined) {
|
|
40
|
+
void draftImageData(code).then((images) => {
|
|
41
|
+
if (live) setLoaded({ code, images });
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return () => {
|
|
45
|
+
live = false;
|
|
46
|
+
};
|
|
47
|
+
}, [code]);
|
|
48
|
+
if (code === undefined) return undefined;
|
|
49
|
+
return loaded?.code === code ? loaded.images : null;
|
|
50
|
+
}
|
|
51
|
+
|
|
29
52
|
export interface ContentSandboxProps {
|
|
30
53
|
/** `mdx` delivers a compiled MDX function body; `html` a sanitized HTML string. */
|
|
31
54
|
mode: 'mdx' | 'html';
|
|
@@ -69,7 +92,7 @@ export function ContentSandbox({
|
|
|
69
92
|
const iframeRef = useRef<HTMLIFrameElement | null>(null);
|
|
70
93
|
const reactId = useId().replace(/:/g, '');
|
|
71
94
|
const frameKeyRef = useRef(`sf_${reactId}_${Math.random().toString(36).slice(2, 10)}`);
|
|
72
|
-
const frameSrc = `${SANDBOX_FRAME_PATH}?k=${encodeURIComponent(frameKeyRef.current)}`;
|
|
95
|
+
const frameSrc = `${getUIConfig().sandboxFramePath ?? SANDBOX_FRAME_PATH}?k=${encodeURIComponent(frameKeyRef.current)}`;
|
|
73
96
|
|
|
74
97
|
const modeRef = useRef(mode);
|
|
75
98
|
const contentRef = useRef(content);
|
|
@@ -77,13 +100,16 @@ export function ContentSandbox({
|
|
|
77
100
|
modeRef.current = mode;
|
|
78
101
|
contentRef.current = content;
|
|
79
102
|
stylesRef.current = styles;
|
|
103
|
+
const images = useDraftImageData(mode === 'mdx' && getUIConfig().loadMedia ? content : undefined);
|
|
104
|
+
const imagesRef = useRef(images);
|
|
105
|
+
imagesRef.current = images;
|
|
80
106
|
|
|
81
107
|
const [height, setHeight] = useState(0);
|
|
82
108
|
const [ready, setReady] = useState(false);
|
|
83
109
|
const readyRef = useRef(false);
|
|
84
110
|
|
|
85
111
|
const deliver = useCallback(() => {
|
|
86
|
-
if (!readyRef.current) return;
|
|
112
|
+
if (!readyRef.current || imagesRef.current === null) return;
|
|
87
113
|
const payload = contentRef.current;
|
|
88
114
|
iframeRef.current?.contentWindow?.postMessage(
|
|
89
115
|
{
|
|
@@ -92,6 +118,7 @@ export function ContentSandbox({
|
|
|
92
118
|
mode: modeRef.current,
|
|
93
119
|
payload,
|
|
94
120
|
styles: stylesRef.current,
|
|
121
|
+
...(imagesRef.current ? { images: imagesRef.current } : {}),
|
|
95
122
|
},
|
|
96
123
|
'*',
|
|
97
124
|
);
|
|
@@ -114,6 +141,8 @@ export function ContentSandbox({
|
|
|
114
141
|
const data = event.data as SandboxOutboundMessage | undefined;
|
|
115
142
|
if (data?.__conlocaSandbox !== true) return;
|
|
116
143
|
if (data.k !== frameKey) return;
|
|
144
|
+
// The key is readable by anything that saw the frame URL; the source is not forgeable.
|
|
145
|
+
if (event.source === null || event.source !== iframeRef.current?.contentWindow) return;
|
|
117
146
|
switch (data.kind) {
|
|
118
147
|
case 'ready':
|
|
119
148
|
markReady();
|
|
@@ -160,11 +189,11 @@ export function ContentSandbox({
|
|
|
160
189
|
};
|
|
161
190
|
}, [ready, deliver]);
|
|
162
191
|
|
|
163
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: Mode, content, and
|
|
192
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: Mode, content, styles and images are delivery events; deliver reads their current values from refs to keep message listeners stable.
|
|
164
193
|
useEffect(() => {
|
|
165
194
|
if (!ready) return;
|
|
166
195
|
deliver();
|
|
167
|
-
}, [ready, mode, content, styles, deliver]);
|
|
196
|
+
}, [ready, mode, content, styles, images, deliver]);
|
|
168
197
|
|
|
169
198
|
return (
|
|
170
199
|
<iframe
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { FieldInfo, FormFields } from './utils/schema-fields.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Form definitions for the metadata the CMS itself owns.
|
|
5
|
+
*
|
|
6
|
+
* These were Zod objects built only so a Zod introspector could read a
|
|
7
|
+
* {@link FormFields} record back out of them — the schemas were never parsed
|
|
8
|
+
* with. They are the records directly now; validation of the same metadata is
|
|
9
|
+
* the generated validators in `@conloca/content-api/schemas`.
|
|
10
|
+
*
|
|
11
|
+
* Every entry below is pinned as a literal table in
|
|
12
|
+
* `test/content-form-fields.test.ts`, which also checks each field's
|
|
13
|
+
* type/optional/nullable against the Typia-generated metadata of the matching
|
|
14
|
+
* content-api type. Each record keeps its literal keys (`satisfies`), so a
|
|
15
|
+
* dialog can prove at compile time which fields it renders.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const requiredString = (description: string): FieldInfo => ({
|
|
19
|
+
type: 'string',
|
|
20
|
+
description,
|
|
21
|
+
isOptional: false,
|
|
22
|
+
isNullable: false,
|
|
23
|
+
});
|
|
24
|
+
const optionalString = (description: string): FieldInfo => ({
|
|
25
|
+
type: 'string',
|
|
26
|
+
description,
|
|
27
|
+
isOptional: true,
|
|
28
|
+
isNullable: false,
|
|
29
|
+
});
|
|
30
|
+
const optionalStringArray = (description: string): FieldInfo => ({
|
|
31
|
+
type: 'array',
|
|
32
|
+
description,
|
|
33
|
+
isOptional: true,
|
|
34
|
+
isNullable: false,
|
|
35
|
+
});
|
|
36
|
+
const optionalNullableDate = (description: string): FieldInfo => ({
|
|
37
|
+
type: 'date',
|
|
38
|
+
format: 'date-time',
|
|
39
|
+
description,
|
|
40
|
+
isOptional: true,
|
|
41
|
+
isNullable: true,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** Pathname — the page-settings core section in every mode (the dialog renders the title itself). */
|
|
45
|
+
export const pathnameOnlyFields = {
|
|
46
|
+
pathname: requiredString('URL path (e.g., /about)'),
|
|
47
|
+
} satisfies FormFields;
|
|
48
|
+
|
|
49
|
+
/** Publishing window only — the page-settings trailing section in `minimal` mode. */
|
|
50
|
+
export const publishWindowFields = {
|
|
51
|
+
publishAt: optionalNullableDate(
|
|
52
|
+
'When the page goes live. Page lists that sort by date use this date, or the date the page was created when it is empty.',
|
|
53
|
+
),
|
|
54
|
+
unpublishAt: optionalNullableDate('Schedule unpublish date/time'),
|
|
55
|
+
} satisfies FormFields;
|
|
56
|
+
|
|
57
|
+
/** SEO + publishing window — the page-settings trailing section in `full` mode. */
|
|
58
|
+
export const seoPublishingFields = {
|
|
59
|
+
description: optionalString('Meta description for search engines'),
|
|
60
|
+
robots: optionalString('Robots meta tag (e.g., index, follow)'),
|
|
61
|
+
canonical: { ...optionalString('Canonical URL for duplicate content'), format: 'url' },
|
|
62
|
+
...publishWindowFields,
|
|
63
|
+
} satisfies FormFields;
|
|
64
|
+
|
|
65
|
+
/** Editable fragment metadata — replaces `fragmentEditableSchema`. */
|
|
66
|
+
export const fragmentEditableFields = {
|
|
67
|
+
title: requiredString('Display name for the fragment'),
|
|
68
|
+
description: optionalString('Brief description of this fragment'),
|
|
69
|
+
category: optionalString('Category for organizing fragments (e.g., headers, cta, content)'),
|
|
70
|
+
tags: optionalStringArray('Tags for filtering and organization'),
|
|
71
|
+
} satisfies FormFields;
|
|
72
|
+
|
|
73
|
+
/** Editable data-entry metadata — replaces `dataEditableSchema`. */
|
|
74
|
+
export const dataEditableFields = {
|
|
75
|
+
title: requiredString('Display name for the entry'),
|
|
76
|
+
description: optionalString('Brief description of this entry'),
|
|
77
|
+
category: optionalString('Category for organizing entries'),
|
|
78
|
+
tags: optionalStringArray('Tags for filtering and organization'),
|
|
79
|
+
} satisfies FormFields;
|