@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
|
@@ -14,6 +14,7 @@ import { useProbedHostStyles } from '../../host-style-probe.js';
|
|
|
14
14
|
import { isJsxDescriptor, toJsxComponentDescriptor, useMdxComponents } from '../../mdx-components.js';
|
|
15
15
|
import { prepareImageUpload } from '../../media/prepare-image-upload.js';
|
|
16
16
|
import { deriveProseSurfaceStyles } from '../../prose-surface-css.js';
|
|
17
|
+
import { useSiteRender } from '../../site-render.js';
|
|
17
18
|
import {
|
|
18
19
|
type SiteStyles,
|
|
19
20
|
useEditorStyles,
|
|
@@ -24,20 +25,26 @@ import {
|
|
|
24
25
|
} from '../../site-styles.js';
|
|
25
26
|
import { getUIConfig, inEditorFrame } from '../../ui-config.js';
|
|
26
27
|
import { assetRefOf } from '../../utils/asset-url.js';
|
|
28
|
+
import { bodySyncPlugin } from './body-sync-plugin.js';
|
|
27
29
|
import { draftImagePreview } from './draft-media-config.js';
|
|
30
|
+
import { FragmentBlockTypeSelect } from './FragmentBlockTypeSelect.js';
|
|
31
|
+
import { FragmentComponentBlock } from './FragmentComponentBlock.js';
|
|
28
32
|
import { GenericBlock } from './GenericBlock.js';
|
|
29
33
|
import { hostWrapperPlugin } from './host-wrapper-plugin.js';
|
|
30
34
|
import { ImagePickerDialog } from './ImagePickerDialog.js';
|
|
31
35
|
import { InsertMdxComponentButton } from './insert-menu/InsertMdxComponentButton.js';
|
|
32
36
|
import { mdxComponentsPlugin } from './insert-menu/mdx-components-plugin.js';
|
|
37
|
+
import { jsxLayoutPlugin } from './jsx-layout-plugin.js';
|
|
38
|
+
import { FragmentModeContext, offeredMdxComponents } from './offered-mdx-components.js';
|
|
39
|
+
import { softBreakPlugin } from './soft-break-plugin.js';
|
|
33
40
|
|
|
34
41
|
const EDITOR_CSS: string = import.meta.env.CONLOCA_EDITOR_CSS || '';
|
|
35
42
|
|
|
36
43
|
export interface CMSMDXEditorProps
|
|
37
44
|
extends Omit<
|
|
38
45
|
BaseMDXEditorProps,
|
|
46
|
+
| 'blockTypeSelect'
|
|
39
47
|
| 'disableImageSettingsButton'
|
|
40
|
-
| 'extraPlugins'
|
|
41
48
|
| 'extraToolbarItems'
|
|
42
49
|
| 'imageButtonRef'
|
|
43
50
|
| 'imageDialog'
|
|
@@ -52,210 +59,243 @@ export interface CMSMDXEditorProps
|
|
|
52
59
|
* to the static `editorStyles` registry if unset or the fetch fails.
|
|
53
60
|
*/
|
|
54
61
|
previewRouteUrl?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Edit a fragment: offer only the site's fragment vocabulary, render each component with the site's own component
|
|
64
|
+
* while typing (no `/api/render`), and insert components without imports.
|
|
65
|
+
*/
|
|
66
|
+
fragment?: boolean;
|
|
55
67
|
}
|
|
56
68
|
|
|
57
|
-
export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const staticEditorStyles = useEditorStyles();
|
|
80
|
-
// Probe the host's computed styles for each prose tag from the
|
|
81
|
-
// actual live page and synthesize a stylesheet scoped to the
|
|
82
|
-
// editor's contenteditable. This catches what the wrapper auto-
|
|
83
|
-
// copy misses: utility-class-styled elements (Tailwind utility-
|
|
84
|
-
// first), inline `style` attributes, and any other styling that
|
|
85
|
-
// resolves to computed values but isn't reachable via a wrapper-
|
|
86
|
-
// and-descendant cascade. The probe takes the discovered wrapper
|
|
87
|
-
// class so it queries the same element inside the iframe — avoids
|
|
88
|
-
// duplicate find-wrapper logic. `css` is empty while the probe is in
|
|
89
|
-
// flight AND when the page has nothing probable; gate fallbacks on
|
|
90
|
-
// `settled`, not on the empty string alone, or the derived tier
|
|
91
|
-
// paints first and flips when the probe lands.
|
|
92
|
-
// Discover the host page's content-root shape (eg `<article class="card">`
|
|
93
|
-
// on Starlight) AND its code-block chrome wrapper (eg `<div class=
|
|
94
|
-
// "expressive-code">`). The editor wraps its contenteditable in a clone
|
|
95
|
-
// of `content` via `hostWrapperPlugin`, so host CSS paints the prose
|
|
96
|
-
// surface naturally. It also threads `codeBlock` through to the
|
|
97
|
-
// code-block frame component (in @conloca/mdx) so it can carry the host's
|
|
98
|
-
// code-block classes and inherit the host's code-block CSS the same way.
|
|
99
|
-
const fetchedWrappers = useFetchedHostWrappers(devServerRouteUrl);
|
|
100
|
-
// Editor and published page maintain independent theme preferences
|
|
101
|
-
// (CMS SPA → `conloca-theme`; Starlight → `starlight-theme`). The
|
|
102
|
-
// probe needs to capture styles in the EDITOR's current scheme, not
|
|
103
|
-
// the published page's, so we pass our resolved theme through. When
|
|
104
|
-
// the user toggles theme inside the editor, the hook's dep on
|
|
105
|
-
// `theme` re-runs the probe and the new computed values land.
|
|
106
|
-
const { resolvedTheme } = useTheme();
|
|
107
|
-
const probe = useProbedHostStyles(previewRouteUrl, fetchedWrappers.content?.className ?? null, {
|
|
108
|
-
theme: resolvedTheme,
|
|
109
|
-
discover: inFrame,
|
|
110
|
-
});
|
|
111
|
-
const { css: probedStyles, settled: probeSettled } = probe;
|
|
112
|
-
// The route's own CSS and wrappers: from the dev endpoints locally, from the
|
|
113
|
-
// page the probe loaded in a frame.
|
|
114
|
-
const routeStyles = inFrame ? probe.styles : fetchedStyles;
|
|
115
|
-
const hostWrappers = inFrame ? probe.wrappers : fetchedWrappers;
|
|
116
|
-
// First tier with content wins: live discovery, then the manually-configured
|
|
117
|
-
// path.
|
|
118
|
-
const activeStyles = routeStyles.length > 0 ? routeStyles : staticEditorStyles;
|
|
119
|
-
// The editor mounts directly in the parent SPA's React tree, so the broad
|
|
120
|
-
// stylesheet is confined to `.conloca-mdx-editor-surround` below. The
|
|
121
|
-
// content still receives the site's complete cascade while adjacent admin
|
|
122
|
-
// chrome keeps its own tokens and utilities.
|
|
123
|
-
//
|
|
124
|
-
// The host can also append raw CSS via the integration's `editorCSS`
|
|
125
|
-
// option (see `ConlocaCMSOptions`) — concatenated AFTER auto-
|
|
126
|
-
// discovered styles so it sits later in the same cascade layer and
|
|
127
|
-
// wins on tie-breaks. Empty string when the host didn't set it; no
|
|
128
|
-
// marker `<style>` is emitted for the no-op case.
|
|
129
|
-
const editorCss = getUIConfig().editorCss ?? EDITOR_CSS;
|
|
130
|
-
const styleStack = useMemo<SiteStyles>(
|
|
131
|
-
() => (editorCss ? [...activeStyles, editorCss] : activeStyles),
|
|
132
|
-
[activeStyles, editorCss],
|
|
133
|
-
);
|
|
134
|
-
const probedStack = useMemo<SiteStyles>(() => (probedStyles ? [probedStyles] : []), [probedStyles]);
|
|
135
|
-
// Injected here, AFTER the probe has been read, so the bridge inside this
|
|
136
|
-
// hook can be gated on it. Head order is unchanged: this tier still lands
|
|
137
|
-
// before `conloca-host-defaults` below, and the two never compete anyway —
|
|
138
|
-
// this one is layered, that one deliberately is not.
|
|
139
|
-
//
|
|
140
|
-
// `bridgeHostVars` is the gate. Both this bridge and the probe publish the
|
|
141
|
-
// same `--conloca-host-*` typography contract, and this one writes inline
|
|
142
|
-
// properties on `<html>` while the probe emits a `:root` rule — so without
|
|
143
|
-
// the gate the bridge would outrank the probe purely because inline beats a
|
|
144
|
-
// stylesheet. The probe reads the REAL rendered page; it must win wherever
|
|
145
|
-
// it works, which is every editor served by the site's dev server. The bridge
|
|
146
|
-
// is the fallback where the probe cannot run at all (a site on a different
|
|
147
|
-
// origin from the editor, or a production build with no dev server).
|
|
148
|
-
useInjectHostStyles('conloca-host-preview', styleStack, {
|
|
149
|
-
scopeSelector: '.conloca-mdx-editor-surround',
|
|
150
|
-
// Fallback bridge only after the probe has settled empty. While the
|
|
151
|
-
// probe is in flight, leave the contract unset rather than publishing
|
|
152
|
-
// derived vars that the probe will immediately overwrite.
|
|
153
|
-
bridgeHostVars: probeSettled && probedStyles === '',
|
|
154
|
-
});
|
|
155
|
-
useInjectHostStyles('conloca-host-defaults', probedStack, { layered: false });
|
|
156
|
-
// Production styles tier: prose-safe rules derived from the siteStyles
|
|
157
|
-
// registry (the siteStyles option's CSS) plus a paper base. Fallback ONLY —
|
|
158
|
-
// when the discovery endpoint delivered (dev server), this stays empty so
|
|
159
|
-
// discovery-styled surfaces keep their host-painted look, paper included.
|
|
160
|
-
// Unlayered for the same reason as the probe stack: the editor's default
|
|
161
|
-
// prose scale is unlayered and would beat any layered override.
|
|
162
|
-
const siteStyles = useSiteStyles();
|
|
163
|
-
const proseSurface = useMemo<SiteStyles>(
|
|
164
|
-
// Derived from the siteStyles registry, the host CSS the surface shows.
|
|
69
|
+
export const CMSMDXEditor = forwardRef<MDXEditorMethods, CMSMDXEditorProps>(
|
|
70
|
+
({ previewRouteUrl, fragment = false, ...props }, ref) => {
|
|
71
|
+
const insertImageRef = useRef<HTMLButtonElement>(null);
|
|
72
|
+
const uploadAsset = useUploadAsset();
|
|
73
|
+
const { vocabulary } = useSiteRender();
|
|
74
|
+
const registered = useMdxComponents();
|
|
75
|
+
const registeredMdxComponents = useMemo(
|
|
76
|
+
() => offeredMdxComponents(registered, fragment ? vocabulary : undefined),
|
|
77
|
+
[registered, fragment, vocabulary],
|
|
78
|
+
);
|
|
79
|
+
// Style injection has two paths:
|
|
80
|
+
//
|
|
81
|
+
// 1. `useFetchedSiteStyles(previewRouteUrl)` — auto-discovery. When a
|
|
82
|
+
// route URL is provided, ask the integration for that route's full
|
|
83
|
+
// effective CSS (Tailwind, theme, scoped styles) so the editor
|
|
84
|
+
// matches the published page without the host curating a list.
|
|
85
|
+
// 2. `useEditorStyles()` — the original, manually-configured narrow path.
|
|
86
|
+
// Fallback when no route URL is available or the fetch fails.
|
|
87
|
+
//
|
|
88
|
+
// Full host CSS must stay inside the editor surface. Site styles often
|
|
89
|
+
// contain bare `h1`, `button`, and Tailwind reset rules that would otherwise
|
|
90
|
+
// restyle the admin header and any host app around it.
|
|
165
91
|
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
//
|
|
92
|
+
// Inside a parent frame the dev-server endpoints do not exist, so the
|
|
93
|
+
// probe's load of the real page stands in for them (see `routeStyles`).
|
|
94
|
+
const inFrame = inEditorFrame();
|
|
95
|
+
const devServerRouteUrl = inFrame ? undefined : previewRouteUrl;
|
|
96
|
+
const fetchedStyles = useFetchedSiteStyles(devServerRouteUrl);
|
|
97
|
+
const staticEditorStyles = useEditorStyles();
|
|
98
|
+
// Probe the host's computed styles for each prose tag from the
|
|
99
|
+
// actual live page and synthesize a stylesheet scoped to the
|
|
100
|
+
// editor's contenteditable. This catches what the wrapper auto-
|
|
101
|
+
// copy misses: utility-class-styled elements (Tailwind utility-
|
|
102
|
+
// first), inline `style` attributes, and any other styling that
|
|
103
|
+
// resolves to computed values but isn't reachable via a wrapper-
|
|
104
|
+
// and-descendant cascade. The probe takes the discovered wrapper
|
|
105
|
+
// class so it queries the same element inside the iframe — avoids
|
|
106
|
+
// duplicate find-wrapper logic. `css` is empty while the probe is in
|
|
107
|
+
// flight AND when the page has nothing probable; gate fallbacks on
|
|
108
|
+
// `settled`, not on the empty string alone, or the derived tier
|
|
109
|
+
// paints first and flips when the probe lands.
|
|
110
|
+
// Discover the host page's content-root shape (eg `<article class="card">`
|
|
111
|
+
// on Starlight) AND its code-block chrome wrapper (eg `<div class=
|
|
112
|
+
// "expressive-code">`). The editor wraps its contenteditable in a clone
|
|
113
|
+
// of `content` via `hostWrapperPlugin`, so host CSS paints the prose
|
|
114
|
+
// surface naturally. It also threads `codeBlock` through to the
|
|
115
|
+
// code-block frame component (in @conloca/mdx) so it can carry the host's
|
|
116
|
+
// code-block classes and inherit the host's code-block CSS the same way.
|
|
117
|
+
const fetchedWrappers = useFetchedHostWrappers(devServerRouteUrl);
|
|
118
|
+
// Editor and published page maintain independent theme preferences
|
|
119
|
+
// (CMS SPA → `conloca-theme`; Starlight → `starlight-theme`). The
|
|
120
|
+
// probe needs to capture styles in the EDITOR's current scheme, not
|
|
121
|
+
// the published page's, so we pass our resolved theme through. When
|
|
122
|
+
// the user toggles theme inside the editor, the hook's dep on
|
|
123
|
+
// `theme` re-runs the probe and the new computed values land.
|
|
124
|
+
const { resolvedTheme } = useTheme();
|
|
125
|
+
const probe = useProbedHostStyles(previewRouteUrl, fetchedWrappers.content?.className ?? null, {
|
|
126
|
+
theme: resolvedTheme,
|
|
127
|
+
discover: inFrame,
|
|
128
|
+
});
|
|
129
|
+
const { css: probedStyles, settled: probeSettled } = probe;
|
|
130
|
+
// The route's own CSS and wrappers: from the dev endpoints locally, from the
|
|
131
|
+
// page the probe loaded in a frame.
|
|
132
|
+
const routeStyles = inFrame ? probe.styles : fetchedStyles;
|
|
133
|
+
const hostWrappers = inFrame ? probe.wrappers : fetchedWrappers;
|
|
134
|
+
// First tier with content wins: live discovery, then the manually-configured
|
|
135
|
+
// path.
|
|
136
|
+
const activeStyles = routeStyles.length > 0 ? routeStyles : staticEditorStyles;
|
|
137
|
+
// The editor mounts directly in the parent SPA's React tree, so the broad
|
|
138
|
+
// stylesheet is confined to `.conloca-mdx-editor-surround` below. The
|
|
139
|
+
// content still receives the site's complete cascade while adjacent admin
|
|
140
|
+
// chrome keeps its own tokens and utilities.
|
|
173
141
|
//
|
|
174
|
-
// The
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
//
|
|
142
|
+
// The host can also append raw CSS via the integration's `editorCSS`
|
|
143
|
+
// option (see `ConlocaCMSOptions`) — concatenated AFTER auto-
|
|
144
|
+
// discovered styles so it sits later in the same cascade layer and
|
|
145
|
+
// wins on tie-breaks. Empty string when the host didn't set it; no
|
|
146
|
+
// marker `<style>` is emitted for the no-op case.
|
|
147
|
+
const editorCss = getUIConfig().editorCss ?? EDITOR_CSS;
|
|
148
|
+
const styleStack = useMemo<SiteStyles>(
|
|
149
|
+
() => (editorCss ? [...activeStyles, editorCss] : activeStyles),
|
|
150
|
+
[activeStyles, editorCss],
|
|
151
|
+
);
|
|
152
|
+
const probedStack = useMemo<SiteStyles>(() => (probedStyles ? [probedStyles] : []), [probedStyles]);
|
|
153
|
+
// Injected here, AFTER the probe has been read, so the bridge inside this
|
|
154
|
+
// hook can be gated on it. Head order is unchanged: this tier still lands
|
|
155
|
+
// before `conloca-host-defaults` below, and the two never compete anyway —
|
|
156
|
+
// this one is layered, that one deliberately is not.
|
|
186
157
|
//
|
|
187
|
-
// `
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
158
|
+
// `bridgeHostVars` is the gate. Both this bridge and the probe publish the
|
|
159
|
+
// same `--conloca-host-*` typography contract, and this one writes inline
|
|
160
|
+
// properties on `<html>` while the probe emits a `:root` rule — so without
|
|
161
|
+
// the gate the bridge would outrank the probe purely because inline beats a
|
|
162
|
+
// stylesheet. The probe reads the REAL rendered page; it must win wherever
|
|
163
|
+
// it works, which is every editor served by the site's dev server. The bridge
|
|
164
|
+
// is the fallback where the probe cannot run at all (a site on a different
|
|
165
|
+
// origin from the editor, or a production build with no dev server).
|
|
166
|
+
useInjectHostStyles('conloca-host-preview', styleStack, {
|
|
167
|
+
scopeSelector: '.conloca-mdx-editor-surround',
|
|
168
|
+
// Fallback bridge only after the probe has settled empty. While the
|
|
169
|
+
// probe is in flight, leave the contract unset rather than publishing
|
|
170
|
+
// derived vars that the probe will immediately overwrite.
|
|
171
|
+
bridgeHostVars: probeSettled && probedStyles === '',
|
|
172
|
+
});
|
|
173
|
+
useInjectHostStyles('conloca-host-defaults', probedStack, { layered: false });
|
|
174
|
+
// Production styles tier: prose-safe rules derived from the siteStyles
|
|
175
|
+
// registry (the siteStyles option's CSS) plus a paper base. Fallback ONLY —
|
|
176
|
+
// when the discovery endpoint delivered (dev server), this stays empty so
|
|
177
|
+
// discovery-styled surfaces keep their host-painted look, paper included.
|
|
178
|
+
// Unlayered for the same reason as the probe stack: the editor's default
|
|
179
|
+
// prose scale is unlayered and would beat any layered override.
|
|
180
|
+
const siteStyles = useSiteStyles();
|
|
181
|
+
const proseSurface = useMemo<SiteStyles>(
|
|
182
|
+
// Derived from the siteStyles registry, the host CSS the surface shows.
|
|
183
|
+
//
|
|
184
|
+
// It must run ALONGSIDE the layered host CSS, not instead of it. That CSS is
|
|
185
|
+
// injected into a cascade LAYER, the editor's default prose scale is
|
|
186
|
+
// unlayered, and layered always loses to unlayered — so the layered tier
|
|
187
|
+
// alone cannot restore heading metrics. This tier is the prose-scoped subset that is safe to
|
|
188
|
+
// inject unlayered, which is what actually beats the defaults. Live
|
|
189
|
+
// discovery is the exception: it ships the computed-style probe, itself
|
|
190
|
+
// unlayered and better at the same job.
|
|
191
|
+
//
|
|
192
|
+
// The discovered wrapper class goes in as a second scope root. Host themes
|
|
193
|
+
// scope prose to their OWN wrapper class (`.sl-markdown-content`), never to
|
|
194
|
+
// `.conloca-prose`, so filtering on the Conloca class alone yielded an
|
|
195
|
+
// empty tier on every real site. `hostWrapperPlugin` renders a clone of
|
|
196
|
+
// that wrapper around the contenteditable, so those selectors match here.
|
|
197
|
+
// Gated on the probe as well as on live discovery. Both this tier and the
|
|
198
|
+
// probe inject UNLAYERED, and for a heading they land on equal specificity
|
|
199
|
+
// — `.conloca-prose--editor h2` (0,1,1) against
|
|
200
|
+
// `.sl-markdown-content h2:not(:where(…))` (0,1,1), since `:not(:where())`
|
|
201
|
+
// contributes nothing — so whichever is later in head order wins, and that
|
|
202
|
+
// is this tier. Without this gate a working probe would be a measurable
|
|
203
|
+
// no-op wherever a host sets siteStyles.
|
|
204
|
+
//
|
|
205
|
+
// `probeSettled` is the load-bearing half of the gate. `probedStyles === ''`
|
|
206
|
+
// alone is true on the initial render (probe still in flight) AND after a
|
|
207
|
+
// definitive empty failure, so gating only on the string paints this tier
|
|
208
|
+
// first, then tears it down when the probe lands — a visible flash on
|
|
209
|
+
// every editor open that relies on siteStyles. Hold the tier
|
|
210
|
+
// until the probe has resolved once; only then, if it settled empty, fill in
|
|
211
|
+
// with derived rules.
|
|
212
|
+
() =>
|
|
213
|
+
routeStyles.length === 0 && probeSettled && probedStyles === ''
|
|
214
|
+
? deriveProseSurfaceStyles(siteStyles, hostWrappers.content?.className)
|
|
215
|
+
: [],
|
|
216
|
+
[routeStyles, probeSettled, probedStyles, siteStyles, hostWrappers],
|
|
217
|
+
);
|
|
218
|
+
useInjectHostStyles('conloca-prose-surface', proseSurface, { layered: false });
|
|
219
|
+
// Recompose the plugins list whenever the wrappers change so the plugin
|
|
220
|
+
// re-runs its `update` and the wrapper component refreshes inside the
|
|
221
|
+
// editor. The hostWrapperPlugin's renderers read reactively from their
|
|
222
|
+
// own Cells, so we DON'T need to remount the entire editor for this.
|
|
223
|
+
// The caller's plugins (co-editing) come after the editor's own.
|
|
224
|
+
const extraPlugins = useMemo<RealmPlugin[]>(
|
|
225
|
+
() => [
|
|
226
|
+
jsxLayoutPlugin(),
|
|
227
|
+
mdxComponentsPlugin(),
|
|
228
|
+
softBreakPlugin(),
|
|
229
|
+
bodySyncPlugin(),
|
|
230
|
+
hostWrapperPlugin({ wrapper: hostWrappers.content, codeBlockWrapper: hostWrappers.codeBlock }),
|
|
231
|
+
...(props.extraPlugins ?? []),
|
|
232
|
+
],
|
|
233
|
+
[hostWrappers, props.extraPlugins],
|
|
234
|
+
);
|
|
235
|
+
const jsxComponentDescriptors = useMemo<JsxComponentDescriptor[]>(
|
|
236
|
+
// Filter to JSX flavors before translating — snippets live in the same
|
|
237
|
+
// registry but aren't valid input for @mdxeditor/editor's jsxPlugin, and
|
|
238
|
+
// toJsxComponentDescriptor throws if handed one to surface the misuse.
|
|
239
|
+
() =>
|
|
240
|
+
registeredMdxComponents.filter(isJsxDescriptor).map((descriptor) =>
|
|
241
|
+
fragment
|
|
242
|
+
? toJsxComponentDescriptor({ ...descriptor, Editor: undefined }, FragmentComponentBlock, {
|
|
243
|
+
withImport: false,
|
|
244
|
+
})
|
|
245
|
+
: toJsxComponentDescriptor(descriptor, GenericBlock),
|
|
246
|
+
),
|
|
247
|
+
[registeredMdxComponents, fragment],
|
|
248
|
+
);
|
|
249
|
+
const blockTypeSelect = useMemo(
|
|
250
|
+
() =>
|
|
251
|
+
fragment ? (
|
|
252
|
+
<FragmentBlockTypeSelect
|
|
253
|
+
components={registeredMdxComponents.filter(isJsxDescriptor).filter((d) => d.blockType)}
|
|
254
|
+
/>
|
|
255
|
+
) : undefined,
|
|
256
|
+
[registeredMdxComponents, fragment],
|
|
257
|
+
);
|
|
222
258
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
259
|
+
// Wire paste/drop image uploads to the same backend mutation that powers
|
|
260
|
+
// the asset library's UploadModal. The library expects a Promise<string>
|
|
261
|
+
// resolving to the image src; we hand back the link `assetRefOf` stores,
|
|
262
|
+
// so it round-trips identically to a path picked from the asset browser.
|
|
263
|
+
const imageUploadHandler = useCallback(
|
|
264
|
+
async (file: File) => {
|
|
265
|
+
const formData = buildUploadFormData(await prepareImageUpload(file, DEFAULT_MAX_FILE_SIZE), undefined, '/');
|
|
266
|
+
const asset = await uploadAsset.mutateAsync(formData);
|
|
267
|
+
return assetRefOf(asset);
|
|
268
|
+
},
|
|
269
|
+
[uploadAsset],
|
|
270
|
+
);
|
|
235
271
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
272
|
+
return (
|
|
273
|
+
<FragmentModeContext.Provider value={fragment}>
|
|
274
|
+
<BaseMDXEditor
|
|
275
|
+
ref={ref}
|
|
276
|
+
{...props}
|
|
277
|
+
imageDialog={ImagePickerDialog}
|
|
278
|
+
disableImageSettingsButton={true}
|
|
279
|
+
imageButtonRef={insertImageRef}
|
|
280
|
+
imageUploadHandler={imageUploadHandler}
|
|
281
|
+
// The site does not serve branch drafts: draft images show their loaded bytes, draft addresses a placeholder until then.
|
|
282
|
+
imagePreviewHandler={draftImagePreview}
|
|
283
|
+
jsxComponentDescriptors={jsxComponentDescriptors}
|
|
284
|
+
extraPlugins={extraPlugins}
|
|
285
|
+
extraToolbarItems={<InsertMdxComponentButton />}
|
|
286
|
+
blockTypeSelect={blockTypeSelect}
|
|
287
|
+
onImageShortcut={() => {
|
|
288
|
+
if (insertImageRef.current) {
|
|
289
|
+
insertImageRef.current.click();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
254
292
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
293
|
+
console.warn('[CMSMDXEditor] InsertImage ref not attached - toolbar may not be rendered');
|
|
294
|
+
}}
|
|
295
|
+
/>
|
|
296
|
+
</FragmentModeContext.Provider>
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
);
|
|
260
300
|
|
|
261
301
|
CMSMDXEditor.displayName = 'CMSMDXEditor';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type EditorFrame, useSiteRender } from '../../site-render.js';
|
|
3
|
+
import { getUIConfig } from '../../ui-config.js';
|
|
4
|
+
|
|
5
|
+
/** The page on the canvas, for the editor frame; provided by `PageEditor`, read inside Puck's iframe override. */
|
|
6
|
+
export const CanvasPageContext = React.createContext<{ pathname: string; collection: string | undefined }>({
|
|
7
|
+
pathname: '/',
|
|
8
|
+
collection: undefined,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/** Errors thrown by the page inside a frame, so the frame's boundary passes them on instead of blaming the frame. */
|
|
12
|
+
const pageErrors = new WeakSet();
|
|
13
|
+
|
|
14
|
+
interface PageErrorTagState {
|
|
15
|
+
error: object | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Tags an error from the page's own blocks, then rethrows it to the boundaries above. */
|
|
19
|
+
class PageErrorTag extends React.Component<{ children: React.ReactNode }, PageErrorTagState> {
|
|
20
|
+
override state: PageErrorTagState = { error: undefined };
|
|
21
|
+
|
|
22
|
+
static getDerivedStateFromError(error: unknown): PageErrorTagState {
|
|
23
|
+
// A thrown primitive cannot sit in a WeakSet, so it is wrapped once in an Error that reads as the primitive; an
|
|
24
|
+
// already-tagged error passes as is.
|
|
25
|
+
const tagged = typeof error === 'object' && error !== null ? error : new Error(String(error));
|
|
26
|
+
pageErrors.add(tagged);
|
|
27
|
+
return { error: tagged };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override render() {
|
|
31
|
+
if (this.state.error !== undefined) throw this.state.error;
|
|
32
|
+
return this.props.children;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface FrameErrorBoundaryState {
|
|
37
|
+
error: unknown;
|
|
38
|
+
failed: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const isPageError = (error: unknown) => typeof error === 'object' && error !== null && pageErrors.has(error);
|
|
42
|
+
|
|
43
|
+
/** Renders the page bare once the site's frame throws, naming the route in one error; page errors pass through. */
|
|
44
|
+
class FrameErrorBoundary extends React.Component<
|
|
45
|
+
{ route: string; Frame: EditorFrame; pathname: string; children: React.ReactNode },
|
|
46
|
+
FrameErrorBoundaryState
|
|
47
|
+
> {
|
|
48
|
+
override state: FrameErrorBoundaryState = { error: undefined, failed: false };
|
|
49
|
+
|
|
50
|
+
static getDerivedStateFromError(error: unknown) {
|
|
51
|
+
return isPageError(error) ? { error } : { error: undefined, failed: true };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override componentDidCatch(error: unknown) {
|
|
55
|
+
if (isPageError(error)) return;
|
|
56
|
+
console.error(
|
|
57
|
+
`[conloca] The editor frame of route '${this.props.route}' failed; showing the page unframed.`,
|
|
58
|
+
error,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
override componentDidUpdate(previous: { Frame: EditorFrame }) {
|
|
63
|
+
// A replaced frame (HMR) gets another try.
|
|
64
|
+
if (previous.Frame !== this.props.Frame && this.state.failed) this.setState({ failed: false });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override render() {
|
|
68
|
+
const { Frame, pathname, children } = this.props;
|
|
69
|
+
if (this.state.error !== undefined) throw this.state.error;
|
|
70
|
+
// Still tagged once the frame failed, so later page errors pass on instead of counting as frame failures.
|
|
71
|
+
if (this.state.failed) return <PageErrorTag>{children}</PageErrorTag>;
|
|
72
|
+
return (
|
|
73
|
+
<Frame pathname={pathname}>
|
|
74
|
+
<div data-conloca-page-root="">
|
|
75
|
+
<PageErrorTag>{children}</PageErrorTag>
|
|
76
|
+
</div>
|
|
77
|
+
</Frame>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The page inside `Frame`, around the published page's `data-conloca-page-root` marker; bare if the frame throws. */
|
|
83
|
+
export function FramedContent({
|
|
84
|
+
route,
|
|
85
|
+
Frame,
|
|
86
|
+
pathname,
|
|
87
|
+
children,
|
|
88
|
+
}: {
|
|
89
|
+
route: string;
|
|
90
|
+
Frame: EditorFrame;
|
|
91
|
+
pathname: string;
|
|
92
|
+
children: React.ReactNode;
|
|
93
|
+
}) {
|
|
94
|
+
return (
|
|
95
|
+
<FrameErrorBoundary route={route} Frame={Frame} pathname={pathname}>
|
|
96
|
+
{children}
|
|
97
|
+
</FrameErrorBoundary>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Shows the page inside the editor frame of the first routing entry serving its collection; bare when no entry or
|
|
103
|
+
* frame applies.
|
|
104
|
+
*/
|
|
105
|
+
export function EditorFrameBoundary({ children }: { children: React.ReactNode }) {
|
|
106
|
+
const { pathname, collection } = React.useContext(CanvasPageContext);
|
|
107
|
+
const { frames } = useSiteRender();
|
|
108
|
+
const route = getUIConfig().dataBindings?.entries?.find((e) => e.collection === collection)?.frame;
|
|
109
|
+
const Frame = route === undefined ? undefined : frames[route];
|
|
110
|
+
if (route === undefined || Frame === undefined) return <>{children}</>;
|
|
111
|
+
return (
|
|
112
|
+
<FramedContent route={route} Frame={Frame} pathname={pathname}>
|
|
113
|
+
{children}
|
|
114
|
+
</FramedContent>
|
|
115
|
+
);
|
|
116
|
+
}
|