@conloca/cms-spa 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-Bk1LNxbS.mjs +10851 -0
- package/dist/App-Bk1LNxbS.mjs.map +1 -0
- package/dist/App.d.ts +35 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +52 -0
- package/dist/CmsSpaApp.d.ts +13 -0
- package/dist/CmsSpaApp.d.ts.map +1 -0
- package/dist/CmsSpaApp.js +33 -0
- package/dist/cn-dlASUkDY.mjs +10 -0
- package/dist/cn-dlASUkDY.mjs.map +1 -0
- package/dist/components/CMSDashboard.d.ts +2 -0
- package/dist/components/CMSDashboard.d.ts.map +1 -0
- package/dist/components/CMSDashboard.js +20 -0
- package/dist/components/CMSLayout.d.ts +2 -0
- package/dist/components/CMSLayout.d.ts.map +1 -0
- package/dist/components/CMSLayout.js +15 -0
- package/dist/components/ConlocaLogo.d.ts +2 -0
- package/dist/components/ConlocaLogo.d.ts.map +1 -0
- package/dist/components/ConlocaLogo.js +4 -0
- package/dist/components/GitStatusPanel.d.ts +25 -0
- package/dist/components/GitStatusPanel.d.ts.map +1 -0
- package/dist/components/GitStatusPanel.js +77 -0
- package/dist/components/MobileTopBar.d.ts +6 -0
- package/dist/components/MobileTopBar.d.ts.map +1 -0
- package/dist/components/MobileTopBar.js +6 -0
- package/dist/components/Sidebar.d.ts +8 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +40 -0
- package/dist/components/UserAvatar.d.ts +2 -0
- package/dist/components/UserAvatar.d.ts.map +1 -0
- package/dist/components/UserAvatar.js +14 -0
- package/dist/components/cards/DataEntryCard.d.ts +14 -0
- package/dist/components/cards/DataEntryCard.d.ts.map +1 -0
- package/dist/components/cards/DataEntryCard.js +32 -0
- package/dist/components/cards/SectionCard.d.ts +15 -0
- package/dist/components/cards/SectionCard.d.ts.map +1 -0
- package/dist/components/cards/SectionCard.js +10 -0
- package/dist/components/cards/index.d.ts +2 -0
- package/dist/components/cards/index.d.ts.map +1 -0
- package/dist/components/cards/index.js +1 -0
- package/dist/components/dashboard/RecentActivity.d.ts +2 -0
- package/dist/components/dashboard/RecentActivity.d.ts.map +1 -0
- package/dist/components/dashboard/RecentActivity.js +58 -0
- package/dist/components/dialog.d.ts +53 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +56 -0
- package/dist/components/dialogs/BlockPropertiesDialog.d.ts +12 -0
- package/dist/components/dialogs/BlockPropertiesDialog.d.ts.map +1 -0
- package/dist/components/dialogs/BlockPropertiesDialog.js +42 -0
- package/dist/components/dialogs/ConflictDialog.d.ts +10 -0
- package/dist/components/dialogs/ConflictDialog.d.ts.map +1 -0
- package/dist/components/dialogs/ConflictDialog.js +29 -0
- package/dist/components/dialogs/CreateDataDialog.d.ts +9 -0
- package/dist/components/dialogs/CreateDataDialog.d.ts.map +1 -0
- package/dist/components/dialogs/CreateDataDialog.js +20 -0
- package/dist/components/dialogs/CreateFolderDialog.d.ts +9 -0
- package/dist/components/dialogs/CreateFolderDialog.d.ts.map +1 -0
- package/dist/components/dialogs/CreateFolderDialog.js +33 -0
- package/dist/components/dialogs/CreatePageDialog.d.ts +10 -0
- package/dist/components/dialogs/CreatePageDialog.d.ts.map +1 -0
- package/dist/components/dialogs/CreatePageDialog.js +155 -0
- package/dist/components/dialogs/DataPropertiesDialog.d.ts +10 -0
- package/dist/components/dialogs/DataPropertiesDialog.d.ts.map +1 -0
- package/dist/components/dialogs/DataPropertiesDialog.js +38 -0
- package/dist/components/dialogs/DeleteConfirmDialog.d.ts +12 -0
- package/dist/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -0
- package/dist/components/dialogs/DeleteConfirmDialog.js +7 -0
- package/dist/components/dialogs/ErrorModal.d.ts +14 -0
- package/dist/components/dialogs/ErrorModal.d.ts.map +1 -0
- package/dist/components/dialogs/ErrorModal.js +38 -0
- package/dist/components/dialogs/MoveFolderDialog.d.ts +11 -0
- package/dist/components/dialogs/MoveFolderDialog.d.ts.map +1 -0
- package/dist/components/dialogs/MoveFolderDialog.js +45 -0
- package/dist/components/dialogs/PageMetadataDialog.d.ts +10 -0
- package/dist/components/dialogs/PageMetadataDialog.d.ts.map +1 -0
- package/dist/components/dialogs/PageMetadataDialog.js +85 -0
- package/dist/components/dialogs/UnsavedChangesDialog.d.ts +8 -0
- package/dist/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -0
- package/dist/components/dialogs/UnsavedChangesDialog.js +6 -0
- package/dist/components/dialogs/index.d.ts +9 -0
- package/dist/components/dialogs/index.d.ts.map +1 -0
- package/dist/components/dialogs/index.js +8 -0
- package/dist/components/editor/BlockEditor.d.ts +8 -0
- package/dist/components/editor/BlockEditor.d.ts.map +1 -0
- package/dist/components/editor/BlockEditor.js +262 -0
- package/dist/components/editor/BlockWrappers.d.ts +15 -0
- package/dist/components/editor/BlockWrappers.d.ts.map +1 -0
- package/dist/components/editor/BlockWrappers.js +29 -0
- package/dist/components/editor/CMSMDXEditor.d.ts +13 -0
- package/dist/components/editor/CMSMDXEditor.d.ts.map +1 -0
- package/dist/components/editor/CMSMDXEditor.js +123 -0
- package/dist/components/editor/ContentDiff.d.ts +10 -0
- package/dist/components/editor/ContentDiff.d.ts.map +1 -0
- package/dist/components/editor/ContentDiff.js +51 -0
- package/dist/components/editor/CreateBlockDialog.d.ts +26 -0
- package/dist/components/editor/CreateBlockDialog.d.ts.map +1 -0
- package/dist/components/editor/CreateBlockDialog.js +131 -0
- package/dist/components/editor/DrawerItemOverride.d.ts +8 -0
- package/dist/components/editor/DrawerItemOverride.d.ts.map +1 -0
- package/dist/components/editor/DrawerItemOverride.js +41 -0
- package/dist/components/editor/EditorChromeToggles.d.ts +16 -0
- package/dist/components/editor/EditorChromeToggles.d.ts.map +1 -0
- package/dist/components/editor/EditorChromeToggles.js +16 -0
- package/dist/components/editor/GenericBlock.d.ts +3 -0
- package/dist/components/editor/GenericBlock.d.ts.map +1 -0
- package/dist/components/editor/GenericBlock.js +1067 -0
- package/dist/components/editor/ImagePickerDialog.d.ts +6 -0
- package/dist/components/editor/ImagePickerDialog.d.ts.map +1 -0
- package/dist/components/editor/ImagePickerDialog.js +24 -0
- package/dist/components/editor/JsxPropsPanel.d.ts +16 -0
- package/dist/components/editor/JsxPropsPanel.d.ts.map +1 -0
- package/dist/components/editor/JsxPropsPanel.js +145 -0
- package/dist/components/editor/LocaleSelector.d.ts +9 -0
- package/dist/components/editor/LocaleSelector.d.ts.map +1 -0
- package/dist/components/editor/LocaleSelector.js +13 -0
- package/dist/components/editor/MDXLivePreview.d.ts +14 -0
- package/dist/components/editor/MDXLivePreview.d.ts.map +1 -0
- package/dist/components/editor/MDXLivePreview.js +103 -0
- package/dist/components/editor/MdxPageEditor.d.ts +10 -0
- package/dist/components/editor/MdxPageEditor.d.ts.map +1 -0
- package/dist/components/editor/MdxPageEditor.js +297 -0
- package/dist/components/editor/PageEditor.d.ts +18 -0
- package/dist/components/editor/PageEditor.d.ts.map +1 -0
- package/dist/components/editor/PageEditor.js +288 -0
- package/dist/components/editor/PageEditorHeaderActions.d.ts +16 -0
- package/dist/components/editor/PageEditorHeaderActions.d.ts.map +1 -0
- package/dist/components/editor/PageEditorHeaderActions.js +19 -0
- package/dist/components/editor/PageEditorWrapper.d.ts +7 -0
- package/dist/components/editor/PageEditorWrapper.d.ts.map +1 -0
- package/dist/components/editor/PageEditorWrapper.js +319 -0
- package/dist/components/editor/SearchableSelect.d.ts +34 -0
- package/dist/components/editor/SearchableSelect.d.ts.map +1 -0
- package/dist/components/editor/SearchableSelect.js +116 -0
- package/dist/components/editor/host-wrapper-plugin.d.ts +51 -0
- package/dist/components/editor/host-wrapper-plugin.d.ts.map +1 -0
- package/dist/components/editor/host-wrapper-plugin.js +37 -0
- package/dist/components/editor/index.d.ts +9 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +7 -0
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts +15 -0
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.js +90 -0
- package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts +12 -0
- package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/SlashMenuPlugin.js +106 -0
- package/dist/components/editor/insert-menu/insert-payload.d.ts +76 -0
- package/dist/components/editor/insert-menu/insert-payload.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/insert-payload.js +94 -0
- package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts +8 -0
- package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/mdx-components-plugin.js +13 -0
- package/dist/components/editors/DataEditor.d.ts +19 -0
- package/dist/components/editors/DataEditor.d.ts.map +1 -0
- package/dist/components/editors/DataEditor.js +139 -0
- package/dist/components/fields/ContentBlockSelectorField.d.ts +14 -0
- package/dist/components/fields/ContentBlockSelectorField.d.ts.map +1 -0
- package/dist/components/fields/ContentBlockSelectorField.js +105 -0
- package/dist/components/fields/ImageField.d.ts +16 -0
- package/dist/components/fields/ImageField.d.ts.map +1 -0
- package/dist/components/fields/ImageField.js +39 -0
- package/dist/components/fields/MDXEditField.d.ts +17 -0
- package/dist/components/fields/MDXEditField.d.ts.map +1 -0
- package/dist/components/fields/MDXEditField.js +28 -0
- package/dist/components/forms/ChipArrayField.d.ts +12 -0
- package/dist/components/forms/ChipArrayField.d.ts.map +1 -0
- package/dist/components/forms/ChipArrayField.js +40 -0
- package/dist/components/forms/HintForm.d.ts +22 -0
- package/dist/components/forms/HintForm.d.ts.map +1 -0
- package/dist/components/forms/HintForm.js +162 -0
- package/dist/components/forms/SchemaForm.d.ts +15 -0
- package/dist/components/forms/SchemaForm.d.ts.map +1 -0
- package/dist/components/forms/SchemaForm.js +106 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +13 -0
- package/dist/components/media/AssetCard.d.ts +14 -0
- package/dist/components/media/AssetCard.d.ts.map +1 -0
- package/dist/components/media/AssetCard.js +31 -0
- package/dist/components/media/AssetDetailSidebar.d.ts +11 -0
- package/dist/components/media/AssetDetailSidebar.d.ts.map +1 -0
- package/dist/components/media/AssetDetailSidebar.js +101 -0
- package/dist/components/media/BulkActionBar.d.ts +9 -0
- package/dist/components/media/BulkActionBar.d.ts.map +1 -0
- package/dist/components/media/BulkActionBar.js +8 -0
- package/dist/components/media/FolderNav.d.ts +7 -0
- package/dist/components/media/FolderNav.d.ts.map +1 -0
- package/dist/components/media/FolderNav.js +12 -0
- package/dist/components/media/FolderTreeSidebar.d.ts +9 -0
- package/dist/components/media/FolderTreeSidebar.d.ts.map +1 -0
- package/dist/components/media/FolderTreeSidebar.js +41 -0
- package/dist/components/media/ImagePicker.d.ts +14 -0
- package/dist/components/media/ImagePicker.d.ts.map +1 -0
- package/dist/components/media/ImagePicker.js +45 -0
- package/dist/components/media/MediaLibrary.d.ts +35 -0
- package/dist/components/media/MediaLibrary.d.ts.map +1 -0
- package/dist/components/media/MediaLibrary.js +100 -0
- package/dist/components/media/MediaToolbar.d.ts +21 -0
- package/dist/components/media/MediaToolbar.d.ts.map +1 -0
- package/dist/components/media/MediaToolbar.js +6 -0
- package/dist/components/media/UploadModal.d.ts +9 -0
- package/dist/components/media/UploadModal.d.ts.map +1 -0
- package/dist/components/media/UploadModal.js +42 -0
- package/dist/components/media/UploadZone.d.ts +8 -0
- package/dist/components/media/UploadZone.d.ts.map +1 -0
- package/dist/components/media/UploadZone.js +22 -0
- package/dist/components/media/index.d.ts +11 -0
- package/dist/components/media/index.d.ts.map +1 -0
- package/dist/components/media/index.js +10 -0
- package/dist/components/pages/BlockList.d.ts +2 -0
- package/dist/components/pages/BlockList.d.ts.map +1 -0
- package/dist/components/pages/BlockList.js +280 -0
- package/dist/components/pages/DataList.d.ts +7 -0
- package/dist/components/pages/DataList.d.ts.map +1 -0
- package/dist/components/pages/DataList.js +244 -0
- package/dist/components/pages/MediaPage.d.ts +8 -0
- package/dist/components/pages/MediaPage.d.ts.map +1 -0
- package/dist/components/pages/MediaPage.js +107 -0
- package/dist/components/pages/PageList.d.ts +7 -0
- package/dist/components/pages/PageList.d.ts.map +1 -0
- package/dist/components/pages/PageList.js +308 -0
- package/dist/components/pages/index.d.ts +3 -0
- package/dist/components/pages/index.d.ts.map +1 -0
- package/dist/components/pages/index.js +2 -0
- package/dist/components/puck/MDXContent.d.ts +10 -0
- package/dist/components/puck/MDXContent.d.ts.map +1 -0
- package/dist/components/puck/MDXContent.js +80 -0
- package/dist/components/puck/index.d.ts +2 -0
- package/dist/components/puck/index.d.ts.map +1 -0
- package/dist/components/puck/index.js +1 -0
- package/dist/components/toast.d.ts +44 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +7 -0
- package/dist/components/ui/Banner.d.ts +76 -0
- package/dist/components/ui/Banner.d.ts.map +1 -0
- package/dist/components/ui/Banner.js +49 -0
- package/dist/components/ui/Button.d.ts +25 -0
- package/dist/components/ui/Button.d.ts.map +1 -0
- package/dist/components/ui/Button.js +33 -0
- package/dist/components/ui/Card.d.ts +72 -0
- package/dist/components/ui/Card.d.ts.map +1 -0
- package/dist/components/ui/Card.js +49 -0
- package/dist/components/ui/FieldError.d.ts +24 -0
- package/dist/components/ui/FieldError.d.ts.map +1 -0
- package/dist/components/ui/FieldError.js +17 -0
- package/dist/components/ui/IconButton.d.ts +13 -0
- package/dist/components/ui/IconButton.d.ts.map +1 -0
- package/dist/components/ui/IconButton.js +10 -0
- package/dist/components/ui/Input.d.ts +37 -0
- package/dist/components/ui/Input.d.ts.map +1 -0
- package/dist/components/ui/Input.js +9 -0
- package/dist/components/ui/SaveIndicator.d.ts +8 -0
- package/dist/components/ui/SaveIndicator.d.ts.map +1 -0
- package/dist/components/ui/SaveIndicator.js +32 -0
- package/dist/components/ui/Select.d.ts +8 -0
- package/dist/components/ui/Select.d.ts.map +1 -0
- package/dist/components/ui/Select.js +9 -0
- package/dist/components/ui/Separator.d.ts +7 -0
- package/dist/components/ui/Separator.d.ts.map +1 -0
- package/dist/components/ui/Separator.js +8 -0
- package/dist/components/ui/Textarea.d.ts +8 -0
- package/dist/components/ui/Textarea.d.ts.map +1 -0
- package/dist/components/ui/Textarea.js +5 -0
- package/dist/components/ui/Tooltip.d.ts +9 -0
- package/dist/components/ui/Tooltip.d.ts.map +1 -0
- package/dist/components/ui/Tooltip.js +7 -0
- package/dist/components/ui/index.d.ts +14 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +17 -0
- package/dist/data-schemas.d.mts +0 -1
- package/dist/data-schemas.d.mts.map +1 -1
- package/dist/data-schemas.d.ts +22 -0
- package/dist/data-schemas.d.ts.map +1 -0
- package/dist/data-schemas.js +51 -0
- package/dist/data-schemas.mjs +3 -4
- package/dist/data-schemas.mjs.map +1 -1
- package/dist/dev-entry.d.ts +2 -0
- package/dist/dev-entry.d.ts.map +1 -0
- package/dist/dev-entry.js +19 -0
- package/dist/dialog.d.mts +56 -0
- package/dist/dialog.d.mts.map +1 -0
- package/dist/dialog.mjs +67 -0
- package/dist/dialog.mjs.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useCanvasTheme.d.ts +12 -0
- package/dist/hooks/useCanvasTheme.d.ts.map +1 -0
- package/dist/hooks/useCanvasTheme.js +33 -0
- package/dist/hooks/useClickOutside.d.ts +7 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.js +18 -0
- package/dist/hooks/useDialogState.d.ts +23 -0
- package/dist/hooks/useDialogState.d.ts.map +1 -0
- package/dist/hooks/useDialogState.js +31 -0
- package/dist/hooks/useEditorPref.d.ts +2 -0
- package/dist/hooks/useEditorPref.d.ts.map +1 -0
- package/dist/hooks/useEditorPref.js +49 -0
- package/dist/hooks/useErrorModal.d.ts +15 -0
- package/dist/hooks/useErrorModal.d.ts.map +1 -0
- package/dist/hooks/useErrorModal.js +35 -0
- package/dist/hooks/useSiteBaseUrl.d.ts +10 -0
- package/dist/hooks/useSiteBaseUrl.d.ts.map +1 -0
- package/dist/hooks/useSiteBaseUrl.js +14 -0
- package/dist/hooks/useTheme.d.ts +13 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +69 -0
- package/dist/hooks/useUnsavedChangesGuard.d.ts +16 -0
- package/dist/hooks/useUnsavedChangesGuard.d.ts.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard.js +29 -0
- package/dist/hooks/useUpload.d.ts +10 -0
- package/dist/hooks/useUpload.d.ts.map +1 -0
- package/dist/hooks/useUpload.js +42 -0
- package/dist/hooks/useUploadFlow.d.ts +42 -0
- package/dist/hooks/useUploadFlow.d.ts.map +1 -0
- package/dist/hooks/useUploadFlow.js +148 -0
- package/dist/host-style-probe.d.ts +22 -0
- package/dist/host-style-probe.d.ts.map +1 -0
- package/dist/host-style-probe.js +508 -0
- package/dist/index.d.mts +167 -39
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.mjs +36 -2
- package/dist/index.mjs.map +1 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +47 -0
- package/dist/main-spa-781YUplS.mjs +46 -0
- package/dist/main-spa-781YUplS.mjs.map +1 -0
- package/dist/main-spa.d.ts +8 -0
- package/dist/main-spa.d.ts.map +1 -0
- package/dist/main-spa.js +61 -0
- package/dist/main.d.mts +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +13 -0
- package/dist/main.mjs +11 -5681
- package/dist/main.mjs.map +1 -1
- package/dist/mdx-components.d.mts +207 -0
- package/dist/mdx-components.d.mts.map +1 -0
- package/dist/mdx-components.d.ts +204 -0
- package/dist/mdx-components.d.ts.map +1 -0
- package/dist/mdx-components.js +217 -0
- package/dist/mdx-components.mjs +208 -0
- package/dist/mdx-components.mjs.map +1 -0
- package/dist/media/AssetScopePill.d.ts +30 -0
- package/dist/media/AssetScopePill.d.ts.map +1 -0
- package/dist/media/AssetScopePill.js +30 -0
- package/dist/media/MediaIssueBadge.d.ts +33 -0
- package/dist/media/MediaIssueBadge.d.ts.map +1 -0
- package/dist/media/MediaIssueBadge.js +54 -0
- package/dist/media/types.d.ts +101 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/types.js +1 -0
- package/dist/media/use-asset-scope.d.ts +25 -0
- package/dist/media/use-asset-scope.d.ts.map +1 -0
- package/dist/media/use-asset-scope.js +54 -0
- package/dist/media/use-media-issue.d.ts +24 -0
- package/dist/media/use-media-issue.d.ts.map +1 -0
- package/dist/media/use-media-issue.js +49 -0
- package/dist/mock-puck-config.d.mts +23 -0
- package/dist/mock-puck-config.d.mts.map +1 -0
- package/dist/mock-puck-config.d.ts +21 -0
- package/dist/mock-puck-config.d.ts.map +1 -0
- package/dist/mock-puck-config.js +73 -0
- package/dist/mock-puck-config.mjs +125 -0
- package/dist/mock-puck-config.mjs.map +1 -0
- package/dist/page-schemas.d.mts +139 -6
- package/dist/page-schemas.d.mts.map +1 -1
- package/dist/page-schemas.d.ts +156 -0
- package/dist/page-schemas.d.ts.map +1 -0
- package/dist/page-schemas.js +118 -0
- package/dist/page-schemas.mjs +74 -6
- package/dist/page-schemas.mjs.map +1 -1
- package/dist/puck-config.d.mts +0 -1
- package/dist/puck-config.d.mts.map +1 -1
- package/dist/puck-config.d.ts +31 -0
- package/dist/puck-config.d.ts.map +1 -0
- package/dist/puck-config.js +50 -0
- package/dist/puck-config.mjs +3 -4
- package/dist/puck-config.mjs.map +1 -1
- package/dist/selected-block.d.ts +61 -0
- package/dist/selected-block.d.ts.map +1 -0
- package/dist/selected-block.js +64 -0
- package/dist/site-styles.d.mts +90 -8
- package/dist/site-styles.d.mts.map +1 -1
- package/dist/site-styles.d.ts +121 -0
- package/dist/site-styles.d.ts.map +1 -0
- package/dist/site-styles.js +253 -0
- package/dist/site-styles.mjs +187 -5
- package/dist/site-styles.mjs.map +1 -1
- package/dist/spa/main.css +690 -127
- package/dist/toast.d.mts +7 -0
- package/dist/toast.d.mts.map +1 -0
- package/dist/toast.mjs +16 -0
- package/dist/toast.mjs.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/ui-CIacC6Mv.mjs +318 -0
- package/dist/ui-CIacC6Mv.mjs.map +1 -0
- package/dist/ui-config.d.ts +70 -0
- package/dist/ui-config.d.ts.map +1 -0
- package/dist/ui-config.js +44 -0
- package/dist/ui.d.mts +290 -0
- package/dist/ui.d.mts.map +1 -0
- package/dist/ui.mjs +2 -0
- package/dist/utils/asset-url.d.ts +3 -0
- package/dist/utils/asset-url.d.ts.map +1 -0
- package/dist/utils/asset-url.js +7 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +5 -0
- package/dist/utils/format-date.d.ts +15 -0
- package/dist/utils/format-date.d.ts.map +1 -0
- package/dist/utils/format-date.js +37 -0
- package/dist/utils/mdast-to-html.d.ts +55 -0
- package/dist/utils/mdast-to-html.d.ts.map +1 -0
- package/dist/utils/mdast-to-html.js +206 -0
- package/dist/utils/mdast-tree.d.ts +104 -0
- package/dist/utils/mdast-tree.d.ts.map +1 -0
- package/dist/utils/mdast-tree.js +285 -0
- package/dist/utils/pageMetadata.d.ts +67 -0
- package/dist/utils/pageMetadata.d.ts.map +1 -0
- package/dist/utils/pageMetadata.js +161 -0
- package/dist/utils/slugify.d.ts +12 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/dist/utils/slugify.js +17 -0
- package/dist/utils/zodIntrospect.d.ts +24 -0
- package/dist/utils/zodIntrospect.d.ts.map +1 -0
- package/dist/utils/zodIntrospect.js +88 -0
- package/package.json +148 -35
- package/styles/styles.css.d.ts +2 -0
- package/styles/tailwind-theme.css +126 -0
- package/styles/tailwind-theme.css.d.ts +2 -0
- package/dist/puck-C9_F3_cJ.mjs +0 -1589
- package/dist/puck-C9_F3_cJ.mjs.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
2
|
+
/**
|
|
3
|
+
* Pure mdast-walking helpers used by `GenericBlock` to read and rewrite
|
|
4
|
+
* the JSX subtree it owns.
|
|
5
|
+
*
|
|
6
|
+
* Lives outside the component file because none of these touch React,
|
|
7
|
+
* the DOM, or editor state — they're plain tree operations on the
|
|
8
|
+
* mdast shape produced by `mdast-util-mdx-jsx`. Same input, same
|
|
9
|
+
* output, every time.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Strip the `body` (escaped-text fallback) field from every node in the
|
|
13
|
+
* render tree before hashing for the SSR cache key. Cache keys should
|
|
14
|
+
* hash structural shape — NOT prose body text from the portaled
|
|
15
|
+
* `<NestedLexicalEditor>`s. Without this, every keystroke inside a
|
|
16
|
+
* leaf body would mint a different cache key and force a server
|
|
17
|
+
* roundtrip even though the SSR HTML itself doesn't change (the body
|
|
18
|
+
* lives in the portaled slot, not in the SSR markup).
|
|
19
|
+
*
|
|
20
|
+
* `bodyHtml` is NOT stripped — unlike `body` (a static text fallback
|
|
21
|
+
* the editor portal hides), `bodyHtml` IS the actual rendered slot
|
|
22
|
+
* content for strict-slot components (Steps, FileTree) where the
|
|
23
|
+
* editor doesn't portal an inline editor. Its value must participate
|
|
24
|
+
* in the cache key, otherwise changes to the list structure won't
|
|
25
|
+
* bust the stale cached HTML and the SSR returns out-of-date markup.
|
|
26
|
+
*/
|
|
27
|
+
export declare function stripBodyFields(node: unknown): unknown;
|
|
28
|
+
/**
|
|
29
|
+
* Read mdast JSX attributes as a plain props object. Three attribute
|
|
30
|
+
* shapes from mdast-util-mdx-jsx:
|
|
31
|
+
* - `prop="value"` → `value: string`
|
|
32
|
+
* - `prop={expression}` → object `{ type: 'mdxJsxAttributeValueExpression', value: '<src>' }`
|
|
33
|
+
* - `prop` → `value: null` (shorthand boolean true)
|
|
34
|
+
*
|
|
35
|
+
* Expression values are parsed as JSON so numeric / boolean / array /
|
|
36
|
+
* object literals (`<Box columns={3}>`, `<Card featured={true}>`,
|
|
37
|
+
* `<Grid sizes={[1,2,3]}>`) reach the Astro component as real values
|
|
38
|
+
* instead of being dropped. Non-JSON expressions (variable refs,
|
|
39
|
+
* function calls) fall through as their literal source string — not
|
|
40
|
+
* ideal but no worse than the previous "drop entirely" behavior, and
|
|
41
|
+
* supporting JS evaluation properly needs a real parser.
|
|
42
|
+
*/
|
|
43
|
+
export declare function readAttrs(node: MdxJsxFlowElement): Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* Many MDX parsers wrap inline JSX (Cards inside CardGrid written on
|
|
46
|
+
* adjacent lines without blank-line separators) in a single
|
|
47
|
+
* `paragraph` node. Authors don't think about that — they just write
|
|
48
|
+
* `<CardGrid><Card/><Card/></CardGrid>`. Unwrap one level of paragraph
|
|
49
|
+
* so the effective children we consider are the JSX nodes themselves.
|
|
50
|
+
*/
|
|
51
|
+
export declare function effectiveChildren(node: {
|
|
52
|
+
children?: unknown[];
|
|
53
|
+
}): unknown[];
|
|
54
|
+
/** Read the `slot` attribute off a `<Fragment slot="...">` mdast
|
|
55
|
+
* node. Returns null when the node isn't a Fragment, isn't named, or
|
|
56
|
+
* the slot attribute isn't a plain string. */
|
|
57
|
+
export declare function getNamedSlotName(child: unknown): string | null;
|
|
58
|
+
/**
|
|
59
|
+
* Parse a slot id like `"root.0.1"` into a numeric path `[0, 1]`. The
|
|
60
|
+
* leading `"root"` is the buildRenderTree prefix and isn't a real
|
|
61
|
+
* step; an empty path (`"root"` alone) means the top-level node
|
|
62
|
+
* itself, which is never an inline-editable slot (it's the parent we
|
|
63
|
+
* SSR'd) — included only for completeness.
|
|
64
|
+
*/
|
|
65
|
+
export declare function slotIdToPath(slotId: string): number[];
|
|
66
|
+
/**
|
|
67
|
+
* Walk the mdast tree following the same logic `buildRenderTree` uses
|
|
68
|
+
* (effectiveChildren unwrap → named-slot filter → kid at index) and
|
|
69
|
+
* return the subtree at `path`. Returns `null` when the path doesn't
|
|
70
|
+
* resolve (eg the structure changed between SSR and this walk).
|
|
71
|
+
*/
|
|
72
|
+
export declare function getMdastAtPath(root: unknown, path: number[]): MdxJsxFlowElement | null;
|
|
73
|
+
/**
|
|
74
|
+
* Return a NEW root with the subtree at `path` having its `children`
|
|
75
|
+
* replaced by `newChildren`. The walk mirrors `getMdastAtPath` —
|
|
76
|
+
* effectiveChildren unwrap + named-slot filter — and the write
|
|
77
|
+
* reverses the unwrap when it happened, so the original mdast shape
|
|
78
|
+
* (paragraph wrapper or not) round-trips on save.
|
|
79
|
+
*
|
|
80
|
+
* Empty `path` means "replace the root's children" — the only caller
|
|
81
|
+
* for that case would be the top-level editor, which doesn't go
|
|
82
|
+
* through this path.
|
|
83
|
+
*/
|
|
84
|
+
export declare function replaceMdastAtPath(root: MdxJsxFlowElement, path: number[], newChildren: MdxJsxFlowElement['children']): MdxJsxFlowElement;
|
|
85
|
+
/**
|
|
86
|
+
* Like `replaceMdastAtPath` but swaps the WHOLE node at `path`, not
|
|
87
|
+
* just its children. Used when the side panel edits a CHILD
|
|
88
|
+
* component's attributes (eg a Card inside a CardGrid): we replace
|
|
89
|
+
* the child JSX node with a new one carrying updated attributes.
|
|
90
|
+
*
|
|
91
|
+
* `replaceMdastAtPath` only rewrites `children` because that's all
|
|
92
|
+
* the inline body editors ever change. For attribute edits the whole
|
|
93
|
+
* node needs replacement, hence this twin.
|
|
94
|
+
*/
|
|
95
|
+
export declare function replaceMdastNodeAtPath(root: MdxJsxFlowElement, path: number[], newNode: MdxJsxFlowElement): MdxJsxFlowElement;
|
|
96
|
+
/**
|
|
97
|
+
* Drop the JSX node at `path` from its parent's children. Same walk
|
|
98
|
+
* as `replaceMdastNodeAtPath` — at the leaf we splice instead of
|
|
99
|
+
* replace. Used when the side panel's Remove button fires on a
|
|
100
|
+
* selected CHILD inside a container (eg removing one Card from a
|
|
101
|
+
* CardGrid without touching the grid itself).
|
|
102
|
+
*/
|
|
103
|
+
export declare function removeMdastNodeAtPath(root: MdxJsxFlowElement, path: number[]): MdxJsxFlowElement;
|
|
104
|
+
//# sourceMappingURL=mdast-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdast-tree.d.ts","sourceRoot":"","sources":["../../src/utils/mdast-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAWtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB1E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,OAAO,EAAE,CAO3E;AAED;;8CAE8C;AAC9C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAKrD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,GAAG,IAAI,CAUtF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,EAAE,iBAAiB,CAAC,UAAU,CAAC,GACzC,iBAAiB,CA2CnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,iBAAiB,GACzB,iBAAiB,CA8BnB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAoChG"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure mdast-walking helpers used by `GenericBlock` to read and rewrite
|
|
3
|
+
* the JSX subtree it owns.
|
|
4
|
+
*
|
|
5
|
+
* Lives outside the component file because none of these touch React,
|
|
6
|
+
* the DOM, or editor state — they're plain tree operations on the
|
|
7
|
+
* mdast shape produced by `mdast-util-mdx-jsx`. Same input, same
|
|
8
|
+
* output, every time.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Strip the `body` (escaped-text fallback) field from every node in the
|
|
12
|
+
* render tree before hashing for the SSR cache key. Cache keys should
|
|
13
|
+
* hash structural shape — NOT prose body text from the portaled
|
|
14
|
+
* `<NestedLexicalEditor>`s. Without this, every keystroke inside a
|
|
15
|
+
* leaf body would mint a different cache key and force a server
|
|
16
|
+
* roundtrip even though the SSR HTML itself doesn't change (the body
|
|
17
|
+
* lives in the portaled slot, not in the SSR markup).
|
|
18
|
+
*
|
|
19
|
+
* `bodyHtml` is NOT stripped — unlike `body` (a static text fallback
|
|
20
|
+
* the editor portal hides), `bodyHtml` IS the actual rendered slot
|
|
21
|
+
* content for strict-slot components (Steps, FileTree) where the
|
|
22
|
+
* editor doesn't portal an inline editor. Its value must participate
|
|
23
|
+
* in the cache key, otherwise changes to the list structure won't
|
|
24
|
+
* bust the stale cached HTML and the SSR returns out-of-date markup.
|
|
25
|
+
*/
|
|
26
|
+
export function stripBodyFields(node) {
|
|
27
|
+
if (Array.isArray(node))
|
|
28
|
+
return node.map(stripBodyFields);
|
|
29
|
+
if (node && typeof node === 'object') {
|
|
30
|
+
const out = {};
|
|
31
|
+
for (const [k, v] of Object.entries(node)) {
|
|
32
|
+
if (k === 'body')
|
|
33
|
+
continue;
|
|
34
|
+
out[k] = stripBodyFields(v);
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
return node;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Read mdast JSX attributes as a plain props object. Three attribute
|
|
42
|
+
* shapes from mdast-util-mdx-jsx:
|
|
43
|
+
* - `prop="value"` → `value: string`
|
|
44
|
+
* - `prop={expression}` → object `{ type: 'mdxJsxAttributeValueExpression', value: '<src>' }`
|
|
45
|
+
* - `prop` → `value: null` (shorthand boolean true)
|
|
46
|
+
*
|
|
47
|
+
* Expression values are parsed as JSON so numeric / boolean / array /
|
|
48
|
+
* object literals (`<Box columns={3}>`, `<Card featured={true}>`,
|
|
49
|
+
* `<Grid sizes={[1,2,3]}>`) reach the Astro component as real values
|
|
50
|
+
* instead of being dropped. Non-JSON expressions (variable refs,
|
|
51
|
+
* function calls) fall through as their literal source string — not
|
|
52
|
+
* ideal but no worse than the previous "drop entirely" behavior, and
|
|
53
|
+
* supporting JS evaluation properly needs a real parser.
|
|
54
|
+
*/
|
|
55
|
+
export function readAttrs(node) {
|
|
56
|
+
const out = {};
|
|
57
|
+
for (const a of node.attributes) {
|
|
58
|
+
if (a.type !== 'mdxJsxAttribute')
|
|
59
|
+
continue;
|
|
60
|
+
const v = a.value;
|
|
61
|
+
if (typeof v === 'string') {
|
|
62
|
+
out[a.name] = v;
|
|
63
|
+
}
|
|
64
|
+
else if (v == null) {
|
|
65
|
+
// `<Card featured />` — shorthand boolean true.
|
|
66
|
+
out[a.name] = true;
|
|
67
|
+
}
|
|
68
|
+
else if (typeof v === 'object' && 'value' in v && typeof v.value === 'string') {
|
|
69
|
+
const src = v.value.trim();
|
|
70
|
+
try {
|
|
71
|
+
out[a.name] = JSON.parse(src);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
out[a.name] = src;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Many MDX parsers wrap inline JSX (Cards inside CardGrid written on
|
|
82
|
+
* adjacent lines without blank-line separators) in a single
|
|
83
|
+
* `paragraph` node. Authors don't think about that — they just write
|
|
84
|
+
* `<CardGrid><Card/><Card/></CardGrid>`. Unwrap one level of paragraph
|
|
85
|
+
* so the effective children we consider are the JSX nodes themselves.
|
|
86
|
+
*/
|
|
87
|
+
export function effectiveChildren(node) {
|
|
88
|
+
const kids = node.children ?? [];
|
|
89
|
+
if (kids.length === 1) {
|
|
90
|
+
const only = kids[0];
|
|
91
|
+
if (only?.type === 'paragraph')
|
|
92
|
+
return only.children ?? [];
|
|
93
|
+
}
|
|
94
|
+
return kids;
|
|
95
|
+
}
|
|
96
|
+
/** Read the `slot` attribute off a `<Fragment slot="...">` mdast
|
|
97
|
+
* node. Returns null when the node isn't a Fragment, isn't named, or
|
|
98
|
+
* the slot attribute isn't a plain string. */
|
|
99
|
+
export function getNamedSlotName(child) {
|
|
100
|
+
const c = child;
|
|
101
|
+
if (!c || (c.type !== 'mdxJsxFlowElement' && c.type !== 'mdxJsxTextElement'))
|
|
102
|
+
return null;
|
|
103
|
+
if (c.name !== 'Fragment')
|
|
104
|
+
return null;
|
|
105
|
+
if (!Array.isArray(c.attributes))
|
|
106
|
+
return null;
|
|
107
|
+
for (const a of c.attributes) {
|
|
108
|
+
if (a?.type === 'mdxJsxAttribute' && a.name === 'slot' && typeof a.value === 'string') {
|
|
109
|
+
return a.value;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Parse a slot id like `"root.0.1"` into a numeric path `[0, 1]`. The
|
|
116
|
+
* leading `"root"` is the buildRenderTree prefix and isn't a real
|
|
117
|
+
* step; an empty path (`"root"` alone) means the top-level node
|
|
118
|
+
* itself, which is never an inline-editable slot (it's the parent we
|
|
119
|
+
* SSR'd) — included only for completeness.
|
|
120
|
+
*/
|
|
121
|
+
export function slotIdToPath(slotId) {
|
|
122
|
+
return slotId
|
|
123
|
+
.split('.')
|
|
124
|
+
.slice(1)
|
|
125
|
+
.map((s) => Number.parseInt(s, 10));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Walk the mdast tree following the same logic `buildRenderTree` uses
|
|
129
|
+
* (effectiveChildren unwrap → named-slot filter → kid at index) and
|
|
130
|
+
* return the subtree at `path`. Returns `null` when the path doesn't
|
|
131
|
+
* resolve (eg the structure changed between SSR and this walk).
|
|
132
|
+
*/
|
|
133
|
+
export function getMdastAtPath(root, path) {
|
|
134
|
+
let node = root;
|
|
135
|
+
for (const step of path) {
|
|
136
|
+
if (!node || typeof node !== 'object')
|
|
137
|
+
return null;
|
|
138
|
+
const allKids = effectiveChildren(node);
|
|
139
|
+
const kids = allKids.filter((k) => getNamedSlotName(k) == null);
|
|
140
|
+
node = kids[step];
|
|
141
|
+
if (!node)
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return node ?? null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Return a NEW root with the subtree at `path` having its `children`
|
|
148
|
+
* replaced by `newChildren`. The walk mirrors `getMdastAtPath` —
|
|
149
|
+
* effectiveChildren unwrap + named-slot filter — and the write
|
|
150
|
+
* reverses the unwrap when it happened, so the original mdast shape
|
|
151
|
+
* (paragraph wrapper or not) round-trips on save.
|
|
152
|
+
*
|
|
153
|
+
* Empty `path` means "replace the root's children" — the only caller
|
|
154
|
+
* for that case would be the top-level editor, which doesn't go
|
|
155
|
+
* through this path.
|
|
156
|
+
*/
|
|
157
|
+
export function replaceMdastAtPath(root, path, newChildren) {
|
|
158
|
+
if (path.length === 0) {
|
|
159
|
+
return { ...root, children: newChildren };
|
|
160
|
+
}
|
|
161
|
+
const [head, ...rest] = path;
|
|
162
|
+
const originalKids = (root.children ?? []);
|
|
163
|
+
// Detect the same paragraph-unwrap effectiveChildren did on read.
|
|
164
|
+
const isUnwrapped = originalKids.length === 1 && originalKids[0]?.type === 'paragraph';
|
|
165
|
+
const workingKids = isUnwrapped ? (originalKids[0].children ?? []) : originalKids;
|
|
166
|
+
// Walk `workingKids` skipping named-slot children, find the original
|
|
167
|
+
// index in `workingKids` that corresponds to filtered-index `head`.
|
|
168
|
+
let filteredIdx = 0;
|
|
169
|
+
let originalIdx = -1;
|
|
170
|
+
for (let i = 0; i < workingKids.length; i++) {
|
|
171
|
+
if (getNamedSlotName(workingKids[i]) != null)
|
|
172
|
+
continue;
|
|
173
|
+
if (filteredIdx === head) {
|
|
174
|
+
originalIdx = i;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
filteredIdx++;
|
|
178
|
+
}
|
|
179
|
+
if (originalIdx === -1)
|
|
180
|
+
return root;
|
|
181
|
+
const targetKid = workingKids[originalIdx];
|
|
182
|
+
const updatedKid = rest.length === 0
|
|
183
|
+
? { ...targetKid, children: newChildren }
|
|
184
|
+
: replaceMdastAtPath(targetKid, rest, newChildren);
|
|
185
|
+
const newWorkingKids = [...workingKids];
|
|
186
|
+
newWorkingKids[originalIdx] = updatedKid;
|
|
187
|
+
if (isUnwrapped) {
|
|
188
|
+
const paragraphWrap = originalKids[0];
|
|
189
|
+
return {
|
|
190
|
+
...root,
|
|
191
|
+
children: [{ ...paragraphWrap, children: newWorkingKids }],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return { ...root, children: newWorkingKids };
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Like `replaceMdastAtPath` but swaps the WHOLE node at `path`, not
|
|
198
|
+
* just its children. Used when the side panel edits a CHILD
|
|
199
|
+
* component's attributes (eg a Card inside a CardGrid): we replace
|
|
200
|
+
* the child JSX node with a new one carrying updated attributes.
|
|
201
|
+
*
|
|
202
|
+
* `replaceMdastAtPath` only rewrites `children` because that's all
|
|
203
|
+
* the inline body editors ever change. For attribute edits the whole
|
|
204
|
+
* node needs replacement, hence this twin.
|
|
205
|
+
*/
|
|
206
|
+
export function replaceMdastNodeAtPath(root, path, newNode) {
|
|
207
|
+
if (path.length === 0)
|
|
208
|
+
return newNode;
|
|
209
|
+
const [head, ...rest] = path;
|
|
210
|
+
const originalKids = (root.children ?? []);
|
|
211
|
+
const isUnwrapped = originalKids.length === 1 && originalKids[0]?.type === 'paragraph';
|
|
212
|
+
const workingKids = isUnwrapped ? (originalKids[0].children ?? []) : originalKids;
|
|
213
|
+
let filteredIdx = 0;
|
|
214
|
+
let originalIdx = -1;
|
|
215
|
+
for (let i = 0; i < workingKids.length; i++) {
|
|
216
|
+
if (getNamedSlotName(workingKids[i]) != null)
|
|
217
|
+
continue;
|
|
218
|
+
if (filteredIdx === head) {
|
|
219
|
+
originalIdx = i;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
filteredIdx++;
|
|
223
|
+
}
|
|
224
|
+
if (originalIdx === -1)
|
|
225
|
+
return root;
|
|
226
|
+
const targetKid = workingKids[originalIdx];
|
|
227
|
+
const updatedKid = rest.length === 0 ? newNode : replaceMdastNodeAtPath(targetKid, rest, newNode);
|
|
228
|
+
const newWorkingKids = [...workingKids];
|
|
229
|
+
newWorkingKids[originalIdx] = updatedKid;
|
|
230
|
+
if (isUnwrapped) {
|
|
231
|
+
const paragraphWrap = originalKids[0];
|
|
232
|
+
return {
|
|
233
|
+
...root,
|
|
234
|
+
children: [{ ...paragraphWrap, children: newWorkingKids }],
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return { ...root, children: newWorkingKids };
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Drop the JSX node at `path` from its parent's children. Same walk
|
|
241
|
+
* as `replaceMdastNodeAtPath` — at the leaf we splice instead of
|
|
242
|
+
* replace. Used when the side panel's Remove button fires on a
|
|
243
|
+
* selected CHILD inside a container (eg removing one Card from a
|
|
244
|
+
* CardGrid without touching the grid itself).
|
|
245
|
+
*/
|
|
246
|
+
export function removeMdastNodeAtPath(root, path) {
|
|
247
|
+
if (path.length === 0)
|
|
248
|
+
return root;
|
|
249
|
+
const [head, ...rest] = path;
|
|
250
|
+
const originalKids = (root.children ?? []);
|
|
251
|
+
const isUnwrapped = originalKids.length === 1 && originalKids[0]?.type === 'paragraph';
|
|
252
|
+
const workingKids = isUnwrapped ? (originalKids[0].children ?? []) : originalKids;
|
|
253
|
+
let filteredIdx = 0;
|
|
254
|
+
let originalIdx = -1;
|
|
255
|
+
for (let i = 0; i < workingKids.length; i++) {
|
|
256
|
+
if (getNamedSlotName(workingKids[i]) != null)
|
|
257
|
+
continue;
|
|
258
|
+
if (filteredIdx === head) {
|
|
259
|
+
originalIdx = i;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
filteredIdx++;
|
|
263
|
+
}
|
|
264
|
+
if (originalIdx === -1)
|
|
265
|
+
return root;
|
|
266
|
+
let newWorkingKids;
|
|
267
|
+
if (rest.length === 0) {
|
|
268
|
+
// Leaf — splice the child out.
|
|
269
|
+
newWorkingKids = workingKids.filter((_, i) => i !== originalIdx);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
const targetKid = workingKids[originalIdx];
|
|
273
|
+
const updatedKid = removeMdastNodeAtPath(targetKid, rest);
|
|
274
|
+
newWorkingKids = [...workingKids];
|
|
275
|
+
newWorkingKids[originalIdx] = updatedKid;
|
|
276
|
+
}
|
|
277
|
+
if (isUnwrapped) {
|
|
278
|
+
const paragraphWrap = originalKids[0];
|
|
279
|
+
return {
|
|
280
|
+
...root,
|
|
281
|
+
children: [{ ...paragraphWrap, children: newWorkingKids }],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
return { ...root, children: newWorkingKids };
|
|
285
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type PageSchemaDescriptor } from '../page-schemas';
|
|
2
|
+
import type { PageMetadata } from '../types';
|
|
3
|
+
interface LocaleVersionMetaSource {
|
|
4
|
+
meta: Record<string, unknown> & {
|
|
5
|
+
title?: string;
|
|
6
|
+
};
|
|
7
|
+
pathname?: string;
|
|
8
|
+
publishAt?: string;
|
|
9
|
+
unpublishAt?: string;
|
|
10
|
+
}
|
|
11
|
+
interface LocalizedEntryMetaSource {
|
|
12
|
+
collection?: string;
|
|
13
|
+
type?: 'puck' | 'mdx' | 'json';
|
|
14
|
+
localized: LocaleVersionMetaSource;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Extract metadata from a localized content entry into the shape the
|
|
18
|
+
* page-settings dialog renders.
|
|
19
|
+
*
|
|
20
|
+
* Accepts either:
|
|
21
|
+
* - the full `LocalizedEntry` (preferred — `collection`/`type` flow through
|
|
22
|
+
* so the dialog can resolve the right descriptor); or
|
|
23
|
+
* - a bare `LocaleVersion` (legacy — `collection`/`type` are undefined and
|
|
24
|
+
* schema resolution falls back to pathname-prefix matching).
|
|
25
|
+
*
|
|
26
|
+
* The active descriptor's `coreFields.mode` decides which keys are claimed
|
|
27
|
+
* by the conloca sections vs. handed off to the host schema as `customMeta`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractPageMetadata(source: LocalizedEntryMetaSource | LocaleVersionMetaSource, descriptor?: PageSchemaDescriptor | null): PageMetadata;
|
|
30
|
+
export interface MetadataUpdatePayload {
|
|
31
|
+
meta: Record<string, unknown>;
|
|
32
|
+
pathname: string;
|
|
33
|
+
publishAt: string | null;
|
|
34
|
+
unpublishAt: string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the update payload sent to `updateLocalized`.
|
|
38
|
+
*
|
|
39
|
+
* `customMeta` is spread directly into `meta` so nested host fields
|
|
40
|
+
* (e.g. `sidebar: { label, order }`) round-trip into YAML frontmatter
|
|
41
|
+
* untouched. Empty strings are dropped at the VxJSON serialization
|
|
42
|
+
* boundary (commit b640406).
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildMetadataUpdate(metadata: PageMetadata): MetadataUpdatePayload;
|
|
45
|
+
/**
|
|
46
|
+
* Flatten a nested value tree to dotted keys, only following paths the
|
|
47
|
+
* provided hint map declares.
|
|
48
|
+
*
|
|
49
|
+
* E.g. given `{ sidebar: { label: 'Intro', order: 1 } }` and hints
|
|
50
|
+
* `{ 'sidebar.label': ..., 'sidebar.order': ... }`, returns
|
|
51
|
+
* `{ 'sidebar.label': 'Intro', 'sidebar.order': 1 }`.
|
|
52
|
+
*
|
|
53
|
+
* Keys not mentioned in `hints` are preserved as-is at their original
|
|
54
|
+
* (possibly nested) path so the form's "raw passthrough" branch can
|
|
55
|
+
* still render them.
|
|
56
|
+
*/
|
|
57
|
+
export declare function flattenForHints(value: Record<string, unknown>, hintKeys: ReadonlySet<string>): Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Inverse of `flattenForHints` — materialize dotted keys back into nested
|
|
60
|
+
* objects so YAML frontmatter renders as `sidebar: { label, order }`
|
|
61
|
+
* instead of `'sidebar.label': ..., 'sidebar.order': ...`.
|
|
62
|
+
*
|
|
63
|
+
* Non-dotted keys pass through unchanged.
|
|
64
|
+
*/
|
|
65
|
+
export declare function unflattenFromHints(value: Record<string, unknown>): Record<string, unknown>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=pageMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageMetadata.d.ts","sourceRoot":"","sources":["../../src/utils/pageMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,oBAAoB,EAA0B,MAAM,iBAAiB,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,wBAAwB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/B,SAAS,EAAE,uBAAuB,CAAC;CACpC;AA4BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,wBAAwB,GAAG,uBAAuB,EAC1D,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI,GACvC,YAAY,CAsCd;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,qBAAqB,CAajF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB1F"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { getPageSchemas, resolvePageSchemaEntry } from '../page-schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Fields the dialog's conloca-managed sections own when `coreFields.mode`
|
|
4
|
+
* is `'full'` (the legacy default). Kept here so `extractPageMetadata` and
|
|
5
|
+
* `buildMetadataUpdate` agree on what's "core" vs. "custom" without the
|
|
6
|
+
* dialog passing the descriptor through both directions.
|
|
7
|
+
*/
|
|
8
|
+
const FULL_MODE_CORE_KEYS = new Set([
|
|
9
|
+
'title',
|
|
10
|
+
'description',
|
|
11
|
+
'robots',
|
|
12
|
+
'canonical',
|
|
13
|
+
'keywords',
|
|
14
|
+
'ogTitle',
|
|
15
|
+
'ogDescription',
|
|
16
|
+
'ogImage',
|
|
17
|
+
]);
|
|
18
|
+
function coreKeysFor(descriptor) {
|
|
19
|
+
const mode = descriptor?.coreFields?.mode ?? 'full';
|
|
20
|
+
// In 'minimal' and 'none' the host schema owns every meta key — nothing
|
|
21
|
+
// is reserved for conloca's hardcoded sections, so customMeta receives
|
|
22
|
+
// the whole `meta` object and the host renders title/description/etc.
|
|
23
|
+
if (mode === 'minimal' || mode === 'none')
|
|
24
|
+
return new Set();
|
|
25
|
+
return FULL_MODE_CORE_KEYS;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Extract metadata from a localized content entry into the shape the
|
|
29
|
+
* page-settings dialog renders.
|
|
30
|
+
*
|
|
31
|
+
* Accepts either:
|
|
32
|
+
* - the full `LocalizedEntry` (preferred — `collection`/`type` flow through
|
|
33
|
+
* so the dialog can resolve the right descriptor); or
|
|
34
|
+
* - a bare `LocaleVersion` (legacy — `collection`/`type` are undefined and
|
|
35
|
+
* schema resolution falls back to pathname-prefix matching).
|
|
36
|
+
*
|
|
37
|
+
* The active descriptor's `coreFields.mode` decides which keys are claimed
|
|
38
|
+
* by the conloca sections vs. handed off to the host schema as `customMeta`.
|
|
39
|
+
*/
|
|
40
|
+
export function extractPageMetadata(source, descriptor) {
|
|
41
|
+
const localized = 'localized' in source ? source.localized : source;
|
|
42
|
+
const collection = 'localized' in source ? source.collection : undefined;
|
|
43
|
+
const rawType = 'localized' in source ? source.type : undefined;
|
|
44
|
+
const type = rawType === 'puck' || rawType === 'mdx' ? rawType : undefined;
|
|
45
|
+
// If the caller didn't pre-resolve a descriptor, look it up against the
|
|
46
|
+
// live registry using whatever identity info we have. Legacy callers
|
|
47
|
+
// (LocaleVersion-only) get pathname-prefix matching just like before.
|
|
48
|
+
const effectiveDescriptor = descriptor === undefined
|
|
49
|
+
? (resolvePageSchemaEntry(getPageSchemas(), {
|
|
50
|
+
pathname: localized.pathname ?? '/',
|
|
51
|
+
collection,
|
|
52
|
+
type,
|
|
53
|
+
})?.descriptor ?? null)
|
|
54
|
+
: descriptor;
|
|
55
|
+
const coreKeys = coreKeysFor(effectiveDescriptor);
|
|
56
|
+
const customMeta = {};
|
|
57
|
+
for (const [key, value] of Object.entries(localized.meta)) {
|
|
58
|
+
if (!coreKeys.has(key)) {
|
|
59
|
+
customMeta[key] = value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
title: localized.meta.title || '',
|
|
64
|
+
description: localized.meta.description || '',
|
|
65
|
+
pathname: localized.pathname || '/',
|
|
66
|
+
publishDate: localized.publishAt ? new Date(localized.publishAt) : null,
|
|
67
|
+
unpublishDate: localized.unpublishAt ? new Date(localized.unpublishAt) : null,
|
|
68
|
+
robots: localized.meta.robots,
|
|
69
|
+
canonical: localized.meta.canonical,
|
|
70
|
+
customMeta,
|
|
71
|
+
collection,
|
|
72
|
+
type,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build the update payload sent to `updateLocalized`.
|
|
77
|
+
*
|
|
78
|
+
* `customMeta` is spread directly into `meta` so nested host fields
|
|
79
|
+
* (e.g. `sidebar: { label, order }`) round-trip into YAML frontmatter
|
|
80
|
+
* untouched. Empty strings are dropped at the VxJSON serialization
|
|
81
|
+
* boundary (commit b640406).
|
|
82
|
+
*/
|
|
83
|
+
export function buildMetadataUpdate(metadata) {
|
|
84
|
+
return {
|
|
85
|
+
meta: {
|
|
86
|
+
title: metadata.title,
|
|
87
|
+
description: metadata.description,
|
|
88
|
+
robots: metadata.robots,
|
|
89
|
+
canonical: metadata.canonical,
|
|
90
|
+
...(metadata.customMeta || {}),
|
|
91
|
+
},
|
|
92
|
+
pathname: metadata.pathname,
|
|
93
|
+
publishAt: metadata.publishDate?.toISOString() || null,
|
|
94
|
+
unpublishAt: metadata.unpublishDate?.toISOString() || null,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Flatten a nested value tree to dotted keys, only following paths the
|
|
99
|
+
* provided hint map declares.
|
|
100
|
+
*
|
|
101
|
+
* E.g. given `{ sidebar: { label: 'Intro', order: 1 } }` and hints
|
|
102
|
+
* `{ 'sidebar.label': ..., 'sidebar.order': ... }`, returns
|
|
103
|
+
* `{ 'sidebar.label': 'Intro', 'sidebar.order': 1 }`.
|
|
104
|
+
*
|
|
105
|
+
* Keys not mentioned in `hints` are preserved as-is at their original
|
|
106
|
+
* (possibly nested) path so the form's "raw passthrough" branch can
|
|
107
|
+
* still render them.
|
|
108
|
+
*/
|
|
109
|
+
export function flattenForHints(value, hintKeys) {
|
|
110
|
+
const out = { ...value };
|
|
111
|
+
for (const dotted of hintKeys) {
|
|
112
|
+
if (!dotted.includes('.'))
|
|
113
|
+
continue;
|
|
114
|
+
const segments = dotted.split('.');
|
|
115
|
+
let cursor = value;
|
|
116
|
+
for (const seg of segments) {
|
|
117
|
+
if (cursor && typeof cursor === 'object' && seg in cursor) {
|
|
118
|
+
cursor = cursor[seg];
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
cursor = undefined;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (cursor !== undefined) {
|
|
126
|
+
out[dotted] = cursor;
|
|
127
|
+
// Trim the top-level branch the dotted key descended into — the
|
|
128
|
+
// flattened entry is now the source of truth for the form.
|
|
129
|
+
delete out[segments[0]];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Inverse of `flattenForHints` — materialize dotted keys back into nested
|
|
136
|
+
* objects so YAML frontmatter renders as `sidebar: { label, order }`
|
|
137
|
+
* instead of `'sidebar.label': ..., 'sidebar.order': ...`.
|
|
138
|
+
*
|
|
139
|
+
* Non-dotted keys pass through unchanged.
|
|
140
|
+
*/
|
|
141
|
+
export function unflattenFromHints(value) {
|
|
142
|
+
const out = {};
|
|
143
|
+
for (const [key, val] of Object.entries(value)) {
|
|
144
|
+
if (!key.includes('.')) {
|
|
145
|
+
out[key] = val;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const segments = key.split('.');
|
|
149
|
+
let cursor = out;
|
|
150
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
151
|
+
const seg = segments[i];
|
|
152
|
+
const existing = cursor[seg];
|
|
153
|
+
if (!existing || typeof existing !== 'object') {
|
|
154
|
+
cursor[seg] = {};
|
|
155
|
+
}
|
|
156
|
+
cursor = cursor[seg];
|
|
157
|
+
}
|
|
158
|
+
cursor[segments[segments.length - 1]] = val;
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert text to a URL/filename-safe slug.
|
|
3
|
+
* - Converts to lowercase
|
|
4
|
+
* - Replaces spaces and special chars with hyphens
|
|
5
|
+
* - Removes consecutive hyphens
|
|
6
|
+
* - Trims hyphens from start/end
|
|
7
|
+
*
|
|
8
|
+
* @example slugify("My Block Name!") // "my-block-name"
|
|
9
|
+
* @example slugify(" Hello World ") // "hello-world"
|
|
10
|
+
*/
|
|
11
|
+
export declare function slugify(text: string): string;
|
|
12
|
+
//# sourceMappingURL=slugify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../src/utils/slugify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert text to a URL/filename-safe slug.
|
|
3
|
+
* - Converts to lowercase
|
|
4
|
+
* - Replaces spaces and special chars with hyphens
|
|
5
|
+
* - Removes consecutive hyphens
|
|
6
|
+
* - Trims hyphens from start/end
|
|
7
|
+
*
|
|
8
|
+
* @example slugify("My Block Name!") // "my-block-name"
|
|
9
|
+
* @example slugify(" Hello World ") // "hello-world"
|
|
10
|
+
*/
|
|
11
|
+
export function slugify(text) {
|
|
12
|
+
return text
|
|
13
|
+
.toLowerCase()
|
|
14
|
+
.trim()
|
|
15
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
16
|
+
.replace(/^-|-$/g, '');
|
|
17
|
+
}
|