@conloca/cms-spa 0.1.16 → 0.2.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/README.md +1 -1
- package/dist/spa/main.css +3725 -3781
- package/dist/ts/App.d.ts +35 -0
- package/dist/ts/App.d.ts.map +1 -0
- package/dist/ts/App.js +53 -0
- package/dist/ts/App.js.map +1 -0
- package/dist/ts/CmsSpaApp.d.ts +13 -0
- package/dist/ts/CmsSpaApp.d.ts.map +1 -0
- package/dist/ts/CmsSpaApp.js +50 -0
- package/dist/ts/CmsSpaApp.js.map +1 -0
- package/dist/ts/components/CMSDashboard.d.ts +2 -0
- package/dist/ts/components/CMSDashboard.d.ts.map +1 -0
- package/dist/ts/components/CMSDashboard.js +21 -0
- package/dist/ts/components/CMSDashboard.js.map +1 -0
- package/dist/ts/components/CMSLayout.d.ts +2 -0
- package/dist/ts/components/CMSLayout.d.ts.map +1 -0
- package/dist/ts/components/CMSLayout.js +15 -0
- package/dist/ts/components/CMSLayout.js.map +1 -0
- package/dist/ts/components/ConlocaLogo.d.ts +2 -0
- package/dist/ts/components/ConlocaLogo.d.ts.map +1 -0
- package/dist/ts/components/ConlocaLogo.js +5 -0
- package/dist/ts/components/ConlocaLogo.js.map +1 -0
- package/dist/ts/components/GitStatusPanel.d.ts +21 -0
- package/dist/ts/components/GitStatusPanel.d.ts.map +1 -0
- package/dist/ts/components/GitStatusPanel.js +74 -0
- package/dist/ts/components/GitStatusPanel.js.map +1 -0
- package/dist/ts/components/MobileTopBar.d.ts +6 -0
- package/dist/ts/components/MobileTopBar.d.ts.map +1 -0
- package/dist/ts/components/MobileTopBar.js +7 -0
- package/dist/ts/components/MobileTopBar.js.map +1 -0
- package/dist/ts/components/Sidebar.d.ts +8 -0
- package/dist/ts/components/Sidebar.d.ts.map +1 -0
- package/dist/ts/components/Sidebar.js +41 -0
- package/dist/ts/components/Sidebar.js.map +1 -0
- package/dist/ts/components/UserAvatar.d.ts +2 -0
- package/dist/ts/components/UserAvatar.d.ts.map +1 -0
- package/dist/ts/components/UserAvatar.js +15 -0
- package/dist/ts/components/UserAvatar.js.map +1 -0
- package/dist/ts/components/cards/DataEntryCard.d.ts +14 -0
- package/dist/ts/components/cards/DataEntryCard.d.ts.map +1 -0
- package/dist/ts/components/cards/DataEntryCard.js +39 -0
- package/dist/ts/components/cards/DataEntryCard.js.map +1 -0
- package/dist/ts/components/cards/SectionCard.d.ts +15 -0
- package/dist/ts/components/cards/SectionCard.d.ts.map +1 -0
- package/dist/ts/components/cards/SectionCard.js +11 -0
- package/dist/ts/components/cards/SectionCard.js.map +1 -0
- package/dist/ts/components/cards/index.d.ts +2 -0
- package/dist/ts/components/cards/index.d.ts.map +1 -0
- package/dist/ts/components/cards/index.js +2 -0
- package/dist/ts/components/cards/index.js.map +1 -0
- package/dist/ts/components/dashboard/RecentActivity.d.ts +2 -0
- package/dist/ts/components/dashboard/RecentActivity.d.ts.map +1 -0
- package/dist/ts/components/dashboard/RecentActivity.js +58 -0
- package/dist/ts/components/dashboard/RecentActivity.js.map +1 -0
- package/dist/ts/components/dialog.d.ts +53 -0
- package/dist/ts/components/dialog.d.ts.map +1 -0
- package/dist/ts/components/dialog.js +57 -0
- package/dist/ts/components/dialog.js.map +1 -0
- package/dist/ts/components/dialogs/ConflictDialog.d.ts +10 -0
- package/dist/ts/components/dialogs/ConflictDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/ConflictDialog.js +28 -0
- package/dist/ts/components/dialogs/ConflictDialog.js.map +1 -0
- package/dist/ts/components/dialogs/CreateDataDialog.d.ts +9 -0
- package/dist/ts/components/dialogs/CreateDataDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/CreateDataDialog.js +21 -0
- package/dist/ts/components/dialogs/CreateDataDialog.js.map +1 -0
- package/dist/ts/components/dialogs/CreateFolderDialog.d.ts +11 -0
- package/dist/ts/components/dialogs/CreateFolderDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/CreateFolderDialog.js +39 -0
- package/dist/ts/components/dialogs/CreateFolderDialog.js.map +1 -0
- package/dist/ts/components/dialogs/CreatePageDialog.d.ts +11 -0
- package/dist/ts/components/dialogs/CreatePageDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/CreatePageDialog.js +237 -0
- package/dist/ts/components/dialogs/CreatePageDialog.js.map +1 -0
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts +10 -0
- package/dist/ts/components/dialogs/DataPropertiesDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/DataPropertiesDialog.js +39 -0
- package/dist/ts/components/dialogs/DataPropertiesDialog.js.map +1 -0
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts +12 -0
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js +8 -0
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js.map +1 -0
- package/dist/ts/components/dialogs/ErrorModal.d.ts +14 -0
- package/dist/ts/components/dialogs/ErrorModal.d.ts.map +1 -0
- package/dist/ts/components/dialogs/ErrorModal.js +43 -0
- package/dist/ts/components/dialogs/ErrorModal.js.map +1 -0
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +12 -0
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js +43 -0
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.js.map +1 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts +12 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.js +69 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.js.map +1 -0
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts +31 -0
- package/dist/ts/components/dialogs/PageMetadataDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/PageMetadataDialog.js +154 -0
- package/dist/ts/components/dialogs/PageMetadataDialog.js.map +1 -0
- package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts +8 -0
- package/dist/ts/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/UnsavedChangesDialog.js +7 -0
- package/dist/ts/components/dialogs/UnsavedChangesDialog.js.map +1 -0
- package/dist/ts/components/dialogs/index.d.ts +9 -0
- package/dist/ts/components/dialogs/index.d.ts.map +1 -0
- package/dist/ts/components/dialogs/index.js +9 -0
- package/dist/ts/components/dialogs/index.js.map +1 -0
- package/dist/ts/components/editor/CMSMDXEditor.d.ts +14 -0
- package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -0
- package/dist/ts/components/editor/CMSMDXEditor.js +209 -0
- package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -0
- package/dist/ts/components/editor/ContentDiff.d.ts +10 -0
- package/dist/ts/components/editor/ContentDiff.d.ts.map +1 -0
- package/dist/ts/components/editor/ContentDiff.js +52 -0
- package/dist/ts/components/editor/ContentDiff.js.map +1 -0
- package/dist/ts/components/editor/CreateFragmentDialog.d.ts +26 -0
- package/dist/ts/components/editor/CreateFragmentDialog.d.ts.map +1 -0
- package/dist/ts/components/editor/CreateFragmentDialog.js +159 -0
- package/dist/ts/components/editor/CreateFragmentDialog.js.map +1 -0
- package/dist/ts/components/editor/DrawerItemOverride.d.ts +8 -0
- package/dist/ts/components/editor/DrawerItemOverride.d.ts.map +1 -0
- package/dist/ts/components/editor/DrawerItemOverride.js +37 -0
- package/dist/ts/components/editor/DrawerItemOverride.js.map +1 -0
- package/dist/ts/components/editor/EditorChromeToggles.d.ts +16 -0
- package/dist/ts/components/editor/EditorChromeToggles.d.ts.map +1 -0
- package/dist/ts/components/editor/EditorChromeToggles.js +17 -0
- package/dist/ts/components/editor/EditorChromeToggles.js.map +1 -0
- package/dist/ts/components/editor/FragmentEditor.d.ts +15 -0
- package/dist/ts/components/editor/FragmentEditor.d.ts.map +1 -0
- package/dist/ts/components/editor/FragmentEditor.js +322 -0
- package/dist/ts/components/editor/FragmentEditor.js.map +1 -0
- package/dist/ts/components/editor/FragmentWrappers.d.ts +20 -0
- package/dist/ts/components/editor/FragmentWrappers.d.ts.map +1 -0
- package/dist/ts/components/editor/FragmentWrappers.js +44 -0
- package/dist/ts/components/editor/FragmentWrappers.js.map +1 -0
- package/dist/ts/components/editor/GenericBlock.d.ts +3 -0
- package/dist/ts/components/editor/GenericBlock.d.ts.map +1 -0
- package/dist/ts/components/editor/GenericBlock.js +1124 -0
- package/dist/ts/components/editor/GenericBlock.js.map +1 -0
- package/dist/ts/components/editor/ImagePickerDialog.d.ts +6 -0
- package/dist/ts/components/editor/ImagePickerDialog.d.ts.map +1 -0
- package/dist/ts/components/editor/ImagePickerDialog.js +23 -0
- package/dist/ts/components/editor/ImagePickerDialog.js.map +1 -0
- package/dist/ts/components/editor/JsxPropsPanel.d.ts +16 -0
- package/dist/ts/components/editor/JsxPropsPanel.d.ts.map +1 -0
- package/dist/ts/components/editor/JsxPropsPanel.js +146 -0
- package/dist/ts/components/editor/JsxPropsPanel.js.map +1 -0
- package/dist/ts/components/editor/LocaleSelector.d.ts +9 -0
- package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -0
- package/dist/ts/components/editor/LocaleSelector.js +14 -0
- package/dist/ts/components/editor/LocaleSelector.js.map +1 -0
- package/dist/ts/components/editor/MDXLivePreview.d.ts +15 -0
- package/dist/ts/components/editor/MDXLivePreview.d.ts.map +1 -0
- package/dist/ts/components/editor/MDXLivePreview.js +111 -0
- package/dist/ts/components/editor/MDXLivePreview.js.map +1 -0
- package/dist/ts/components/editor/MdxPageEditor.d.ts +10 -0
- package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -0
- package/dist/ts/components/editor/MdxPageEditor.js +353 -0
- package/dist/ts/components/editor/MdxPageEditor.js.map +1 -0
- package/dist/ts/components/editor/PageEditor.d.ts +54 -0
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -0
- package/dist/ts/components/editor/PageEditor.js +399 -0
- package/dist/ts/components/editor/PageEditor.js.map +1 -0
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +22 -0
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -0
- package/dist/ts/components/editor/PageEditorHeaderActions.js +24 -0
- package/dist/ts/components/editor/PageEditorHeaderActions.js.map +1 -0
- package/dist/ts/components/editor/PageEditorWrapper.d.ts +38 -0
- package/dist/ts/components/editor/PageEditorWrapper.d.ts.map +1 -0
- package/dist/ts/components/editor/PageEditorWrapper.js +360 -0
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -0
- package/dist/ts/components/editor/PuckWithUntouchedMetadata.d.ts +5 -0
- package/dist/ts/components/editor/PuckWithUntouchedMetadata.d.ts.map +1 -0
- package/dist/ts/components/editor/PuckWithUntouchedMetadata.js +53 -0
- package/dist/ts/components/editor/PuckWithUntouchedMetadata.js.map +1 -0
- package/dist/ts/components/editor/SearchableSelect.d.ts +34 -0
- package/dist/ts/components/editor/SearchableSelect.d.ts.map +1 -0
- package/dist/ts/components/editor/SearchableSelect.js +116 -0
- package/dist/ts/components/editor/SearchableSelect.js.map +1 -0
- package/dist/ts/components/editor/host-wrapper-plugin.d.ts.map +1 -0
- package/dist/ts/components/editor/host-wrapper-plugin.js +38 -0
- package/dist/ts/components/editor/host-wrapper-plugin.js.map +1 -0
- package/dist/ts/components/editor/index.d.ts +9 -0
- package/dist/ts/components/editor/index.d.ts.map +1 -0
- package/dist/ts/components/editor/index.js +8 -0
- package/dist/ts/components/editor/index.js.map +1 -0
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts +15 -0
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -0
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js +91 -0
- package/dist/ts/components/editor/insert-menu/InsertMdxComponentButton.js.map +1 -0
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts +12 -0
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -0
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js +107 -0
- package/dist/ts/components/editor/insert-menu/SlashMenuPlugin.js.map +1 -0
- package/dist/ts/components/editor/insert-menu/insert-payload.d.ts +76 -0
- package/dist/ts/components/editor/insert-menu/insert-payload.d.ts.map +1 -0
- package/dist/ts/components/editor/insert-menu/insert-payload.js +95 -0
- package/dist/ts/components/editor/insert-menu/insert-payload.js.map +1 -0
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -0
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js +14 -0
- package/dist/ts/components/editor/insert-menu/mdx-components-plugin.js.map +1 -0
- package/dist/ts/components/editor/page-setting-targets.d.ts +24 -0
- package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -0
- package/dist/ts/components/editor/page-setting-targets.js +124 -0
- package/dist/ts/components/editor/page-setting-targets.js.map +1 -0
- package/dist/ts/components/editor/preview-availability.d.ts +18 -0
- package/dist/ts/components/editor/preview-availability.d.ts.map +1 -0
- package/dist/ts/components/editor/preview-availability.js +18 -0
- package/dist/ts/components/editor/preview-availability.js.map +1 -0
- package/dist/ts/components/editors/DataEditor.d.ts +18 -0
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -0
- package/dist/ts/components/editors/DataEditor.js +140 -0
- package/dist/ts/components/editors/DataEditor.js.map +1 -0
- package/dist/ts/components/fields/ContentFragmentSelectorField.d.ts +14 -0
- package/dist/ts/components/fields/ContentFragmentSelectorField.d.ts.map +1 -0
- package/dist/ts/components/fields/ContentFragmentSelectorField.js +108 -0
- package/dist/ts/components/fields/ContentFragmentSelectorField.js.map +1 -0
- package/dist/ts/components/fields/ImageField.d.ts +17 -0
- package/dist/ts/components/fields/ImageField.d.ts.map +1 -0
- package/dist/ts/components/fields/ImageField.js +39 -0
- package/dist/ts/components/fields/ImageField.js.map +1 -0
- package/dist/ts/components/fields/MDXEditField.d.ts +17 -0
- package/dist/ts/components/fields/MDXEditField.d.ts.map +1 -0
- package/dist/ts/components/fields/MDXEditField.js +29 -0
- package/dist/ts/components/fields/MDXEditField.js.map +1 -0
- package/dist/ts/components/forms/ChipArrayField.d.ts +12 -0
- package/dist/ts/components/forms/ChipArrayField.d.ts.map +1 -0
- package/dist/ts/components/forms/ChipArrayField.js +39 -0
- package/dist/ts/components/forms/ChipArrayField.js.map +1 -0
- package/dist/ts/components/forms/HintForm.d.ts +22 -0
- package/dist/ts/components/forms/HintForm.d.ts.map +1 -0
- package/dist/ts/components/forms/HintForm.js +195 -0
- package/dist/ts/components/forms/HintForm.js.map +1 -0
- package/dist/ts/components/forms/SchemaForm.d.ts +15 -0
- package/dist/ts/components/forms/SchemaForm.d.ts.map +1 -0
- package/dist/ts/components/forms/SchemaForm.js +103 -0
- package/dist/ts/components/forms/SchemaForm.js.map +1 -0
- package/dist/ts/components/index.d.ts +8 -0
- package/dist/ts/components/index.d.ts.map +1 -0
- package/dist/ts/components/index.js +14 -0
- package/dist/ts/components/index.js.map +1 -0
- package/dist/ts/components/media/AssetCard.d.ts +14 -0
- package/dist/ts/components/media/AssetCard.d.ts.map +1 -0
- package/dist/ts/components/media/AssetCard.js +26 -0
- package/dist/ts/components/media/AssetCard.js.map +1 -0
- package/dist/ts/components/media/AssetDetailSidebar.d.ts +15 -0
- package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -0
- package/dist/ts/components/media/AssetDetailSidebar.js +122 -0
- package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -0
- package/dist/ts/components/media/BulkActionBar.d.ts +9 -0
- package/dist/ts/components/media/BulkActionBar.d.ts.map +1 -0
- package/dist/ts/components/media/BulkActionBar.js +9 -0
- package/dist/ts/components/media/BulkActionBar.js.map +1 -0
- package/dist/ts/components/media/FolderNav.d.ts +7 -0
- package/dist/ts/components/media/FolderNav.d.ts.map +1 -0
- package/dist/ts/components/media/FolderNav.js +13 -0
- package/dist/ts/components/media/FolderNav.js.map +1 -0
- package/dist/ts/components/media/FolderTreeSidebar.d.ts +9 -0
- package/dist/ts/components/media/FolderTreeSidebar.d.ts.map +1 -0
- package/dist/ts/components/media/FolderTreeSidebar.js +46 -0
- package/dist/ts/components/media/FolderTreeSidebar.js.map +1 -0
- package/dist/ts/components/media/ImagePicker.d.ts +14 -0
- package/dist/ts/components/media/ImagePicker.d.ts.map +1 -0
- package/dist/ts/components/media/ImagePicker.js +44 -0
- package/dist/ts/components/media/ImagePicker.js.map +1 -0
- package/dist/ts/components/media/MediaLibrary.d.ts +31 -0
- package/dist/ts/components/media/MediaLibrary.d.ts.map +1 -0
- package/dist/ts/components/media/MediaLibrary.js +87 -0
- package/dist/ts/components/media/MediaLibrary.js.map +1 -0
- package/dist/ts/components/media/MediaToolbar.d.ts +21 -0
- package/dist/ts/components/media/MediaToolbar.d.ts.map +1 -0
- package/dist/ts/components/media/MediaToolbar.js +7 -0
- package/dist/ts/components/media/MediaToolbar.js.map +1 -0
- package/dist/ts/components/media/UploadModal.d.ts +9 -0
- package/dist/ts/components/media/UploadModal.d.ts.map +1 -0
- package/dist/ts/components/media/UploadModal.js +36 -0
- package/dist/ts/components/media/UploadModal.js.map +1 -0
- package/dist/ts/components/media/index.d.ts +10 -0
- package/dist/ts/components/media/index.d.ts.map +1 -0
- package/dist/ts/components/media/index.js +10 -0
- package/dist/ts/components/media/index.js.map +1 -0
- package/dist/ts/components/pages/DataList.d.ts +7 -0
- package/dist/ts/components/pages/DataList.d.ts.map +1 -0
- package/dist/ts/components/pages/DataList.js +267 -0
- package/dist/ts/components/pages/DataList.js.map +1 -0
- package/dist/ts/components/pages/FragmentList.d.ts +2 -0
- package/dist/ts/components/pages/FragmentList.d.ts.map +1 -0
- package/dist/ts/components/pages/FragmentList.js +281 -0
- package/dist/ts/components/pages/FragmentList.js.map +1 -0
- package/dist/ts/components/pages/MediaPage.d.ts +8 -0
- package/dist/ts/components/pages/MediaPage.d.ts.map +1 -0
- package/dist/ts/components/pages/MediaPage.js +146 -0
- package/dist/ts/components/pages/MediaPage.js.map +1 -0
- package/dist/ts/components/pages/PageList.d.ts +7 -0
- package/dist/ts/components/pages/PageList.d.ts.map +1 -0
- package/dist/ts/components/pages/PageList.js +299 -0
- package/dist/ts/components/pages/PageList.js.map +1 -0
- package/dist/ts/components/pages/index.d.ts +3 -0
- package/dist/ts/components/pages/index.d.ts.map +1 -0
- package/dist/ts/components/pages/index.js +3 -0
- package/dist/ts/components/pages/index.js.map +1 -0
- package/dist/ts/components/puck/MDXContent.d.ts +19 -0
- package/dist/ts/components/puck/MDXContent.d.ts.map +1 -0
- package/dist/ts/components/puck/MDXContent.js +110 -0
- package/dist/ts/components/puck/MDXContent.js.map +1 -0
- package/dist/ts/components/puck/index.d.ts +2 -0
- package/dist/ts/components/puck/index.d.ts.map +1 -0
- package/dist/ts/components/puck/index.js +2 -0
- package/dist/ts/components/puck/index.js.map +1 -0
- package/dist/ts/components/sandbox/ContentSandbox.d.ts +31 -0
- package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -0
- package/dist/ts/components/sandbox/ContentSandbox.js +148 -0
- package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -0
- package/dist/ts/components/sandbox/frame-runtime.d.ts +7 -0
- package/dist/ts/components/sandbox/frame-runtime.d.ts.map +1 -0
- package/dist/ts/components/sandbox/frame-runtime.js +7 -0
- package/dist/ts/components/sandbox/frame-runtime.js.map +1 -0
- package/dist/ts/components/toast.d.ts +44 -0
- package/dist/ts/components/toast.d.ts.map +1 -0
- package/dist/ts/components/toast.js +8 -0
- package/dist/ts/components/toast.js.map +1 -0
- package/dist/ts/components/ui/Banner.d.ts +76 -0
- package/dist/ts/components/ui/Banner.d.ts.map +1 -0
- package/dist/ts/components/ui/Banner.js +50 -0
- package/dist/ts/components/ui/Banner.js.map +1 -0
- package/dist/ts/components/ui/Button.d.ts +25 -0
- package/dist/ts/components/ui/Button.d.ts.map +1 -0
- package/dist/ts/components/ui/Button.js +34 -0
- package/dist/ts/components/ui/Button.js.map +1 -0
- package/dist/ts/components/ui/Card.d.ts +72 -0
- package/dist/ts/components/ui/Card.d.ts.map +1 -0
- package/dist/ts/components/ui/Card.js +50 -0
- package/dist/ts/components/ui/Card.js.map +1 -0
- package/dist/ts/components/ui/FieldError.d.ts +24 -0
- package/dist/ts/components/ui/FieldError.d.ts.map +1 -0
- package/dist/ts/components/ui/FieldError.js +18 -0
- package/dist/ts/components/ui/FieldError.js.map +1 -0
- package/dist/ts/components/ui/IconButton.d.ts +13 -0
- package/dist/ts/components/ui/IconButton.d.ts.map +1 -0
- package/dist/ts/components/ui/IconButton.js +11 -0
- package/dist/ts/components/ui/IconButton.js.map +1 -0
- package/dist/ts/components/ui/Input.d.ts +37 -0
- package/dist/ts/components/ui/Input.d.ts.map +1 -0
- package/dist/ts/components/ui/Input.js +10 -0
- package/dist/ts/components/ui/Input.js.map +1 -0
- package/dist/ts/components/ui/SaveIndicator.d.ts +8 -0
- package/dist/ts/components/ui/SaveIndicator.d.ts.map +1 -0
- package/dist/ts/components/ui/SaveIndicator.js +33 -0
- package/dist/ts/components/ui/SaveIndicator.js.map +1 -0
- package/dist/ts/components/ui/Select.d.ts +8 -0
- package/dist/ts/components/ui/Select.d.ts.map +1 -0
- package/dist/ts/components/ui/Select.js +10 -0
- package/dist/ts/components/ui/Select.js.map +1 -0
- package/dist/ts/components/ui/Separator.d.ts +7 -0
- package/dist/ts/components/ui/Separator.d.ts.map +1 -0
- package/dist/ts/components/ui/Separator.js +9 -0
- package/dist/ts/components/ui/Separator.js.map +1 -0
- package/dist/ts/components/ui/Textarea.d.ts +8 -0
- package/dist/ts/components/ui/Textarea.d.ts.map +1 -0
- package/dist/ts/components/ui/Textarea.js +6 -0
- package/dist/ts/components/ui/Textarea.js.map +1 -0
- package/dist/ts/components/ui/Tooltip.d.ts +9 -0
- package/dist/ts/components/ui/Tooltip.d.ts.map +1 -0
- package/dist/ts/components/ui/Tooltip.js +6 -0
- package/dist/ts/components/ui/Tooltip.js.map +1 -0
- package/dist/ts/components/ui/index.d.ts +14 -0
- package/dist/ts/components/ui/index.d.ts.map +1 -0
- package/dist/ts/components/ui/index.js +18 -0
- package/dist/ts/components/ui/index.js.map +1 -0
- package/dist/ts/data-schemas.d.ts +36 -0
- package/dist/ts/data-schemas.d.ts.map +1 -0
- package/dist/ts/data-schemas.js +52 -0
- package/dist/ts/data-schemas.js.map +1 -0
- package/dist/ts/dev-entry.d.ts +2 -0
- package/dist/ts/dev-entry.d.ts.map +1 -0
- package/dist/ts/dev-entry.js +23 -0
- package/dist/ts/dev-entry.js.map +1 -0
- package/dist/ts/editor-flush.d.ts +26 -0
- package/dist/ts/editor-flush.d.ts.map +1 -0
- package/dist/ts/editor-flush.js +40 -0
- package/dist/ts/editor-flush.js.map +1 -0
- package/dist/ts/hooks/index.d.ts +10 -0
- package/dist/ts/hooks/index.d.ts.map +1 -0
- package/dist/ts/hooks/index.js +8 -0
- package/dist/ts/hooks/index.js.map +1 -0
- package/dist/ts/hooks/useCanvasTheme.d.ts +12 -0
- package/dist/ts/hooks/useCanvasTheme.d.ts.map +1 -0
- package/dist/ts/hooks/useCanvasTheme.js +34 -0
- package/dist/ts/hooks/useCanvasTheme.js.map +1 -0
- package/dist/ts/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/ts/hooks/useClickOutside.js +19 -0
- package/dist/ts/hooks/useClickOutside.js.map +1 -0
- package/dist/ts/hooks/useDialogState.d.ts.map +1 -0
- package/dist/ts/hooks/useDialogState.js +32 -0
- package/dist/ts/hooks/useDialogState.js.map +1 -0
- package/dist/ts/hooks/useEditorPref.d.ts.map +1 -0
- package/dist/ts/hooks/useEditorPref.js +50 -0
- package/dist/ts/hooks/useEditorPref.js.map +1 -0
- package/dist/ts/hooks/useErrorModal.d.ts +15 -0
- package/dist/ts/hooks/useErrorModal.d.ts.map +1 -0
- package/dist/ts/hooks/useErrorModal.js +36 -0
- package/dist/ts/hooks/useErrorModal.js.map +1 -0
- package/dist/ts/hooks/useSiteBaseUrl.d.ts +10 -0
- package/dist/ts/hooks/useSiteBaseUrl.d.ts.map +1 -0
- package/dist/ts/hooks/useSiteBaseUrl.js +15 -0
- package/dist/ts/hooks/useSiteBaseUrl.js.map +1 -0
- package/dist/ts/hooks/useTheme.d.ts +12 -0
- package/dist/ts/hooks/useTheme.d.ts.map +1 -0
- package/dist/ts/hooks/useTheme.js +55 -0
- package/dist/ts/hooks/useTheme.js.map +1 -0
- package/dist/ts/hooks/useUnsavedChangesGuard.d.ts.map +1 -0
- package/dist/ts/hooks/useUnsavedChangesGuard.js +30 -0
- package/dist/ts/hooks/useUnsavedChangesGuard.js.map +1 -0
- package/dist/ts/hooks/useUpload.d.ts +5 -0
- package/dist/ts/hooks/useUpload.d.ts.map +1 -0
- package/dist/ts/hooks/useUpload.js +15 -0
- package/dist/ts/hooks/useUpload.js.map +1 -0
- package/dist/ts/hooks/useUploadFlow.d.ts +47 -0
- package/dist/ts/hooks/useUploadFlow.d.ts.map +1 -0
- package/dist/ts/hooks/useUploadFlow.js +154 -0
- package/dist/ts/hooks/useUploadFlow.js.map +1 -0
- package/dist/ts/host-discovery.d.ts +40 -0
- package/dist/ts/host-discovery.d.ts.map +1 -0
- package/dist/ts/host-discovery.js +39 -0
- package/dist/ts/host-discovery.js.map +1 -0
- package/dist/ts/host-style-probe.d.ts +81 -0
- package/dist/ts/host-style-probe.d.ts.map +1 -0
- package/dist/ts/host-style-probe.js +638 -0
- package/dist/ts/host-style-probe.js.map +1 -0
- package/dist/ts/index.d.ts +13 -0
- package/dist/ts/index.d.ts.map +1 -0
- package/dist/ts/index.js +17 -0
- package/dist/ts/index.js.map +1 -0
- package/dist/ts/lib/utils.d.ts.map +1 -0
- package/dist/ts/lib/utils.js +48 -0
- package/dist/ts/lib/utils.js.map +1 -0
- package/dist/ts/main-spa.d.ts.map +1 -0
- package/dist/ts/main-spa.js +58 -0
- package/dist/ts/main-spa.js.map +1 -0
- package/dist/ts/main.d.ts.map +1 -0
- package/dist/ts/main.js +16 -0
- package/dist/ts/main.js.map +1 -0
- package/dist/ts/mdx-components-define.d.ts +185 -0
- package/dist/ts/mdx-components-define.d.ts.map +1 -0
- package/dist/ts/mdx-components-define.js +140 -0
- package/dist/ts/mdx-components-define.js.map +1 -0
- package/dist/ts/mdx-components.d.ts +63 -0
- package/dist/ts/mdx-components.d.ts.map +1 -0
- package/dist/ts/mdx-components.js +129 -0
- package/dist/ts/mdx-components.js.map +1 -0
- package/dist/ts/media/AssetScopePill.d.ts +30 -0
- package/dist/ts/media/AssetScopePill.d.ts.map +1 -0
- package/dist/ts/media/AssetScopePill.js +31 -0
- package/dist/ts/media/AssetScopePill.js.map +1 -0
- package/dist/ts/media/MediaIssueBadge.d.ts +33 -0
- package/dist/ts/media/MediaIssueBadge.d.ts.map +1 -0
- package/dist/ts/media/MediaIssueBadge.js +55 -0
- package/dist/ts/media/MediaIssueBadge.js.map +1 -0
- package/dist/ts/media/types.d.ts +108 -0
- package/dist/ts/media/types.d.ts.map +1 -0
- package/dist/ts/media/types.js +2 -0
- package/dist/ts/media/types.js.map +1 -0
- package/dist/ts/media/use-asset-scope.d.ts +24 -0
- package/dist/ts/media/use-asset-scope.d.ts.map +1 -0
- package/dist/ts/media/use-asset-scope.js +57 -0
- package/dist/ts/media/use-asset-scope.js.map +1 -0
- package/dist/ts/media/use-media-issue.d.ts +24 -0
- package/dist/ts/media/use-media-issue.d.ts.map +1 -0
- package/dist/ts/media/use-media-issue.js +52 -0
- package/dist/ts/media/use-media-issue.js.map +1 -0
- package/dist/ts/merge-default-props.d.ts +23 -0
- package/dist/ts/merge-default-props.d.ts.map +1 -0
- package/dist/ts/merge-default-props.js +51 -0
- package/dist/ts/merge-default-props.js.map +1 -0
- package/dist/ts/mock-puck-config.d.ts.map +1 -0
- package/dist/ts/mock-puck-config.js +74 -0
- package/dist/ts/mock-puck-config.js.map +1 -0
- package/dist/ts/page-schema-define.d.ts +134 -0
- package/dist/ts/page-schema-define.d.ts.map +1 -0
- package/dist/ts/page-schema-define.js +60 -0
- package/dist/ts/page-schema-define.js.map +1 -0
- package/dist/ts/page-schemas.d.ts +31 -0
- package/dist/ts/page-schemas.d.ts.map +1 -0
- package/dist/ts/page-schemas.js +56 -0
- package/dist/ts/page-schemas.js.map +1 -0
- package/dist/ts/page-setting-attributes.d.ts +27 -0
- package/dist/ts/page-setting-attributes.d.ts.map +1 -0
- package/dist/ts/page-setting-attributes.js +11 -0
- package/dist/ts/page-setting-attributes.js.map +1 -0
- package/dist/ts/prose-surface-css.d.ts +92 -0
- package/dist/ts/prose-surface-css.d.ts.map +1 -0
- package/dist/ts/prose-surface-css.js +349 -0
- package/dist/ts/prose-surface-css.js.map +1 -0
- package/dist/ts/puck-config.d.ts.map +1 -0
- package/dist/ts/puck-config.js +51 -0
- package/dist/ts/puck-config.js.map +1 -0
- package/dist/ts/sandbox-preview-styles.d.ts +63 -0
- package/dist/ts/sandbox-preview-styles.d.ts.map +1 -0
- package/dist/ts/sandbox-preview-styles.js +169 -0
- package/dist/ts/sandbox-preview-styles.js.map +1 -0
- package/dist/ts/selected-block.d.ts +61 -0
- package/dist/ts/selected-block.d.ts.map +1 -0
- package/dist/ts/selected-block.js +65 -0
- package/dist/ts/selected-block.js.map +1 -0
- package/dist/ts/site-css-layer.d.ts +40 -0
- package/dist/ts/site-css-layer.d.ts.map +1 -0
- package/dist/ts/site-css-layer.js +110 -0
- package/dist/ts/site-css-layer.js.map +1 -0
- package/dist/ts/site-styles.d.ts +141 -0
- package/dist/ts/site-styles.d.ts.map +1 -0
- package/dist/ts/site-styles.js +426 -0
- package/dist/ts/site-styles.js.map +1 -0
- package/dist/ts/theme.d.ts +46 -0
- package/dist/ts/theme.d.ts.map +1 -0
- package/dist/ts/theme.js +96 -0
- package/dist/ts/theme.js.map +1 -0
- package/dist/ts/types.d.ts +58 -0
- package/dist/ts/types.d.ts.map +1 -0
- package/dist/ts/types.js +2 -0
- package/dist/ts/types.js.map +1 -0
- package/dist/ts/ui-config.d.ts +249 -0
- package/dist/ts/ui-config.d.ts.map +1 -0
- package/dist/ts/ui-config.js +142 -0
- package/dist/ts/ui-config.js.map +1 -0
- package/dist/ts/utils/asset-url.d.ts +9 -0
- package/dist/ts/utils/asset-url.d.ts.map +1 -0
- package/dist/ts/utils/asset-url.js +19 -0
- package/dist/ts/utils/asset-url.js.map +1 -0
- package/dist/ts/utils/cn.d.ts.map +1 -0
- package/dist/ts/utils/cn.js +6 -0
- package/dist/ts/utils/cn.js.map +1 -0
- package/dist/ts/utils/content-failure.d.ts +32 -0
- package/dist/ts/utils/content-failure.d.ts.map +1 -0
- package/dist/ts/utils/content-failure.js +67 -0
- package/dist/ts/utils/content-failure.js.map +1 -0
- package/dist/ts/utils/entry-meta.d.ts +29 -0
- package/dist/ts/utils/entry-meta.d.ts.map +1 -0
- package/dist/ts/utils/entry-meta.js +38 -0
- package/dist/ts/utils/entry-meta.js.map +1 -0
- package/dist/ts/utils/entry-name.d.ts +11 -0
- package/dist/ts/utils/entry-name.d.ts.map +1 -0
- package/dist/ts/utils/entry-name.js +19 -0
- package/dist/ts/utils/entry-name.js.map +1 -0
- package/dist/ts/utils/format-date.d.ts.map +1 -0
- package/dist/ts/utils/format-date.js +38 -0
- package/dist/ts/utils/format-date.js.map +1 -0
- package/dist/ts/utils/mdast-to-html.d.ts.map +1 -0
- package/dist/ts/utils/mdast-to-html.js +235 -0
- package/dist/ts/utils/mdast-to-html.js.map +1 -0
- package/dist/ts/utils/mdast-tree.d.ts.map +1 -0
- package/dist/ts/utils/mdast-tree.js +286 -0
- package/dist/ts/utils/mdast-tree.js.map +1 -0
- package/dist/ts/utils/menu-placement.d.ts +8 -0
- package/dist/ts/utils/menu-placement.d.ts.map +1 -0
- package/dist/ts/utils/menu-placement.js +10 -0
- package/dist/ts/utils/menu-placement.js.map +1 -0
- package/dist/ts/utils/pageMetadata.d.ts +80 -0
- package/dist/ts/utils/pageMetadata.d.ts.map +1 -0
- package/dist/ts/utils/pageMetadata.js +249 -0
- package/dist/ts/utils/pageMetadata.js.map +1 -0
- package/dist/ts/utils/sanitize-html.d.ts +31 -0
- package/dist/ts/utils/sanitize-html.d.ts.map +1 -0
- package/dist/ts/utils/sanitize-html.js +84 -0
- package/dist/ts/utils/sanitize-html.js.map +1 -0
- package/dist/ts/utils/slugify.d.ts +14 -0
- package/dist/ts/utils/slugify.d.ts.map +1 -0
- package/dist/ts/utils/slugify.js +22 -0
- package/dist/ts/utils/slugify.js.map +1 -0
- package/dist/ts/utils/zodIntrospect.d.ts +19 -0
- package/dist/ts/utils/zodIntrospect.d.ts.map +1 -0
- package/dist/ts/utils/zodIntrospect.js +95 -0
- package/dist/ts/utils/zodIntrospect.js.map +1 -0
- package/dist/ts/write-access.d.ts +48 -0
- package/dist/ts/write-access.d.ts.map +1 -0
- package/dist/ts/write-access.js +140 -0
- package/dist/ts/write-access.js.map +1 -0
- package/package.json +145 -98
- package/src/App.tsx +78 -0
- package/src/CmsSpaApp.tsx +63 -0
- package/src/components/CMSDashboard.tsx +118 -0
- package/src/components/CMSLayout.tsx +25 -0
- package/src/components/ConlocaLogo.tsx +10 -0
- package/src/components/GitStatusPanel.tsx +188 -0
- package/src/components/MobileTopBar.tsx +22 -0
- package/src/components/Sidebar.tsx +146 -0
- package/src/components/UserAvatar.tsx +28 -0
- package/src/components/cards/DataEntryCard.tsx +163 -0
- package/src/components/cards/SectionCard.tsx +103 -0
- package/src/components/cards/index.ts +1 -0
- package/src/components/dashboard/RecentActivity.tsx +114 -0
- package/src/components/dialog.tsx +78 -0
- package/src/components/dialogs/ConflictDialog.tsx +139 -0
- package/src/components/dialogs/CreateDataDialog.tsx +70 -0
- package/src/components/dialogs/CreateFolderDialog.tsx +94 -0
- package/src/components/dialogs/CreatePageDialog.tsx +465 -0
- package/src/components/dialogs/DataPropertiesDialog.tsx +84 -0
- package/src/components/dialogs/DeleteConfirmDialog.tsx +61 -0
- package/src/components/dialogs/ErrorModal.tsx +109 -0
- package/src/components/dialogs/FragmentPropertiesDialog.tsx +97 -0
- package/src/components/dialogs/MoveFolderDialog.tsx +205 -0
- package/src/components/dialogs/PageMetadataDialog.tsx +311 -0
- package/src/components/dialogs/UnsavedChangesDialog.tsx +43 -0
- package/src/components/dialogs/index.ts +8 -0
- package/src/components/editor/CMSMDXEditor.tsx +281 -0
- package/src/components/editor/ContentDiff.tsx +251 -0
- package/src/components/editor/CreateFragmentDialog.tsx +227 -0
- package/src/components/editor/DrawerItemOverride.tsx +62 -0
- package/src/components/editor/EditorChromeToggles.tsx +35 -0
- package/src/components/editor/FragmentEditor.tsx +506 -0
- package/src/components/editor/FragmentWrappers.tsx +72 -0
- package/src/components/editor/GenericBlock.tsx +1361 -0
- package/src/components/editor/ImagePickerDialog.tsx +25 -0
- package/src/components/editor/JsxPropsPanel.tsx +293 -0
- package/src/components/editor/LocaleSelector.tsx +60 -0
- package/src/components/editor/MDXLivePreview.tsx +179 -0
- package/src/components/editor/MdxPageEditor.tsx +546 -0
- package/src/components/editor/PageEditor.tsx +529 -0
- package/src/components/editor/PageEditorHeaderActions.tsx +160 -0
- package/src/components/editor/PageEditorWrapper.tsx +502 -0
- package/src/components/editor/PuckWithUntouchedMetadata.tsx +65 -0
- package/src/components/editor/SearchableSelect.tsx +186 -0
- package/src/components/editor/host-wrapper-plugin.ts +91 -0
- package/src/components/editor/index.ts +8 -0
- package/src/components/editor/insert-menu/InsertMdxComponentButton.tsx +149 -0
- package/src/components/editor/insert-menu/SlashMenuPlugin.tsx +152 -0
- package/src/components/editor/insert-menu/insert-payload.ts +150 -0
- package/src/components/editor/insert-menu/mdx-components-plugin.ts +14 -0
- package/src/components/editor/page-setting-targets.tsx +154 -0
- package/src/components/editor/preview-availability.ts +20 -0
- package/src/components/editors/DataEditor.tsx +270 -0
- package/src/components/fields/ContentFragmentSelectorField.tsx +290 -0
- package/src/components/fields/ImageField.tsx +75 -0
- package/src/components/fields/MDXEditField.tsx +54 -0
- package/src/components/forms/ChipArrayField.tsx +81 -0
- package/src/components/forms/HintForm.tsx +437 -0
- package/src/components/forms/SchemaForm.tsx +307 -0
- package/src/components/index.ts +14 -0
- package/src/components/media/AssetCard.tsx +84 -0
- package/src/components/media/AssetDetailSidebar.tsx +335 -0
- package/src/components/media/BulkActionBar.tsx +33 -0
- package/src/components/media/FolderNav.tsx +44 -0
- package/src/components/media/FolderTreeSidebar.tsx +171 -0
- package/src/components/media/ImagePicker.tsx +102 -0
- package/src/components/media/MediaLibrary.tsx +183 -0
- package/src/components/media/MediaToolbar.tsx +100 -0
- package/src/components/media/UploadModal.tsx +266 -0
- package/src/components/media/index.ts +9 -0
- package/src/components/pages/DataList.tsx +496 -0
- package/src/components/pages/FragmentList.tsx +592 -0
- package/src/components/pages/MediaPage.tsx +284 -0
- package/src/components/pages/PageList.tsx +683 -0
- package/src/components/pages/index.ts +2 -0
- package/src/components/puck/MDXContent.tsx +199 -0
- package/src/components/puck/index.ts +1 -0
- package/src/components/sandbox/ContentSandbox.tsx +191 -0
- package/src/components/sandbox/frame-runtime.ts +15 -0
- package/src/components/toast.tsx +48 -0
- package/src/components/ui/Banner.tsx +108 -0
- package/src/components/ui/Button.tsx +51 -0
- package/src/components/ui/Card.tsx +124 -0
- package/src/components/ui/FieldError.tsx +37 -0
- package/src/components/ui/IconButton.tsx +40 -0
- package/src/components/ui/Input.tsx +66 -0
- package/src/components/ui/SaveIndicator.tsx +44 -0
- package/src/components/ui/Select.tsx +29 -0
- package/src/components/ui/Separator.tsx +14 -0
- package/src/components/ui/Textarea.tsx +22 -0
- package/src/components/ui/Tooltip.tsx +25 -0
- package/src/components/ui/index.ts +18 -0
- package/src/data-schemas.ts +82 -0
- package/src/dev-entry.tsx +25 -0
- package/src/dev.html +36 -0
- package/src/editor-flush.ts +47 -0
- package/src/hooks/index.ts +22 -0
- package/src/hooks/useCanvasTheme.tsx +52 -0
- package/src/hooks/useClickOutside.ts +24 -0
- package/src/hooks/useDialogState.ts +40 -0
- package/src/hooks/useEditorPref.ts +58 -0
- package/src/hooks/useErrorModal.tsx +63 -0
- package/src/hooks/useSiteBaseUrl.ts +16 -0
- package/src/hooks/useTheme.tsx +76 -0
- package/src/hooks/useUnsavedChangesGuard.ts +32 -0
- package/src/hooks/useUpload.ts +19 -0
- package/src/hooks/useUploadFlow.ts +227 -0
- package/src/host-discovery.ts +77 -0
- package/src/host-style-probe.ts +684 -0
- package/src/index.ts +42 -0
- package/src/lib/utils.ts +56 -0
- package/src/main-spa.tsx +69 -0
- package/src/main.css +1095 -0
- package/src/main.html +43 -0
- package/src/main.tsx +16 -0
- package/src/mdx-components-define.ts +296 -0
- package/src/mdx-components.ts +154 -0
- package/src/media/AssetScopePill.tsx +56 -0
- package/src/media/MediaIssueBadge.tsx +86 -0
- package/src/media/types.ts +96 -0
- package/src/media/use-asset-scope.ts +58 -0
- package/src/media/use-media-issue.ts +53 -0
- package/src/merge-default-props.ts +58 -0
- package/src/mock-puck-config.tsx +115 -0
- package/src/page-schema-define.ts +176 -0
- package/src/page-schemas.ts +80 -0
- package/src/page-setting-attributes.ts +40 -0
- package/src/prose-surface-css.ts +359 -0
- package/src/puck-config.ts +77 -0
- package/src/sandbox-preview-styles.ts +166 -0
- package/src/selected-block.ts +121 -0
- package/src/site-css-layer.ts +109 -0
- package/src/site-styles.ts +524 -0
- package/src/theme.ts +102 -0
- package/src/types.ts +63 -0
- package/src/ui-config.ts +334 -0
- package/src/utils/asset-url.ts +22 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/content-failure.ts +74 -0
- package/src/utils/entry-meta.ts +47 -0
- package/src/utils/entry-name.ts +21 -0
- package/src/utils/format-date.ts +34 -0
- package/src/utils/mdast-to-html.ts +247 -0
- package/src/utils/mdast-tree.ts +292 -0
- package/src/utils/menu-placement.ts +13 -0
- package/src/utils/pageMetadata.ts +285 -0
- package/src/utils/sanitize-html.ts +84 -0
- package/src/utils/slugify.ts +21 -0
- package/src/utils/zodIntrospect.ts +136 -0
- package/src/vite-env.d.ts +10 -0
- package/src/write-access.ts +147 -0
- package/styles/stylesheet.d.ts +6 -0
- package/styles/tailwind-theme.css +7 -5
- package/dist/App-Bk1LNxbS.mjs +0 -10851
- package/dist/App-Bk1LNxbS.mjs.map +0 -1
- package/dist/App.d.ts +0 -35
- package/dist/App.d.ts.map +0 -1
- package/dist/App.js +0 -52
- package/dist/CmsSpaApp.d.ts +0 -13
- package/dist/CmsSpaApp.d.ts.map +0 -1
- package/dist/CmsSpaApp.js +0 -33
- package/dist/cn-dlASUkDY.mjs +0 -10
- package/dist/cn-dlASUkDY.mjs.map +0 -1
- package/dist/components/CMSDashboard.d.ts +0 -2
- package/dist/components/CMSDashboard.d.ts.map +0 -1
- package/dist/components/CMSDashboard.js +0 -20
- package/dist/components/CMSLayout.d.ts +0 -2
- package/dist/components/CMSLayout.d.ts.map +0 -1
- package/dist/components/CMSLayout.js +0 -15
- package/dist/components/ConlocaLogo.d.ts +0 -2
- package/dist/components/ConlocaLogo.d.ts.map +0 -1
- package/dist/components/ConlocaLogo.js +0 -4
- package/dist/components/GitStatusPanel.d.ts +0 -25
- package/dist/components/GitStatusPanel.d.ts.map +0 -1
- package/dist/components/GitStatusPanel.js +0 -77
- package/dist/components/MobileTopBar.d.ts +0 -6
- package/dist/components/MobileTopBar.d.ts.map +0 -1
- package/dist/components/MobileTopBar.js +0 -6
- package/dist/components/Sidebar.d.ts +0 -8
- package/dist/components/Sidebar.d.ts.map +0 -1
- package/dist/components/Sidebar.js +0 -40
- package/dist/components/UserAvatar.d.ts +0 -2
- package/dist/components/UserAvatar.d.ts.map +0 -1
- package/dist/components/UserAvatar.js +0 -14
- package/dist/components/cards/DataEntryCard.d.ts +0 -14
- package/dist/components/cards/DataEntryCard.d.ts.map +0 -1
- package/dist/components/cards/DataEntryCard.js +0 -32
- package/dist/components/cards/SectionCard.d.ts +0 -15
- package/dist/components/cards/SectionCard.d.ts.map +0 -1
- package/dist/components/cards/SectionCard.js +0 -10
- package/dist/components/cards/index.d.ts +0 -2
- package/dist/components/cards/index.d.ts.map +0 -1
- package/dist/components/cards/index.js +0 -1
- package/dist/components/dashboard/RecentActivity.d.ts +0 -2
- package/dist/components/dashboard/RecentActivity.d.ts.map +0 -1
- package/dist/components/dashboard/RecentActivity.js +0 -58
- package/dist/components/dialog.d.ts +0 -53
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/dialog.js +0 -56
- package/dist/components/dialogs/BlockPropertiesDialog.d.ts +0 -12
- package/dist/components/dialogs/BlockPropertiesDialog.d.ts.map +0 -1
- package/dist/components/dialogs/BlockPropertiesDialog.js +0 -42
- package/dist/components/dialogs/ConflictDialog.d.ts +0 -10
- package/dist/components/dialogs/ConflictDialog.d.ts.map +0 -1
- package/dist/components/dialogs/ConflictDialog.js +0 -29
- package/dist/components/dialogs/CreateDataDialog.d.ts +0 -9
- package/dist/components/dialogs/CreateDataDialog.d.ts.map +0 -1
- package/dist/components/dialogs/CreateDataDialog.js +0 -20
- package/dist/components/dialogs/CreateFolderDialog.d.ts +0 -9
- package/dist/components/dialogs/CreateFolderDialog.d.ts.map +0 -1
- package/dist/components/dialogs/CreateFolderDialog.js +0 -33
- package/dist/components/dialogs/CreatePageDialog.d.ts +0 -10
- package/dist/components/dialogs/CreatePageDialog.d.ts.map +0 -1
- package/dist/components/dialogs/CreatePageDialog.js +0 -155
- package/dist/components/dialogs/DataPropertiesDialog.d.ts +0 -10
- package/dist/components/dialogs/DataPropertiesDialog.d.ts.map +0 -1
- package/dist/components/dialogs/DataPropertiesDialog.js +0 -38
- package/dist/components/dialogs/DeleteConfirmDialog.d.ts +0 -12
- package/dist/components/dialogs/DeleteConfirmDialog.d.ts.map +0 -1
- package/dist/components/dialogs/DeleteConfirmDialog.js +0 -7
- package/dist/components/dialogs/ErrorModal.d.ts +0 -14
- package/dist/components/dialogs/ErrorModal.d.ts.map +0 -1
- package/dist/components/dialogs/ErrorModal.js +0 -38
- package/dist/components/dialogs/MoveFolderDialog.d.ts +0 -11
- package/dist/components/dialogs/MoveFolderDialog.d.ts.map +0 -1
- package/dist/components/dialogs/MoveFolderDialog.js +0 -45
- package/dist/components/dialogs/PageMetadataDialog.d.ts +0 -10
- package/dist/components/dialogs/PageMetadataDialog.d.ts.map +0 -1
- package/dist/components/dialogs/PageMetadataDialog.js +0 -85
- package/dist/components/dialogs/UnsavedChangesDialog.d.ts +0 -8
- package/dist/components/dialogs/UnsavedChangesDialog.d.ts.map +0 -1
- package/dist/components/dialogs/UnsavedChangesDialog.js +0 -6
- package/dist/components/dialogs/index.d.ts +0 -9
- package/dist/components/dialogs/index.d.ts.map +0 -1
- package/dist/components/dialogs/index.js +0 -8
- package/dist/components/editor/BlockEditor.d.ts +0 -8
- package/dist/components/editor/BlockEditor.d.ts.map +0 -1
- package/dist/components/editor/BlockEditor.js +0 -262
- package/dist/components/editor/BlockWrappers.d.ts +0 -15
- package/dist/components/editor/BlockWrappers.d.ts.map +0 -1
- package/dist/components/editor/BlockWrappers.js +0 -29
- package/dist/components/editor/CMSMDXEditor.d.ts +0 -13
- package/dist/components/editor/CMSMDXEditor.d.ts.map +0 -1
- package/dist/components/editor/CMSMDXEditor.js +0 -123
- package/dist/components/editor/ContentDiff.d.ts +0 -10
- package/dist/components/editor/ContentDiff.d.ts.map +0 -1
- package/dist/components/editor/ContentDiff.js +0 -51
- package/dist/components/editor/CreateBlockDialog.d.ts +0 -26
- package/dist/components/editor/CreateBlockDialog.d.ts.map +0 -1
- package/dist/components/editor/CreateBlockDialog.js +0 -131
- package/dist/components/editor/DrawerItemOverride.d.ts +0 -8
- package/dist/components/editor/DrawerItemOverride.d.ts.map +0 -1
- package/dist/components/editor/DrawerItemOverride.js +0 -41
- package/dist/components/editor/EditorChromeToggles.d.ts +0 -16
- package/dist/components/editor/EditorChromeToggles.d.ts.map +0 -1
- package/dist/components/editor/EditorChromeToggles.js +0 -16
- package/dist/components/editor/GenericBlock.d.ts +0 -3
- package/dist/components/editor/GenericBlock.d.ts.map +0 -1
- package/dist/components/editor/GenericBlock.js +0 -1067
- package/dist/components/editor/ImagePickerDialog.d.ts +0 -6
- package/dist/components/editor/ImagePickerDialog.d.ts.map +0 -1
- package/dist/components/editor/ImagePickerDialog.js +0 -24
- package/dist/components/editor/JsxPropsPanel.d.ts +0 -16
- package/dist/components/editor/JsxPropsPanel.d.ts.map +0 -1
- package/dist/components/editor/JsxPropsPanel.js +0 -145
- package/dist/components/editor/LocaleSelector.d.ts +0 -9
- package/dist/components/editor/LocaleSelector.d.ts.map +0 -1
- package/dist/components/editor/LocaleSelector.js +0 -13
- package/dist/components/editor/MDXLivePreview.d.ts +0 -14
- package/dist/components/editor/MDXLivePreview.d.ts.map +0 -1
- package/dist/components/editor/MDXLivePreview.js +0 -103
- package/dist/components/editor/MdxPageEditor.d.ts +0 -10
- package/dist/components/editor/MdxPageEditor.d.ts.map +0 -1
- package/dist/components/editor/MdxPageEditor.js +0 -297
- package/dist/components/editor/PageEditor.d.ts +0 -18
- package/dist/components/editor/PageEditor.d.ts.map +0 -1
- package/dist/components/editor/PageEditor.js +0 -288
- package/dist/components/editor/PageEditorHeaderActions.d.ts +0 -16
- package/dist/components/editor/PageEditorHeaderActions.d.ts.map +0 -1
- package/dist/components/editor/PageEditorHeaderActions.js +0 -19
- package/dist/components/editor/PageEditorWrapper.d.ts +0 -7
- package/dist/components/editor/PageEditorWrapper.d.ts.map +0 -1
- package/dist/components/editor/PageEditorWrapper.js +0 -319
- package/dist/components/editor/SearchableSelect.d.ts +0 -34
- package/dist/components/editor/SearchableSelect.d.ts.map +0 -1
- package/dist/components/editor/SearchableSelect.js +0 -116
- package/dist/components/editor/host-wrapper-plugin.d.ts.map +0 -1
- package/dist/components/editor/host-wrapper-plugin.js +0 -37
- package/dist/components/editor/index.d.ts +0 -9
- package/dist/components/editor/index.d.ts.map +0 -1
- package/dist/components/editor/index.js +0 -7
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts +0 -15
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +0 -1
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.js +0 -90
- package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts +0 -12
- package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +0 -1
- package/dist/components/editor/insert-menu/SlashMenuPlugin.js +0 -106
- package/dist/components/editor/insert-menu/insert-payload.d.ts +0 -76
- package/dist/components/editor/insert-menu/insert-payload.d.ts.map +0 -1
- package/dist/components/editor/insert-menu/insert-payload.js +0 -94
- package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts.map +0 -1
- package/dist/components/editor/insert-menu/mdx-components-plugin.js +0 -13
- package/dist/components/editors/DataEditor.d.ts +0 -19
- package/dist/components/editors/DataEditor.d.ts.map +0 -1
- package/dist/components/editors/DataEditor.js +0 -139
- package/dist/components/fields/ContentBlockSelectorField.d.ts +0 -14
- package/dist/components/fields/ContentBlockSelectorField.d.ts.map +0 -1
- package/dist/components/fields/ContentBlockSelectorField.js +0 -105
- package/dist/components/fields/ImageField.d.ts +0 -16
- package/dist/components/fields/ImageField.d.ts.map +0 -1
- package/dist/components/fields/ImageField.js +0 -39
- package/dist/components/fields/MDXEditField.d.ts +0 -17
- package/dist/components/fields/MDXEditField.d.ts.map +0 -1
- package/dist/components/fields/MDXEditField.js +0 -28
- package/dist/components/forms/ChipArrayField.d.ts +0 -12
- package/dist/components/forms/ChipArrayField.d.ts.map +0 -1
- package/dist/components/forms/ChipArrayField.js +0 -40
- package/dist/components/forms/HintForm.d.ts +0 -22
- package/dist/components/forms/HintForm.d.ts.map +0 -1
- package/dist/components/forms/HintForm.js +0 -162
- package/dist/components/forms/SchemaForm.d.ts +0 -15
- package/dist/components/forms/SchemaForm.d.ts.map +0 -1
- package/dist/components/forms/SchemaForm.js +0 -106
- package/dist/components/index.d.ts +0 -8
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -13
- package/dist/components/media/AssetCard.d.ts +0 -14
- package/dist/components/media/AssetCard.d.ts.map +0 -1
- package/dist/components/media/AssetCard.js +0 -31
- package/dist/components/media/AssetDetailSidebar.d.ts +0 -11
- package/dist/components/media/AssetDetailSidebar.d.ts.map +0 -1
- package/dist/components/media/AssetDetailSidebar.js +0 -101
- package/dist/components/media/BulkActionBar.d.ts +0 -9
- package/dist/components/media/BulkActionBar.d.ts.map +0 -1
- package/dist/components/media/BulkActionBar.js +0 -8
- package/dist/components/media/FolderNav.d.ts +0 -7
- package/dist/components/media/FolderNav.d.ts.map +0 -1
- package/dist/components/media/FolderNav.js +0 -12
- package/dist/components/media/FolderTreeSidebar.d.ts +0 -9
- package/dist/components/media/FolderTreeSidebar.d.ts.map +0 -1
- package/dist/components/media/FolderTreeSidebar.js +0 -41
- package/dist/components/media/ImagePicker.d.ts +0 -14
- package/dist/components/media/ImagePicker.d.ts.map +0 -1
- package/dist/components/media/ImagePicker.js +0 -45
- package/dist/components/media/MediaLibrary.d.ts +0 -35
- package/dist/components/media/MediaLibrary.d.ts.map +0 -1
- package/dist/components/media/MediaLibrary.js +0 -100
- package/dist/components/media/MediaToolbar.d.ts +0 -21
- package/dist/components/media/MediaToolbar.d.ts.map +0 -1
- package/dist/components/media/MediaToolbar.js +0 -6
- package/dist/components/media/UploadModal.d.ts +0 -9
- package/dist/components/media/UploadModal.d.ts.map +0 -1
- package/dist/components/media/UploadModal.js +0 -42
- package/dist/components/media/UploadZone.d.ts +0 -8
- package/dist/components/media/UploadZone.d.ts.map +0 -1
- package/dist/components/media/UploadZone.js +0 -22
- package/dist/components/media/index.d.ts +0 -11
- package/dist/components/media/index.d.ts.map +0 -1
- package/dist/components/media/index.js +0 -10
- package/dist/components/pages/BlockList.d.ts +0 -2
- package/dist/components/pages/BlockList.d.ts.map +0 -1
- package/dist/components/pages/BlockList.js +0 -280
- package/dist/components/pages/DataList.d.ts +0 -7
- package/dist/components/pages/DataList.d.ts.map +0 -1
- package/dist/components/pages/DataList.js +0 -244
- package/dist/components/pages/MediaPage.d.ts +0 -8
- package/dist/components/pages/MediaPage.d.ts.map +0 -1
- package/dist/components/pages/MediaPage.js +0 -107
- package/dist/components/pages/PageList.d.ts +0 -7
- package/dist/components/pages/PageList.d.ts.map +0 -1
- package/dist/components/pages/PageList.js +0 -308
- package/dist/components/pages/index.d.ts +0 -3
- package/dist/components/pages/index.d.ts.map +0 -1
- package/dist/components/pages/index.js +0 -2
- package/dist/components/puck/MDXContent.d.ts +0 -10
- package/dist/components/puck/MDXContent.d.ts.map +0 -1
- package/dist/components/puck/MDXContent.js +0 -80
- package/dist/components/puck/index.d.ts +0 -2
- package/dist/components/puck/index.d.ts.map +0 -1
- package/dist/components/puck/index.js +0 -1
- package/dist/components/toast.d.ts +0 -44
- package/dist/components/toast.d.ts.map +0 -1
- package/dist/components/toast.js +0 -7
- package/dist/components/ui/Banner.d.ts +0 -76
- package/dist/components/ui/Banner.d.ts.map +0 -1
- package/dist/components/ui/Banner.js +0 -49
- package/dist/components/ui/Button.d.ts +0 -25
- package/dist/components/ui/Button.d.ts.map +0 -1
- package/dist/components/ui/Button.js +0 -33
- package/dist/components/ui/Card.d.ts +0 -72
- package/dist/components/ui/Card.d.ts.map +0 -1
- package/dist/components/ui/Card.js +0 -49
- package/dist/components/ui/FieldError.d.ts +0 -24
- package/dist/components/ui/FieldError.d.ts.map +0 -1
- package/dist/components/ui/FieldError.js +0 -17
- package/dist/components/ui/IconButton.d.ts +0 -13
- package/dist/components/ui/IconButton.d.ts.map +0 -1
- package/dist/components/ui/IconButton.js +0 -10
- package/dist/components/ui/Input.d.ts +0 -37
- package/dist/components/ui/Input.d.ts.map +0 -1
- package/dist/components/ui/Input.js +0 -9
- package/dist/components/ui/SaveIndicator.d.ts +0 -8
- package/dist/components/ui/SaveIndicator.d.ts.map +0 -1
- package/dist/components/ui/SaveIndicator.js +0 -32
- package/dist/components/ui/Select.d.ts +0 -8
- package/dist/components/ui/Select.d.ts.map +0 -1
- package/dist/components/ui/Select.js +0 -9
- package/dist/components/ui/Separator.d.ts +0 -7
- package/dist/components/ui/Separator.d.ts.map +0 -1
- package/dist/components/ui/Separator.js +0 -8
- package/dist/components/ui/Textarea.d.ts +0 -8
- package/dist/components/ui/Textarea.d.ts.map +0 -1
- package/dist/components/ui/Textarea.js +0 -5
- package/dist/components/ui/Tooltip.d.ts +0 -9
- package/dist/components/ui/Tooltip.d.ts.map +0 -1
- package/dist/components/ui/Tooltip.js +0 -7
- package/dist/components/ui/index.d.ts +0 -14
- package/dist/components/ui/index.d.ts.map +0 -1
- package/dist/components/ui/index.js +0 -17
- package/dist/data-schemas.d.mts +0 -25
- package/dist/data-schemas.d.mts.map +0 -1
- package/dist/data-schemas.d.ts +0 -22
- package/dist/data-schemas.d.ts.map +0 -1
- package/dist/data-schemas.js +0 -51
- package/dist/data-schemas.mjs +0 -51
- package/dist/data-schemas.mjs.map +0 -1
- package/dist/dev-entry.d.ts +0 -2
- package/dist/dev-entry.d.ts.map +0 -1
- package/dist/dev-entry.js +0 -19
- package/dist/dialog.d.mts +0 -56
- package/dist/dialog.d.mts.map +0 -1
- package/dist/dialog.mjs +0 -67
- package/dist/dialog.mjs.map +0 -1
- package/dist/hooks/index.d.ts +0 -10
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -7
- package/dist/hooks/useCanvasTheme.d.ts +0 -12
- package/dist/hooks/useCanvasTheme.d.ts.map +0 -1
- package/dist/hooks/useCanvasTheme.js +0 -33
- package/dist/hooks/useClickOutside.d.ts.map +0 -1
- package/dist/hooks/useClickOutside.js +0 -18
- package/dist/hooks/useDialogState.d.ts.map +0 -1
- package/dist/hooks/useDialogState.js +0 -31
- package/dist/hooks/useEditorPref.d.ts.map +0 -1
- package/dist/hooks/useEditorPref.js +0 -49
- package/dist/hooks/useErrorModal.d.ts +0 -15
- package/dist/hooks/useErrorModal.d.ts.map +0 -1
- package/dist/hooks/useErrorModal.js +0 -35
- package/dist/hooks/useSiteBaseUrl.d.ts +0 -10
- package/dist/hooks/useSiteBaseUrl.d.ts.map +0 -1
- package/dist/hooks/useSiteBaseUrl.js +0 -14
- package/dist/hooks/useTheme.d.ts +0 -13
- package/dist/hooks/useTheme.d.ts.map +0 -1
- package/dist/hooks/useTheme.js +0 -69
- package/dist/hooks/useUnsavedChangesGuard.d.ts.map +0 -1
- package/dist/hooks/useUnsavedChangesGuard.js +0 -29
- package/dist/hooks/useUpload.d.ts +0 -10
- package/dist/hooks/useUpload.d.ts.map +0 -1
- package/dist/hooks/useUpload.js +0 -42
- package/dist/hooks/useUploadFlow.d.ts +0 -42
- package/dist/hooks/useUploadFlow.d.ts.map +0 -1
- package/dist/hooks/useUploadFlow.js +0 -148
- package/dist/host-style-probe.d.ts +0 -22
- package/dist/host-style-probe.d.ts.map +0 -1
- package/dist/host-style-probe.js +0 -508
- package/dist/index.d.mts +0 -253
- package/dist/index.d.mts.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.mjs +0 -38
- package/dist/index.mjs.map +0 -1
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -47
- package/dist/main-spa-781YUplS.mjs +0 -46
- package/dist/main-spa-781YUplS.mjs.map +0 -1
- package/dist/main-spa.d.ts.map +0 -1
- package/dist/main-spa.js +0 -61
- package/dist/main.d.mts +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -13
- package/dist/main.mjs +0 -17
- package/dist/main.mjs.map +0 -1
- package/dist/mdx-components.d.mts +0 -207
- package/dist/mdx-components.d.mts.map +0 -1
- package/dist/mdx-components.d.ts +0 -204
- package/dist/mdx-components.d.ts.map +0 -1
- package/dist/mdx-components.js +0 -217
- package/dist/mdx-components.mjs +0 -208
- package/dist/mdx-components.mjs.map +0 -1
- package/dist/media/AssetScopePill.d.ts +0 -30
- package/dist/media/AssetScopePill.d.ts.map +0 -1
- package/dist/media/AssetScopePill.js +0 -30
- package/dist/media/MediaIssueBadge.d.ts +0 -33
- package/dist/media/MediaIssueBadge.d.ts.map +0 -1
- package/dist/media/MediaIssueBadge.js +0 -54
- package/dist/media/types.d.ts +0 -101
- package/dist/media/types.d.ts.map +0 -1
- package/dist/media/types.js +0 -1
- package/dist/media/use-asset-scope.d.ts +0 -25
- package/dist/media/use-asset-scope.d.ts.map +0 -1
- package/dist/media/use-asset-scope.js +0 -54
- package/dist/media/use-media-issue.d.ts +0 -24
- package/dist/media/use-media-issue.d.ts.map +0 -1
- package/dist/media/use-media-issue.js +0 -49
- package/dist/mock-puck-config.d.mts +0 -23
- package/dist/mock-puck-config.d.mts.map +0 -1
- package/dist/mock-puck-config.d.ts.map +0 -1
- package/dist/mock-puck-config.js +0 -73
- package/dist/mock-puck-config.mjs +0 -125
- package/dist/mock-puck-config.mjs.map +0 -1
- package/dist/page-schemas.d.mts +0 -159
- package/dist/page-schemas.d.mts.map +0 -1
- package/dist/page-schemas.d.ts +0 -156
- package/dist/page-schemas.d.ts.map +0 -1
- package/dist/page-schemas.js +0 -118
- package/dist/page-schemas.mjs +0 -120
- package/dist/page-schemas.mjs.map +0 -1
- package/dist/puck-config.d.mts +0 -33
- package/dist/puck-config.d.mts.map +0 -1
- package/dist/puck-config.d.ts.map +0 -1
- package/dist/puck-config.js +0 -50
- package/dist/puck-config.mjs +0 -50
- package/dist/puck-config.mjs.map +0 -1
- package/dist/selected-block.d.ts +0 -61
- package/dist/selected-block.d.ts.map +0 -1
- package/dist/selected-block.js +0 -64
- package/dist/site-styles.d.mts +0 -123
- package/dist/site-styles.d.mts.map +0 -1
- package/dist/site-styles.d.ts +0 -121
- package/dist/site-styles.d.ts.map +0 -1
- package/dist/site-styles.js +0 -253
- package/dist/site-styles.mjs +0 -234
- package/dist/site-styles.mjs.map +0 -1
- package/dist/toast.d.mts +0 -7
- package/dist/toast.d.mts.map +0 -1
- package/dist/toast.mjs +0 -16
- package/dist/toast.mjs.map +0 -1
- package/dist/types.d.ts +0 -57
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/ui-CIacC6Mv.mjs +0 -318
- package/dist/ui-CIacC6Mv.mjs.map +0 -1
- package/dist/ui-config.d.ts +0 -70
- package/dist/ui-config.d.ts.map +0 -1
- package/dist/ui-config.js +0 -44
- package/dist/ui.d.mts +0 -290
- package/dist/ui.d.mts.map +0 -1
- package/dist/ui.mjs +0 -2
- package/dist/utils/asset-url.d.ts +0 -3
- package/dist/utils/asset-url.d.ts.map +0 -1
- package/dist/utils/asset-url.js +0 -7
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/cn.js +0 -5
- package/dist/utils/format-date.d.ts.map +0 -1
- package/dist/utils/format-date.js +0 -37
- package/dist/utils/mdast-to-html.d.ts.map +0 -1
- package/dist/utils/mdast-to-html.js +0 -206
- package/dist/utils/mdast-tree.d.ts.map +0 -1
- package/dist/utils/mdast-tree.js +0 -285
- package/dist/utils/pageMetadata.d.ts +0 -67
- package/dist/utils/pageMetadata.d.ts.map +0 -1
- package/dist/utils/pageMetadata.js +0 -161
- package/dist/utils/slugify.d.ts +0 -12
- package/dist/utils/slugify.d.ts.map +0 -1
- package/dist/utils/slugify.js +0 -17
- package/dist/utils/zodIntrospect.d.ts +0 -24
- package/dist/utils/zodIntrospect.d.ts.map +0 -1
- package/dist/utils/zodIntrospect.js +0 -88
- package/styles/styles.css.d.ts +0 -2
- package/styles/tailwind-theme.css.d.ts +0 -2
- /package/dist/{components → ts/components}/editor/host-wrapper-plugin.d.ts +0 -0
- /package/dist/{components → ts/components}/editor/insert-menu/mdx-components-plugin.d.ts +0 -0
- /package/dist/{hooks → ts/hooks}/useClickOutside.d.ts +0 -0
- /package/dist/{hooks → ts/hooks}/useDialogState.d.ts +0 -0
- /package/dist/{hooks → ts/hooks}/useEditorPref.d.ts +0 -0
- /package/dist/{hooks → ts/hooks}/useUnsavedChangesGuard.d.ts +0 -0
- /package/dist/{lib → ts/lib}/utils.d.ts +0 -0
- /package/dist/{main-spa.d.ts → ts/main-spa.d.ts} +0 -0
- /package/dist/{main.d.ts → ts/main.d.ts} +0 -0
- /package/dist/{mock-puck-config.d.ts → ts/mock-puck-config.d.ts} +0 -0
- /package/dist/{puck-config.d.ts → ts/puck-config.d.ts} +0 -0
- /package/dist/{utils → ts/utils}/cn.d.ts +0 -0
- /package/dist/{utils → ts/utils}/format-date.d.ts +0 -0
- /package/dist/{utils → ts/utils}/mdast-to-html.d.ts +0 -0
- /package/dist/{utils → ts/utils}/mdast-tree.d.ts +0 -0
|
@@ -0,0 +1,1361 @@
|
|
|
1
|
+
import type { JsxEditorProps } from '@mdxeditor/editor';
|
|
2
|
+
import {
|
|
3
|
+
NestedLexicalEditor,
|
|
4
|
+
useLexicalNodeRemove,
|
|
5
|
+
useMdastNodeUpdater,
|
|
6
|
+
useNestedEditorContext,
|
|
7
|
+
} from '@mdxeditor/editor';
|
|
8
|
+
import { $getNodeByKey } from 'lexical';
|
|
9
|
+
import type * as Mdast from 'mdast';
|
|
10
|
+
import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
11
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { createPortal } from 'react-dom';
|
|
13
|
+
import {
|
|
14
|
+
containsMarkdownMarkers,
|
|
15
|
+
isJsxDescriptor,
|
|
16
|
+
type MdxComponentDescriptor,
|
|
17
|
+
useMdxComponents,
|
|
18
|
+
writeAttribute,
|
|
19
|
+
} from '../../mdx-components.js';
|
|
20
|
+
import { useSandboxPreviewStyles } from '../../sandbox-preview-styles.js';
|
|
21
|
+
import { getSelectedBlock, setSelectedBlock, useSelectedBlock } from '../../selected-block.js';
|
|
22
|
+
import { bodyNeedsStaticHtml, isHtmlTag, mdastToHtml } from '../../utils/mdast-to-html.js';
|
|
23
|
+
import {
|
|
24
|
+
effectiveChildren,
|
|
25
|
+
getMdastAtPath,
|
|
26
|
+
getNamedSlotName,
|
|
27
|
+
readAttrs,
|
|
28
|
+
removeMdastNodeAtPath,
|
|
29
|
+
replaceMdastAtPath,
|
|
30
|
+
replaceMdastNodeAtPath,
|
|
31
|
+
slotIdToPath,
|
|
32
|
+
stripBodyFields,
|
|
33
|
+
} from '../../utils/mdast-tree.js';
|
|
34
|
+
import { sanitizeComponentHtml, sanitizeHtml } from '../../utils/sanitize-html.js';
|
|
35
|
+
import { ContentSandbox } from '../sandbox/ContentSandbox.js';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One editor component for any MDX JSX block. Replaces the per-component
|
|
39
|
+
* `AsideEditor` / `CardEditor` / ... files in the host project.
|
|
40
|
+
*
|
|
41
|
+
* Markup comes from the integration's `/api/render` endpoint, which runs
|
|
42
|
+
* the real framework component via Astro's Container API and returns the
|
|
43
|
+
* exact HTML the published page would emit. No hardcoded templates, no
|
|
44
|
+
* version-pinned class names — every component the host can render on
|
|
45
|
+
* its live site renders identically in the editor.
|
|
46
|
+
*
|
|
47
|
+
* Editing affordances (prop fields + delete) live in a small overlay row
|
|
48
|
+
* above the block. The body is a `NestedLexicalEditor` portaled into a
|
|
49
|
+
* `<conloca-slot>` element inside the rendered HTML, so wrapper-HTML
|
|
50
|
+
* replacement on prop change preserves the editor's mounting state
|
|
51
|
+
* (focus, selection, undo stack).
|
|
52
|
+
*
|
|
53
|
+
* If a component has no `import` source (descriptor missing), or the
|
|
54
|
+
* render endpoint fails, falls back to a plain wrapper so the body
|
|
55
|
+
* stays editable and the document still saves correctly.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
type AnyProps = Record<string, unknown>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* One node in the recursive render-tree payload. Leaves emit a single
|
|
62
|
+
* `<conloca-slot data-slot-id="...">` for inline body editing.
|
|
63
|
+
* Containers (with `children`) emit each child's rendered HTML in
|
|
64
|
+
* document order as the parent's default slot, so the final markup
|
|
65
|
+
* matches what Astro would emit for the same MDX — positional CSS
|
|
66
|
+
* (Card colour cycle, CSS-grid placement, etc.) resolves the same
|
|
67
|
+
* way as on the live page.
|
|
68
|
+
*
|
|
69
|
+
* `body` is an HTML-escaped string of the leaf's text content,
|
|
70
|
+
* shipped as fallback so children inside containers (Cards in a
|
|
71
|
+
* CardGrid) display their authored text statically.
|
|
72
|
+
*
|
|
73
|
+
* `bodyHtml` is RAW HTML that REPLACES the conloca-slot wrapper
|
|
74
|
+
* entirely. Used for components whose Astro implementation validates
|
|
75
|
+
* the slot element type (Starlight's `<Steps>` requires `<ol>`,
|
|
76
|
+
* `<FileTree>` requires `<ul>`) — passing `<conloca-slot>` makes the
|
|
77
|
+
* Container API render call throw. With `bodyHtml` set, the server
|
|
78
|
+
* emits the raw HTML directly as the slot content, so the validator
|
|
79
|
+
* sees the expected element. Inline editing isn't possible until
|
|
80
|
+
* we add slot-id markers to specific positions inside the rendered
|
|
81
|
+
* list and portal editors there.
|
|
82
|
+
*/
|
|
83
|
+
interface RenderTreeNode {
|
|
84
|
+
component: string;
|
|
85
|
+
source: string;
|
|
86
|
+
defaultExport?: boolean;
|
|
87
|
+
props: AnyProps;
|
|
88
|
+
slotId: string;
|
|
89
|
+
body?: string;
|
|
90
|
+
bodyHtml?: string;
|
|
91
|
+
children?: RenderTreeNode[];
|
|
92
|
+
/** Named-slot HTML keyed by slot name. Extracted from
|
|
93
|
+
* `<Fragment slot="...">...</Fragment>` children in the source MDX
|
|
94
|
+
* and passed to the Astro renderer as additional slots. */
|
|
95
|
+
namedSlots?: Record<string, string>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface RenderRequest {
|
|
99
|
+
tree: RenderTreeNode;
|
|
100
|
+
/**
|
|
101
|
+
* 1-based position of the top-level block among Lexical's root
|
|
102
|
+
* children. Server prepends `documentIndex - 1` hidden phantom
|
|
103
|
+
* siblings inside the wrapper so the real component lands at
|
|
104
|
+
* `:nth-child(N)` for positional CSS rules.
|
|
105
|
+
*
|
|
106
|
+
* Inline (text-kind) components aren't root flow children, so they
|
|
107
|
+
* skip this — set to 0 (or omit) to suppress the wrapping div + phantoms.
|
|
108
|
+
*/
|
|
109
|
+
documentIndex: number;
|
|
110
|
+
/**
|
|
111
|
+
* When true, the server emits inline HTML with no `<div
|
|
112
|
+
* class="sl-markdown-content">` wrapper and no phantom siblings,
|
|
113
|
+
* suitable for splicing into a paragraph's text flow. Used for
|
|
114
|
+
* text-kind components like `<Icon>` whose published markup is an
|
|
115
|
+
* inline `<svg>`.
|
|
116
|
+
*/
|
|
117
|
+
inline?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const SLOT_TAG = 'conloca-slot';
|
|
121
|
+
const RENDER_ENDPOINT = '/__cms/api/render';
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Find string-prop values inside the SSR'd preview and make their rendering
|
|
125
|
+
* element directly editable. The author types in place; on blur the new
|
|
126
|
+
* value flows back through `onPropChange`, which routes through the same
|
|
127
|
+
* mdast updater the side panel uses — so a LinkCard's `description` can
|
|
128
|
+
* be edited inline OR in the side panel, both update the same source.
|
|
129
|
+
*
|
|
130
|
+
* Resolution is a conservative text-match heuristic: only leaf elements
|
|
131
|
+
* (no element children) whose `textContent.trim()` equals the prop value
|
|
132
|
+
* qualify, AND the match must be unique. If two elements happen to render
|
|
133
|
+
* the same string, or the value is too short to disambiguate (<3 chars),
|
|
134
|
+
* the prop falls back to side-panel-only editing. This avoids accidentally
|
|
135
|
+
* binding the wrong element when a value like "tip" coincides with body
|
|
136
|
+
* text or a CSS class.
|
|
137
|
+
*
|
|
138
|
+
* Commits land on blur (or Enter), not on keystroke — committing per-key
|
|
139
|
+
* would refire the render endpoint on every character and lose focus
|
|
140
|
+
* each time the new HTML replaces the wrapper.
|
|
141
|
+
*
|
|
142
|
+
* No registry opt-in for now; the uniqueness + length guards make the
|
|
143
|
+
* heuristic safe enough that "automatically inline-editable for components
|
|
144
|
+
* where it makes sense" matches the zero-config goal of the broader
|
|
145
|
+
* registry work.
|
|
146
|
+
*/
|
|
147
|
+
function wireInlinePropEditors(
|
|
148
|
+
wrap: HTMLElement,
|
|
149
|
+
attrs: Record<string, unknown>,
|
|
150
|
+
onPropChange: (propName: string, value: string) => void,
|
|
151
|
+
): void {
|
|
152
|
+
for (const [propName, rawValue] of Object.entries(attrs)) {
|
|
153
|
+
if (typeof rawValue !== 'string') continue;
|
|
154
|
+
const value = rawValue.trim();
|
|
155
|
+
if (value.length < 3) continue;
|
|
156
|
+
// Skip markdown-bearing values. A `plaintext-only` contenteditable
|
|
157
|
+
// strips `**bold**` / inline code / link syntax on commit, so we
|
|
158
|
+
// route these props through the side panel instead. The author sees
|
|
159
|
+
// the raw string there and decides whether to keep the formatting.
|
|
160
|
+
// Conservative detection (see `containsMarkdownMarkers`) — false
|
|
161
|
+
// positive cost is "edit via panel" which is fine; false negative
|
|
162
|
+
// cost is silent formatting loss, which isn't.
|
|
163
|
+
if (containsMarkdownMarkers(value)) continue;
|
|
164
|
+
|
|
165
|
+
// Two parallel walks, combined for uniqueness. The element walk
|
|
166
|
+
// catches "value lives in a leaf span" cases (LinkCard's
|
|
167
|
+
// `<span class="description">`); the text-node walk catches "value
|
|
168
|
+
// is a text node sibling of an icon" cases (Aside's title sits
|
|
169
|
+
// inside `<p class="starlight-aside__title">` right next to an SVG).
|
|
170
|
+
// Total matches across both walks must equal 1 — otherwise we can't
|
|
171
|
+
// unambiguously bind the prop to a single rendering location and
|
|
172
|
+
// fall back to side-panel-only editing.
|
|
173
|
+
const elementMatches: HTMLElement[] = [];
|
|
174
|
+
for (const el of Array.from(wrap.querySelectorAll<HTMLElement>('*'))) {
|
|
175
|
+
// Leaf-only — skip elements with element children, otherwise we'd
|
|
176
|
+
// turn an entire `<a class="sl-link-card">` into a contenteditable.
|
|
177
|
+
if (el.children.length > 0) continue;
|
|
178
|
+
// Skip already-wired editors so re-renders don't double-bind.
|
|
179
|
+
if (el.hasAttribute('data-conloca-prop')) continue;
|
|
180
|
+
if ((el.textContent ?? '').trim() === value) elementMatches.push(el);
|
|
181
|
+
}
|
|
182
|
+
const textMatches: Text[] = [];
|
|
183
|
+
const walker = wrap.ownerDocument.createTreeWalker(wrap, NodeFilter.SHOW_TEXT);
|
|
184
|
+
let textNode = walker.nextNode();
|
|
185
|
+
while (textNode) {
|
|
186
|
+
const t = textNode as Text;
|
|
187
|
+
const parent = t.parentElement;
|
|
188
|
+
// A text node wholly contained by a leaf element is already
|
|
189
|
+
// represented by `elementMatches`; only consider mixed-content
|
|
190
|
+
// parents that have not already been wired.
|
|
191
|
+
if (
|
|
192
|
+
parent &&
|
|
193
|
+
parent.children.length > 0 &&
|
|
194
|
+
!parent.closest('[data-conloca-prop]') &&
|
|
195
|
+
(t.nodeValue ?? '').trim() === value
|
|
196
|
+
) {
|
|
197
|
+
textMatches.push(t);
|
|
198
|
+
}
|
|
199
|
+
textNode = walker.nextNode();
|
|
200
|
+
}
|
|
201
|
+
if (elementMatches.length + textMatches.length !== 1) continue;
|
|
202
|
+
|
|
203
|
+
// Resolve the actual target element. For text-node matches we wrap
|
|
204
|
+
// the value in a fresh span so we have something to attach
|
|
205
|
+
// contenteditable to. Surrounding whitespace stays as plain text
|
|
206
|
+
// nodes either side of the span, so the icon→text spacing the host
|
|
207
|
+
// designed for is preserved.
|
|
208
|
+
let target: HTMLElement;
|
|
209
|
+
if (elementMatches.length === 1) {
|
|
210
|
+
target = elementMatches[0];
|
|
211
|
+
} else {
|
|
212
|
+
const t = textMatches[0];
|
|
213
|
+
const original = t.nodeValue ?? '';
|
|
214
|
+
const idx = original.indexOf(value);
|
|
215
|
+
const before = idx > 0 ? original.slice(0, idx) : '';
|
|
216
|
+
const after = idx + value.length < original.length ? original.slice(idx + value.length) : '';
|
|
217
|
+
const span = wrap.ownerDocument.createElement('span');
|
|
218
|
+
span.textContent = value;
|
|
219
|
+
const parent = t.parentNode!;
|
|
220
|
+
if (before) parent.insertBefore(wrap.ownerDocument.createTextNode(before), t);
|
|
221
|
+
parent.insertBefore(span, t);
|
|
222
|
+
if (after) parent.insertBefore(wrap.ownerDocument.createTextNode(after), t);
|
|
223
|
+
parent.removeChild(t);
|
|
224
|
+
target = span;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
bindInlinePropEditor(target, propName, onPropChange);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Attach the inline-prop event listeners to a target element. Pulled
|
|
233
|
+
* out of `wireInlinePropEditors` so both the selector-driven path
|
|
234
|
+
* (defaults like Aside's auto-derived "Note" title) and the text-match
|
|
235
|
+
* path (explicit prop values that render as visible text) share the
|
|
236
|
+
* same wiring code — contenteditable attribute, focus override against
|
|
237
|
+
* stretched-link anchors, Enter/Escape semantics, and the blur commit
|
|
238
|
+
* that flows back through `onPropChange`.
|
|
239
|
+
*/
|
|
240
|
+
function bindInlinePropEditor(
|
|
241
|
+
target: HTMLElement,
|
|
242
|
+
propName: string,
|
|
243
|
+
onPropChange: (propName: string, value: string) => void,
|
|
244
|
+
): void {
|
|
245
|
+
// `plaintext-only` keeps the contenteditable from accepting rich
|
|
246
|
+
// formatting (bold, italic, pasted markup). String props are flat
|
|
247
|
+
// text — bolding inside one would silently lose the styling on
|
|
248
|
+
// save anyway, so the affordance shouldn't suggest otherwise.
|
|
249
|
+
target.setAttribute('contenteditable', 'plaintext-only');
|
|
250
|
+
target.setAttribute('data-conloca-prop', propName);
|
|
251
|
+
target.setAttribute('spellcheck', 'true');
|
|
252
|
+
// Small visual cue so the author can tell which inline regions
|
|
253
|
+
// accept editing. Faint outline-color on hover, no layout shift.
|
|
254
|
+
target.classList.add('conloca-inline-prop');
|
|
255
|
+
|
|
256
|
+
let committed = (target.textContent ?? '').trim();
|
|
257
|
+
const commit = () => {
|
|
258
|
+
const next = (target.textContent ?? '').trim();
|
|
259
|
+
if (next !== committed) {
|
|
260
|
+
committed = next;
|
|
261
|
+
onPropChange(propName, next);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
target.addEventListener('blur', commit);
|
|
265
|
+
target.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
266
|
+
// Enter commits (string props are single-line); Escape reverts.
|
|
267
|
+
if (e.key === 'Enter') {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
target.blur();
|
|
270
|
+
} else if (e.key === 'Escape') {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
target.textContent = committed;
|
|
273
|
+
target.blur();
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
// Anchor-parent focus override. When the inline-editable element sits
|
|
277
|
+
// inside a clickable anchor (Starlight's `<LinkCard>` wraps title +
|
|
278
|
+
// description in a single `<a>`), the browser's default mousedown
|
|
279
|
+
// focuses the anchor, not our contenteditable child. Override by
|
|
280
|
+
// calling preventDefault() to stop the anchor's default focus, then
|
|
281
|
+
// explicitly focus the contenteditable and place the caret at the
|
|
282
|
+
// click point. `stopPropagation` is intentionally NOT used — the
|
|
283
|
+
// parent block's mousedownCapture still needs to fire so the side
|
|
284
|
+
// panel updates with this block's props.
|
|
285
|
+
target.addEventListener('mousedown', (e: MouseEvent) => {
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
target.focus();
|
|
288
|
+
// `caretPositionFromPoint` is the spec API; WebKit/older Chromium
|
|
289
|
+
// ship `caretRangeFromPoint` instead. Try both, fall back to the
|
|
290
|
+
// end of the text if neither works.
|
|
291
|
+
const doc = target.ownerDocument;
|
|
292
|
+
let range: Range | null = null;
|
|
293
|
+
const cp = (
|
|
294
|
+
doc as unknown as {
|
|
295
|
+
caretPositionFromPoint?: (x: number, y: number) => { offsetNode: Node; offset: number } | null;
|
|
296
|
+
}
|
|
297
|
+
).caretPositionFromPoint;
|
|
298
|
+
if (cp) {
|
|
299
|
+
const pos = cp.call(doc, e.clientX, e.clientY);
|
|
300
|
+
if (pos) {
|
|
301
|
+
range = doc.createRange();
|
|
302
|
+
range.setStart(pos.offsetNode, pos.offset);
|
|
303
|
+
range.collapse(true);
|
|
304
|
+
}
|
|
305
|
+
} else if (
|
|
306
|
+
(doc as unknown as { caretRangeFromPoint?: (x: number, y: number) => Range | null }).caretRangeFromPoint
|
|
307
|
+
) {
|
|
308
|
+
range = (doc as unknown as { caretRangeFromPoint: (x: number, y: number) => Range | null }).caretRangeFromPoint(
|
|
309
|
+
e.clientX,
|
|
310
|
+
e.clientY,
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
if (!range) {
|
|
314
|
+
range = doc.createRange();
|
|
315
|
+
range.selectNodeContents(target);
|
|
316
|
+
range.collapse(false);
|
|
317
|
+
}
|
|
318
|
+
const sel = doc.defaultView?.getSelection();
|
|
319
|
+
if (sel) {
|
|
320
|
+
sel.removeAllRanges();
|
|
321
|
+
sel.addRange(range);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Activate the tab the author clicked on inside an SSR'd `<starlight-tabs>`
|
|
328
|
+
* preview. Mirrors what `<starlight-tabs>`'s connectedCallback does at
|
|
329
|
+
* runtime on the published page — toggling `aria-selected` on the trigger
|
|
330
|
+
* and the `hidden` attribute on the matching panel — but runs purely off
|
|
331
|
+
* the DOM we already SSR'd, so the editor doesn't need to load the host's
|
|
332
|
+
* tab script.
|
|
333
|
+
*
|
|
334
|
+
* Starlight's tab markup ([starlight-tabs] > [role=tablist] > a[role=tab]
|
|
335
|
+
* with `href="#tab-panel-N"`, and `<section role="tabpanel" id="...">`
|
|
336
|
+
* siblings of the tablist) is stable enough that this resolves by
|
|
337
|
+
* traversing roles + the href hash. If Starlight ever ships a different
|
|
338
|
+
* variant the resolution falls back to no-op, which is the same as the
|
|
339
|
+
* pre-fix behaviour.
|
|
340
|
+
*/
|
|
341
|
+
function activateTabInPlace(tab: HTMLElement): void {
|
|
342
|
+
const tablist = tab.closest('[role="tablist"]');
|
|
343
|
+
// The panels live as siblings of the tablist inside the same custom
|
|
344
|
+
// element (or inside a generic ancestor if Starlight changes shape).
|
|
345
|
+
const tabsRoot = tab.closest('starlight-tabs') ?? tablist?.parentElement ?? null;
|
|
346
|
+
if (!tablist || !tabsRoot) return;
|
|
347
|
+
|
|
348
|
+
// Deselect every trigger in this tablist; tabindex=-1 keeps keyboard
|
|
349
|
+
// focus order matching Starlight's runtime behaviour.
|
|
350
|
+
for (const t of tablist.querySelectorAll('[role="tab"]')) {
|
|
351
|
+
t.setAttribute('aria-selected', 'false');
|
|
352
|
+
t.setAttribute('tabindex', '-1');
|
|
353
|
+
}
|
|
354
|
+
tab.setAttribute('aria-selected', 'true');
|
|
355
|
+
tab.setAttribute('tabindex', '0');
|
|
356
|
+
|
|
357
|
+
// Resolve target panel via the trigger's `href="#id"`. Falls back to
|
|
358
|
+
// positional match if href is missing — covers future Starlight shapes
|
|
359
|
+
// that wire via aria-controls or index.
|
|
360
|
+
const href = tab.getAttribute('href') || '';
|
|
361
|
+
const targetId = href.startsWith('#') ? href.slice(1) : '';
|
|
362
|
+
const panels = Array.from(tabsRoot.querySelectorAll('[role="tabpanel"]'));
|
|
363
|
+
let activeIndex = -1;
|
|
364
|
+
if (targetId) {
|
|
365
|
+
activeIndex = panels.findIndex((p) => p.id === targetId);
|
|
366
|
+
}
|
|
367
|
+
if (activeIndex < 0) {
|
|
368
|
+
const triggers = Array.from(tablist.querySelectorAll('[role="tab"]'));
|
|
369
|
+
activeIndex = triggers.indexOf(tab);
|
|
370
|
+
}
|
|
371
|
+
panels.forEach((p, i) => {
|
|
372
|
+
if (i === activeIndex) p.removeAttribute('hidden');
|
|
373
|
+
else p.setAttribute('hidden', '');
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* In-memory cache of rendered HTML keyed by the full tree shape +
|
|
379
|
+
* document index. Same edit state reuses cached HTML without a server
|
|
380
|
+
* roundtrip. Cleared on page reload.
|
|
381
|
+
*/
|
|
382
|
+
const renderCache = new Map<string, string>();
|
|
383
|
+
|
|
384
|
+
function cacheKey(req: RenderRequest): string {
|
|
385
|
+
return `${req.documentIndex}::${req.inline ? 'inline::' : ''}${stableStringify(stripBodyFields(req.tree as unknown as AnyProps) as AnyProps)}`;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function stableStringify(obj: AnyProps): string {
|
|
389
|
+
// Stable across key order so attribute reordering doesn't bust the cache.
|
|
390
|
+
// For nested objects/arrays (children trees) JSON.stringify already
|
|
391
|
+
// preserves array order which is what we want.
|
|
392
|
+
const sort = (v: unknown): unknown => {
|
|
393
|
+
if (Array.isArray(v)) return v.map(sort);
|
|
394
|
+
if (v && typeof v === 'object') {
|
|
395
|
+
const keys = Object.keys(v as object).sort();
|
|
396
|
+
return Object.fromEntries(keys.map((k) => [k, sort((v as Record<string, unknown>)[k])]));
|
|
397
|
+
}
|
|
398
|
+
return v;
|
|
399
|
+
};
|
|
400
|
+
return JSON.stringify(sort(obj));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
async function fetchRendered(req: RenderRequest): Promise<string> {
|
|
404
|
+
const key = cacheKey(req);
|
|
405
|
+
const cached = renderCache.get(key);
|
|
406
|
+
if (cached !== undefined) return cached;
|
|
407
|
+
|
|
408
|
+
const res = await fetch(RENDER_ENDPOINT, {
|
|
409
|
+
method: 'POST',
|
|
410
|
+
headers: { 'content-type': 'application/json' },
|
|
411
|
+
body: JSON.stringify(req),
|
|
412
|
+
});
|
|
413
|
+
if (!res.ok) throw new Error(`Render endpoint returned ${res.status}: ${await res.text()}`);
|
|
414
|
+
const html = await res.text();
|
|
415
|
+
renderCache.set(key, html);
|
|
416
|
+
return html;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Given a child slot element inside a container's SSR'd preview,
|
|
421
|
+
* return the DOM subtree that belongs to ONLY this child. Used to
|
|
422
|
+
* bound the inline-prop scan so we don't accidentally match a
|
|
423
|
+
* sibling child's title.
|
|
424
|
+
*
|
|
425
|
+
* Heuristic: walk up from the slot. Each ancestor is a candidate.
|
|
426
|
+
* We keep walking as long as the parent of the ancestor contains
|
|
427
|
+
* exactly one slot-with-data-slot-id descendant (this slot). The
|
|
428
|
+
* moment we'd step into an ancestor whose subtree contains MORE
|
|
429
|
+
* than one slot — that's the boundary between children — we stop
|
|
430
|
+
* and return the last single-slot ancestor.
|
|
431
|
+
*
|
|
432
|
+
* For Starlight CardGrid the result is the `<article class="card">`
|
|
433
|
+
* for each child. For a future framework that wraps each child
|
|
434
|
+
* differently the same logic applies — we don't care about the
|
|
435
|
+
* specific class names.
|
|
436
|
+
*
|
|
437
|
+
* Returns `null` if the slot isn't actually inside a container with
|
|
438
|
+
* sibling slots (eg edge cases where the framework only emits one
|
|
439
|
+
* child). The caller falls back to wiring against the whole wrapper.
|
|
440
|
+
*/
|
|
441
|
+
function findChildRegion(slot: HTMLElement): HTMLElement | null {
|
|
442
|
+
let region: HTMLElement = slot;
|
|
443
|
+
let parent = slot.parentElement;
|
|
444
|
+
while (parent) {
|
|
445
|
+
const slotCount = parent.querySelectorAll(`${SLOT_TAG}[data-slot-id]`).length;
|
|
446
|
+
if (slotCount > 1) {
|
|
447
|
+
// Parent encloses more than one child — region is the current
|
|
448
|
+
// node (before stepping into the multi-child container).
|
|
449
|
+
return region === slot ? null : region;
|
|
450
|
+
}
|
|
451
|
+
region = parent;
|
|
452
|
+
parent = parent.parentElement;
|
|
453
|
+
}
|
|
454
|
+
return region === slot ? null : region;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Find the first mdast `list` node inside a component's effective
|
|
459
|
+
* children. Returns both the list and the path that `getMdastAtPath`
|
|
460
|
+
* would walk to reach it. `null` when no list is present at the top
|
|
461
|
+
* level — eg a regular Aside body where children are paragraphs.
|
|
462
|
+
*
|
|
463
|
+
* Handles two common shapes:
|
|
464
|
+
* 1. `{ name: 'Steps', children: [list] }` — path: `[0]`
|
|
465
|
+
* 2. `{ name: 'Steps', children: [{paragraph, children:[list]}] }`
|
|
466
|
+
* — `effectiveChildren` unwraps the single-paragraph wrapper, so
|
|
467
|
+
* the list is still reached at path `[0]`.
|
|
468
|
+
*
|
|
469
|
+
* Restricted to "first child is a list" because that's the strict-
|
|
470
|
+
* slot list pattern (Steps, FileTree). A Card body that happens to
|
|
471
|
+
* contain a list as a non-leading child stays in the regular slot
|
|
472
|
+
* path — those have a real `<conloca-slot>` from the server already.
|
|
473
|
+
*/
|
|
474
|
+
function findTopLevelList(
|
|
475
|
+
node: MdxJsxFlowElement,
|
|
476
|
+
): { list: { children: unknown[]; ordered?: boolean }; path: number[] } | null {
|
|
477
|
+
const effective = effectiveChildren(node as { children?: unknown[] });
|
|
478
|
+
if (effective.length === 0) return null;
|
|
479
|
+
const first = effective[0] as { type?: string; children?: unknown[]; ordered?: boolean } | undefined;
|
|
480
|
+
if (first?.type !== 'list' || !Array.isArray(first.children)) return null;
|
|
481
|
+
return { list: first as { children: unknown[]; ordered?: boolean }, path: [0] };
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Wire each `<li>` of the first ordered/unordered list in the
|
|
486
|
+
* rendered preview as a contenteditable, with on-blur commit that
|
|
487
|
+
* rewrites the corresponding mdast `listItem`. Used for strict-slot
|
|
488
|
+
* list components (Starlight `<Steps>`, `<FileTree>`) where the
|
|
489
|
+
* framework rejects `<conloca-slot>` children — we can't portal a
|
|
490
|
+
* Lexical editor into them, so we edit the rendered HTML in place.
|
|
491
|
+
*
|
|
492
|
+
* Trade-off vs the portal path: this loses any inline formatting on
|
|
493
|
+
* commit (the blur handler reads `textContent` and rewrites the item
|
|
494
|
+
* as plain text). The rendered output keeps whatever formatting the
|
|
495
|
+
* framework SSR'd (bold survives across renders that don't touch the
|
|
496
|
+
* item), but typing in a step replaces its content with plaintext.
|
|
497
|
+
* For step descriptions and file-tree labels that's usually fine; for
|
|
498
|
+
* heavily-formatted lists the user has to edit through markdown.
|
|
499
|
+
*
|
|
500
|
+
* DOM mutation safety: we DO NOT replace the li's children or inject
|
|
501
|
+
* anything React might reconcile against. Just set `contenteditable`
|
|
502
|
+
* on the existing element and attach listeners. The next render's
|
|
503
|
+
* `wrap.innerHTML = sanitizeComponentHtml(html)` wipes the contenteditable cleanly.
|
|
504
|
+
*/
|
|
505
|
+
function wireListItemEditors(
|
|
506
|
+
wrap: HTMLElement,
|
|
507
|
+
node: MdxJsxFlowElement,
|
|
508
|
+
updater: (partial: Partial<MdxJsxFlowElement>) => void,
|
|
509
|
+
pendingFocusIndexRef: { current: number | null },
|
|
510
|
+
): void {
|
|
511
|
+
const found = findTopLevelList(node);
|
|
512
|
+
if (!found) return;
|
|
513
|
+
const domList = wrap.querySelector('ol, ul');
|
|
514
|
+
if (!domList) return;
|
|
515
|
+
const domItems = Array.from(domList.children).filter((c): c is HTMLElement => c.tagName === 'LI');
|
|
516
|
+
if (domItems.length !== found.list.children.length) return;
|
|
517
|
+
// Default-deny tree-shaped lists. A flat plaintext editor over an
|
|
518
|
+
// `<li>` that contains a nested `<ul>`/`<ol>` would collapse the
|
|
519
|
+
// sub-tree into a single text node on commit. FileTree is the
|
|
520
|
+
// canonical case, but the same trap applies to any nav-menu /
|
|
521
|
+
// outline / nested-list component. The side panel still works;
|
|
522
|
+
// authors who need to restructure the tree edit the raw MDX.
|
|
523
|
+
// Future: a proper tree-aware editor can ship as a follow-up that
|
|
524
|
+
// handles recursive wiring, path-scoped writes, and add/remove
|
|
525
|
+
// affordances for sub-items.
|
|
526
|
+
if (domItems.some((li) => li.querySelector('ul, ol') !== null)) return;
|
|
527
|
+
const listOrdered = found.list.ordered ?? false;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Shared helper that writes a new list of items back through the
|
|
531
|
+
* mdast updater, preserving the paragraph-wrap shape if any. All
|
|
532
|
+
* commit / insert / remove paths funnel through this so the
|
|
533
|
+
* write-side logic stays in one place.
|
|
534
|
+
*/
|
|
535
|
+
const writeListChildren = (newListChildren: unknown[]) => {
|
|
536
|
+
const newList = { type: 'list', ordered: listOrdered, children: newListChildren };
|
|
537
|
+
const originalKids = (node.children ?? []) as unknown[];
|
|
538
|
+
const isWrapped =
|
|
539
|
+
originalKids.length === 1 && (originalKids[0] as { type?: string } | undefined)?.type === 'paragraph';
|
|
540
|
+
const newChildren = isWrapped ? [{ ...(originalKids[0] as object), children: [newList] }] : [newList];
|
|
541
|
+
updater({ children: newChildren as typeof node.children });
|
|
542
|
+
};
|
|
543
|
+
const buildListItem = (text: string) => ({
|
|
544
|
+
type: 'listItem',
|
|
545
|
+
children: [{ type: 'paragraph', children: [{ type: 'text', value: text }] }],
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
for (let i = 0; i < domItems.length; i++) {
|
|
549
|
+
const li = domItems[i];
|
|
550
|
+
// Skip already-wired editors so re-renders don't double-bind.
|
|
551
|
+
if (li.hasAttribute('data-conloca-listitem')) continue;
|
|
552
|
+
li.setAttribute('data-conloca-listitem', String(i));
|
|
553
|
+
li.setAttribute('contenteditable', 'plaintext-only');
|
|
554
|
+
li.classList.add('conloca-listitem');
|
|
555
|
+
let committed = (li.textContent ?? '').trim();
|
|
556
|
+
const itemIndex = i;
|
|
557
|
+
const commit = () => {
|
|
558
|
+
const next = (li.textContent ?? '').trim();
|
|
559
|
+
if (next === committed) return;
|
|
560
|
+
committed = next;
|
|
561
|
+
// Build a fresh listItem with a single paragraph of plain text.
|
|
562
|
+
// Future enhancement: parse inline markdown so `**bold**` round-
|
|
563
|
+
// trips correctly. For now, plaintext-only matches the editing
|
|
564
|
+
// affordance authors see (no formatting toolbar in the li).
|
|
565
|
+
const newListChildren = found.list.children.map((it, idx) => (idx === itemIndex ? buildListItem(next) : it));
|
|
566
|
+
writeListChildren(newListChildren);
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* Insert an empty list item BELOW this one and ask the next
|
|
570
|
+
* render to focus the new li. The render cycle is:
|
|
571
|
+
* 1. writeListChildren → mdast updates → React re-renders
|
|
572
|
+
* 2. html-injection effect runs `wrap.innerHTML = sanitizeComponentHtml(html)`
|
|
573
|
+
* 3. wireListItemEditors runs again; it sees the pending
|
|
574
|
+
* focus index and focuses that li.
|
|
575
|
+
* The ref decouples the focus request from the render — we
|
|
576
|
+
* can't focus the new li synchronously because it doesn't
|
|
577
|
+
* exist in the DOM yet.
|
|
578
|
+
*/
|
|
579
|
+
const insertItemBelow = () => {
|
|
580
|
+
// Commit current text first so we don't lose any unsaved
|
|
581
|
+
// typing in this li. `commit` is a no-op if nothing changed.
|
|
582
|
+
const currentText = (li.textContent ?? '').trim();
|
|
583
|
+
const updatedCurrent = buildListItem(currentText);
|
|
584
|
+
const newListChildren = [
|
|
585
|
+
...found.list.children.slice(0, itemIndex),
|
|
586
|
+
updatedCurrent,
|
|
587
|
+
buildListItem(''),
|
|
588
|
+
...found.list.children.slice(itemIndex + 1),
|
|
589
|
+
];
|
|
590
|
+
pendingFocusIndexRef.current = itemIndex + 1;
|
|
591
|
+
writeListChildren(newListChildren);
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
* Remove this list item from the list. Used when the author
|
|
595
|
+
* presses Backspace at the start of an already-empty step. If
|
|
596
|
+
* removing would leave the list empty we leave one empty item
|
|
597
|
+
* — Starlight's `<Steps>` rejects an empty `<ol>` and the
|
|
598
|
+
* author probably wants to keep editing.
|
|
599
|
+
*/
|
|
600
|
+
const removeSelf = () => {
|
|
601
|
+
if (found.list.children.length <= 1) return;
|
|
602
|
+
const newListChildren = found.list.children.filter((_, idx) => idx !== itemIndex);
|
|
603
|
+
// Focus the previous item after re-render (or the new first
|
|
604
|
+
// item if we removed the head).
|
|
605
|
+
pendingFocusIndexRef.current = Math.max(0, itemIndex - 1);
|
|
606
|
+
writeListChildren(newListChildren);
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
li.addEventListener('blur', commit);
|
|
610
|
+
li.addEventListener('keydown', (e) => {
|
|
611
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
612
|
+
// Enter splits the list: commit current text, append a new
|
|
613
|
+
// empty item below, focus it. Standard list-editor pattern
|
|
614
|
+
// (Notion, Bear, native markdown editors).
|
|
615
|
+
e.preventDefault();
|
|
616
|
+
insertItemBelow();
|
|
617
|
+
} else if (e.key === 'Backspace') {
|
|
618
|
+
// Backspace at the start of an empty item removes the item.
|
|
619
|
+
// Anywhere else: default delete-character behaviour.
|
|
620
|
+
const text = (li.textContent ?? '').trim();
|
|
621
|
+
if (text.length === 0) {
|
|
622
|
+
e.preventDefault();
|
|
623
|
+
removeSelf();
|
|
624
|
+
}
|
|
625
|
+
} else if (e.key === 'Escape') {
|
|
626
|
+
e.preventDefault();
|
|
627
|
+
li.textContent = committed;
|
|
628
|
+
li.blur();
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// After every re-wire pass, honor any pending focus request from
|
|
634
|
+
// the previous render's keyboard handler. This is what makes Enter
|
|
635
|
+
// / Backspace feel responsive — the new li appears AND gets the
|
|
636
|
+
// caret in one perceived action.
|
|
637
|
+
if (pendingFocusIndexRef.current !== null) {
|
|
638
|
+
const targetIdx = pendingFocusIndexRef.current;
|
|
639
|
+
pendingFocusIndexRef.current = null;
|
|
640
|
+
const target = domItems[targetIdx];
|
|
641
|
+
if (target) {
|
|
642
|
+
// Defer to next microtask so any in-flight focus management
|
|
643
|
+
// (Lexical refocus after the discrete update) settles first.
|
|
644
|
+
Promise.resolve().then(() => {
|
|
645
|
+
target.focus();
|
|
646
|
+
// Place caret at start for the freshly-inserted empty item.
|
|
647
|
+
const range = target.ownerDocument.createRange();
|
|
648
|
+
range.selectNodeContents(target);
|
|
649
|
+
range.collapse(true);
|
|
650
|
+
const sel = target.ownerDocument.defaultView?.getSelection();
|
|
651
|
+
if (sel) {
|
|
652
|
+
sel.removeAllRanges();
|
|
653
|
+
sel.addRange(range);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Walk the mdast subtree starting at `node` and build the render-tree
|
|
662
|
+
* payload. Children that are JSX elements (flow OR text — MDX parses
|
|
663
|
+
* inline-written JSX as text variants) with a registered descriptor
|
|
664
|
+
* are recursed into; anything else terminates the recursion and the
|
|
665
|
+
* parent ends up with a single body slot like a leaf would.
|
|
666
|
+
*
|
|
667
|
+
* `isRoot=true` means this is the top-level node the caller will
|
|
668
|
+
* portal a Lexical editor into. We skip the static text fallback on
|
|
669
|
+
* the root so the portal isn't stacked on top of duplicate text —
|
|
670
|
+
* the editor itself owns the body content for the root. Nested
|
|
671
|
+
* leaves (children inside a container) DO get the fallback, since
|
|
672
|
+
* they aren't being portaled into yet (Phase 3).
|
|
673
|
+
*/
|
|
674
|
+
function buildRenderTree(
|
|
675
|
+
node: MdxJsxFlowElement,
|
|
676
|
+
descriptors: ReadonlyArray<MdxComponentDescriptor>,
|
|
677
|
+
slotIdPrefix: string,
|
|
678
|
+
isRoot = false,
|
|
679
|
+
): RenderTreeNode | null {
|
|
680
|
+
const name = node.name ?? '';
|
|
681
|
+
const desc = descriptors.find((d): d is MdxComponentDescriptor => 'name' in d && d.name === name);
|
|
682
|
+
const jsxDesc = desc && isJsxDescriptor(desc) ? desc : null;
|
|
683
|
+
const source = jsxDesc?.import?.from;
|
|
684
|
+
if (!source) return null;
|
|
685
|
+
|
|
686
|
+
const allKids = effectiveChildren(node as { children?: unknown[] });
|
|
687
|
+
|
|
688
|
+
// Extract `<Fragment slot="name">…</Fragment>` children into a
|
|
689
|
+
// namedSlots map and continue body processing with the remaining
|
|
690
|
+
// (default-slot) children only. This is the Astro convention for
|
|
691
|
+
// multi-slot components like `<Layout>` or `<Hero>`.
|
|
692
|
+
const namedSlots: Record<string, string> = {};
|
|
693
|
+
const kids: unknown[] = [];
|
|
694
|
+
for (const child of allKids) {
|
|
695
|
+
const slot = getNamedSlotName(child);
|
|
696
|
+
if (slot) {
|
|
697
|
+
const inner = (child as { children?: unknown[] }).children;
|
|
698
|
+
namedSlots[slot] = sanitizeHtml(mdastToHtml({ children: Array.isArray(inner) ? inner : [] }));
|
|
699
|
+
} else {
|
|
700
|
+
kids.push(child);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
const children: RenderTreeNode[] = [];
|
|
705
|
+
let hasJsxChildren = false;
|
|
706
|
+
for (let i = 0; i < kids.length; i++) {
|
|
707
|
+
const child = kids[i] as { type?: string };
|
|
708
|
+
if (child?.type === 'mdxJsxFlowElement' || child?.type === 'mdxJsxTextElement') {
|
|
709
|
+
const childTree = buildRenderTree(child as MdxJsxFlowElement, descriptors, `${slotIdPrefix}.${i}`);
|
|
710
|
+
if (childTree) {
|
|
711
|
+
children.push(childTree);
|
|
712
|
+
hasJsxChildren = true;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// If the body is a markdown list (Steps/FileTree), render it as
|
|
718
|
+
// raw HTML — those components' Astro implementations validate the
|
|
719
|
+
// slot tag name and reject `<conloca-slot>`. `bodyHtml` makes the
|
|
720
|
+
// server emit our rendered list directly as the slot content with
|
|
721
|
+
// no wrapper.
|
|
722
|
+
const bodyHtml =
|
|
723
|
+
!hasJsxChildren && bodyNeedsStaticHtml(kids) ? sanitizeHtml(mdastToHtml({ children: kids })) : undefined;
|
|
724
|
+
|
|
725
|
+
// Previously, nested leaves shipped a static-text `body` fallback
|
|
726
|
+
// inside their slot so authored text was visible even without an
|
|
727
|
+
// inline editor — back when only the root slot got a Lexical
|
|
728
|
+
// portal. Every container child now gets its own `ContainerSlotEditor`
|
|
729
|
+
// portaled in (see `GenericBlock`), so the slot's owner is always
|
|
730
|
+
// an editor. Emitting `body` here would render the same text twice:
|
|
731
|
+
// once as static text from the SSR'd slot, once via the portaled
|
|
732
|
+
// editor's contentEditable. Always omit.
|
|
733
|
+
const body: string | undefined = undefined;
|
|
734
|
+
|
|
735
|
+
return {
|
|
736
|
+
component: name,
|
|
737
|
+
source,
|
|
738
|
+
defaultExport: jsxDesc?.import?.default ?? false,
|
|
739
|
+
props: readAttrs(node),
|
|
740
|
+
slotId: slotIdPrefix,
|
|
741
|
+
...(hasJsxChildren ? { children } : {}),
|
|
742
|
+
...(body ? { body } : {}),
|
|
743
|
+
...(bodyHtml ? { bodyHtml } : {}),
|
|
744
|
+
...(Object.keys(namedSlots).length > 0 ? { namedSlots } : {}),
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* True when every non-trivial child of `node` is itself a JSX element
|
|
750
|
+
* (flow or text variant). This is the "container" case (CardGrid with
|
|
751
|
+
* Cards inside, Tabs with TabItems). Text-bearing or mixed children
|
|
752
|
+
* fall through to leaf rendering with one body slot.
|
|
753
|
+
*/
|
|
754
|
+
function isPureContainer(node: MdxJsxFlowElement): boolean {
|
|
755
|
+
const allKids = effectiveChildren(node as { children?: unknown[] });
|
|
756
|
+
if (allKids.length === 0) return false;
|
|
757
|
+
// Ignore named-slot Fragments — they're passed as separate slots,
|
|
758
|
+
// not part of the default-body container detection.
|
|
759
|
+
const kids = allKids.filter((k) => getNamedSlotName(k) == null);
|
|
760
|
+
if (kids.length === 0) return false;
|
|
761
|
+
let sawJsx = false;
|
|
762
|
+
for (const child of kids) {
|
|
763
|
+
const c = child as { type?: string; value?: unknown };
|
|
764
|
+
if (!c || typeof c !== 'object') continue;
|
|
765
|
+
if (c.type === 'mdxJsxFlowElement' || c.type === 'mdxJsxTextElement') {
|
|
766
|
+
sawJsx = true;
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
// Permit pure-whitespace text nodes between block JSX.
|
|
770
|
+
if (c.type === 'text' && typeof c.value === 'string' && c.value.trim() === '') continue;
|
|
771
|
+
return false;
|
|
772
|
+
}
|
|
773
|
+
return sawJsx;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* One nested editor scoped to a single child inside a container's
|
|
778
|
+
* render-tree. The parent's MDXEditor `JsxNode` owns the WHOLE mdast
|
|
779
|
+
* subtree (CardGrid + its Cards + grandchildren) as one opaque blob;
|
|
780
|
+
* we can't give each child its own Lexical node within the library's
|
|
781
|
+
* data model. Instead, this component sits inside the parent's JsxEditor
|
|
782
|
+
* context (via `<NestedLexicalEditor>`) and uses `getContent` /
|
|
783
|
+
* `getUpdatedMdastNode` to read and write a SPECIFIC child by mdast
|
|
784
|
+
* path. The same `effectiveChildren` unwrap that buildRenderTree did
|
|
785
|
+
* on read is mirrored in the write helper so the original tree shape
|
|
786
|
+
* round-trips on save.
|
|
787
|
+
*
|
|
788
|
+
* Concurrency caveat: when two `ContainerSlotEditor` instances inside
|
|
789
|
+
* the same parent both fire `getUpdatedMdastNode`, each sees the
|
|
790
|
+
* parent snapshot captured by `useMdastNodeUpdater` at its render
|
|
791
|
+
* time. MDXEditor's `discrete: true` update path makes the parent
|
|
792
|
+
* commit synchronously between blurs and React re-renders before
|
|
793
|
+
* the next blur could fire, so blur-driven prose edits are safe. The
|
|
794
|
+
* race exists only for non-blur updates (codemirror's
|
|
795
|
+
* `NESTED_EDITOR_UPDATED_COMMAND` while still focused) — vanishingly
|
|
796
|
+
* rare in container-child editing today.
|
|
797
|
+
*/
|
|
798
|
+
function ContainerSlotEditor({ path }: { path: number[] }) {
|
|
799
|
+
return (
|
|
800
|
+
<NestedLexicalEditor<MdxJsxFlowElement>
|
|
801
|
+
getContent={(parent) => {
|
|
802
|
+
const target = getMdastAtPath(parent, path);
|
|
803
|
+
return (target?.children as Mdast.PhrasingContent[]) ?? [];
|
|
804
|
+
}}
|
|
805
|
+
getUpdatedMdastNode={(parent, newChildren) =>
|
|
806
|
+
replaceMdastAtPath(parent, path, newChildren as MdxJsxFlowElement['children'])
|
|
807
|
+
}
|
|
808
|
+
/>
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export function GenericBlock({ mdastNode }: JsxEditorProps) {
|
|
813
|
+
const updater = useMdastNodeUpdater<MdxJsxFlowElement>();
|
|
814
|
+
const removeNode = useLexicalNodeRemove();
|
|
815
|
+
const descriptors = useMdxComponents();
|
|
816
|
+
const descriptorsByName = useMemo(() => {
|
|
817
|
+
const byName = new Map<string, MdxComponentDescriptor>();
|
|
818
|
+
for (const candidate of descriptors) {
|
|
819
|
+
if ('name' in candidate) byName.set(candidate.name, candidate);
|
|
820
|
+
}
|
|
821
|
+
return byName;
|
|
822
|
+
}, [descriptors]);
|
|
823
|
+
const { parentEditor, lexicalNode } = useNestedEditorContext();
|
|
824
|
+
|
|
825
|
+
const node = mdastNode as MdxJsxFlowElement;
|
|
826
|
+
const attrs = readAttrs(node);
|
|
827
|
+
const name = node.name ?? '';
|
|
828
|
+
const found = descriptorsByName.get(name);
|
|
829
|
+
const descriptor = found && isJsxDescriptor(found) ? found : null;
|
|
830
|
+
const source = descriptor?.import?.from;
|
|
831
|
+
|
|
832
|
+
// Inline (text-kind) components — `<Icon>`, anything rendered as
|
|
833
|
+
// `mdxJsxTextElement` — sit inside a paragraph's text flow and must
|
|
834
|
+
// NOT carry block wrappers. The phantom-sibling / `sl-markdown-content`
|
|
835
|
+
// path only makes sense for root-level flow blocks (Card colour
|
|
836
|
+
// cycle, CSS-grid placement); for inline elements it would force a
|
|
837
|
+
// line break and stack hidden siblings around the glyph.
|
|
838
|
+
const isInline = descriptor?.kind === 'text';
|
|
839
|
+
|
|
840
|
+
// This block's 1-based position among Lexical's root-level children.
|
|
841
|
+
// Passed to the render endpoint so it can prepend phantom siblings and
|
|
842
|
+
// restore the same `:nth-child(N)` position the live page would have.
|
|
843
|
+
// Subscribes to the parent editor so the index updates when the user
|
|
844
|
+
// adds, deletes, or reorders blocks above this one. Inline components
|
|
845
|
+
// skip this entirely — they aren't root children.
|
|
846
|
+
const [documentIndex, setDocumentIndex] = useState(1);
|
|
847
|
+
useEffect(() => {
|
|
848
|
+
if (isInline) return;
|
|
849
|
+
const computeIndex = () => {
|
|
850
|
+
parentEditor.getEditorState().read(() => {
|
|
851
|
+
const me = $getNodeByKey(lexicalNode.getKey());
|
|
852
|
+
// Walk up to the root-level child (a JSX block lives inside a
|
|
853
|
+
// Lexical paragraph; the paragraph is the root's direct child).
|
|
854
|
+
let cursor = me;
|
|
855
|
+
while (cursor && cursor.getParent() && cursor.getParent()?.getParent() !== null) {
|
|
856
|
+
cursor = cursor.getParent();
|
|
857
|
+
}
|
|
858
|
+
const root = cursor?.getParent();
|
|
859
|
+
if (root && cursor) {
|
|
860
|
+
const idx = root.getChildren().indexOf(cursor);
|
|
861
|
+
if (idx >= 0) setDocumentIndex(idx + 1);
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
};
|
|
865
|
+
computeIndex();
|
|
866
|
+
return parentEditor.registerUpdateListener(computeIndex);
|
|
867
|
+
}, [parentEditor, lexicalNode, isInline]);
|
|
868
|
+
|
|
869
|
+
// Container mode: when all of this node's children are themselves
|
|
870
|
+
// JSX flow elements with known descriptors, we render the whole
|
|
871
|
+
// subtree in one server call so the children emerge as real DOM
|
|
872
|
+
// siblings of their parent (vs. each child rendering in its own
|
|
873
|
+
// wrapper). This fixes CSS grid layout and positional CSS for
|
|
874
|
+
// components like CardGrid and Tabs whose children must be direct
|
|
875
|
+
// DOM children of the container.
|
|
876
|
+
const containerMode = isPureContainer(node);
|
|
877
|
+
|
|
878
|
+
// Build the full render-tree payload. For leaves this is one node
|
|
879
|
+
// with a `<conloca-slot>` body slot. For containers it recurses
|
|
880
|
+
// into children. `tree` is null when we lack an import source for
|
|
881
|
+
// the root component — the fallback wrapper handles that path.
|
|
882
|
+
const tree = useMemo<RenderTreeNode | null>(
|
|
883
|
+
() => buildRenderTree(node, descriptors, 'root', true),
|
|
884
|
+
// mdast attrs/children are regenerated on every render but
|
|
885
|
+
// structurally stable, so we use stableStringify in cacheKey to
|
|
886
|
+
// dedupe identical requests. Recomputing the tree per render is
|
|
887
|
+
// cheap.
|
|
888
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
889
|
+
[node, descriptors],
|
|
890
|
+
);
|
|
891
|
+
|
|
892
|
+
const selectionSignature = useMemo(() => stableStringify({ node }), [node]);
|
|
893
|
+
const renderReq = useMemo<RenderRequest | null>(
|
|
894
|
+
() => (tree ? { tree, documentIndex, ...(isInline ? { inline: true } : {}) } : null),
|
|
895
|
+
[tree, documentIndex, isInline],
|
|
896
|
+
);
|
|
897
|
+
|
|
898
|
+
const [html, setHtml] = useState<string | null>(() =>
|
|
899
|
+
renderReq ? (renderCache.get(cacheKey(renderReq)) ?? null) : null,
|
|
900
|
+
);
|
|
901
|
+
const [error, setError] = useState<string | null>(null);
|
|
902
|
+
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
903
|
+
const [slotEl, setSlotEl] = useState<Element | null>(null);
|
|
904
|
+
/** Container-mode slots: slot-id → element. Each entry portals a
|
|
905
|
+
* `<ContainerSlotEditor>` into that element so every child's body
|
|
906
|
+
* is inline-editable, even when N children share one SSR'd wrapper. */
|
|
907
|
+
const [containerSlots, setContainerSlots] = useState<Map<string, Element>>(() => new Map());
|
|
908
|
+
/** Index of a list item that should receive focus after the next
|
|
909
|
+
* render commits. Set by the Enter / Backspace handlers in
|
|
910
|
+
* `wireListItemEditors`; consumed by the same function on the
|
|
911
|
+
* next re-wire pass. Lives at component level (not effect-local)
|
|
912
|
+
* so it survives across render cycles. */
|
|
913
|
+
const pendingListItemFocusRef = useRef<number | null>(null);
|
|
914
|
+
// Preview wiring must only re-run when the rendered HTML changes:
|
|
915
|
+
// replacing innerHTML during selection-only renders would destroy
|
|
916
|
+
// contenteditable focus. Keep the current editor bindings in a ref so
|
|
917
|
+
// that the HTML-triggered effect still commits through the latest node.
|
|
918
|
+
const previewBindingsRef = useRef({ attrs, node, updater });
|
|
919
|
+
previewBindingsRef.current.attrs = attrs;
|
|
920
|
+
previewBindingsRef.current.node = node;
|
|
921
|
+
previewBindingsRef.current.updater = updater;
|
|
922
|
+
|
|
923
|
+
// Fetch (or serve from cache) the rendered HTML on prop changes.
|
|
924
|
+
useEffect(() => {
|
|
925
|
+
if (!renderReq) return;
|
|
926
|
+
let cancelled = false;
|
|
927
|
+
setError(null);
|
|
928
|
+
fetchRendered(renderReq)
|
|
929
|
+
.then((next) => {
|
|
930
|
+
if (!cancelled) setHtml(next);
|
|
931
|
+
})
|
|
932
|
+
.catch((err) => {
|
|
933
|
+
if (cancelled) return;
|
|
934
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
935
|
+
console.warn('[Conloca] GenericBlock render failed:', err);
|
|
936
|
+
});
|
|
937
|
+
return () => {
|
|
938
|
+
cancelled = true;
|
|
939
|
+
};
|
|
940
|
+
}, [renderReq]);
|
|
941
|
+
|
|
942
|
+
// Imperatively swap the wrapper's inner HTML when the rendered
|
|
943
|
+
// string changes, then locate every body slot in the SSR'd markup.
|
|
944
|
+
//
|
|
945
|
+
// Leaf mode: one `<conloca-slot>` at the root, portaled with a
|
|
946
|
+
// single `<NestedLexicalEditor>` for the component's body.
|
|
947
|
+
//
|
|
948
|
+
// Container mode: each child JSX node also emits a slot (carrying
|
|
949
|
+
// its `data-slot-id` from the buildRenderTree path). Each gets its
|
|
950
|
+
// own portaled `<ContainerSlotEditor>` scoped to that child's mdast
|
|
951
|
+
// subtree via path resolution — so editing the body of a Card
|
|
952
|
+
// inside a CardGrid works the same as editing the body of a
|
|
953
|
+
// root-level Aside.
|
|
954
|
+
useEffect(() => {
|
|
955
|
+
const wrap = wrapperRef.current;
|
|
956
|
+
if (!wrap || html == null) return;
|
|
957
|
+
const { attrs: currentAttrs, node: currentNode, updater: currentUpdater } = previewBindingsRef.current;
|
|
958
|
+
const currentOnPropChange = (propName: string, value: string | boolean | number | null | undefined) => {
|
|
959
|
+
currentUpdater({
|
|
960
|
+
attributes: writeAttribute(currentNode.attributes, propName, value) as typeof currentNode.attributes,
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
// The render-endpoint RESPONSE lands in the PRIVILEGED admin document here
|
|
964
|
+
// (this fourth content-execution site can't be iframed — the portaled
|
|
965
|
+
// Lexical editors need same-origin DOM access). It is DOMPurified before the
|
|
966
|
+
// innerHTML assignment so no active markup reaches the privileged document,
|
|
967
|
+
// whatever produced it: the `bodyHtml`/`namedSlots` we send, OR a string prop
|
|
968
|
+
// a registered component reflected through `set:html`. `sanitizeComponentHtml`
|
|
969
|
+
// is used (not the strict author `sanitizeHtml`) because the response is our
|
|
970
|
+
// OWN registered-component output — it keeps the `<iframe>` embeds and SVG
|
|
971
|
+
// `<use>` icons real components emit, while still stripping scripts, `on*`
|
|
972
|
+
// handlers, dangerous URL schemes, and CSS `url()` beacons. Escaped entities
|
|
973
|
+
// survive untouched, so legitimate prop text (`5 < 10`) still renders;
|
|
974
|
+
// `conloca-slot` stays allowlisted so the inline-editing slots survive.
|
|
975
|
+
wrap.innerHTML = sanitizeComponentHtml(html);
|
|
976
|
+
// After replacing the preview HTML, scan for string-prop values that
|
|
977
|
+
// appear exactly once as a leaf element's textContent and wire those
|
|
978
|
+
// elements as contenteditable. Authors edit eg LinkCard's `description`
|
|
979
|
+
// in place; the blur handler commits via `onPropChange`. Runs after
|
|
980
|
+
// every prop change because the new HTML wipes prior contenteditable
|
|
981
|
+
// attributes — re-wiring keeps inline editing alive across re-renders.
|
|
982
|
+
wireInlinePropEditors(wrap, currentAttrs, currentOnPropChange);
|
|
983
|
+
if (containerMode) {
|
|
984
|
+
// Multiple slots — discover them all and key by slot-id so the
|
|
985
|
+
// path resolution in `ContainerSlotEditor` can find the right
|
|
986
|
+
// mdast subtree to edit.
|
|
987
|
+
const next = new Map<string, Element>();
|
|
988
|
+
const slotEls = wrap.querySelectorAll(`${SLOT_TAG}[data-slot-id]`);
|
|
989
|
+
for (const el of Array.from(slotEls)) {
|
|
990
|
+
const slotId = el.getAttribute('data-slot-id');
|
|
991
|
+
if (slotId) next.set(slotId, el);
|
|
992
|
+
}
|
|
993
|
+
setContainerSlots(next);
|
|
994
|
+
setSlotEl(null);
|
|
995
|
+
// Per-child inline-prop wiring. The container's own
|
|
996
|
+
// `wireInlinePropEditors` call above only matches against the
|
|
997
|
+
// container's props (eg CardGrid's `stagger`) — child Cards'
|
|
998
|
+
// `title` and `icon` values are skipped because the matcher
|
|
999
|
+
// doesn't know they belong to a child. For each child slot
|
|
1000
|
+
// we find the enclosing region (the DOM subtree the framework
|
|
1001
|
+
// rendered for that one child), then run the matcher against
|
|
1002
|
+
// the child's own attrs with a child-scoped `onPropChange` that
|
|
1003
|
+
// routes through `replaceMdastNodeAtPath`. This is what lets
|
|
1004
|
+
// the author click "First card" inside a CardGrid and edit it.
|
|
1005
|
+
for (const [slotId, slotEl] of next) {
|
|
1006
|
+
const childPath = slotIdToPath(slotId);
|
|
1007
|
+
const childNode = getMdastAtPath(currentNode, childPath);
|
|
1008
|
+
if (!childNode) continue;
|
|
1009
|
+
const region = findChildRegion(slotEl as HTMLElement);
|
|
1010
|
+
if (!region) continue;
|
|
1011
|
+
// Tag the child's enclosing region with its path so the
|
|
1012
|
+
// wrapper-level mousedown/focus handler (`handleSelect`) can
|
|
1013
|
+
// resolve which child a click landed in. The slot-id walk
|
|
1014
|
+
// alone isn't enough — clicks on a child's title or icon
|
|
1015
|
+
// (which sit OUTSIDE the slot) wouldn't find a slot ancestor
|
|
1016
|
+
// via `closest`. This attribute IS a child ancestor in those
|
|
1017
|
+
// cases, so `closest('[data-conloca-child-path]')` lands on
|
|
1018
|
+
// the right region.
|
|
1019
|
+
region.setAttribute('data-conloca-child-path', slotId);
|
|
1020
|
+
const childAttrs = readAttrs(childNode);
|
|
1021
|
+
const childOnPropChange = (propName: string, value: string | boolean | number | null | undefined) => {
|
|
1022
|
+
const newChild = {
|
|
1023
|
+
...childNode,
|
|
1024
|
+
attributes: writeAttribute(childNode.attributes, propName, value),
|
|
1025
|
+
} as MdxJsxFlowElement;
|
|
1026
|
+
const nextRoot = replaceMdastNodeAtPath(currentNode, childPath, newChild);
|
|
1027
|
+
currentUpdater({ children: nextRoot.children as typeof currentNode.children });
|
|
1028
|
+
};
|
|
1029
|
+
wireInlinePropEditors(region, childAttrs, childOnPropChange);
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
// Not a JSX container (so `containerMode` is false). But the
|
|
1033
|
+
// mdast might still be a list-based strict-slot component (Steps,
|
|
1034
|
+
// FileTree, anything else whose framework component validates
|
|
1035
|
+
// its slot as a real `<ol>` / `<ul>` and rejects `<conloca-slot>`
|
|
1036
|
+
// children). For those, we wire each `<li>` as a contenteditable
|
|
1037
|
+
// with on-blur commit — no DOM mutation, no portal collision
|
|
1038
|
+
// with React. Trade-off: plaintext-only commits (loses bold/
|
|
1039
|
+
// italic on edit). Future enhancement: parse inline markdown
|
|
1040
|
+
// back from contenteditable text so formatting round-trips.
|
|
1041
|
+
wireListItemEditors(wrap, currentNode, currentUpdater, pendingListItemFocusRef);
|
|
1042
|
+
setContainerSlots(new Map());
|
|
1043
|
+
setSlotEl(wrap.querySelector(SLOT_TAG));
|
|
1044
|
+
}
|
|
1045
|
+
// `previewBindingsRef` supplies the current attrs, node, and updater
|
|
1046
|
+
// without making their render-local identities effect triggers.
|
|
1047
|
+
// This preserves focus while preventing stale editor callbacks.
|
|
1048
|
+
}, [html, containerMode]);
|
|
1049
|
+
|
|
1050
|
+
const slot = (
|
|
1051
|
+
<NestedLexicalEditor<MdxJsxFlowElement>
|
|
1052
|
+
getContent={(n) => n.children as Mdast.PhrasingContent[]}
|
|
1053
|
+
getUpdatedMdastNode={(n, children) => ({ ...n, children: children as MdxJsxFlowElement['children'] })}
|
|
1054
|
+
/>
|
|
1055
|
+
);
|
|
1056
|
+
|
|
1057
|
+
const onPropChange = useCallback(
|
|
1058
|
+
(propName: string, next: string | boolean | number | null | undefined) => {
|
|
1059
|
+
// Route through the type-aware writer so booleans become JSX
|
|
1060
|
+
// shorthand (`<CardGrid stagger />`), numbers become expressions
|
|
1061
|
+
// (`<Box columns={3} />`), and strings stay as string literals.
|
|
1062
|
+
// The inline-prop editor in the preview still calls this with
|
|
1063
|
+
// string values — `writeAttribute` handles those identically to
|
|
1064
|
+
// `writeStringAttribute` (the previous narrow writer).
|
|
1065
|
+
updater({ attributes: writeAttribute(node.attributes, propName, next) as typeof node.attributes });
|
|
1066
|
+
},
|
|
1067
|
+
[updater, node.attributes],
|
|
1068
|
+
);
|
|
1069
|
+
|
|
1070
|
+
// Publish to the side-panel registry whenever this block is the
|
|
1071
|
+
// currently-selected one, or its props change while still selected.
|
|
1072
|
+
// The panel reads `descriptor`/`attrs` to render the form and calls
|
|
1073
|
+
// back through `onPropChange`/`removeNode` (closed over the block's
|
|
1074
|
+
// own updater hooks) so updates flow on the same path inline editing
|
|
1075
|
+
// used.
|
|
1076
|
+
// Stable per-block identity. `useLexicalNodeRemove` returns a fresh
|
|
1077
|
+
// closure on each render so we can't key off `removeNode`. The Lexical
|
|
1078
|
+
// node `getKey()` is stable for the block's whole lifetime and unique
|
|
1079
|
+
// across siblings — exactly what the side-panel registry and the
|
|
1080
|
+
// `is-selected` className need to identify the active block.
|
|
1081
|
+
const blockKey = lexicalNode.getKey();
|
|
1082
|
+
// Selection publication is keyed by a structural signature rather
|
|
1083
|
+
// than render-local mdast and callback identities. The mutable
|
|
1084
|
+
// bindings keep the published handlers current without feeding the
|
|
1085
|
+
// external selection store an infinite render loop.
|
|
1086
|
+
const selectionBindingsRef = useRef({
|
|
1087
|
+
signature: selectionSignature,
|
|
1088
|
+
attrs,
|
|
1089
|
+
onPropChange,
|
|
1090
|
+
removeNode,
|
|
1091
|
+
node,
|
|
1092
|
+
updater,
|
|
1093
|
+
});
|
|
1094
|
+
const selectionBindings = selectionBindingsRef.current;
|
|
1095
|
+
selectionBindings.signature = selectionSignature;
|
|
1096
|
+
selectionBindings.attrs = attrs;
|
|
1097
|
+
selectionBindings.onPropChange = onPropChange;
|
|
1098
|
+
selectionBindings.removeNode = removeNode;
|
|
1099
|
+
selectionBindings.node = node;
|
|
1100
|
+
selectionBindings.updater = updater;
|
|
1101
|
+
|
|
1102
|
+
useEffect(() => {
|
|
1103
|
+
const bindings = selectionBindingsRef.current;
|
|
1104
|
+
// Effects run after commit; only publish a snapshot that matches the
|
|
1105
|
+
// structural change which scheduled this effect.
|
|
1106
|
+
if (bindings.signature !== selectionSignature) return;
|
|
1107
|
+
const {
|
|
1108
|
+
attrs: currentAttrs,
|
|
1109
|
+
onPropChange: currentOnPropChange,
|
|
1110
|
+
removeNode: currentRemoveNode,
|
|
1111
|
+
node: currentNode,
|
|
1112
|
+
updater: currentUpdater,
|
|
1113
|
+
} = bindings;
|
|
1114
|
+
if (!descriptor) return;
|
|
1115
|
+
const current = getSelectedBlock();
|
|
1116
|
+
if (!current) return;
|
|
1117
|
+
if (current.key === blockKey) {
|
|
1118
|
+
// Container/leaf itself is selected — republish with current attrs.
|
|
1119
|
+
setSelectedBlock({
|
|
1120
|
+
key: blockKey,
|
|
1121
|
+
name,
|
|
1122
|
+
descriptor,
|
|
1123
|
+
attrs: currentAttrs,
|
|
1124
|
+
onPropChange: currentOnPropChange,
|
|
1125
|
+
onRemove: currentRemoveNode,
|
|
1126
|
+
});
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
// A child of this container might be the selection. Child keys are
|
|
1130
|
+
// `${containerKey}:${dotPath}` — strip our prefix to find which
|
|
1131
|
+
// child path the panel is showing. Re-resolve that child from the
|
|
1132
|
+
// current mdast so panel inputs reflect prop edits done elsewhere
|
|
1133
|
+
// (inline editor commits, programmatic updates).
|
|
1134
|
+
if (containerMode && current.key.startsWith(`${blockKey}:`)) {
|
|
1135
|
+
const dotPath = current.key.slice(blockKey.length + 1);
|
|
1136
|
+
const childPath = dotPath ? dotPath.split('.').map((s) => Number.parseInt(s, 10)) : [];
|
|
1137
|
+
const childNode = getMdastAtPath(currentNode, childPath);
|
|
1138
|
+
if (!childNode || childNode.name !== current.name) return;
|
|
1139
|
+
const childDescriptor = descriptorsByName.get(childNode.name);
|
|
1140
|
+
if (!childDescriptor || !isJsxDescriptor(childDescriptor)) return;
|
|
1141
|
+
const childAttrs = readAttrs(childNode);
|
|
1142
|
+
const childOnPropChange = (propName: string, value: string | boolean | number | null | undefined) => {
|
|
1143
|
+
const newChild = {
|
|
1144
|
+
...childNode,
|
|
1145
|
+
attributes: writeAttribute(childNode.attributes, propName, value),
|
|
1146
|
+
} as MdxJsxFlowElement;
|
|
1147
|
+
const next = replaceMdastNodeAtPath(currentNode, childPath, newChild);
|
|
1148
|
+
currentUpdater({ children: next.children as typeof currentNode.children });
|
|
1149
|
+
};
|
|
1150
|
+
const childOnRemove = () => {
|
|
1151
|
+
const next = removeMdastNodeAtPath(currentNode, childPath);
|
|
1152
|
+
currentUpdater({ children: next.children as typeof currentNode.children });
|
|
1153
|
+
};
|
|
1154
|
+
setSelectedBlock({
|
|
1155
|
+
key: current.key,
|
|
1156
|
+
name: childNode.name,
|
|
1157
|
+
descriptor: childDescriptor,
|
|
1158
|
+
attrs: childAttrs,
|
|
1159
|
+
onPropChange: childOnPropChange,
|
|
1160
|
+
onRemove: childOnRemove,
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
// The signature changes only when mdast content changes; the
|
|
1164
|
+
// descriptor map changes only when the host registry changes.
|
|
1165
|
+
// Render-local editor bindings are read from the ref above.
|
|
1166
|
+
}, [selectionSignature, descriptor, name, blockKey, containerMode, descriptorsByName]);
|
|
1167
|
+
|
|
1168
|
+
const handleSelect = useCallback(
|
|
1169
|
+
(e?: React.SyntheticEvent) => {
|
|
1170
|
+
if (!descriptor) return;
|
|
1171
|
+
// Container resolution: when the click/focus landed inside a
|
|
1172
|
+
// child slot (eg a Card inside a CardGrid), publish the CHILD's
|
|
1173
|
+
// descriptor + attrs to the panel instead of the container's.
|
|
1174
|
+
// The same wrapper handler covers both cases — we walk from the
|
|
1175
|
+
// event target to find the nearest `data-slot-id` ancestor; if
|
|
1176
|
+
// one exists, the user clicked into a child, otherwise the click
|
|
1177
|
+
// hit container-level chrome and the container itself is the
|
|
1178
|
+
// selection.
|
|
1179
|
+
if (containerMode && e) {
|
|
1180
|
+
const target = e.target as HTMLElement | null;
|
|
1181
|
+
// Prefer the child-region marker stamped by the html-injection
|
|
1182
|
+
// effect — covers clicks anywhere inside a child (title, icon,
|
|
1183
|
+
// body). The slot-id fallback covers the case where the
|
|
1184
|
+
// region marker is missing (eg edge cases where the region
|
|
1185
|
+
// walker couldn't find a bounded subtree).
|
|
1186
|
+
const regionEl = target?.closest<HTMLElement>('[data-conloca-child-path]');
|
|
1187
|
+
const slotEl = regionEl ?? target?.closest<HTMLElement>('[data-slot-id]');
|
|
1188
|
+
if (slotEl) {
|
|
1189
|
+
const slotId = slotEl.getAttribute('data-conloca-child-path') ?? slotEl.getAttribute('data-slot-id') ?? '';
|
|
1190
|
+
const childPath = slotIdToPath(slotId);
|
|
1191
|
+
const childNode = getMdastAtPath(node, childPath);
|
|
1192
|
+
if (childNode?.name) {
|
|
1193
|
+
const childDescriptor = descriptors.find((d) => d.name === childNode.name);
|
|
1194
|
+
if (childDescriptor && isJsxDescriptor(childDescriptor)) {
|
|
1195
|
+
const childAttrs = readAttrs(childNode);
|
|
1196
|
+
const childKey = `${blockKey}:${childPath.join('.')}`;
|
|
1197
|
+
const childOnPropChange = (propName: string, value: string | boolean | number | null | undefined) => {
|
|
1198
|
+
const newChild = {
|
|
1199
|
+
...childNode,
|
|
1200
|
+
attributes: writeAttribute(childNode.attributes, propName, value),
|
|
1201
|
+
} as MdxJsxFlowElement;
|
|
1202
|
+
const next = replaceMdastNodeAtPath(node, childPath, newChild);
|
|
1203
|
+
updater({ children: next.children as typeof node.children });
|
|
1204
|
+
};
|
|
1205
|
+
const childOnRemove = () => {
|
|
1206
|
+
const next = removeMdastNodeAtPath(node, childPath);
|
|
1207
|
+
updater({ children: next.children as typeof node.children });
|
|
1208
|
+
};
|
|
1209
|
+
setSelectedBlock({
|
|
1210
|
+
key: childKey,
|
|
1211
|
+
name: childNode.name,
|
|
1212
|
+
descriptor: childDescriptor,
|
|
1213
|
+
attrs: childAttrs,
|
|
1214
|
+
onPropChange: childOnPropChange,
|
|
1215
|
+
onRemove: childOnRemove,
|
|
1216
|
+
});
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
setSelectedBlock({ key: blockKey, name, descriptor, attrs, onPropChange, onRemove: removeNode });
|
|
1223
|
+
},
|
|
1224
|
+
[blockKey, descriptor, name, attrs, onPropChange, removeNode, containerMode, node, descriptors, updater],
|
|
1225
|
+
);
|
|
1226
|
+
|
|
1227
|
+
// SSR'd component previews ship with real interactive anchors — Starlight
|
|
1228
|
+
// `<LinkCard>`s navigate, `<Tabs>` triggers are `<a role="tab" href="#...">`,
|
|
1229
|
+
// any `<a>` inside a `<Card>` body, etc. In a live page Starlight's custom
|
|
1230
|
+
// elements (`<starlight-tabs>`) wire click → tab-panel toggle, and link
|
|
1231
|
+
// anchors navigate. In the editor neither of those is desirable: the JS
|
|
1232
|
+
// that runs `<starlight-tabs>`'s connectedCallback isn't loaded under
|
|
1233
|
+
// /__cms, and navigation yanks the author away from what they're editing.
|
|
1234
|
+
//
|
|
1235
|
+
// So intercept anchor clicks in capture phase and handle the two cases:
|
|
1236
|
+
// 1. `[role="tab"]` → switch tabs in place (manual ARIA toggle that
|
|
1237
|
+
// mirrors what `<starlight-tabs>` would do at runtime). The author
|
|
1238
|
+
// can now click "npm" to see and edit the npm tab body.
|
|
1239
|
+
// 2. Any other `<a>` → swallow. Selection still fires from the
|
|
1240
|
+
// `mousedown` handler so the block becomes selected as if it were a
|
|
1241
|
+
// static surface.
|
|
1242
|
+
//
|
|
1243
|
+
// `auxclick` (middle-click) gets the anchor swallow too — without it
|
|
1244
|
+
// middle-click on a LinkCard would still "open in new tab" and escape
|
|
1245
|
+
// the editor.
|
|
1246
|
+
const handleAnchorClickInPreview = useCallback((e: React.MouseEvent) => {
|
|
1247
|
+
const target = e.target as HTMLElement | null;
|
|
1248
|
+
const tab = target?.closest('[role="tab"]');
|
|
1249
|
+
if (tab) {
|
|
1250
|
+
e.preventDefault();
|
|
1251
|
+
e.stopPropagation();
|
|
1252
|
+
activateTabInPlace(tab as HTMLElement);
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
if (target?.closest('a')) {
|
|
1256
|
+
e.preventDefault();
|
|
1257
|
+
e.stopPropagation();
|
|
1258
|
+
}
|
|
1259
|
+
}, []);
|
|
1260
|
+
|
|
1261
|
+
// Per-block "am I selected" subscription. Compares the registry's
|
|
1262
|
+
// current key with this block's stable key; safe across re-renders.
|
|
1263
|
+
// The CSS hook is the `is-selected` class on the wrapper, which paints
|
|
1264
|
+
// the accent outline; the side panel keys off the same registry.
|
|
1265
|
+
const selected = useSelectedBlock();
|
|
1266
|
+
const isSelected = selected?.key === blockKey;
|
|
1267
|
+
const sandboxStyles = useSandboxPreviewStyles();
|
|
1268
|
+
|
|
1269
|
+
// Raw HTML in MDX (`<div class="x">`, `<details>`, etc.) lands here
|
|
1270
|
+
// with a lowercase tag name and no registered component descriptor.
|
|
1271
|
+
// Render the whole subtree client-side as HTML — no SSR roundtrip,
|
|
1272
|
+
// no labelled fallback. Static (not inline-editable) for now.
|
|
1273
|
+
if (!source && isHtmlTag(name)) {
|
|
1274
|
+
// Raw HTML is sanitized AND rendered inside the opaque-origin sandbox —
|
|
1275
|
+
// defence in depth: even a payload that slips past the sanitizer cannot
|
|
1276
|
+
// reach this document's cookies or `__CONTENT_API_CLIENT__`. This block is
|
|
1277
|
+
// static (no descriptor, so `handleSelect` already no-ops); anchor
|
|
1278
|
+
// navigation is swallowed by ignoring the frame's `link` message.
|
|
1279
|
+
const rawHtml = sanitizeHtml(mdastToHtml(node));
|
|
1280
|
+
return (
|
|
1281
|
+
<div
|
|
1282
|
+
className={`conloca-generic-block conloca-generic-block--html${isSelected ? ' is-selected' : ''}`}
|
|
1283
|
+
onMouseDownCapture={handleSelect}
|
|
1284
|
+
onFocusCapture={handleSelect}
|
|
1285
|
+
>
|
|
1286
|
+
<ContentSandbox mode="html" content={rawHtml} styles={sandboxStyles} />
|
|
1287
|
+
</div>
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
// Text-kind components are inline glyphs (Icon, raw-HTML inline tags).
|
|
1292
|
+
// Wrapping them in a `<div>` would force a line break inside the
|
|
1293
|
+
// paragraph that contains them. Use `<span>` wrappers and a class
|
|
1294
|
+
// modifier so CSS can drop block-level styling for this path.
|
|
1295
|
+
if (isInline) {
|
|
1296
|
+
return (
|
|
1297
|
+
<span
|
|
1298
|
+
className={`conloca-generic-block conloca-generic-block--inline${isSelected ? ' is-selected' : ''}`}
|
|
1299
|
+
onMouseDownCapture={handleSelect}
|
|
1300
|
+
onFocusCapture={handleSelect}
|
|
1301
|
+
onClickCapture={handleAnchorClickInPreview}
|
|
1302
|
+
onAuxClickCapture={handleAnchorClickInPreview}
|
|
1303
|
+
>
|
|
1304
|
+
{source && !error ? (
|
|
1305
|
+
<>
|
|
1306
|
+
<span
|
|
1307
|
+
ref={wrapperRef as unknown as React.RefObject<HTMLSpanElement>}
|
|
1308
|
+
className="conloca-generic-block__rendered"
|
|
1309
|
+
/>
|
|
1310
|
+
{slotEl && createPortal(slot, slotEl)}
|
|
1311
|
+
</>
|
|
1312
|
+
) : (
|
|
1313
|
+
<span className="conloca-generic-block__fallback" data-mdx-block={name}>
|
|
1314
|
+
<span className="conloca-generic-block__fallback-label">{name}</span>
|
|
1315
|
+
<span className="conloca-generic-block__fallback-body">{slot}</span>
|
|
1316
|
+
</span>
|
|
1317
|
+
)}
|
|
1318
|
+
</span>
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
return (
|
|
1323
|
+
<div
|
|
1324
|
+
className={`conloca-generic-block${isSelected ? ' is-selected' : ''}`}
|
|
1325
|
+
onMouseDownCapture={handleSelect}
|
|
1326
|
+
onFocusCapture={handleSelect}
|
|
1327
|
+
onClickCapture={handleAnchorClickInPreview}
|
|
1328
|
+
onAuxClickCapture={handleAnchorClickInPreview}
|
|
1329
|
+
>
|
|
1330
|
+
{/* Wrapper that hosts the SSR'd HTML. The nested editor portals
|
|
1331
|
+
into the <conloca-slot> element inside this HTML. When no source
|
|
1332
|
+
is registered (unknown JSX tag, custom React/Vue component without
|
|
1333
|
+
a descriptor) or the SSR call fails, fall back to a labelled
|
|
1334
|
+
wrapper so the body stays editable and visual chrome at least
|
|
1335
|
+
shows the block's name. */}
|
|
1336
|
+
{source && !error ? (
|
|
1337
|
+
<>
|
|
1338
|
+
<div ref={wrapperRef} className="conloca-generic-block__rendered" />
|
|
1339
|
+
{/* Leaf mode: one slot at the wrapper level, portaled with a
|
|
1340
|
+
single nested editor for the block's body. */}
|
|
1341
|
+
{slotEl && createPortal(slot, slotEl)}
|
|
1342
|
+
{/* Container/list slots: each child node OR list item gets
|
|
1343
|
+
a slot with `data-slot-id`. Portal a `ContainerSlotEditor`
|
|
1344
|
+
into each, scoped to that child's mdast subtree via path
|
|
1345
|
+
resolution. The same render path covers two cases —
|
|
1346
|
+
container components (CardGrid → Card children) and
|
|
1347
|
+
strict-slot list components (Steps → listItem children)
|
|
1348
|
+
where the slot markers are injected client-side post-SSR. */}
|
|
1349
|
+
{Array.from(containerSlots).map(([slotId, el]) =>
|
|
1350
|
+
createPortal(<ContainerSlotEditor key={slotId} path={slotIdToPath(slotId)} />, el),
|
|
1351
|
+
)}
|
|
1352
|
+
</>
|
|
1353
|
+
) : (
|
|
1354
|
+
<div className="conloca-generic-block__fallback" data-mdx-block={name}>
|
|
1355
|
+
<span className="conloca-generic-block__fallback-label">{name}</span>
|
|
1356
|
+
<div className="conloca-generic-block__fallback-body">{slot}</div>
|
|
1357
|
+
</div>
|
|
1358
|
+
)}
|
|
1359
|
+
</div>
|
|
1360
|
+
);
|
|
1361
|
+
}
|