@conloca/cms-spa 0.2.5 → 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
package/src/host-style-probe.ts
CHANGED
|
@@ -256,6 +256,15 @@ function buildProbeStylesheet(doc: Document, wrapperClass: string | null): strin
|
|
|
256
256
|
// rule beats inheritance and restores the host's typography.
|
|
257
257
|
const wrapperRule = probeWrapper(view, wrapper);
|
|
258
258
|
if (wrapperRule) rules.push(wrapperRule);
|
|
259
|
+
// The page's own colour scheme (`normal`, ie light, for a site that declares none), so the browser draws the
|
|
260
|
+
// content's links, controls and scrollbars as the published page does rather than in the editor chrome's scheme.
|
|
261
|
+
// Resolved: `light dark` in the editor would follow the OS preference again, not the scheme probed here.
|
|
262
|
+
rules.push(`:where(.conloca-prose--editor) { color-scheme: ${usedScheme(view, wrapper)}; }`);
|
|
263
|
+
// A site that can be dark rebases its `:root { color-scheme: light dark }` onto the surround, whose
|
|
264
|
+
// `light-dark()` paper would then follow the OS too; only then does the surround take the resolved scheme.
|
|
265
|
+
if (/\bdark\b/.test(view.getComputedStyle(doc.body).colorScheme)) {
|
|
266
|
+
rules.push(`${HOST_TOKEN_SCOPE} { color-scheme: ${usedScheme(view, doc.body)}; }`);
|
|
267
|
+
}
|
|
259
268
|
|
|
260
269
|
// Page background, read off BODY rather than the wrapper. The wrapper is
|
|
261
270
|
// transparent on most hosts (Starlight's is), so the page's surface colour
|
|
@@ -359,40 +368,67 @@ function buildProbeStylesheet(doc: Document, wrapperClass: string | null): strin
|
|
|
359
368
|
function probeBlockTagInSiblingContext(view: Window, wrapper: HTMLElement, tag: string): string {
|
|
360
369
|
const doc = wrapper.ownerDocument;
|
|
361
370
|
|
|
362
|
-
//
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
// Standard "block element after a paragraph" context.
|
|
382
|
-
host = doc.createElement('div');
|
|
371
|
+
// List items and table cells: inside their parent, after a sibling of the same kind.
|
|
372
|
+
if (tag === 'li' || tag === 'th' || tag === 'td') {
|
|
373
|
+
let host: HTMLElement;
|
|
374
|
+
let target: HTMLElement;
|
|
375
|
+
if (tag === 'li') {
|
|
376
|
+
host = doc.createElement('ul');
|
|
377
|
+
host.appendChild(makeProbeEl(doc, 'li'));
|
|
378
|
+
target = makeProbeEl(doc, 'li');
|
|
379
|
+
host.appendChild(target);
|
|
380
|
+
} else {
|
|
381
|
+
host = doc.createElement('table');
|
|
382
|
+
const tr1 = doc.createElement('tr');
|
|
383
|
+
tr1.appendChild(makeProbeEl(doc, tag));
|
|
384
|
+
host.appendChild(tr1);
|
|
385
|
+
const tr2 = doc.createElement('tr');
|
|
386
|
+
target = makeProbeEl(doc, tag);
|
|
387
|
+
tr2.appendChild(target);
|
|
388
|
+
host.appendChild(tr2);
|
|
389
|
+
}
|
|
383
390
|
host.setAttribute('data-conloca-probe-host', 'true');
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
391
|
+
wrapper.appendChild(host);
|
|
392
|
+
try {
|
|
393
|
+
return generateRule(view, target, tag);
|
|
394
|
+
} finally {
|
|
395
|
+
host.remove();
|
|
396
|
+
}
|
|
387
397
|
}
|
|
388
398
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
399
|
+
// A block after a paragraph, twice. On the page: the wrapper's own
|
|
400
|
+
// children, where its flow rules (`.prose > p + p`) reach. In the editor:
|
|
401
|
+
// the contenteditable carries the wrapper's classes under a clone of the
|
|
402
|
+
// wrapper and nothing else of the page (host-wrapper-plugin.ts), so the
|
|
403
|
+
// twin sits in that shape at the top of the body. Where both agree on the
|
|
404
|
+
// spacing, the site's CSS gives it in the editor on its own. A paragraph
|
|
405
|
+
// follows each, so neither is measured as a last child (`.prose >
|
|
406
|
+
// :last-child { margin-bottom: 0 }`).
|
|
407
|
+
const before = makeProbeEl(doc, 'p');
|
|
408
|
+
const target = makeProbeEl(doc, tag);
|
|
409
|
+
const after = makeProbeEl(doc, 'p');
|
|
410
|
+
wrapper.append(before, target, after);
|
|
411
|
+
const clone = doc.createElement(wrapper.tagName);
|
|
412
|
+
clone.className = wrapper.className;
|
|
413
|
+
clone.setAttribute('data-conloca-probe-host', 'true');
|
|
414
|
+
// The editor publishes the wrapper's resolved font (probeWrapper), so `em` spacing resolves there at the
|
|
415
|
+
// wrapper's size even where the page inherits it from an ancestor the clone lacks.
|
|
416
|
+
const wrapperStyle = view.getComputedStyle(wrapper);
|
|
417
|
+
clone.style.fontSize = wrapperStyle.fontSize;
|
|
418
|
+
clone.style.lineHeight = wrapperStyle.lineHeight;
|
|
419
|
+
const editable = doc.createElement('div');
|
|
420
|
+
editable.className = `conloca-prose conloca-prose--editor ${wrapper.className}`.trim();
|
|
421
|
+
const twin = makeProbeEl(doc, tag);
|
|
422
|
+
editable.append(makeProbeEl(doc, 'p'), twin, makeProbeEl(doc, 'p'));
|
|
423
|
+
clone.appendChild(editable);
|
|
424
|
+
doc.body.appendChild(clone);
|
|
392
425
|
try {
|
|
393
|
-
return generateRule(view, target, tag);
|
|
426
|
+
return generateRule(view, target, tag, view.getComputedStyle(twin));
|
|
394
427
|
} finally {
|
|
395
|
-
|
|
428
|
+
before.remove();
|
|
429
|
+
target.remove();
|
|
430
|
+
after.remove();
|
|
431
|
+
clone.remove();
|
|
396
432
|
}
|
|
397
433
|
}
|
|
398
434
|
|
|
@@ -456,6 +492,20 @@ function probeWrapper(view: Window, wrapper: HTMLElement): string {
|
|
|
456
492
|
return `:root { ${decls.join('; ')}; }`;
|
|
457
493
|
}
|
|
458
494
|
|
|
495
|
+
/** The scheme `el` is drawn in: its `color-scheme`, with `light dark` resolved to the one the browser picked for it. */
|
|
496
|
+
function usedScheme(view: Window, el: HTMLElement): string {
|
|
497
|
+
const declared = view.getComputedStyle(el).colorScheme;
|
|
498
|
+
if (!/\blight\b/.test(declared) || !/\bdark\b/.test(declared)) return declared;
|
|
499
|
+
const sample = el.ownerDocument.createElement('span');
|
|
500
|
+
sample.style.color = 'light-dark(rgb(0, 0, 0), rgb(255, 255, 255))';
|
|
501
|
+
el.appendChild(sample);
|
|
502
|
+
try {
|
|
503
|
+
return view.getComputedStyle(sample).color === 'rgb(0, 0, 0)' ? 'light' : 'dark';
|
|
504
|
+
} finally {
|
|
505
|
+
sample.remove();
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
459
509
|
function makeProbeEl(doc: Document, tag: string): HTMLElement {
|
|
460
510
|
const el = doc.createElement(tag);
|
|
461
511
|
el.textContent = 'probe';
|
|
@@ -485,20 +535,74 @@ const HEADING_SCALE_PROPS: Partial<Record<(typeof PROBE_PROPS)[number], true>> =
|
|
|
485
535
|
'line-height': true,
|
|
486
536
|
};
|
|
487
537
|
|
|
488
|
-
|
|
538
|
+
/** The layerable properties a block inherits from its parent when nothing sets them on it. */
|
|
539
|
+
const INHERITED_PROPS = new Set<(typeof PROBE_PROPS)[number]>([
|
|
540
|
+
'color',
|
|
541
|
+
'font-family',
|
|
542
|
+
'font-size',
|
|
543
|
+
'font-weight',
|
|
544
|
+
'font-style',
|
|
545
|
+
'line-height',
|
|
546
|
+
'letter-spacing',
|
|
547
|
+
]);
|
|
548
|
+
|
|
549
|
+
/** Properties a probed block keeps only as a fallback, in the layer under the site's CSS, wherever the site's own CSS
|
|
550
|
+
* gives the block the same value in the editor's shape: its spacing, colours and typography. */
|
|
551
|
+
const LAYERABLE_PROPS = new Set<(typeof PROBE_PROPS)[number]>([
|
|
552
|
+
'margin-block-start',
|
|
553
|
+
'margin-block-end',
|
|
554
|
+
'color',
|
|
555
|
+
'background-color',
|
|
556
|
+
'font-family',
|
|
557
|
+
'font-size',
|
|
558
|
+
'font-weight',
|
|
559
|
+
'font-style',
|
|
560
|
+
'line-height',
|
|
561
|
+
'letter-spacing',
|
|
562
|
+
]);
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* `inEditor` is the same sample laid out the way the editor lays it out (see
|
|
566
|
+
* `probeBlockTagInSiblingContext`), or null where the probe has no such twin.
|
|
567
|
+
*/
|
|
568
|
+
function generateRule(
|
|
569
|
+
view: Window,
|
|
570
|
+
sample: HTMLElement,
|
|
571
|
+
tag: string,
|
|
572
|
+
inEditor: CSSStyleDeclaration | null = null,
|
|
573
|
+
): string {
|
|
489
574
|
const cs = view.getComputedStyle(sample);
|
|
575
|
+
// What the sample inherits where it sits: the wrapper's values, which the contenteditable already carries.
|
|
576
|
+
const around = sample.parentElement ? view.getComputedStyle(sample.parentElement) : null;
|
|
490
577
|
const decls: string[] = [];
|
|
578
|
+
const fallback: string[] = [];
|
|
579
|
+
const reverted: string[] = [];
|
|
491
580
|
const isListContainer = tag === 'ul' || tag === 'ol';
|
|
492
581
|
const isHeading = /^h[1-6]$/.test(tag);
|
|
493
582
|
for (const prop of PROBE_PROPS) {
|
|
494
583
|
if (LIST_STYLE_PROPS.has(prop) && !isListContainer) continue;
|
|
495
584
|
const value = cs.getPropertyValue(prop);
|
|
496
585
|
if (value && value !== 'normal' && value !== 'none') {
|
|
497
|
-
|
|
498
|
-
|
|
586
|
+
// Spacing the site's own CSS also gives the block in the editor (a wrapper
|
|
587
|
+
// flow rule like `.prose > p + p`) is only a fallback: unlayered, this
|
|
588
|
+
// one sample's value would override the rule for every other pair of
|
|
589
|
+
// blocks. Spacing the editor would lose (`article p` with no `article`
|
|
590
|
+
// around the editor, under a margin reset) stays unlayered so it wins.
|
|
591
|
+
// Colours and typography alike: unlayered, a bare paragraph's ink and
|
|
592
|
+
// font beat the site's own class rules on a paragraph that has them (an
|
|
593
|
+
// eyebrow `p.eyebrow` in a monospace face).
|
|
594
|
+
const reproduced = LAYERABLE_PROPS.has(prop) && inEditor?.getPropertyValue(prop) === value;
|
|
595
|
+
// A reproduced value the tag only inherits from the wrapper is no default of the tag's own: pinned on every
|
|
596
|
+
// `p`, the wrapper's 16px overrode the 20px a paragraph inherits inside a component that sizes its text.
|
|
597
|
+
const merelyInherited = reproduced && INHERITED_PROPS.has(prop) && around?.getPropertyValue(prop) === value;
|
|
598
|
+
if (!merelyInherited) (reproduced ? fallback : decls).push(`${prop}: ${value}`);
|
|
599
|
+
if (isHeading && HEADING_SCALE_PROPS[prop]) {
|
|
600
|
+
// The editor's own unlayered heading scale would beat the layer; hand the property back to the layers.
|
|
601
|
+
if (reproduced) reverted.push(`${prop}: revert-layer`);
|
|
602
|
+
else decls.push(`--conloca-host-${tag}-${prop}: ${value}`);
|
|
603
|
+
}
|
|
499
604
|
}
|
|
500
605
|
}
|
|
501
|
-
if (decls.length === 0) return '';
|
|
502
606
|
// Wrap the wrapper class in `:where()` so the selector has the same
|
|
503
607
|
// specificity as a bare element selector (0,0,1). Without :where(),
|
|
504
608
|
// `.conloca-prose--editor ol` has specificity (0,1,1) — higher than
|
|
@@ -506,8 +610,15 @@ function generateRule(view: Window, sample: HTMLElement, tag: string): string {
|
|
|
506
610
|
// "ol defaults" override component-specific styling on `<ol>`
|
|
507
611
|
// elements that carry component classes (Steps, Tabs, etc.).
|
|
508
612
|
// With :where() the probe acts as a defaults layer for BARE prose
|
|
509
|
-
// tags
|
|
510
|
-
|
|
613
|
+
// tags; the declarations in the layer below also lose to host class rules.
|
|
614
|
+
const selector = `:where(.conloca-prose--editor) ${tag}`;
|
|
615
|
+
const rules: string[] = [];
|
|
616
|
+
if (decls.length > 0) rules.push(`${selector} { ${decls.join('; ')}; }`);
|
|
617
|
+
// The layer before the host's CSS (see main.css): the site's own rules win wherever they reach the editor's blocks.
|
|
618
|
+
if (fallback.length > 0) rules.push(`@layer conloca-host-defaults { ${selector} { ${fallback.join('; ')}; } }`);
|
|
619
|
+
// (0,0,2) beats the heading scale's (0,0,1) whichever sheet comes last in `<head>`.
|
|
620
|
+
if (reverted.length > 0) rules.push(`${selector}:is(${tag}) { ${reverted.join('; ')}; }`);
|
|
621
|
+
return rules.join('\n');
|
|
511
622
|
}
|
|
512
623
|
|
|
513
624
|
/**
|
|
@@ -599,13 +710,22 @@ export function probeHostStyles(
|
|
|
599
710
|
// of what the user is editing in. We override `data-theme` (and
|
|
600
711
|
// mirror as `.dark` class for Tailwind-style hosts) so the probe
|
|
601
712
|
// captures the scheme the editor is rendering, not the published
|
|
602
|
-
// page's stale scheme.
|
|
713
|
+
// page's stale scheme. Those are the site's own switches, so a site
|
|
714
|
+
// with no dark mode stays light. `color-scheme` is the third switch,
|
|
715
|
+
// the one `light-dark()` and system colours follow: set only when the
|
|
716
|
+
// site declares the editor's scheme among its own (`light dark`), since
|
|
717
|
+
// forcing it on a light-only page would paint its undeclared ink and
|
|
718
|
+
// controls in the browser's dark defaults, and forcing light on a
|
|
719
|
+
// dark-only page would flip it the other way. Inside a frame the
|
|
720
|
+
// browser's own preference is the OS's, not the editor's, so a site
|
|
721
|
+
// that offers both would otherwise follow the OS.
|
|
603
722
|
try {
|
|
604
723
|
const doc = iframe.contentDocument;
|
|
605
724
|
if (doc && theme) {
|
|
606
725
|
doc.documentElement.dataset.theme = theme;
|
|
607
726
|
doc.documentElement.classList.toggle('dark', theme === 'dark');
|
|
608
|
-
doc.documentElement.
|
|
727
|
+
const declared = doc.defaultView?.getComputedStyle(doc.documentElement).colorScheme ?? '';
|
|
728
|
+
if (declared.split(/\s+/).includes(theme)) doc.documentElement.style.colorScheme = theme;
|
|
609
729
|
}
|
|
610
730
|
} catch (err) {
|
|
611
731
|
// Same-origin iframe access can throw if the dev server emitted
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// Re-export useful types from dependencies
|
|
2
|
+
export type { Data as PuckData } from '@puckeditor/core';
|
|
2
3
|
export type { QueryClientConfig } from '@tanstack/react-query';
|
|
3
4
|
// Export the mount component for embedding cms-spa inside another React app
|
|
4
5
|
export { CmsSpaApp } from './CmsSpaApp.js';
|
|
6
|
+
// The field conflict picker and list, labelled from the site's Puck config
|
|
7
|
+
export { type ConflictLabel, resolveConflictLabel } from './components/conflicts/conflict-label.js';
|
|
8
|
+
export { FieldConflictList, type FieldConflictListProps } from './components/conflicts/FieldConflictList.js';
|
|
9
|
+
export {
|
|
10
|
+
type ConflictChoice,
|
|
11
|
+
FieldConflictPicker,
|
|
12
|
+
type FieldConflictPickerProps,
|
|
13
|
+
} from './components/conflicts/FieldConflictPicker.js';
|
|
5
14
|
// The host fragment block's props; @conloca/astro-cms re-exports this for host sites.
|
|
6
15
|
export type { ContentFragmentSectionProps } from './components/editor/PageEditorWrapper.js';
|
|
7
16
|
export { FolderTreeSidebar } from './components/media/FolderTreeSidebar.js';
|
|
@@ -12,6 +21,18 @@ export { UploadModal } from './components/media/UploadModal.js';
|
|
|
12
21
|
export { MDXContent } from './components/puck/index.js';
|
|
13
22
|
// Export data schemas functions
|
|
14
23
|
export { type DataSchemas, setDataSchemas } from './data-schemas.js';
|
|
24
|
+
// Draft tools a host may serve the editor: conflicts, discard, earlier versions
|
|
25
|
+
export type {
|
|
26
|
+
DiscardOutcome,
|
|
27
|
+
DraftToolsHost,
|
|
28
|
+
EarlierVersion,
|
|
29
|
+
PageConflict,
|
|
30
|
+
PageNote,
|
|
31
|
+
PageRef,
|
|
32
|
+
ResolveConflictInput,
|
|
33
|
+
ResolveConflictOutcome,
|
|
34
|
+
RestoreVersionOutcome,
|
|
35
|
+
} from './draft-tools.js';
|
|
15
36
|
// Export editor flush bridge (host Save flushes open editor first)
|
|
16
37
|
export {
|
|
17
38
|
EDITOR_DIRTY_CHANGED_EVENT,
|
|
@@ -29,6 +50,75 @@ export { awaitParentHello } from './frame/parent-hello.js';
|
|
|
29
50
|
// Export types from hooks (AssetEntry, etc.)
|
|
30
51
|
export type { AssetEntry, AssetUsage, FolderListing, FolderTreeNode } from './hooks/index.js';
|
|
31
52
|
export { buildUploadFormData } from './hooks/useUpload.js';
|
|
53
|
+
export {
|
|
54
|
+
createDataBinding,
|
|
55
|
+
type DataBinding,
|
|
56
|
+
dropHeldDataValues,
|
|
57
|
+
hasHeldDataValues,
|
|
58
|
+
readDataValues,
|
|
59
|
+
useLiveDataValues,
|
|
60
|
+
writeDataValues,
|
|
61
|
+
} from './live/data-binding.js';
|
|
62
|
+
// The editor page's side of the co-edited docs, its hooks and per-user undo
|
|
63
|
+
export {
|
|
64
|
+
createDocChannel,
|
|
65
|
+
type DocChannel,
|
|
66
|
+
EDIT_ORIGIN,
|
|
67
|
+
type FrameDocChannel,
|
|
68
|
+
type FrameLiveDoc,
|
|
69
|
+
LOCAL_ORIGIN,
|
|
70
|
+
RELAY_ORIGIN,
|
|
71
|
+
useDocChannel,
|
|
72
|
+
} from './live/doc-channel.js';
|
|
73
|
+
export {
|
|
74
|
+
applyMarkdownEdit,
|
|
75
|
+
type Caret,
|
|
76
|
+
caretAfterRemoteEdit,
|
|
77
|
+
createEditorReplica,
|
|
78
|
+
type EditorReplica,
|
|
79
|
+
markdownBlockRanges,
|
|
80
|
+
syncEditorReplica,
|
|
81
|
+
writeEditorEdit,
|
|
82
|
+
} from './live/markdown-binding.js';
|
|
83
|
+
export { markdownLivePlugin } from './live/markdown-live-plugin.js';
|
|
84
|
+
// Messages the parent and the editor page exchange while several people edit a page
|
|
85
|
+
export {
|
|
86
|
+
type DocOpenRequest,
|
|
87
|
+
type DocOpenResult,
|
|
88
|
+
type LiveHello,
|
|
89
|
+
type LiveMessage,
|
|
90
|
+
type LiveNotice,
|
|
91
|
+
type LiveStatus,
|
|
92
|
+
type PresencePeer,
|
|
93
|
+
readLiveHello,
|
|
94
|
+
readLiveMessage,
|
|
95
|
+
readLiveStatus,
|
|
96
|
+
} from './live/messages.js';
|
|
97
|
+
export {
|
|
98
|
+
createPuckBinding,
|
|
99
|
+
type PuckBinding,
|
|
100
|
+
PuckLiveBridge,
|
|
101
|
+
readPuckData,
|
|
102
|
+
usePeerOutlines,
|
|
103
|
+
writePuckChange,
|
|
104
|
+
} from './live/puck-binding.js';
|
|
105
|
+
export { createLocalUndo, interceptUndoKeys } from './live/undo.js';
|
|
106
|
+
export {
|
|
107
|
+
anyHeld,
|
|
108
|
+
applyDocEdits,
|
|
109
|
+
type DocEditResult,
|
|
110
|
+
flushLive,
|
|
111
|
+
followHandovers,
|
|
112
|
+
heldContent,
|
|
113
|
+
type LiveBinding,
|
|
114
|
+
type LiveDocState,
|
|
115
|
+
useDocEdit,
|
|
116
|
+
useDocEdits,
|
|
117
|
+
useLiveDoc,
|
|
118
|
+
useLiveMessage,
|
|
119
|
+
useLiveStatus,
|
|
120
|
+
usePresencePeers,
|
|
121
|
+
} from './live/use-live.js';
|
|
32
122
|
// Shrinks and checks an image before upload; the editor's parent page runs it on every upload it forwards
|
|
33
123
|
export { prepareImageUpload, prepareUploadForm } from './media/prepare-image-upload.js';
|
|
34
124
|
// Export configuration function
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binds a data entry's form to its replica: each valid change goes into the doc as it is typed, a value the schema
|
|
3
|
+
* rejects is held in the form unwritten, and changes made elsewhere (a teammate, a restore, undo) come back into the
|
|
4
|
+
* form without touching the held values.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ContentData } from '@conloca/content-api';
|
|
8
|
+
import { mergeContent } from '@conloca/content-api/merge';
|
|
9
|
+
import { applyContentDiff, applyItemChanges, type ItemIds, readItemIds, serializeDoc } from '@conloca/content-api/ydoc';
|
|
10
|
+
import { useEffect, useMemo, useReducer, useRef } from 'react';
|
|
11
|
+
import type * as Y from 'yjs';
|
|
12
|
+
import { getUIConfig } from '../ui-config.js';
|
|
13
|
+
import { type FrameLiveDoc, HELD_WRITE_FAILED, LOCAL_ORIGIN } from './doc-channel.js';
|
|
14
|
+
import { createListUndo, interceptUndoKeys } from './undo.js';
|
|
15
|
+
|
|
16
|
+
/** A data entry's values, as the content API types them. */
|
|
17
|
+
type Values = NonNullable<ContentData['data']>;
|
|
18
|
+
export type ValidateData = (values: Values) => string | null;
|
|
19
|
+
|
|
20
|
+
/** What the form binds: its values, their change handler, and the held keys' errors. */
|
|
21
|
+
export interface LiveDataValues {
|
|
22
|
+
values: Values;
|
|
23
|
+
change: (values: Values) => void;
|
|
24
|
+
errors: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b);
|
|
28
|
+
|
|
29
|
+
export function readDataValues(doc: Y.Doc): Values {
|
|
30
|
+
return serializeDoc(doc).data ?? {};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** `values` with `key` set to `next`'s value, or removed when `next` has none. */
|
|
34
|
+
function withKey(values: Values, key: string, next: Values) {
|
|
35
|
+
const out = { ...values };
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(next, key)) out[key] = next[key];
|
|
37
|
+
else Reflect.deleteProperty(out, key);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Writes what changed from `shadow` (the values last shown, with `shadowIds`, the ids of their list items) to
|
|
43
|
+
* `values` into the doc, over whatever it holds that the form has not been shown yet. Each changed key is validated
|
|
44
|
+
* over the doc's current data with that key set: a valid one is written, an invalid one is not, and comes back in
|
|
45
|
+
* `held` with its error. Lists change item by item, by the ids the form showed; the rest is merged against the doc.
|
|
46
|
+
* Returns `written`, the values the doc now has from the form (`shadow` plus the valid keys), and their ids: the next
|
|
47
|
+
* write's pair. A throw writes nothing (see `writePuckChange`).
|
|
48
|
+
*/
|
|
49
|
+
export function writeDataValues(
|
|
50
|
+
doc: Y.Doc,
|
|
51
|
+
shadow: Values,
|
|
52
|
+
shadowIds: ItemIds,
|
|
53
|
+
values: Values,
|
|
54
|
+
validate: ValidateData,
|
|
55
|
+
beforeWrite?: (names: string[]) => void,
|
|
56
|
+
): { ok: true; held: Record<string, string>; written: Values; ids: ItemIds } | { ok: false; error: string } {
|
|
57
|
+
try {
|
|
58
|
+
const changed = [...new Set([...Object.keys(shadow), ...Object.keys(values)])].filter(
|
|
59
|
+
(key) => !same(shadow[key], values[key]),
|
|
60
|
+
);
|
|
61
|
+
if (changed.length === 0) return { ok: true, held: {}, written: shadow, ids: shadowIds };
|
|
62
|
+
const current = readDataValues(doc);
|
|
63
|
+
const held: Record<string, string> = {};
|
|
64
|
+
let written = shadow;
|
|
65
|
+
for (const key of changed) {
|
|
66
|
+
const error = validate(withKey(current, key, values));
|
|
67
|
+
if (error === null) written = withKey(written, key, values);
|
|
68
|
+
else held[key] = error;
|
|
69
|
+
}
|
|
70
|
+
let ids = shadowIds;
|
|
71
|
+
doc.transact(() => {
|
|
72
|
+
const items = applyItemChanges(doc, { data: shadow }, shadowIds, { data: written }, LOCAL_ORIGIN, beforeWrite);
|
|
73
|
+
ids = items.ids;
|
|
74
|
+
const merged = mergeContent({
|
|
75
|
+
kind: 'vxjson',
|
|
76
|
+
base: { type: 'json', data: shadow },
|
|
77
|
+
ours: { type: 'json', data: items.rest.data },
|
|
78
|
+
theirs: { type: 'json', data: readDataValues(doc) },
|
|
79
|
+
}).value;
|
|
80
|
+
const data = typeof merged === 'object' && merged !== null && !Array.isArray(merged) ? merged.data : null;
|
|
81
|
+
// Never reached for a JSON object merge; an empty fallback would wipe the entry.
|
|
82
|
+
if (typeof data !== 'object' || data === null || Array.isArray(data)) throw new Error('merge lost the data');
|
|
83
|
+
applyContentDiff(doc, { data }, LOCAL_ORIGIN);
|
|
84
|
+
}, LOCAL_ORIGIN);
|
|
85
|
+
return { ok: true, held, written, ids };
|
|
86
|
+
} catch (error) {
|
|
87
|
+
return { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The values a form holds unwritten, with their errors and the doc they belong to, by entry (id + locale): a rebind or
|
|
93
|
+
* remount shows them again.
|
|
94
|
+
*/
|
|
95
|
+
const heldByEntry = new Map<string, { values: Values; errors: Record<string, string>; docKey: string }>();
|
|
96
|
+
|
|
97
|
+
/** The view of each replica whose write threw: its unwritten changes, which a remount must show again. */
|
|
98
|
+
const heldViews = new WeakMap<FrameLiveDoc, Values>();
|
|
99
|
+
|
|
100
|
+
/** Some entry holds values the schema rejected; a leave guard counts them as unsaved. */
|
|
101
|
+
export function hasHeldDataValues(): boolean {
|
|
102
|
+
return heldByEntry.size > 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The keys entry `entry` holds unwritten. */
|
|
106
|
+
export function heldDataKeys(entry: string): string[] {
|
|
107
|
+
return Object.keys(heldByEntry.get(entry)?.errors ?? {});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Lets go of the values `entry` (every entry, without one) holds unwritten, in the doc channel too. */
|
|
111
|
+
export function dropHeldDataValues(entry?: string): void {
|
|
112
|
+
const dropped = entry === undefined ? [...heldByEntry.keys()] : [entry];
|
|
113
|
+
for (const key of dropped) {
|
|
114
|
+
const held = heldByEntry.get(key);
|
|
115
|
+
heldByEntry.delete(key);
|
|
116
|
+
if (held) getUIConfig().docChannel?.setValuesHeld(held.docKey, null);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The entries of `ids` for the lists inside data keys `keys`, and the item lists nested in their items. */
|
|
121
|
+
function listsUnder(ids: ItemIds, keys: string[]): ItemIds {
|
|
122
|
+
const out: ItemIds = {};
|
|
123
|
+
const owners = new Set<string>();
|
|
124
|
+
// A list name is the JSON of its owner and path: ['d', '', key, …] for data, ['i', itemId, …] inside an item.
|
|
125
|
+
const inside = (name: string) => {
|
|
126
|
+
const steps: unknown = JSON.parse(name);
|
|
127
|
+
if (!Array.isArray(steps)) return false;
|
|
128
|
+
const [kind, owner, key] = steps;
|
|
129
|
+
return (kind === 'd' && keys.includes(key)) || (kind === 'i' && owners.has(owner));
|
|
130
|
+
};
|
|
131
|
+
for (let size = -1; size !== owners.size; ) {
|
|
132
|
+
size = owners.size;
|
|
133
|
+
for (const [name, listIds] of Object.entries(ids)) {
|
|
134
|
+
if (name in out || !inside(name)) continue;
|
|
135
|
+
out[name] = listIds;
|
|
136
|
+
for (const id of listIds) owners.add(id);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** One form mount's binding to its entry's replica. */
|
|
143
|
+
export interface DataBinding {
|
|
144
|
+
readonly live: FrameLiveDoc;
|
|
145
|
+
/** This user's undo over the entry's data and its lists. */
|
|
146
|
+
readonly undo: Y.UndoManager;
|
|
147
|
+
/** What the form shows: the doc's data with the held values over it. */
|
|
148
|
+
readonly values: Values;
|
|
149
|
+
/** The held keys' errors. */
|
|
150
|
+
readonly errors: Record<string, string>;
|
|
151
|
+
/** The form's onChange. A write that throws holds the replica; from then on the form keeps every change unwritten. */
|
|
152
|
+
change(values: Values): void;
|
|
153
|
+
/** The values to show after a change the form did not make, or null while held (the form stays as the user left it). */
|
|
154
|
+
reseed(): Values | null;
|
|
155
|
+
/** Marks the form mounted; the returned release lets go of the doc once no mount is left (see `ListUndo.retain`). */
|
|
156
|
+
retain(): () => void;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** `entry` names the entry and locale, so held values outlive this binding (see `heldByEntry`). */
|
|
160
|
+
export function createDataBinding(live: FrameLiveDoc, validate: ValidateData, entry: string): DataBinding {
|
|
161
|
+
let shadow = readDataValues(live.doc);
|
|
162
|
+
let shadowIds = readItemIds(live.doc);
|
|
163
|
+
let view = heldViews.get(live) ?? { ...shadow, ...heldByEntry.get(entry)?.values };
|
|
164
|
+
const listUndo = createListUndo(live.doc, ['data']);
|
|
165
|
+
const report = () => {
|
|
166
|
+
const errors = heldByEntry.get(entry)?.errors;
|
|
167
|
+
const message = errors ? `Not saved, not valid: ${Object.keys(errors).join(', ')}` : null;
|
|
168
|
+
getUIConfig().docChannel?.setValuesHeld(live.docKey, message);
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
live,
|
|
172
|
+
get undo() {
|
|
173
|
+
return listUndo.undo;
|
|
174
|
+
},
|
|
175
|
+
retain: () => listUndo.retain(),
|
|
176
|
+
get values() {
|
|
177
|
+
return view;
|
|
178
|
+
},
|
|
179
|
+
get errors() {
|
|
180
|
+
return heldByEntry.get(entry)?.errors ?? {};
|
|
181
|
+
},
|
|
182
|
+
change(next) {
|
|
183
|
+
view = next;
|
|
184
|
+
if (live.held) {
|
|
185
|
+
heldViews.set(live, next);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const written = writeDataValues(live.doc, shadow, shadowIds, next, validate, (names) => listUndo.track(names));
|
|
189
|
+
if (!written.ok) {
|
|
190
|
+
console.error('[live] could not write a data change', written.error);
|
|
191
|
+
heldViews.set(live, next);
|
|
192
|
+
live.hold(HELD_WRITE_FAILED);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
shadow = written.written;
|
|
196
|
+
shadowIds = written.ids;
|
|
197
|
+
const keys = Object.keys(written.held);
|
|
198
|
+
if (keys.length === 0) heldByEntry.delete(entry);
|
|
199
|
+
else
|
|
200
|
+
heldByEntry.set(entry, {
|
|
201
|
+
values: Object.fromEntries(keys.map((key) => [key, next[key]])),
|
|
202
|
+
errors: written.held,
|
|
203
|
+
docKey: live.docKey,
|
|
204
|
+
});
|
|
205
|
+
report();
|
|
206
|
+
},
|
|
207
|
+
reseed() {
|
|
208
|
+
if (live.held) return null;
|
|
209
|
+
const doc = readDataValues(live.doc);
|
|
210
|
+
const keys = heldDataKeys(entry);
|
|
211
|
+
// A held key stays at the base it was held over, with its ids: once fixed, its write diffs from what the user
|
|
212
|
+
// was shown, so it keeps whatever a teammate put into it meanwhile.
|
|
213
|
+
const ids = listsUnder(shadowIds, keys);
|
|
214
|
+
shadow = keys.reduce((out, key) => withKey(out, key, shadow), doc);
|
|
215
|
+
shadowIds = { ...readItemIds(live.doc), ...ids };
|
|
216
|
+
view = { ...doc, ...heldByEntry.get(entry)?.values };
|
|
217
|
+
return view;
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The form's values over the replica `live` of entry `entry` (id + locale): `change` writes valid keys at once and
|
|
224
|
+
* holds the rest, and a change made elsewhere re-renders with the doc's values, held keys kept.
|
|
225
|
+
*/
|
|
226
|
+
export function useLiveDataValues(live: FrameLiveDoc, validate: ValidateData, entry: string): LiveDataValues {
|
|
227
|
+
const latest = useRef(validate);
|
|
228
|
+
latest.current = validate;
|
|
229
|
+
const binding = useMemo(() => createDataBinding(live, (values) => latest.current(values), entry), [live, entry]);
|
|
230
|
+
const [, rerender] = useReducer((count: number) => count + 1, 0);
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
const onTransaction = (transaction: Y.Transaction) => {
|
|
233
|
+
if (transaction.origin !== LOCAL_ORIGIN && binding.reseed()) rerender();
|
|
234
|
+
};
|
|
235
|
+
live.doc.on('afterTransaction', onTransaction);
|
|
236
|
+
const stopKeys = interceptUndoKeys([window], binding.undo);
|
|
237
|
+
const release = binding.retain();
|
|
238
|
+
return () => {
|
|
239
|
+
live.doc.off('afterTransaction', onTransaction);
|
|
240
|
+
stopKeys();
|
|
241
|
+
release();
|
|
242
|
+
};
|
|
243
|
+
}, [binding, live]);
|
|
244
|
+
return {
|
|
245
|
+
values: binding.values,
|
|
246
|
+
errors: binding.errors,
|
|
247
|
+
change: (values) => {
|
|
248
|
+
binding.change(values);
|
|
249
|
+
rerender();
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|