@conloca/cms-spa 0.2.6 → 0.3.0
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/dist/spa/main.css +262 -21
- package/dist/ts/.build-inputs.json +99 -57
- package/dist/ts/CmsSpaApp.d.ts +4 -6
- package/dist/ts/CmsSpaApp.d.ts.map +1 -1
- package/dist/ts/CmsSpaApp.js +19 -8
- package/dist/ts/CmsSpaApp.js.map +1 -1
- package/dist/ts/components/conflicts/EditorNoticeStrip.d.ts +44 -0
- package/dist/ts/components/conflicts/EditorNoticeStrip.d.ts.map +1 -0
- package/dist/ts/components/conflicts/EditorNoticeStrip.js +55 -0
- package/dist/ts/components/conflicts/EditorNoticeStrip.js.map +1 -0
- package/dist/ts/components/conflicts/FieldConflictList.d.ts +20 -0
- package/dist/ts/components/conflicts/FieldConflictList.d.ts.map +1 -0
- package/dist/ts/components/conflicts/FieldConflictList.js +14 -0
- package/dist/ts/components/conflicts/FieldConflictList.js.map +1 -0
- package/dist/ts/components/conflicts/FieldConflictPicker.d.ts +28 -0
- package/dist/ts/components/conflicts/FieldConflictPicker.d.ts.map +1 -0
- package/dist/ts/components/conflicts/FieldConflictPicker.js +52 -0
- package/dist/ts/components/conflicts/FieldConflictPicker.js.map +1 -0
- package/dist/ts/components/conflicts/OverwriteNotice.d.ts +11 -0
- package/dist/ts/components/conflicts/OverwriteNotice.d.ts.map +1 -0
- package/dist/ts/components/conflicts/OverwriteNotice.js +8 -0
- package/dist/ts/components/conflicts/OverwriteNotice.js.map +1 -0
- package/dist/ts/components/conflicts/PageDraftMenu.d.ts +11 -0
- package/dist/ts/components/conflicts/PageDraftMenu.d.ts.map +1 -0
- package/dist/ts/components/conflicts/PageDraftMenu.js +20 -0
- package/dist/ts/components/conflicts/PageDraftMenu.js.map +1 -0
- package/dist/ts/components/conflicts/PeerAvatars.d.ts +9 -0
- package/dist/ts/components/conflicts/PeerAvatars.d.ts.map +1 -0
- package/dist/ts/components/conflicts/PeerAvatars.js +29 -0
- package/dist/ts/components/conflicts/PeerAvatars.js.map +1 -0
- package/dist/ts/components/conflicts/PuckConflicts.d.ts +13 -0
- package/dist/ts/components/conflicts/PuckConflicts.d.ts.map +1 -0
- package/dist/ts/components/conflicts/PuckConflicts.js +59 -0
- package/dist/ts/components/conflicts/PuckConflicts.js.map +1 -0
- package/dist/ts/components/conflicts/RecentVersionsDialog.d.ts +15 -0
- package/dist/ts/components/conflicts/RecentVersionsDialog.d.ts.map +1 -0
- package/dist/ts/components/conflicts/RecentVersionsDialog.js +94 -0
- package/dist/ts/components/conflicts/RecentVersionsDialog.js.map +1 -0
- package/dist/ts/components/conflicts/conflict-label.d.ts +12 -0
- package/dist/ts/components/conflicts/conflict-label.d.ts.map +1 -0
- package/dist/ts/components/conflicts/conflict-label.js +120 -0
- package/dist/ts/components/conflicts/conflict-label.js.map +1 -0
- package/dist/ts/components/conflicts/use-page-conflicts.d.ts +26 -0
- package/dist/ts/components/conflicts/use-page-conflicts.d.ts.map +1 -0
- package/dist/ts/components/conflicts/use-page-conflicts.js +93 -0
- package/dist/ts/components/conflicts/use-page-conflicts.js.map +1 -0
- package/dist/ts/components/conflicts/version-copy.d.ts +7 -0
- package/dist/ts/components/conflicts/version-copy.d.ts.map +1 -0
- package/dist/ts/components/conflicts/version-copy.js +31 -0
- package/dist/ts/components/conflicts/version-copy.js.map +1 -0
- package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -1
- package/dist/ts/components/dashboard/RecentActivity.js +2 -1
- package/dist/ts/components/dashboard/RecentActivity.js.map +1 -1
- package/dist/ts/components/dialogs/CreatePageDialog.js +1 -1
- package/dist/ts/components/dialogs/CreatePageDialog.js.map +1 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +2 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DataPropertiesDialog.js +15 -3
- package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +2 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +16 -3
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +9 -2
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/PageMetadataDialog.js +63 -16
- package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -1
- package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts +16 -1
- package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/UnsavedChangesDialog.js +90 -2
- package/dist/ts/components/dialogs/UnsavedChangesDialog.js.map +1 -1
- package/dist/ts/components/dialogs/unsaved-guard.d.ts +9 -0
- package/dist/ts/components/dialogs/unsaved-guard.d.ts.map +1 -0
- package/dist/ts/components/dialogs/unsaved-guard.js +14 -0
- package/dist/ts/components/dialogs/unsaved-guard.js.map +1 -0
- package/dist/ts/components/editor/CMSMDXEditor.d.ts +6 -1
- package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.js +32 -15
- package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
- package/dist/ts/components/editor/EditorFrame.d.ts +22 -0
- package/dist/ts/components/editor/EditorFrame.d.ts.map +1 -0
- package/dist/ts/components/editor/EditorFrame.js +72 -0
- package/dist/ts/components/editor/EditorFrame.js.map +1 -0
- package/dist/ts/components/editor/FragmentBlockTypeSelect.d.ts +10 -0
- package/dist/ts/components/editor/FragmentBlockTypeSelect.d.ts.map +1 -0
- package/dist/ts/components/editor/FragmentBlockTypeSelect.js +187 -0
- package/dist/ts/components/editor/FragmentBlockTypeSelect.js.map +1 -0
- package/dist/ts/components/editor/FragmentComponentBlock.d.ts +7 -0
- package/dist/ts/components/editor/FragmentComponentBlock.d.ts.map +1 -0
- package/dist/ts/components/editor/FragmentComponentBlock.js +180 -0
- package/dist/ts/components/editor/FragmentComponentBlock.js.map +1 -0
- package/dist/ts/components/editor/FragmentEditor.d.ts +3 -1
- package/dist/ts/components/editor/FragmentEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/FragmentEditor.js +545 -130
- package/dist/ts/components/editor/FragmentEditor.js.map +1 -1
- package/dist/ts/components/editor/FragmentEditorHeaderActions.d.ts +20 -0
- package/dist/ts/components/editor/FragmentEditorHeaderActions.d.ts.map +1 -0
- package/dist/ts/components/editor/FragmentEditorHeaderActions.js +49 -0
- package/dist/ts/components/editor/FragmentEditorHeaderActions.js.map +1 -0
- package/dist/ts/components/editor/GenericBlock.d.ts.map +1 -1
- package/dist/ts/components/editor/GenericBlock.js +109 -12
- package/dist/ts/components/editor/GenericBlock.js.map +1 -1
- package/dist/ts/components/editor/InlinePreviewFrame.d.ts +19 -0
- package/dist/ts/components/editor/InlinePreviewFrame.d.ts.map +1 -0
- package/dist/ts/components/editor/InlinePreviewFrame.js +65 -0
- package/dist/ts/components/editor/InlinePreviewFrame.js.map +1 -0
- package/dist/ts/components/editor/JsxPropsPanel.d.ts.map +1 -1
- package/dist/ts/components/editor/JsxPropsPanel.js +62 -2
- package/dist/ts/components/editor/JsxPropsPanel.js.map +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts +2 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -1
- package/dist/ts/components/editor/LocaleSelector.js +2 -2
- package/dist/ts/components/editor/LocaleSelector.js.map +1 -1
- package/dist/ts/components/editor/MDXLivePreview.d.ts +2 -0
- package/dist/ts/components/editor/MDXLivePreview.d.ts.map +1 -1
- package/dist/ts/components/editor/MDXLivePreview.js +30 -38
- package/dist/ts/components/editor/MDXLivePreview.js.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.d.ts +7 -2
- package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.js +136 -10
- package/dist/ts/components/editor/MdxPageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts +4 -1
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.js +78 -100
- package/dist/ts/components/editor/PageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +15 -4
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.js +13 -7
- package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.d.ts +8 -2
- package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.js +99 -41
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
- package/dist/ts/components/editor/body-sync-plugin.d.ts +2 -0
- package/dist/ts/components/editor/body-sync-plugin.d.ts.map +1 -0
- package/dist/ts/components/editor/body-sync-plugin.js +32 -0
- package/dist/ts/components/editor/body-sync-plugin.js.map +1 -0
- package/dist/ts/components/editor/draft-media-config.d.ts +6 -0
- package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -1
- package/dist/ts/components/editor/draft-media-config.js +21 -0
- package/dist/ts/components/editor/draft-media-config.js.map +1 -1
- package/dist/ts/components/editor/fragment-save-check.d.ts +7 -0
- package/dist/ts/components/editor/fragment-save-check.d.ts.map +1 -0
- package/dist/ts/components/editor/fragment-save-check.js +13 -0
- package/dist/ts/components/editor/fragment-save-check.js.map +1 -0
- package/dist/ts/components/editor/fragment-save-lifetime.d.ts +18 -0
- package/dist/ts/components/editor/fragment-save-lifetime.d.ts.map +1 -0
- package/dist/ts/components/editor/fragment-save-lifetime.js +115 -0
- package/dist/ts/components/editor/fragment-save-lifetime.js.map +1 -0
- package/dist/ts/components/editor/host-wrapper-plugin.d.ts.map +1 -1
- package/dist/ts/components/editor/host-wrapper-plugin.js +20 -7
- package/dist/ts/components/editor/host-wrapper-plugin.js.map +1 -1
- package/dist/ts/components/editor/index.d.ts +0 -1
- package/dist/ts/components/editor/index.d.ts.map +1 -1
- package/dist/ts/components/editor/index.js +0 -1
- package/dist/ts/components/editor/index.js.map +1 -1
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -1
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js +6 -11
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js.map +1 -1
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -1
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js +66 -12
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js.map +1 -1
- package/dist/ts/components/editor/insert-menu/insert-payload.d.ts +16 -21
- package/dist/ts/components/editor/insert-menu/insert-payload.d.ts.map +1 -1
- package/dist/ts/components/editor/insert-menu/insert-payload.js +75 -22
- package/dist/ts/components/editor/insert-menu/insert-payload.js.map +1 -1
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts +3 -1
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -1
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js +5 -3
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js.map +1 -1
- package/dist/ts/components/editor/jsx-layout-plugin.d.ts +25 -0
- package/dist/ts/components/editor/jsx-layout-plugin.d.ts.map +1 -0
- package/dist/ts/components/editor/jsx-layout-plugin.js +77 -0
- package/dist/ts/components/editor/jsx-layout-plugin.js.map +1 -0
- package/dist/ts/components/editor/offered-mdx-components.d.ts +11 -0
- package/dist/ts/components/editor/offered-mdx-components.d.ts.map +1 -0
- package/dist/ts/components/editor/offered-mdx-components.js +27 -0
- package/dist/ts/components/editor/offered-mdx-components.js.map +1 -0
- package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -1
- package/dist/ts/components/editor/page-setting-targets.js +2 -1
- package/dist/ts/components/editor/page-setting-targets.js.map +1 -1
- package/dist/ts/components/editor/preview-availability.d.ts +16 -1
- package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.js +16 -1
- package/dist/ts/components/editor/preview-availability.js.map +1 -1
- package/dist/ts/components/editor/prop-field-hint.d.ts +13 -0
- package/dist/ts/components/editor/prop-field-hint.d.ts.map +1 -0
- package/dist/ts/components/editor/prop-field-hint.js +70 -0
- package/dist/ts/components/editor/prop-field-hint.js.map +1 -0
- package/dist/ts/components/editor/soft-break-plugin.d.ts +21 -0
- package/dist/ts/components/editor/soft-break-plugin.d.ts.map +1 -0
- package/dist/ts/components/editor/soft-break-plugin.js +52 -0
- package/dist/ts/components/editor/soft-break-plugin.js.map +1 -0
- package/dist/ts/components/editor/use-live-page-settings.d.ts +13 -0
- package/dist/ts/components/editor/use-live-page-settings.d.ts.map +1 -0
- package/dist/ts/components/editor/use-live-page-settings.js +76 -0
- package/dist/ts/components/editor/use-live-page-settings.js.map +1 -0
- package/dist/ts/components/editor/usePagePreview.d.ts +32 -0
- package/dist/ts/components/editor/usePagePreview.d.ts.map +1 -0
- package/dist/ts/components/editor/usePagePreview.js +252 -0
- package/dist/ts/components/editor/usePagePreview.js.map +1 -0
- package/dist/ts/components/editors/DataEditor.d.ts +6 -3
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
- package/dist/ts/components/editors/DataEditor.js +153 -19
- package/dist/ts/components/editors/DataEditor.js.map +1 -1
- package/dist/ts/components/fields/MDXEditField.d.ts +1 -1
- package/dist/ts/components/fields/MDXEditField.js +2 -2
- package/dist/ts/components/fields/MDXEditField.js.map +1 -1
- package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -1
- package/dist/ts/components/forms/SchemaForm.js +1 -9
- package/dist/ts/components/forms/SchemaForm.js.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.js +43 -5
- package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
- package/dist/ts/components/pages/DataList.d.ts.map +1 -1
- package/dist/ts/components/pages/DataList.js +16 -4
- package/dist/ts/components/pages/DataList.js.map +1 -1
- package/dist/ts/components/pages/FragmentList.d.ts.map +1 -1
- package/dist/ts/components/pages/FragmentList.js +10 -0
- package/dist/ts/components/pages/FragmentList.js.map +1 -1
- package/dist/ts/components/pages/PageList.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.js +54 -118
- package/dist/ts/components/pages/PageList.js.map +1 -1
- package/dist/ts/components/pages/PageRow.d.ts +21 -0
- package/dist/ts/components/pages/PageRow.d.ts.map +1 -0
- package/dist/ts/components/pages/PageRow.js +70 -0
- package/dist/ts/components/pages/PageRow.js.map +1 -0
- package/dist/ts/components/pages/PageTable.d.ts +21 -0
- package/dist/ts/components/pages/PageTable.d.ts.map +1 -0
- package/dist/ts/components/pages/PageTable.js +12 -0
- package/dist/ts/components/pages/PageTable.js.map +1 -0
- package/dist/ts/components/pages/page-list-model.d.ts +20 -0
- package/dist/ts/components/pages/page-list-model.d.ts.map +1 -0
- package/dist/ts/components/pages/page-list-model.js +78 -0
- package/dist/ts/components/pages/page-list-model.js.map +1 -0
- package/dist/ts/components/puck/MDXContent.d.ts +3 -3
- package/dist/ts/components/puck/MDXContent.d.ts.map +1 -1
- package/dist/ts/components/puck/MDXContent.js +24 -72
- package/dist/ts/components/puck/MDXContent.js.map +1 -1
- package/dist/ts/components/puck/csp-frame-harness.d.ts +14 -0
- package/dist/ts/components/puck/csp-frame-harness.d.ts.map +1 -0
- package/dist/ts/components/puck/csp-frame-harness.js +85 -0
- package/dist/ts/components/puck/csp-frame-harness.js.map +1 -0
- package/dist/ts/components/puck/use-fragment-render.d.ts +9 -0
- package/dist/ts/components/puck/use-fragment-render.d.ts.map +1 -0
- package/dist/ts/components/puck/use-fragment-render.js +70 -0
- package/dist/ts/components/puck/use-fragment-render.js.map +1 -0
- package/dist/ts/components/sandbox/ContentSandbox.d.ts +3 -5
- package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.js +6 -8
- package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -1
- package/dist/ts/components/sandbox/frame-runtime.d.ts +1 -1
- package/dist/ts/components/sandbox/frame-runtime.d.ts.map +1 -1
- package/dist/ts/components/sandbox/frame-runtime.js +1 -1
- package/dist/ts/components/sandbox/frame-runtime.js.map +1 -1
- package/dist/ts/components/toast.d.ts +8 -4
- package/dist/ts/components/toast.d.ts.map +1 -1
- package/dist/ts/components/toast.js +6 -1
- package/dist/ts/components/toast.js.map +1 -1
- package/dist/ts/components/ui/Card.d.ts +3 -5
- package/dist/ts/components/ui/Card.d.ts.map +1 -1
- package/dist/ts/components/ui/Card.js +3 -5
- package/dist/ts/components/ui/Card.js.map +1 -1
- package/dist/ts/components/ui/Select.d.ts.map +1 -1
- package/dist/ts/components/ui/Select.js +12 -3
- package/dist/ts/components/ui/Select.js.map +1 -1
- package/dist/ts/draft-tools.d.ts +76 -0
- package/dist/ts/draft-tools.d.ts.map +1 -0
- package/dist/ts/draft-tools.js +2 -0
- package/dist/ts/draft-tools.js.map +1 -0
- package/dist/ts/frame/channel.d.ts +1 -1
- package/dist/ts/frame/channel.d.ts.map +1 -1
- package/dist/ts/frame/channel.js +3 -0
- package/dist/ts/frame/channel.js.map +1 -1
- package/dist/ts/frame/editor-frame.d.ts.map +1 -1
- package/dist/ts/frame/editor-frame.js +188 -30
- package/dist/ts/frame/editor-frame.js.map +1 -1
- package/dist/ts/frame/protocol.d.ts +73 -4
- package/dist/ts/frame/protocol.d.ts.map +1 -1
- package/dist/ts/frame/protocol.js +54 -16
- package/dist/ts/frame/protocol.js.map +1 -1
- package/dist/ts/hooks/useUnsavedChangesGuard.d.ts +5 -3
- package/dist/ts/hooks/useUnsavedChangesGuard.d.ts.map +1 -1
- package/dist/ts/hooks/useUnsavedChangesGuard.js +17 -7
- package/dist/ts/hooks/useUnsavedChangesGuard.js.map +1 -1
- package/dist/ts/host-style-probe.d.ts.map +1 -1
- package/dist/ts/host-style-probe.js +160 -40
- package/dist/ts/host-style-probe.js.map +1 -1
- package/dist/ts/index.d.ts +13 -0
- package/dist/ts/index.d.ts.map +1 -1
- package/dist/ts/index.js +14 -0
- package/dist/ts/index.js.map +1 -1
- package/dist/ts/live/data-binding.d.ts +67 -0
- package/dist/ts/live/data-binding.d.ts.map +1 -0
- package/dist/ts/live/data-binding.js +215 -0
- package/dist/ts/live/data-binding.js.map +1 -0
- package/dist/ts/live/doc-channel.d.ts +74 -0
- package/dist/ts/live/doc-channel.d.ts.map +1 -0
- package/dist/ts/live/doc-channel.js +293 -0
- package/dist/ts/live/doc-channel.js.map +1 -0
- package/dist/ts/live/held-fragment-edits.d.ts +15 -0
- package/dist/ts/live/held-fragment-edits.d.ts.map +1 -0
- package/dist/ts/live/held-fragment-edits.js +47 -0
- package/dist/ts/live/held-fragment-edits.js.map +1 -0
- package/dist/ts/live/markdown-binding.d.ts +54 -0
- package/dist/ts/live/markdown-binding.d.ts.map +1 -0
- package/dist/ts/live/markdown-binding.js +618 -0
- package/dist/ts/live/markdown-binding.js.map +1 -0
- package/dist/ts/live/markdown-live-plugin.d.ts +42 -0
- package/dist/ts/live/markdown-live-plugin.d.ts.map +1 -0
- package/dist/ts/live/markdown-live-plugin.js +918 -0
- package/dist/ts/live/markdown-live-plugin.js.map +1 -0
- package/dist/ts/live/messages.d.ts +142 -0
- package/dist/ts/live/messages.d.ts.map +1 -0
- package/dist/ts/live/messages.js +266 -0
- package/dist/ts/live/messages.js.map +1 -0
- package/dist/ts/live/puck-binding.d.ts +88 -0
- package/dist/ts/live/puck-binding.d.ts.map +1 -0
- package/dist/ts/live/puck-binding.js +467 -0
- package/dist/ts/live/puck-binding.js.map +1 -0
- package/dist/ts/live/undo.d.ts +29 -0
- package/dist/ts/live/undo.d.ts.map +1 -0
- package/dist/ts/live/undo.js +104 -0
- package/dist/ts/live/undo.js.map +1 -0
- package/dist/ts/live/use-live.d.ts +77 -0
- package/dist/ts/live/use-live.d.ts.map +1 -0
- package/dist/ts/live/use-live.js +207 -0
- package/dist/ts/live/use-live.js.map +1 -0
- package/dist/ts/mdx-components-define.d.ts +52 -15
- package/dist/ts/mdx-components-define.d.ts.map +1 -1
- package/dist/ts/mdx-components-define.js +136 -0
- package/dist/ts/mdx-components-define.js.map +1 -1
- package/dist/ts/mdx-components.d.ts +11 -19
- package/dist/ts/mdx-components.d.ts.map +1 -1
- package/dist/ts/mdx-components.js +23 -32
- package/dist/ts/mdx-components.js.map +1 -1
- package/dist/ts/media/AssetScopePill.d.ts.map +1 -1
- package/dist/ts/media/AssetScopePill.js +2 -1
- package/dist/ts/media/AssetScopePill.js.map +1 -1
- package/dist/ts/merge-default-props.d.ts.map +1 -1
- package/dist/ts/merge-default-props.js +3 -0
- package/dist/ts/merge-default-props.js.map +1 -1
- package/dist/ts/selected-block.d.ts +27 -2
- package/dist/ts/selected-block.d.ts.map +1 -1
- package/dist/ts/selected-block.js +43 -1
- package/dist/ts/selected-block.js.map +1 -1
- package/dist/ts/site-render.d.ts +60 -0
- package/dist/ts/site-render.d.ts.map +1 -0
- package/dist/ts/site-render.js +87 -0
- package/dist/ts/site-render.js.map +1 -0
- package/dist/ts/types.d.ts +3 -0
- package/dist/ts/types.d.ts.map +1 -1
- package/dist/ts/ui-config.d.ts +29 -13
- package/dist/ts/ui-config.d.ts.map +1 -1
- package/dist/ts/ui-config.js +14 -3
- package/dist/ts/ui-config.js.map +1 -1
- package/dist/ts/utils/apply-clash.d.ts +44 -0
- package/dist/ts/utils/apply-clash.d.ts.map +1 -0
- package/dist/ts/utils/apply-clash.js +102 -0
- package/dist/ts/utils/apply-clash.js.map +1 -0
- package/dist/ts/utils/mdast-tree.d.ts +5 -7
- package/dist/ts/utils/mdast-tree.d.ts.map +1 -1
- package/dist/ts/utils/mdast-tree.js +8 -13
- package/dist/ts/utils/mdast-tree.js.map +1 -1
- package/dist/ts/utils/pageMetadata.d.ts +6 -2
- package/dist/ts/utils/pageMetadata.d.ts.map +1 -1
- package/dist/ts/utils/pageMetadata.js +25 -7
- package/dist/ts/utils/pageMetadata.js.map +1 -1
- package/dist/ts/utils/schema-fields.d.ts +2 -0
- package/dist/ts/utils/schema-fields.d.ts.map +1 -1
- package/dist/ts/utils/schema-fields.js +8 -0
- package/dist/ts/utils/schema-fields.js.map +1 -1
- package/dist/ts/write-access.d.ts +2 -0
- package/dist/ts/write-access.d.ts.map +1 -1
- package/dist/ts/write-access.js +9 -4
- package/dist/ts/write-access.js.map +1 -1
- package/package.json +18 -7
- package/src/CmsSpaApp.tsx +20 -11
- package/src/components/conflicts/EditorNoticeStrip.tsx +135 -0
- package/src/components/conflicts/FieldConflictList.tsx +59 -0
- package/src/components/conflicts/FieldConflictPicker.tsx +158 -0
- package/src/components/conflicts/OverwriteNotice.tsx +30 -0
- package/src/components/conflicts/PageDraftMenu.tsx +51 -0
- package/src/components/conflicts/PeerAvatars.tsx +51 -0
- package/src/components/conflicts/PuckConflicts.tsx +92 -0
- package/src/components/conflicts/RecentVersionsDialog.tsx +154 -0
- package/src/components/conflicts/conflict-label.ts +124 -0
- package/src/components/conflicts/use-page-conflicts.ts +112 -0
- package/src/components/conflicts/version-copy.ts +33 -0
- package/src/components/dashboard/RecentActivity.tsx +3 -2
- package/src/components/dialogs/CreatePageDialog.tsx +1 -1
- package/src/components/dialogs/DataPropertiesDialog.tsx +22 -4
- package/src/components/dialogs/FragmentPropertiesDialog.tsx +23 -4
- package/src/components/dialogs/PageMetadataDialog.tsx +157 -65
- package/src/components/dialogs/UnsavedChangesDialog.tsx +171 -21
- package/src/components/dialogs/unsaved-guard.ts +15 -0
- package/src/components/editor/CMSMDXEditor.tsx +238 -198
- package/src/components/editor/EditorFrame.tsx +116 -0
- package/src/components/editor/FragmentBlockTypeSelect.tsx +245 -0
- package/src/components/editor/FragmentComponentBlock.tsx +257 -0
- package/src/components/editor/FragmentEditor.tsx +899 -213
- package/src/components/editor/FragmentEditorHeaderActions.tsx +77 -0
- package/src/components/editor/GenericBlock.tsx +127 -16
- package/src/components/editor/InlinePreviewFrame.tsx +78 -0
- package/src/components/editor/JsxPropsPanel.tsx +90 -6
- package/src/components/editor/LocaleSelector.tsx +4 -2
- package/src/components/editor/MDXLivePreview.tsx +44 -46
- package/src/components/editor/MdxPageEditor.tsx +247 -7
- package/src/components/editor/PageEditor.tsx +154 -121
- package/src/components/editor/PageEditorHeaderActions.tsx +65 -27
- package/src/components/editor/PageEditorWrapper.tsx +122 -45
- package/src/components/editor/body-sync-plugin.ts +44 -0
- package/src/components/editor/draft-media-config.ts +22 -0
- package/src/components/editor/fragment-save-check.ts +26 -0
- package/src/components/editor/fragment-save-lifetime.ts +142 -0
- package/src/components/editor/host-wrapper-plugin.ts +28 -7
- package/src/components/editor/index.ts +0 -1
- package/src/components/editor/insert-menu/InsertMdxComponentButton.tsx +7 -11
- package/src/components/editor/insert-menu/SlashMenuPlugin.tsx +95 -18
- package/src/components/editor/insert-menu/insert-payload.ts +79 -30
- package/src/components/editor/insert-menu/mdx-components-plugin.ts +5 -3
- package/src/components/editor/jsx-layout-plugin.ts +103 -0
- package/src/components/editor/offered-mdx-components.ts +35 -0
- package/src/components/editor/page-setting-targets.tsx +2 -0
- package/src/components/editor/preview-availability.ts +21 -1
- package/src/components/editor/prop-field-hint.ts +75 -0
- package/src/components/editor/soft-break-plugin.ts +55 -0
- package/src/components/editor/use-live-page-settings.ts +80 -0
- package/src/components/editor/usePagePreview.ts +291 -0
- package/src/components/editors/DataEditor.tsx +257 -22
- package/src/components/fields/MDXEditField.tsx +2 -2
- package/src/components/forms/SchemaForm.tsx +1 -10
- package/src/components/media/AssetDetailSidebar.tsx +47 -6
- package/src/components/pages/DataList.tsx +14 -4
- package/src/components/pages/FragmentList.tsx +8 -0
- package/src/components/pages/PageList.tsx +90 -337
- package/src/components/pages/PageRow.tsx +290 -0
- package/src/components/pages/PageTable.tsx +71 -0
- package/src/components/pages/page-list-model.ts +98 -0
- package/src/components/puck/MDXContent.tsx +37 -113
- package/src/components/puck/csp-frame-harness.tsx +99 -0
- package/src/components/puck/use-fragment-render.ts +82 -0
- package/src/components/sandbox/ContentSandbox.tsx +6 -11
- package/src/components/sandbox/frame-runtime.ts +0 -2
- package/src/components/toast.tsx +23 -5
- package/src/components/ui/Card.tsx +3 -5
- package/src/components/ui/Select.tsx +14 -6
- package/src/draft-tools.ts +77 -0
- package/src/frame/channel.ts +3 -1
- package/src/frame/editor-frame.ts +210 -30
- package/src/frame/protocol.ts +98 -15
- package/src/hooks/useUnsavedChangesGuard.ts +17 -6
- package/src/host-style-probe.ts +157 -37
- package/src/index.ts +90 -0
- package/src/live/data-binding.ts +252 -0
- package/src/live/doc-channel.ts +343 -0
- package/src/live/held-fragment-edits.ts +47 -0
- package/src/live/markdown-binding.ts +630 -0
- package/src/live/markdown-live-plugin.tsx +1037 -0
- package/src/live/messages.ts +370 -0
- package/src/live/puck-binding.tsx +579 -0
- package/src/live/undo.ts +112 -0
- package/src/live/use-live.ts +264 -0
- package/src/main.css +184 -4
- package/src/mdx-components-define.ts +170 -24
- package/src/mdx-components.ts +29 -30
- package/src/media/AssetScopePill.tsx +2 -1
- package/src/merge-default-props.ts +4 -0
- package/src/selected-block.ts +55 -3
- package/src/site-render.ts +146 -0
- package/src/types.ts +3 -0
- package/src/ui-config.ts +51 -15
- package/src/utils/apply-clash.ts +113 -0
- package/src/utils/mdast-tree.ts +8 -12
- package/src/utils/pageMetadata.ts +25 -7
- package/src/utils/schema-fields.ts +9 -0
- package/src/write-access.ts +10 -4
- package/styles/tailwind-theme.css +11 -0
- package/dist/ts/components/editor/ContentDiff.d.ts +0 -10
- package/dist/ts/components/editor/ContentDiff.d.ts.map +0 -1
- package/dist/ts/components/editor/ContentDiff.js +0 -52
- package/dist/ts/components/editor/ContentDiff.js.map +0 -1
- package/src/components/editor/ContentDiff.tsx +0 -251
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* `mdx-components.ts`, which re-exports everything here for compatibility.
|
|
7
7
|
* Mirrors the `page-schemas` / `page-schema-define` split.
|
|
8
8
|
*/
|
|
9
|
+
import { type FragmentOutlineProps, type JsonValue, outlineIdFor } from '@conloca/mdx/render';
|
|
9
10
|
import type { JsxEditorProps } from '@mdxeditor/editor';
|
|
10
11
|
import type { MdxJsxAttribute, MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
11
12
|
import type { ComponentType } from 'react';
|
|
@@ -35,32 +36,32 @@ import type { ComponentType } from 'react';
|
|
|
35
36
|
* effects) are dropped. See the astro-cms README for the full constraint.
|
|
36
37
|
*/
|
|
37
38
|
|
|
39
|
+
/** Fields every prop shares. `hidden` keeps a top-level prop out of the settings panel; its value is still kept. */
|
|
40
|
+
interface MdxComponentPropBase {
|
|
41
|
+
name: string;
|
|
42
|
+
required?: boolean;
|
|
43
|
+
label?: string;
|
|
44
|
+
help?: string;
|
|
45
|
+
hidden?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
export type MdxComponentProp =
|
|
39
|
-
| {
|
|
40
|
-
name: string;
|
|
49
|
+
| (MdxComponentPropBase & {
|
|
41
50
|
type: 'string';
|
|
42
|
-
required?: boolean;
|
|
43
|
-
label?: string;
|
|
44
|
-
help?: string;
|
|
45
51
|
defaultValue?: string;
|
|
46
52
|
options?: ReadonlyArray<{ value: string; label: string }>;
|
|
47
|
-
}
|
|
48
|
-
| {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
required?: boolean;
|
|
60
|
-
label?: string;
|
|
61
|
-
help?: string;
|
|
62
|
-
defaultValue?: boolean;
|
|
63
|
-
};
|
|
53
|
+
})
|
|
54
|
+
| (MdxComponentPropBase & { type: 'number'; defaultValue?: number })
|
|
55
|
+
| (MdxComponentPropBase & { type: 'boolean'; defaultValue?: boolean })
|
|
56
|
+
| (MdxComponentPropBase & { type: 'list'; of: MdxComponentField })
|
|
57
|
+
| (MdxComponentPropBase & { type: 'object'; fields: Record<string, MdxComponentField> });
|
|
58
|
+
|
|
59
|
+
/** A list item or object field: an `MdxComponentProp` without `name`. */
|
|
60
|
+
export type MdxComponentField = MdxComponentProp extends infer P
|
|
61
|
+
? P extends MdxComponentProp
|
|
62
|
+
? Omit<P, 'name'>
|
|
63
|
+
: never
|
|
64
|
+
: never;
|
|
64
65
|
|
|
65
66
|
export interface MdxComponentInsertHint {
|
|
66
67
|
/** Human-readable label shown in the slash menu and the toolbar dropdown. */
|
|
@@ -95,9 +96,15 @@ export interface MdxJsxComponentDescriptor {
|
|
|
95
96
|
props?: ReadonlyArray<MdxComponentProp>;
|
|
96
97
|
/** Whether the component accepts children (nested rich-text editor). */
|
|
97
98
|
hasChildren?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Offer the component in the fragment editor's Block type dropdown, next to Paragraph and the headings: its body is
|
|
101
|
+
* one line of text, such as an eyebrow or a quiet title. Choosing it turns the line into the component; choosing
|
|
102
|
+
* Paragraph turns it back. Needs `kind: 'flow'` and `hasChildren: true`.
|
|
103
|
+
*/
|
|
104
|
+
blockType?: boolean;
|
|
98
105
|
/** Default attributes used at insert time. */
|
|
99
106
|
defaults?: {
|
|
100
|
-
attributes?: Record<string,
|
|
107
|
+
attributes?: Record<string, JsonValue>;
|
|
101
108
|
/** Raw MDX snippet parsed to mdast children at insert time. */
|
|
102
109
|
children?: string;
|
|
103
110
|
};
|
|
@@ -151,6 +158,51 @@ export function isSnippetDescriptor(d: MdxComponentDescriptor): d is MdxSnippetD
|
|
|
151
158
|
return d.kind === 'snippet';
|
|
152
159
|
}
|
|
153
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Merge auto-discovered descriptors over host-authored ones.
|
|
163
|
+
*
|
|
164
|
+
* Discovered entries win on a name collision: they are derived from the
|
|
165
|
+
* source of truth (the MDX files and component folders themselves), while a
|
|
166
|
+
* hand-written list can lag. Discovery cannot see the host's editor settings,
|
|
167
|
+
* though: the host's `insert` (labels, descriptions), `props` (labels, help,
|
|
168
|
+
* `hidden`) and `blockType` stay on the merged entry. The exception is a name
|
|
169
|
+
* in `hostWins`, the site's fragment vocabulary components: there the host's
|
|
170
|
+
* declared types are the contract, so the host entry is kept and the
|
|
171
|
+
* discovered one dropped. ONE rule for every caller: the editors and the
|
|
172
|
+
* component manifest.
|
|
173
|
+
*
|
|
174
|
+
* Host survivors keep their relative order and discovered entries append
|
|
175
|
+
* after them, so a colliding entry surfaces at its discovered position, not
|
|
176
|
+
* its host slot. Inputs are assumed unique-by-name — that validation lives
|
|
177
|
+
* in `defineMdxComponents` and the discovery merge, not here.
|
|
178
|
+
*/
|
|
179
|
+
export function mergeDiscoveredMdxComponents(
|
|
180
|
+
hostAuthored: MdxComponents,
|
|
181
|
+
discovered: MdxComponents,
|
|
182
|
+
hostWins: ReadonlySet<string> = new Set(),
|
|
183
|
+
): MdxComponents {
|
|
184
|
+
if (discovered.length === 0) return hostAuthored;
|
|
185
|
+
const host = new Map(hostAuthored.map((descriptor) => [descriptor.name, descriptor]));
|
|
186
|
+
const kept = discovered.filter((descriptor) => !(hostWins.has(descriptor.name) && host.has(descriptor.name)));
|
|
187
|
+
const keptNames = new Set(kept.map((descriptor) => descriptor.name));
|
|
188
|
+
const merged = hostAuthored.filter((descriptor) => !keptNames.has(descriptor.name));
|
|
189
|
+
for (const descriptor of kept) {
|
|
190
|
+
const authored = host.get(descriptor.name);
|
|
191
|
+
if (!authored || !isJsxDescriptor(authored) || !isJsxDescriptor(descriptor)) {
|
|
192
|
+
merged.push(descriptor);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const { insert, props, blockType } = authored;
|
|
196
|
+
merged.push({
|
|
197
|
+
...descriptor,
|
|
198
|
+
...(insert && { insert }),
|
|
199
|
+
...(props && { props }),
|
|
200
|
+
...(blockType !== undefined && { blockType }),
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return merged;
|
|
204
|
+
}
|
|
205
|
+
|
|
154
206
|
/**
|
|
155
207
|
* Identity helper that validates registration-time invariants.
|
|
156
208
|
*
|
|
@@ -183,12 +235,23 @@ export function defineMdxComponents(components: MdxComponents): MdxComponents {
|
|
|
183
235
|
}
|
|
184
236
|
throw new Error(`defineMdxComponents: duplicate descriptor for '${descriptor.name}'.`);
|
|
185
237
|
}
|
|
238
|
+
if (isJsxDescriptor(descriptor)) checkJsxProps(descriptor);
|
|
186
239
|
if (isJsxDescriptor(descriptor) && descriptor.kind === 'text' && descriptor.hasChildren) {
|
|
187
240
|
throw new Error(
|
|
188
241
|
`defineMdxComponents: descriptor '${descriptor.name}' has kind: 'text' with hasChildren: true — ` +
|
|
189
242
|
"text-kind JSX is treated as an inline atom; use kind: 'flow' for components with children.",
|
|
190
243
|
);
|
|
191
244
|
}
|
|
245
|
+
if (
|
|
246
|
+
isJsxDescriptor(descriptor) &&
|
|
247
|
+
descriptor.blockType &&
|
|
248
|
+
(descriptor.kind !== 'flow' || !descriptor.hasChildren)
|
|
249
|
+
) {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`defineMdxComponents: descriptor '${descriptor.name}' has blockType: true — a block type holds a line of text, ` +
|
|
252
|
+
"so it needs kind: 'flow' and hasChildren: true.",
|
|
253
|
+
);
|
|
254
|
+
}
|
|
192
255
|
if (isSnippetDescriptor(descriptor) && descriptor.content.length === 0) {
|
|
193
256
|
throw new Error(
|
|
194
257
|
`defineMdxComponents: snippet descriptor '${descriptor.name}' has empty content — ` +
|
|
@@ -200,6 +263,64 @@ export function defineMdxComponents(components: MdxComponents): MdxComponents {
|
|
|
200
263
|
return components;
|
|
201
264
|
}
|
|
202
265
|
|
|
266
|
+
function isPlainObject(v: unknown): v is { [key: string]: JsonValue } {
|
|
267
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** Throws when a field has an unusable shape or `value` (when given) contradicts it. `path` is `Card.cta.href`. */
|
|
271
|
+
function checkField(field: MdxComponentField, path: string, value?: JsonValue): void {
|
|
272
|
+
const fail = (why: string): never => {
|
|
273
|
+
throw new Error(`defineMdxComponents: ${path} ${why}.`);
|
|
274
|
+
};
|
|
275
|
+
const typeName: unknown = field.type;
|
|
276
|
+
const has = value !== undefined && value !== null;
|
|
277
|
+
switch (field.type) {
|
|
278
|
+
case 'string':
|
|
279
|
+
case 'number':
|
|
280
|
+
case 'boolean':
|
|
281
|
+
if (has && typeof value !== field.type) fail(`default must be a ${field.type}`);
|
|
282
|
+
return;
|
|
283
|
+
case 'list':
|
|
284
|
+
if (!field.of) fail("is a list without 'of'");
|
|
285
|
+
if (has && !Array.isArray(value)) fail('default must be an array');
|
|
286
|
+
checkField(field.of, `${path}[]`);
|
|
287
|
+
if (Array.isArray(value)) {
|
|
288
|
+
for (const [i, item] of value.entries()) checkField(field.of, `${path}[${i}]`, item);
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
case 'object':
|
|
292
|
+
if (!field.fields || Object.keys(field.fields).length === 0) fail("is an object without 'fields'");
|
|
293
|
+
if (has && !isPlainObject(value)) fail('default must be an object');
|
|
294
|
+
for (const [key, sub] of Object.entries(field.fields)) {
|
|
295
|
+
checkField(sub, `${path}.${key}`, isPlainObject(value) ? value[key] : undefined);
|
|
296
|
+
}
|
|
297
|
+
return;
|
|
298
|
+
default:
|
|
299
|
+
fail(`has unknown type '${String(typeName)}'`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function checkJsxProps(d: MdxJsxComponentDescriptor): void {
|
|
304
|
+
const defaults = d.defaults?.attributes ?? {};
|
|
305
|
+
for (const prop of d.props ?? []) {
|
|
306
|
+
if (/^on/i.test(prop.name)) {
|
|
307
|
+
console.warn(
|
|
308
|
+
`defineMdxComponents: ${d.name}.${prop.name} starts with "on" and is never passed to the component; rename it.`,
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
const value = defaults[prop.name];
|
|
312
|
+
const scalar = prop.type === 'string' || prop.type === 'number' || prop.type === 'boolean';
|
|
313
|
+
// Scalar props predate this check; a throw here would crash existing sites at boot, so warn instead.
|
|
314
|
+
if (scalar && value !== undefined && value !== null && typeof value !== prop.type) {
|
|
315
|
+
console.warn(
|
|
316
|
+
`defineMdxComponents: ${d.name}.${prop.name} default should be a ${prop.type}, got ${JSON.stringify(value)}.`,
|
|
317
|
+
);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
checkField(prop, `${d.name}.${prop.name}`, value);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
203
324
|
/**
|
|
204
325
|
* Read a string-valued JSX attribute from an mdast flow element. Returns
|
|
205
326
|
* an empty string when the attribute is missing or holds an expression
|
|
@@ -250,6 +371,24 @@ export function writeStringAttribute<T extends MdxJsxFlowElement | MdxJsxTextEle
|
|
|
250
371
|
return next as T['attributes'];
|
|
251
372
|
}
|
|
252
373
|
|
|
374
|
+
/**
|
|
375
|
+
* `attributes` with the outline anchor (the `outline.id` prop) made from the contents text (`outline.text`) when the
|
|
376
|
+
* element has no anchor and has text. An existing anchor is never changed, so links to it keep working after the text
|
|
377
|
+
* is edited. `taken` holds the anchors already in the document.
|
|
378
|
+
*/
|
|
379
|
+
export function withOutlineId<T extends MdxJsxFlowElement | MdxJsxTextElement>(
|
|
380
|
+
attributes: T['attributes'],
|
|
381
|
+
outline: FragmentOutlineProps,
|
|
382
|
+
taken: Iterable<string>,
|
|
383
|
+
): T['attributes'] {
|
|
384
|
+
const named = (name: string) =>
|
|
385
|
+
attributes.find((a): a is MdxJsxAttribute => a.type === 'mdxJsxAttribute' && a.name === name);
|
|
386
|
+
const id = named(outline.id);
|
|
387
|
+
const text = named(outline.text)?.value;
|
|
388
|
+
if ((id && id.value !== '') || typeof text !== 'string' || text.trim() === '') return attributes;
|
|
389
|
+
return writeAttribute<T>(attributes, outline.id, outlineIdFor(text, taken));
|
|
390
|
+
}
|
|
391
|
+
|
|
253
392
|
/**
|
|
254
393
|
* Type-aware attribute writer. Encodes the value into the right
|
|
255
394
|
* mdast shape so the saved MDX matches what an author would write
|
|
@@ -270,7 +409,7 @@ export function writeStringAttribute<T extends MdxJsxFlowElement | MdxJsxTextEle
|
|
|
270
409
|
export function writeAttribute<T extends MdxJsxFlowElement | MdxJsxTextElement>(
|
|
271
410
|
attributes: T['attributes'],
|
|
272
411
|
name: string,
|
|
273
|
-
value:
|
|
412
|
+
value: JsonValue | null | undefined,
|
|
274
413
|
): T['attributes'] {
|
|
275
414
|
const next = attributes.filter((a) => !(a.type === 'mdxJsxAttribute' && a.name === name));
|
|
276
415
|
if (value === null || value === undefined) return next as T['attributes'];
|
|
@@ -291,6 +430,13 @@ export function writeAttribute<T extends MdxJsxFlowElement | MdxJsxTextElement>(
|
|
|
291
430
|
name,
|
|
292
431
|
value: { type: 'mdxJsxAttributeValueExpression', value: String(value) },
|
|
293
432
|
});
|
|
433
|
+
} else if (typeof value === 'object') {
|
|
434
|
+
// Lists and objects: a JSON literal expression, which readAttrs parses back.
|
|
435
|
+
next.push({
|
|
436
|
+
type: 'mdxJsxAttribute',
|
|
437
|
+
name,
|
|
438
|
+
value: { type: 'mdxJsxAttributeValueExpression', value: JSON.stringify(value) },
|
|
439
|
+
});
|
|
294
440
|
}
|
|
295
441
|
return next as T['attributes'];
|
|
296
442
|
}
|
package/src/mdx-components.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { JsxComponentDescriptor, JsxEditorProps } from '@mdxeditor/editor';
|
|
2
2
|
import { type ComponentType, useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isJsxDescriptor,
|
|
5
|
+
type MdxComponentDescriptor,
|
|
6
|
+
type MdxComponents,
|
|
7
|
+
mergeDiscoveredMdxComponents,
|
|
8
|
+
} from './mdx-components-define.js';
|
|
9
|
+
import { getSiteRender, subscribeSiteRender } from './site-render.js';
|
|
4
10
|
|
|
5
11
|
// The declaration surface (types, defineMdxComponents, the attribute
|
|
6
12
|
// helpers) lives in mdx-components-define — editor-free so content configs
|
|
@@ -20,10 +26,14 @@ export * from './mdx-components-define.js';
|
|
|
20
26
|
*
|
|
21
27
|
* Snippet descriptors are not JSX — call sites filter them out before
|
|
22
28
|
* dispatching here. Passing one throws to surface the misuse loudly.
|
|
29
|
+
*
|
|
30
|
+
* `withImport: false` drops the import a save would emit: a fragment's
|
|
31
|
+
* components come from the site's vocabulary, never from an import.
|
|
23
32
|
*/
|
|
24
33
|
export function toJsxComponentDescriptor(
|
|
25
34
|
d: MdxComponentDescriptor,
|
|
26
35
|
fallbackEditor: ComponentType<JsxEditorProps>,
|
|
36
|
+
{ withImport }: { withImport: boolean } = { withImport: true },
|
|
27
37
|
): JsxComponentDescriptor {
|
|
28
38
|
if (!isJsxDescriptor(d)) {
|
|
29
39
|
throw new Error(`toJsxComponentDescriptor: '${d.name}' is a snippet, not a JSX component.`);
|
|
@@ -33,12 +43,12 @@ export function toJsxComponentDescriptor(
|
|
|
33
43
|
kind: d.kind,
|
|
34
44
|
props: (d.props ?? []).map((p) => ({
|
|
35
45
|
name: p.name,
|
|
36
|
-
type: p.type === '
|
|
46
|
+
type: p.type === 'string' || p.type === 'number' ? p.type : 'expression',
|
|
37
47
|
required: p.required,
|
|
38
48
|
})),
|
|
39
49
|
hasChildren: d.hasChildren,
|
|
40
50
|
Editor: d.Editor ?? fallbackEditor,
|
|
41
|
-
...(d.import ? { source: d.import.from, defaultExport: d.import.default ?? false } : {}),
|
|
51
|
+
...(withImport && d.import ? { source: d.import.from, defaultExport: d.import.default ?? false } : {}),
|
|
42
52
|
};
|
|
43
53
|
}
|
|
44
54
|
|
|
@@ -95,41 +105,30 @@ export function getMdxComponents(): MdxComponents {
|
|
|
95
105
|
* settled last overwrote the other's entries — discovered components
|
|
96
106
|
* vanished whenever the fetch won the race. Each producer now writes its
|
|
97
107
|
* own remembered slot and the registry is recomputed as the merge of both,
|
|
98
|
-
* so settle order stops mattering.
|
|
99
|
-
*
|
|
100
|
-
*
|
|
108
|
+
* so settle order stops mattering. An editor embedding the CMS installs
|
|
109
|
+
* through the same two slots.
|
|
110
|
+
*
|
|
111
|
+
* The merge keeps host-authored entries for the current site render's
|
|
112
|
+
* fragment vocabulary names, and is redone whenever the site render changes.
|
|
101
113
|
*/
|
|
102
114
|
export function installHostAuthoredMdxComponents(components: MdxComponents): void {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
setMdxComponents(mergeDiscoveredMdxComponents(components, state.discovered ?? []));
|
|
115
|
+
getSharedState().hostAuthored = components;
|
|
116
|
+
remerge();
|
|
106
117
|
}
|
|
107
118
|
|
|
108
119
|
/** Install the auto-discovered descriptor list — see `installHostAuthoredMdxComponents`. */
|
|
109
120
|
export function installDiscoveredMdxComponents(components: MdxComponents): void {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
setMdxComponents(mergeDiscoveredMdxComponents(state.hostAuthored ?? [], components));
|
|
121
|
+
getSharedState().discovered = components;
|
|
122
|
+
remerge();
|
|
113
123
|
}
|
|
114
124
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* merges the same two lists from what it supplies.
|
|
123
|
-
*
|
|
124
|
-
* Host survivors keep their relative order and discovered entries append
|
|
125
|
-
* after them, so a colliding entry surfaces at its discovered position, not
|
|
126
|
-
* its host slot. Inputs are assumed unique-by-name — that validation lives
|
|
127
|
-
* in `defineMdxComponents` and the discovery merge, not here.
|
|
128
|
-
*/
|
|
129
|
-
export function mergeDiscoveredMdxComponents(hostAuthored: MdxComponents, discovered: MdxComponents): MdxComponents {
|
|
130
|
-
if (discovered.length === 0) return hostAuthored;
|
|
131
|
-
const discoveredNames = new Set(discovered.map((descriptor) => descriptor.name));
|
|
132
|
-
return [...hostAuthored.filter((descriptor) => !discoveredNames.has(descriptor.name)), ...discovered];
|
|
125
|
+
let unsubscribeSiteRender: (() => void) | undefined;
|
|
126
|
+
|
|
127
|
+
function remerge(): void {
|
|
128
|
+
unsubscribeSiteRender ??= subscribeSiteRender(remerge);
|
|
129
|
+
const state = getSharedState();
|
|
130
|
+
const hostWins = new Set(Object.keys(getSiteRender().vocabulary.components));
|
|
131
|
+
setMdxComponents(mergeDiscoveredMdxComponents(state.hostAuthored ?? [], state.discovered ?? [], hostWins));
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pageStatusLabel } from '../ui-config.js';
|
|
1
2
|
import { cn } from '../utils/cn.js';
|
|
2
3
|
import type { AssetScope } from './types.js';
|
|
3
4
|
|
|
@@ -32,7 +33,7 @@ export function AssetScopePill({ scope, size = 'sm', className }: AssetScopePill
|
|
|
32
33
|
if (!scope) return null;
|
|
33
34
|
|
|
34
35
|
const isBranch = scope === 'branch';
|
|
35
|
-
const label = isBranch ? 'Branch only' : 'Published';
|
|
36
|
+
const label = isBranch ? 'Branch only' : pageStatusLabel('published', 'Published');
|
|
36
37
|
const sizeClasses = size === 'sm' ? 'text-[10px] px-1.5 py-0.5 leading-tight' : 'text-xs px-2 py-0.5';
|
|
37
38
|
|
|
38
39
|
const variantClasses = isBranch
|
|
@@ -50,8 +50,12 @@ export function mergeDefaultProps(data: Data, config: Config): Data {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// Root's defaultProps go under its props as Puck fills them in on load (`root.props || root`).
|
|
54
|
+
const rootDefaults = config.root?.defaultProps;
|
|
55
|
+
|
|
53
56
|
return {
|
|
54
57
|
...data,
|
|
58
|
+
...(rootDefaults && { root: { ...data.root, props: { ...rootDefaults, ...(data.root?.props ?? data.root) } } }),
|
|
55
59
|
content: mergedContent,
|
|
56
60
|
...(mergedZones && { zones: mergedZones }),
|
|
57
61
|
};
|
package/src/selected-block.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { JsonValue } from '@conloca/mdx/render';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
3
|
import type { MdxJsxComponentDescriptor } from './mdx-components.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -34,11 +35,12 @@ export interface SelectedBlock {
|
|
|
34
35
|
attrs: Record<string, unknown>;
|
|
35
36
|
/** Apply a prop change. Wrapped by the owning block over its updater.
|
|
36
37
|
* Accepts strings (text props), booleans (checkbox props), numbers
|
|
37
|
-
* (numeric inputs),
|
|
38
|
+
* (numeric inputs), lists and objects (JSON expressions), or
|
|
39
|
+
* `null`/`undefined` (remove the attribute).
|
|
38
40
|
* The block routes the value through `writeAttribute` which picks
|
|
39
41
|
* the right mdast shape — string literal, JSX shorthand, or
|
|
40
42
|
* expression. */
|
|
41
|
-
onPropChange: (name: string, value:
|
|
43
|
+
onPropChange: (name: string, value: JsonValue | null | undefined) => void;
|
|
42
44
|
/** Remove the block from the document. */
|
|
43
45
|
onRemove: () => void;
|
|
44
46
|
}
|
|
@@ -46,6 +48,10 @@ export interface SelectedBlock {
|
|
|
46
48
|
interface SharedState {
|
|
47
49
|
selected: SelectedBlock | null;
|
|
48
50
|
subscribers: Set<(next: SelectedBlock | null) => void>;
|
|
51
|
+
/** Optional: state made by an older copy of this module has none. */
|
|
52
|
+
drafts?: Set<() => void>;
|
|
53
|
+
/** Co-editing bindings open now (see `markLiveEditing`); optional as `drafts` is. */
|
|
54
|
+
live?: number;
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
declare global {
|
|
@@ -119,3 +125,49 @@ export function useSelectedBlock(): SelectedBlock | null {
|
|
|
119
125
|
|
|
120
126
|
return selected;
|
|
121
127
|
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Registers a field's commit while it may hold typed text that commits only when the field is left (the side panel's
|
|
131
|
+
* fields, a block's inline prop fields, and its list-item fields off co-editing). The co-editing binding commits them
|
|
132
|
+
* all before a teammate's change rebuilds the block they write to, and before the editor closes. `commit` must do
|
|
133
|
+
* nothing when nothing is typed.
|
|
134
|
+
* Returns the release.
|
|
135
|
+
*/
|
|
136
|
+
export function trackDraft(commit: () => void): () => void {
|
|
137
|
+
const state = getState();
|
|
138
|
+
state.drafts ??= new Set();
|
|
139
|
+
const drafts = state.drafts;
|
|
140
|
+
drafts.add(commit);
|
|
141
|
+
return () => {
|
|
142
|
+
drafts.delete(commit);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Commits every tracked draft; see `trackDraft`. */
|
|
147
|
+
export function commitDrafts(): void {
|
|
148
|
+
for (const commit of getState().drafts ?? []) commit();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** `trackDraft` for a React field: its latest `commit` stays tracked while it is mounted. */
|
|
152
|
+
export function useTrackedDraft(commit: () => void): void {
|
|
153
|
+
const latest = useRef(commit);
|
|
154
|
+
latest.current = commit;
|
|
155
|
+
useEffect(() => trackDraft(() => latest.current()), []);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Marks the editor as co-edited while its binding is open: list items then write as they are typed, so teammates see
|
|
160
|
+
* it and no way out of the page drops it. Otherwise they write once the item is left, one undo step per visit.
|
|
161
|
+
* Returns the release.
|
|
162
|
+
*/
|
|
163
|
+
export function markLiveEditing(): () => void {
|
|
164
|
+
const state = getState();
|
|
165
|
+
state.live = (state.live ?? 0) + 1;
|
|
166
|
+
return () => {
|
|
167
|
+
state.live = (state.live ?? 1) - 1;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function isLiveEditing(): boolean {
|
|
172
|
+
return (getState().live ?? 0) > 0;
|
|
173
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { MDXHeading as FragmentHeading } from '@conloca/content-api';
|
|
2
|
+
import {
|
|
3
|
+
EMPTY_FRAGMENT_VOCABULARY,
|
|
4
|
+
evaluateMDXToComponent,
|
|
5
|
+
type FragmentOutlineComponent,
|
|
6
|
+
type FragmentVocabulary,
|
|
7
|
+
isFragmentVocabulary,
|
|
8
|
+
} from '@conloca/mdx/render';
|
|
9
|
+
import { type ComponentType, type ReactNode, useEffect, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The site's own fragment renderer, vocabulary and editor frames, so the
|
|
13
|
+
* inline canvas renders a fragment with the site's components and its copy of
|
|
14
|
+
* the renderer. The dev entry (`${cmsRoute}/site-render-entry.js`) sets it from
|
|
15
|
+
* the site's modules; until then the editor's own renderer and an empty
|
|
16
|
+
* vocabulary stand in.
|
|
17
|
+
*
|
|
18
|
+
* Uses window so virtual modules and bundled code share the same state.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* What a fragment renderer returns. `componentOutline` is optional because a
|
|
23
|
+
* site's own renderer may be a copy of `@conloca/mdx` from before it existed.
|
|
24
|
+
*/
|
|
25
|
+
export interface EvaluatedFragment {
|
|
26
|
+
Component: ComponentType | null;
|
|
27
|
+
error?: Error;
|
|
28
|
+
outline: readonly FragmentHeading[];
|
|
29
|
+
componentOutline?: readonly FragmentOutlineComponent[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type FragmentEvaluate = (mdx: string, vocabulary?: FragmentVocabulary) => Promise<EvaluatedFragment>;
|
|
33
|
+
|
|
34
|
+
export type EditorFrame = ComponentType<{ pathname: string; children: ReactNode }>;
|
|
35
|
+
|
|
36
|
+
export interface SiteRender {
|
|
37
|
+
evaluate: FragmentEvaluate;
|
|
38
|
+
vocabulary: FragmentVocabulary;
|
|
39
|
+
frames: Readonly<Record<string, EditorFrame>>;
|
|
40
|
+
source: 'site' | 'editor';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface SharedSiteRenderState {
|
|
44
|
+
render: SiteRender;
|
|
45
|
+
subscribers: Set<(render: SiteRender) => void>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare global {
|
|
49
|
+
interface Window {
|
|
50
|
+
__SITE_RENDER_STATE__?: SharedSiteRenderState;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const FALLBACK: SiteRender = {
|
|
55
|
+
evaluate: evaluateMDXToComponent,
|
|
56
|
+
vocabulary: EMPTY_FRAGMENT_VOCABULARY,
|
|
57
|
+
frames: {},
|
|
58
|
+
source: 'editor',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const getSharedState = (): SharedSiteRenderState => {
|
|
62
|
+
if (typeof window !== 'undefined') {
|
|
63
|
+
// oxlint-disable-next-line no-underscore-dangle -- the browser global declared above.
|
|
64
|
+
window.__SITE_RENDER_STATE__ ??= { render: FALLBACK, subscribers: new Set() };
|
|
65
|
+
// oxlint-disable-next-line no-underscore-dangle -- the browser global declared above.
|
|
66
|
+
return window.__SITE_RENDER_STATE__;
|
|
67
|
+
}
|
|
68
|
+
// SSR fallback
|
|
69
|
+
return { render: FALLBACK, subscribers: new Set() };
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const isPlainObject = (value: unknown): value is object =>
|
|
73
|
+
typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype;
|
|
74
|
+
|
|
75
|
+
// Shape checks only: site code supplies these, and a wrong signature surfaces as a render error.
|
|
76
|
+
const isFragmentEvaluate = (value: unknown): value is FragmentEvaluate => typeof value === 'function';
|
|
77
|
+
const isEditorFrame = (value: unknown): value is EditorFrame =>
|
|
78
|
+
typeof value === 'function' || (typeof value === 'object' && value !== null && '$$typeof' in value);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Register the site's render inputs. Each field is checked by shape, since it
|
|
82
|
+
* comes from site code: a malformed one is replaced by the fallback and named
|
|
83
|
+
* in one warning.
|
|
84
|
+
*/
|
|
85
|
+
export function setSiteRender(input: { evaluate?: unknown; vocabulary?: unknown; frames?: unknown }): void {
|
|
86
|
+
const siteEvaluate = isFragmentEvaluate(input.evaluate) ? input.evaluate : undefined;
|
|
87
|
+
if (input.evaluate !== undefined && siteEvaluate === undefined) {
|
|
88
|
+
console.warn('[conloca] evaluate is not a function; using the editor renderer');
|
|
89
|
+
}
|
|
90
|
+
const vocabulary = isFragmentVocabulary(input.vocabulary) ? input.vocabulary : EMPTY_FRAGMENT_VOCABULARY;
|
|
91
|
+
if (input.vocabulary !== undefined && vocabulary !== input.vocabulary) {
|
|
92
|
+
console.warn('[conloca] fragmentComponents is not defineFragmentComponents(...) output; using no components');
|
|
93
|
+
}
|
|
94
|
+
const frames: Record<string, EditorFrame> = {};
|
|
95
|
+
if (isPlainObject(input.frames)) {
|
|
96
|
+
for (const [name, frame] of Object.entries(input.frames)) {
|
|
97
|
+
if (isEditorFrame(frame)) frames[name] = frame;
|
|
98
|
+
}
|
|
99
|
+
} else if (input.frames !== undefined) {
|
|
100
|
+
console.warn('[conloca] editorFrames is not an object; using no frames');
|
|
101
|
+
}
|
|
102
|
+
const render: SiteRender = {
|
|
103
|
+
evaluate: siteEvaluate ?? evaluateMDXToComponent,
|
|
104
|
+
vocabulary,
|
|
105
|
+
frames,
|
|
106
|
+
source: siteEvaluate ? 'site' : 'editor',
|
|
107
|
+
};
|
|
108
|
+
const state = getSharedState();
|
|
109
|
+
state.render = render;
|
|
110
|
+
state.subscribers.forEach((fn) => {
|
|
111
|
+
fn(render);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The current site render, or the editor's fallback until one is set. */
|
|
116
|
+
export function getSiteRender(): SiteRender {
|
|
117
|
+
return getSharedState().render;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Call `listener` on every later `setSiteRender`; returns the unsubscribe. */
|
|
121
|
+
export function subscribeSiteRender(listener: (render: SiteRender) => void): () => void {
|
|
122
|
+
const state = getSharedState();
|
|
123
|
+
state.subscribers.add(listener);
|
|
124
|
+
return () => {
|
|
125
|
+
state.subscribers.delete(listener);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** React hook for the current site render; re-renders the caller when it changes (HMR support). */
|
|
130
|
+
export function useSiteRender(): SiteRender {
|
|
131
|
+
const [render, setRender] = useState(() => getSharedState().render);
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
const state = getSharedState();
|
|
135
|
+
// Re-sync in case it changed between render and effect
|
|
136
|
+
if (state.render !== render) {
|
|
137
|
+
setRender(state.render);
|
|
138
|
+
}
|
|
139
|
+
state.subscribers.add(setRender);
|
|
140
|
+
return () => {
|
|
141
|
+
state.subscribers.delete(setRender);
|
|
142
|
+
};
|
|
143
|
+
}, [render]);
|
|
144
|
+
|
|
145
|
+
return render;
|
|
146
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,9 @@ export interface PageMetadata {
|
|
|
39
39
|
pathname: string;
|
|
40
40
|
publishDate: Date | null;
|
|
41
41
|
unpublishDate: Date | null;
|
|
42
|
+
/** The `publishAt` / `unpublishAt` text the page was read with, sent back unchanged while its date is not changed. */
|
|
43
|
+
publishAtText?: string;
|
|
44
|
+
unpublishAtText?: string;
|
|
42
45
|
robots?: string;
|
|
43
46
|
canonical?: string;
|
|
44
47
|
customMeta?: Record<string, unknown>;
|