@drawnagency/primitives 0.1.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 +28 -0
- package/dist/auth/cookies.d.ts +8 -0
- package/dist/auth/cookies.d.ts.map +1 -0
- package/dist/auth/cookies.js +44 -0
- package/dist/auth/errors.d.ts +8 -0
- package/dist/auth/errors.d.ts.map +1 -0
- package/dist/auth/errors.js +10 -0
- package/dist/auth/index.d.ts +5 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/security.d.ts +13 -0
- package/dist/auth/security.d.ts.map +1 -0
- package/dist/auth/security.js +48 -0
- package/dist/auth/types.d.ts +64 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +1 -0
- package/dist/components/brandguide/ColorSwatchSettings.d.ts +8 -0
- package/dist/components/brandguide/ColorSwatchSettings.d.ts.map +1 -0
- package/dist/components/brandguide/ColorSwatchSettings.js +10 -0
- package/dist/components/brandguide/Colors.d.ts +15 -0
- package/dist/components/brandguide/Colors.d.ts.map +1 -0
- package/dist/components/brandguide/Colors.js +79 -0
- package/dist/components/brandguide/DoDontList.d.ts +16 -0
- package/dist/components/brandguide/DoDontList.d.ts.map +1 -0
- package/dist/components/brandguide/DoDontList.js +22 -0
- package/dist/components/brandguide/DoDontMediaGrid.d.ts +16 -0
- package/dist/components/brandguide/DoDontMediaGrid.d.ts.map +1 -0
- package/dist/components/brandguide/DoDontMediaGrid.js +5 -0
- package/dist/components/editor/AudiencePicker.d.ts +9 -0
- package/dist/components/editor/AudiencePicker.d.ts.map +1 -0
- package/dist/components/editor/AudiencePicker.js +24 -0
- package/dist/components/editor/DeleteButton.d.ts +6 -0
- package/dist/components/editor/DeleteButton.d.ts.map +1 -0
- package/dist/components/editor/DeleteButton.js +6 -0
- package/dist/components/editor/DragHandle.d.ts +2 -0
- package/dist/components/editor/DragHandle.d.ts.map +1 -0
- package/dist/components/editor/DragHandle.js +8 -0
- package/dist/components/editor/InsertButton.d.ts +7 -0
- package/dist/components/editor/InsertButton.d.ts.map +1 -0
- package/dist/components/editor/InsertButton.js +7 -0
- package/dist/components/editor/SectionWrapper.d.ts +3 -0
- package/dist/components/editor/SectionWrapper.d.ts.map +1 -0
- package/dist/components/editor/SectionWrapper.js +135 -0
- package/dist/components/editor/SettingsButton.d.ts +6 -0
- package/dist/components/editor/SettingsButton.d.ts.map +1 -0
- package/dist/components/editor/SettingsButton.js +6 -0
- package/dist/components/editor/SettingsForm.d.ts +13 -0
- package/dist/components/editor/SettingsForm.d.ts.map +1 -0
- package/dist/components/editor/SettingsForm.js +64 -0
- package/dist/components/editor/StatusBadge.d.ts +7 -0
- package/dist/components/editor/StatusBadge.d.ts.map +1 -0
- package/dist/components/editor/StatusBadge.js +10 -0
- package/dist/components/editor/StatusPicker.d.ts +9 -0
- package/dist/components/editor/StatusPicker.d.ts.map +1 -0
- package/dist/components/editor/StatusPicker.js +30 -0
- package/dist/components/editor/index.d.ts +8 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +7 -0
- package/dist/components/primitives/CustomParagraph.d.ts +2 -0
- package/dist/components/primitives/CustomParagraph.d.ts.map +1 -0
- package/dist/components/primitives/CustomParagraph.js +24 -0
- package/dist/components/primitives/EditableGrid.d.ts +19 -0
- package/dist/components/primitives/EditableGrid.d.ts.map +1 -0
- package/dist/components/primitives/EditableGrid.js +90 -0
- package/dist/components/primitives/EditableList.d.ts +15 -0
- package/dist/components/primitives/EditableList.d.ts.map +1 -0
- package/dist/components/primitives/EditableList.js +54 -0
- package/dist/components/primitives/EditablePlainText.d.ts +12 -0
- package/dist/components/primitives/EditablePlainText.d.ts.map +1 -0
- package/dist/components/primitives/EditablePlainText.js +52 -0
- package/dist/components/primitives/EditableRichText.d.ts +11 -0
- package/dist/components/primitives/EditableRichText.d.ts.map +1 -0
- package/dist/components/primitives/EditableRichText.js +86 -0
- package/dist/components/primitives/HeadingSection.d.ts +10 -0
- package/dist/components/primitives/HeadingSection.d.ts.map +1 -0
- package/dist/components/primitives/HeadingSection.js +7 -0
- package/dist/components/primitives/IconPicker.d.ts +9 -0
- package/dist/components/primitives/IconPicker.d.ts.map +1 -0
- package/dist/components/primitives/IconPicker.js +21 -0
- package/dist/components/primitives/LinkPopover.d.ts +8 -0
- package/dist/components/primitives/LinkPopover.d.ts.map +1 -0
- package/dist/components/primitives/LinkPopover.js +48 -0
- package/dist/components/primitives/MediaSettingsForms.d.ts +19 -0
- package/dist/components/primitives/MediaSettingsForms.d.ts.map +1 -0
- package/dist/components/primitives/MediaSettingsForms.js +42 -0
- package/dist/components/primitives/ResolvedMedia.d.ts +8 -0
- package/dist/components/primitives/ResolvedMedia.d.ts.map +1 -0
- package/dist/components/primitives/ResolvedMedia.js +9 -0
- package/dist/components/primitives/RichTextToolbar.d.ts +9 -0
- package/dist/components/primitives/RichTextToolbar.d.ts.map +1 -0
- package/dist/components/primitives/RichTextToolbar.js +26 -0
- package/dist/components/primitives/tiptap-presets.d.ts +4 -0
- package/dist/components/primitives/tiptap-presets.d.ts.map +1 -0
- package/dist/components/primitives/tiptap-presets.js +44 -0
- package/dist/components/primitives/useEditableCollection.d.ts +19 -0
- package/dist/components/primitives/useEditableCollection.d.ts.map +1 -0
- package/dist/components/primitives/useEditableCollection.js +61 -0
- package/dist/components/primitives/useEditablePlainText.d.ts +14 -0
- package/dist/components/primitives/useEditablePlainText.d.ts.map +1 -0
- package/dist/components/primitives/useEditablePlainText.js +27 -0
- package/dist/components/primitives/useEditableRichText.d.ts +16 -0
- package/dist/components/primitives/useEditableRichText.d.ts.map +1 -0
- package/dist/components/primitives/useEditableRichText.js +52 -0
- package/dist/components/sections/Button/CTAButton.d.ts +11 -0
- package/dist/components/sections/Button/CTAButton.d.ts.map +1 -0
- package/dist/components/sections/Button/CTAButton.js +18 -0
- package/dist/components/sections/Button/index.d.ts +11 -0
- package/dist/components/sections/Button/index.d.ts.map +1 -0
- package/dist/components/sections/Button/index.js +28 -0
- package/dist/components/sections/Colors/index.d.ts +22 -0
- package/dist/components/sections/Colors/index.d.ts.map +1 -0
- package/dist/components/sections/Colors/index.js +34 -0
- package/dist/components/sections/DoDontList/index.d.ts +21 -0
- package/dist/components/sections/DoDontList/index.d.ts.map +1 -0
- package/dist/components/sections/DoDontList/index.js +33 -0
- package/dist/components/sections/DoDontMediaGrid/index.d.ts +55 -0
- package/dist/components/sections/DoDontMediaGrid/index.d.ts.map +1 -0
- package/dist/components/sections/DoDontMediaGrid/index.js +41 -0
- package/dist/components/sections/IconList/IconList.d.ts +20 -0
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -0
- package/dist/components/sections/IconList/IconList.js +131 -0
- package/dist/components/sections/IconList/IconListSettings.d.ts +11 -0
- package/dist/components/sections/IconList/IconListSettings.d.ts.map +1 -0
- package/dist/components/sections/IconList/IconListSettings.js +22 -0
- package/dist/components/sections/IconList/index.d.ts +17 -0
- package/dist/components/sections/IconList/index.d.ts.map +1 -0
- package/dist/components/sections/IconList/index.js +27 -0
- package/dist/components/sections/LinkHeading/index.d.ts +8 -0
- package/dist/components/sections/LinkHeading/index.d.ts.map +1 -0
- package/dist/components/sections/LinkHeading/index.js +15 -0
- package/dist/components/sections/MediaGrid/MediaGrid.d.ts +17 -0
- package/dist/components/sections/MediaGrid/MediaGrid.d.ts.map +1 -0
- package/dist/components/sections/MediaGrid/MediaGrid.js +62 -0
- package/dist/components/sections/MediaGrid/index.d.ts +55 -0
- package/dist/components/sections/MediaGrid/index.d.ts.map +1 -0
- package/dist/components/sections/MediaGrid/index.js +35 -0
- package/dist/components/sections/Prose/Prose.d.ts +8 -0
- package/dist/components/sections/Prose/Prose.d.ts.map +1 -0
- package/dist/components/sections/Prose/Prose.js +11 -0
- package/dist/components/sections/Prose/index.d.ts +8 -0
- package/dist/components/sections/Prose/index.d.ts.map +1 -0
- package/dist/components/sections/Prose/index.js +15 -0
- package/dist/components/sections/SectionLayout.d.ts +11 -0
- package/dist/components/sections/SectionLayout.d.ts.map +1 -0
- package/dist/components/sections/SectionLayout.js +15 -0
- package/dist/components/sections/SplitContent/SplitContent.d.ts +11 -0
- package/dist/components/sections/SplitContent/SplitContent.d.ts.map +1 -0
- package/dist/components/sections/SplitContent/SplitContent.js +31 -0
- package/dist/components/sections/SplitContent/SplitContentSettings.d.ts +9 -0
- package/dist/components/sections/SplitContent/SplitContentSettings.d.ts.map +1 -0
- package/dist/components/sections/SplitContent/SplitContentSettings.js +17 -0
- package/dist/components/sections/SplitContent/index.d.ts +13 -0
- package/dist/components/sections/SplitContent/index.d.ts.map +1 -0
- package/dist/components/sections/SplitContent/index.js +27 -0
- package/dist/components/sections/SubHeading/index.d.ts +9 -0
- package/dist/components/sections/SubHeading/index.d.ts.map +1 -0
- package/dist/components/sections/SubHeading/index.js +18 -0
- package/dist/components/sections/SubSubHeading/index.d.ts +9 -0
- package/dist/components/sections/SubSubHeading/index.d.ts.map +1 -0
- package/dist/components/sections/SubSubHeading/index.js +18 -0
- package/dist/components/sections/ViewRenderer.d.ts +8 -0
- package/dist/components/sections/ViewRenderer.d.ts.map +1 -0
- package/dist/components/sections/ViewRenderer.js +13 -0
- package/dist/components/sections/register-schemas.d.ts +2 -0
- package/dist/components/sections/register-schemas.d.ts.map +1 -0
- package/dist/components/sections/register-schemas.js +15 -0
- package/dist/components/sections/register.d.ts +2 -0
- package/dist/components/sections/register.d.ts.map +1 -0
- package/dist/components/sections/register.js +15 -0
- package/dist/components/shared/Button.d.ts +15 -0
- package/dist/components/shared/Button.d.ts.map +1 -0
- package/dist/components/shared/Button.js +27 -0
- package/dist/components/shared/Checkbox.d.ts +14 -0
- package/dist/components/shared/Checkbox.d.ts.map +1 -0
- package/dist/components/shared/Checkbox.js +10 -0
- package/dist/components/shared/ColorPicker.d.ts +9 -0
- package/dist/components/shared/ColorPicker.d.ts.map +1 -0
- package/dist/components/shared/ColorPicker.js +5 -0
- package/dist/components/shared/ErrorBoundary.d.ts +24 -0
- package/dist/components/shared/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/shared/ErrorBoundary.js +30 -0
- package/dist/components/shared/FontPicker.d.ts +8 -0
- package/dist/components/shared/FontPicker.d.ts.map +1 -0
- package/dist/components/shared/FontPicker.js +190 -0
- package/dist/components/shared/FormLabel.d.ts +8 -0
- package/dist/components/shared/FormLabel.d.ts.map +1 -0
- package/dist/components/shared/FormLabel.js +5 -0
- package/dist/components/shared/IconButton.d.ts +12 -0
- package/dist/components/shared/IconButton.d.ts.map +1 -0
- package/dist/components/shared/IconButton.js +16 -0
- package/dist/components/shared/Input.d.ts +8 -0
- package/dist/components/shared/Input.d.ts.map +1 -0
- package/dist/components/shared/Input.js +8 -0
- package/dist/components/shared/Navigation.d.ts +9 -0
- package/dist/components/shared/Navigation.d.ts.map +1 -0
- package/dist/components/shared/Navigation.js +71 -0
- package/dist/components/shared/PasswordInput.d.ts +13 -0
- package/dist/components/shared/PasswordInput.d.ts.map +1 -0
- package/dist/components/shared/PasswordInput.js +11 -0
- package/dist/components/shared/Popover.d.ts +12 -0
- package/dist/components/shared/Popover.d.ts.map +1 -0
- package/dist/components/shared/Popover.js +33 -0
- package/dist/components/shared/PopoverItem.d.ts +7 -0
- package/dist/components/shared/PopoverItem.d.ts.map +1 -0
- package/dist/components/shared/PopoverItem.js +6 -0
- package/dist/components/shared/Select.d.ts +16 -0
- package/dist/components/shared/Select.d.ts.map +1 -0
- package/dist/components/shared/Select.js +9 -0
- package/dist/components/shared/Textarea.d.ts +8 -0
- package/dist/components/shared/Textarea.d.ts.map +1 -0
- package/dist/components/shared/Textarea.js +8 -0
- package/dist/components/shared/Toggle.d.ts +10 -0
- package/dist/components/shared/Toggle.d.ts.map +1 -0
- package/dist/components/shared/Toggle.js +5 -0
- package/dist/components/shared/Tooltip.d.ts +12 -0
- package/dist/components/shared/Tooltip.d.ts.map +1 -0
- package/dist/components/shared/Tooltip.js +8 -0
- package/dist/components/shared/icons.d.ts +17 -0
- package/dist/components/shared/icons.d.ts.map +1 -0
- package/dist/components/shared/icons.js +23 -0
- package/dist/components/shell/AudienceAddForm.d.ts +11 -0
- package/dist/components/shell/AudienceAddForm.d.ts.map +1 -0
- package/dist/components/shell/AudienceAddForm.js +43 -0
- package/dist/components/shell/AudienceRow.d.ts +15 -0
- package/dist/components/shell/AudienceRow.d.ts.map +1 -0
- package/dist/components/shell/AudienceRow.js +74 -0
- package/dist/components/shell/EditorContext.d.ts +14 -0
- package/dist/components/shell/EditorContext.d.ts.map +1 -0
- package/dist/components/shell/EditorContext.js +24 -0
- package/dist/components/shell/EditorLoginForm.d.ts +13 -0
- package/dist/components/shell/EditorLoginForm.d.ts.map +1 -0
- package/dist/components/shell/EditorLoginForm.js +46 -0
- package/dist/components/shell/EditorModal.d.ts +13 -0
- package/dist/components/shell/EditorModal.d.ts.map +1 -0
- package/dist/components/shell/EditorModal.js +43 -0
- package/dist/components/shell/EditorModalContext.d.ts +16 -0
- package/dist/components/shell/EditorModalContext.d.ts.map +1 -0
- package/dist/components/shell/EditorModalContext.js +20 -0
- package/dist/components/shell/EditorShell.d.ts +22 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.js +483 -0
- package/dist/components/shell/MediaLibraryContext.d.ts +14 -0
- package/dist/components/shell/MediaLibraryContext.d.ts.map +1 -0
- package/dist/components/shell/MediaLibraryContext.js +5 -0
- package/dist/components/shell/MediaLibraryModal.d.ts +14 -0
- package/dist/components/shell/MediaLibraryModal.d.ts.map +1 -0
- package/dist/components/shell/MediaLibraryModal.js +145 -0
- package/dist/components/shell/ProcessingIndicator.d.ts +7 -0
- package/dist/components/shell/ProcessingIndicator.d.ts.map +1 -0
- package/dist/components/shell/ProcessingIndicator.js +15 -0
- package/dist/components/shell/SectionSkeleton.d.ts +9 -0
- package/dist/components/shell/SectionSkeleton.d.ts.map +1 -0
- package/dist/components/shell/SectionSkeleton.js +22 -0
- package/dist/components/shell/SectionTypePicker.d.ts +14 -0
- package/dist/components/shell/SectionTypePicker.d.ts.map +1 -0
- package/dist/components/shell/SectionTypePicker.js +15 -0
- package/dist/components/shell/SiteSettingsDisplay.d.ts +8 -0
- package/dist/components/shell/SiteSettingsDisplay.d.ts.map +1 -0
- package/dist/components/shell/SiteSettingsDisplay.js +28 -0
- package/dist/components/shell/SiteSettingsModal.d.ts +24 -0
- package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -0
- package/dist/components/shell/SiteSettingsModal.js +40 -0
- package/dist/components/shell/SiteSettingsUsers.d.ts +9 -0
- package/dist/components/shell/SiteSettingsUsers.d.ts.map +1 -0
- package/dist/components/shell/SiteSettingsUsers.js +87 -0
- package/dist/components/shell/SiteSettingsViewerAccess.d.ts +9 -0
- package/dist/components/shell/SiteSettingsViewerAccess.d.ts.map +1 -0
- package/dist/components/shell/SiteSettingsViewerAccess.js +94 -0
- package/dist/components/shell/ViewerLoginForm.d.ts +10 -0
- package/dist/components/shell/ViewerLoginForm.d.ts.map +1 -0
- package/dist/components/shell/ViewerLoginForm.js +40 -0
- package/dist/data/google-fonts.json +7718 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/useActiveHeadings.d.ts +7 -0
- package/dist/hooks/useActiveHeadings.d.ts.map +1 -0
- package/dist/hooks/useActiveHeadings.js +99 -0
- package/dist/hooks/useEditorPersistence.d.ts +13 -0
- package/dist/hooks/useEditorPersistence.d.ts.map +1 -0
- package/dist/hooks/useEditorPersistence.js +73 -0
- package/dist/hooks/useEditorPublish.d.ts +24 -0
- package/dist/hooks/useEditorPublish.d.ts.map +1 -0
- package/dist/hooks/useEditorPublish.js +145 -0
- package/dist/hooks/useFocusTrap.d.ts +3 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/hooks/useFocusTrap.js +51 -0
- package/dist/hooks/useMediaPipeline.d.ts +65 -0
- package/dist/hooks/useMediaPipeline.d.ts.map +1 -0
- package/dist/hooks/useMediaPipeline.js +253 -0
- package/dist/hooks/useResolvedMedia.d.ts +9 -0
- package/dist/hooks/useResolvedMedia.d.ts.map +1 -0
- package/dist/hooks/useResolvedMedia.js +39 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +5 -0
- package/dist/lib/contrast.d.ts +2 -0
- package/dist/lib/contrast.d.ts.map +1 -0
- package/dist/lib/contrast.js +11 -0
- package/dist/lib/dexie.d.ts +41 -0
- package/dist/lib/dexie.d.ts.map +1 -0
- package/dist/lib/dexie.js +236 -0
- package/dist/lib/events.d.ts +12 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/events.js +15 -0
- package/dist/lib/google-fonts.d.ts +2 -0
- package/dist/lib/google-fonts.d.ts.map +1 -0
- package/dist/lib/google-fonts.js +11 -0
- package/dist/lib/grid.d.ts +2 -0
- package/dist/lib/grid.d.ts.map +1 -0
- package/dist/lib/grid.js +7 -0
- package/dist/lib/icons.d.ts +9 -0
- package/dist/lib/icons.d.ts.map +1 -0
- package/dist/lib/icons.js +27 -0
- package/dist/lib/index.d.ts +13 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +12 -0
- package/dist/lib/loader.d.ts +28 -0
- package/dist/lib/loader.d.ts.map +1 -0
- package/dist/lib/loader.js +57 -0
- package/dist/lib/nav.d.ts +15 -0
- package/dist/lib/nav.d.ts.map +1 -0
- package/dist/lib/nav.js +58 -0
- package/dist/lib/registry.d.ts +110 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +64 -0
- package/dist/lib/safeRedirect.d.ts +7 -0
- package/dist/lib/safeRedirect.d.ts.map +1 -0
- package/dist/lib/safeRedirect.js +11 -0
- package/dist/lib/sanitize.d.ts +2 -0
- package/dist/lib/sanitize.d.ts.map +1 -0
- package/dist/lib/sanitize.js +6 -0
- package/dist/lib/timestamp.d.ts +2 -0
- package/dist/lib/timestamp.d.ts.map +1 -0
- package/dist/lib/timestamp.js +28 -0
- package/dist/media/github.d.ts +3 -0
- package/dist/media/github.d.ts.map +1 -0
- package/dist/media/github.js +60 -0
- package/dist/media/index.d.ts +8 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +9 -0
- package/dist/media/queue.d.ts +74 -0
- package/dist/media/queue.d.ts.map +1 -0
- package/dist/media/queue.js +116 -0
- package/dist/media/resolve.d.ts +14 -0
- package/dist/media/resolve.d.ts.map +1 -0
- package/dist/media/resolve.js +50 -0
- package/dist/media/types.d.ts +42 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/types.js +1 -0
- package/dist/media/utils.d.ts +7 -0
- package/dist/media/utils.d.ts.map +1 -0
- package/dist/media/utils.js +41 -0
- package/dist/media/videoPoster.d.ts +6 -0
- package/dist/media/videoPoster.d.ts.map +1 -0
- package/dist/media/videoPoster.js +44 -0
- package/dist/media/worker.d.ts +36 -0
- package/dist/media/worker.d.ts.map +1 -0
- package/dist/media/worker.js +73 -0
- package/dist/schemas/audience.d.ts +12 -0
- package/dist/schemas/audience.d.ts.map +1 -0
- package/dist/schemas/audience.js +19 -0
- package/dist/schemas/auth.d.ts +36 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/auth.js +22 -0
- package/dist/schemas/index.d.ts +8 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +7 -0
- package/dist/schemas/media-grid-options.d.ts +8 -0
- package/dist/schemas/media-grid-options.d.ts.map +1 -0
- package/dist/schemas/media-grid-options.js +7 -0
- package/dist/schemas/media.d.ts +63 -0
- package/dist/schemas/media.d.ts.map +1 -0
- package/dist/schemas/media.js +28 -0
- package/dist/schemas/sections.d.ts +12 -0
- package/dist/schemas/sections.d.ts.map +1 -0
- package/dist/schemas/sections.js +12 -0
- package/dist/schemas/shared.d.ts +98 -0
- package/dist/schemas/shared.d.ts.map +1 -0
- package/dist/schemas/shared.js +71 -0
- package/dist/schemas/site-config.d.ts +48 -0
- package/dist/schemas/site-config.d.ts.map +1 -0
- package/dist/schemas/site-config.js +26 -0
- package/package.json +57 -0
- package/src/auth/cookies.ts +51 -0
- package/src/auth/errors.ts +10 -0
- package/src/auth/index.ts +15 -0
- package/src/auth/security.ts +44 -0
- package/src/auth/types.ts +61 -0
- package/src/components/brandguide/ColorSwatchSettings.tsx +34 -0
- package/src/components/brandguide/Colors.tsx +277 -0
- package/src/components/brandguide/DoDontList.tsx +67 -0
- package/src/components/brandguide/DoDontMediaGrid.tsx +19 -0
- package/src/components/editor/AudiencePicker.tsx +103 -0
- package/src/components/editor/DeleteButton.tsx +18 -0
- package/src/components/editor/DragHandle.tsx +18 -0
- package/src/components/editor/InsertButton.tsx +22 -0
- package/src/components/editor/SectionWrapper.tsx +279 -0
- package/src/components/editor/SettingsButton.tsx +17 -0
- package/src/components/editor/SettingsForm.tsx +159 -0
- package/src/components/editor/StatusBadge.tsx +30 -0
- package/src/components/editor/StatusPicker.tsx +86 -0
- package/src/components/editor/index.ts +7 -0
- package/src/components/primitives/CustomParagraph.ts +25 -0
- package/src/components/primitives/EditableGrid.tsx +260 -0
- package/src/components/primitives/EditableList.tsx +160 -0
- package/src/components/primitives/EditablePlainText.tsx +99 -0
- package/src/components/primitives/EditableRichText.tsx +132 -0
- package/src/components/primitives/HeadingSection.tsx +25 -0
- package/src/components/primitives/IconPicker.tsx +60 -0
- package/src/components/primitives/LinkPopover.tsx +109 -0
- package/src/components/primitives/MediaSettingsForms.tsx +109 -0
- package/src/components/primitives/ResolvedMedia.tsx +36 -0
- package/src/components/primitives/RichTextToolbar.tsx +149 -0
- package/src/components/primitives/tiptap-presets.ts +50 -0
- package/src/components/primitives/useEditableCollection.ts +104 -0
- package/src/components/primitives/useEditablePlainText.ts +49 -0
- package/src/components/primitives/useEditableRichText.ts +74 -0
- package/src/components/sections/Button/CTAButton.tsx +50 -0
- package/src/components/sections/Button/index.tsx +37 -0
- package/src/components/sections/Colors/index.tsx +45 -0
- package/src/components/sections/DoDontList/index.tsx +43 -0
- package/src/components/sections/DoDontMediaGrid/index.tsx +53 -0
- package/src/components/sections/IconList/IconList.tsx +462 -0
- package/src/components/sections/IconList/IconListSettings.tsx +81 -0
- package/src/components/sections/IconList/index.tsx +36 -0
- package/src/components/sections/LinkHeading/index.tsx +24 -0
- package/src/components/sections/MediaGrid/MediaGrid.tsx +219 -0
- package/src/components/sections/MediaGrid/index.tsx +47 -0
- package/src/components/sections/Prose/Prose.tsx +34 -0
- package/src/components/sections/Prose/index.tsx +18 -0
- package/src/components/sections/SectionLayout.tsx +31 -0
- package/src/components/sections/SplitContent/SplitContent.tsx +77 -0
- package/src/components/sections/SplitContent/SplitContentSettings.tsx +42 -0
- package/src/components/sections/SplitContent/index.tsx +36 -0
- package/src/components/sections/SubHeading/index.tsx +27 -0
- package/src/components/sections/SubSubHeading/index.tsx +27 -0
- package/src/components/sections/ViewRenderer.tsx +29 -0
- package/src/components/sections/register-schemas.ts +16 -0
- package/src/components/sections/register.ts +16 -0
- package/src/components/shared/Button.tsx +77 -0
- package/src/components/shared/Checkbox.tsx +73 -0
- package/src/components/shared/ColorPicker.tsx +28 -0
- package/src/components/shared/ErrorBoundary.tsx +92 -0
- package/src/components/shared/FontPicker.tsx +300 -0
- package/src/components/shared/FormLabel.tsx +18 -0
- package/src/components/shared/IconButton.tsx +45 -0
- package/src/components/shared/Input.tsx +34 -0
- package/src/components/shared/Navigation.tsx +196 -0
- package/src/components/shared/PasswordInput.tsx +64 -0
- package/src/components/shared/Popover.tsx +61 -0
- package/src/components/shared/PopoverItem.tsx +24 -0
- package/src/components/shared/Select.tsx +60 -0
- package/src/components/shared/Textarea.tsx +34 -0
- package/src/components/shared/Toggle.tsx +35 -0
- package/src/components/shared/Tooltip.tsx +28 -0
- package/src/components/shared/icons.tsx +28 -0
- package/src/components/shell/AudienceAddForm.tsx +94 -0
- package/src/components/shell/AudienceRow.tsx +171 -0
- package/src/components/shell/EditorContext.tsx +44 -0
- package/src/components/shell/EditorLoginForm.tsx +130 -0
- package/src/components/shell/EditorModal.tsx +93 -0
- package/src/components/shell/EditorModalContext.tsx +40 -0
- package/src/components/shell/EditorShell.tsx +910 -0
- package/src/components/shell/MediaLibraryContext.tsx +19 -0
- package/src/components/shell/MediaLibraryModal.tsx +371 -0
- package/src/components/shell/ProcessingIndicator.tsx +84 -0
- package/src/components/shell/SectionSkeleton.tsx +54 -0
- package/src/components/shell/SectionTypePicker.tsx +47 -0
- package/src/components/shell/SiteSettingsDisplay.tsx +78 -0
- package/src/components/shell/SiteSettingsModal.tsx +129 -0
- package/src/components/shell/SiteSettingsUsers.tsx +190 -0
- package/src/components/shell/SiteSettingsViewerAccess.tsx +171 -0
- package/src/components/shell/ViewerLoginForm.tsx +95 -0
- package/src/data/google-fonts.json +7718 -0
- package/src/env.d.ts +3 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useActiveHeadings.ts +120 -0
- package/src/hooks/useEditorPersistence.ts +103 -0
- package/src/hooks/useEditorPublish.ts +187 -0
- package/src/hooks/useFocusTrap.ts +57 -0
- package/src/hooks/useMediaPipeline.ts +309 -0
- package/src/hooks/useResolvedMedia.ts +54 -0
- package/src/index.ts +4 -0
- package/src/lib/cn.ts +6 -0
- package/src/lib/contrast.ts +11 -0
- package/src/lib/dexie.ts +347 -0
- package/src/lib/events.ts +23 -0
- package/src/lib/google-fonts.ts +10 -0
- package/src/lib/grid.ts +7 -0
- package/src/lib/icons.ts +58 -0
- package/src/lib/index.ts +35 -0
- package/src/lib/loader.ts +81 -0
- package/src/lib/nav.ts +64 -0
- package/src/lib/registry.ts +202 -0
- package/src/lib/safeRedirect.ts +11 -0
- package/src/lib/sanitize.ts +6 -0
- package/src/lib/timestamp.ts +31 -0
- package/src/media/github.ts +72 -0
- package/src/media/index.ts +12 -0
- package/src/media/queue.ts +166 -0
- package/src/media/resolve.ts +63 -0
- package/src/media/types.ts +58 -0
- package/src/media/utils.ts +48 -0
- package/src/media/videoPoster.ts +53 -0
- package/src/media/worker.ts +122 -0
- package/src/schemas/audience.ts +28 -0
- package/src/schemas/auth.ts +31 -0
- package/src/schemas/index.ts +7 -0
- package/src/schemas/media-grid-options.ts +8 -0
- package/src/schemas/media.ts +40 -0
- package/src/schemas/sections.ts +24 -0
- package/src/schemas/shared.ts +96 -0
- package/src/schemas/site-config.ts +38 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useActiveHeadings } from "./useActiveHeadings";
|
|
2
|
+
export { useEditorPersistence } from "./useEditorPersistence";
|
|
3
|
+
export { useEditorPublish } from "./useEditorPublish";
|
|
4
|
+
export { useFocusTrap } from "./useFocusTrap";
|
|
5
|
+
export { useMediaPipeline } from "./useMediaPipeline";
|
|
6
|
+
export { useResolvedMedia } from "./useResolvedMedia";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useActiveHeadings } from "./useActiveHeadings";
|
|
2
|
+
export { useEditorPersistence } from "./useEditorPersistence";
|
|
3
|
+
export { useEditorPublish } from "./useEditorPublish";
|
|
4
|
+
export { useFocusTrap } from "./useFocusTrap";
|
|
5
|
+
export { useMediaPipeline } from "./useMediaPipeline";
|
|
6
|
+
export { useResolvedMedia } from "./useResolvedMedia";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function useActiveHeadings(parentIds: string[], childIdsByParent: Record<string, string[]>, grandchildIdsByChild: Record<string, string[]>, headerOffset?: number): {
|
|
2
|
+
activeParentId: string;
|
|
3
|
+
activeChildId: string;
|
|
4
|
+
activeGrandchildId: string;
|
|
5
|
+
setActiveSection: (id: string) => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useActiveHeadings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveHeadings.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveHeadings.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC1C,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC9C,YAAY,GAAE,MAAW;;;;2BAyGiB,MAAM;EAQjD"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState, useCallback } from "react";
|
|
2
|
+
export function useActiveHeadings(parentIds, childIdsByParent, grandchildIdsByChild, headerOffset = 80) {
|
|
3
|
+
const [activeParentId, setActiveParentId] = useState("");
|
|
4
|
+
const [activeChildId, setActiveChildId] = useState("");
|
|
5
|
+
const [activeGrandchildId, setActiveGrandchildId] = useState("");
|
|
6
|
+
const childKey = useMemo(() => Object.entries(childIdsByParent).map(([k, v]) => `${k}:${v.join(",")}`).join("|"), [childIdsByParent]);
|
|
7
|
+
const grandchildKey = useMemo(() => Object.entries(grandchildIdsByChild).map(([k, v]) => `${k}:${v.join(",")}`).join("|"), [grandchildIdsByChild]);
|
|
8
|
+
// Use refs for comparison inside the effect to avoid re-render loops
|
|
9
|
+
const activeParentRef = useRef("");
|
|
10
|
+
const activeChildRef = useRef("");
|
|
11
|
+
const activeGrandchildRef = useRef("");
|
|
12
|
+
const ticking = useRef(false);
|
|
13
|
+
const transitionTimeoutRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (parentIds.length === 0)
|
|
16
|
+
return;
|
|
17
|
+
let parentEls = [];
|
|
18
|
+
const collect = () => {
|
|
19
|
+
parentEls = parentIds
|
|
20
|
+
.map((id) => ({ id, el: document.getElementById(id) }))
|
|
21
|
+
.filter((x) => !!x.el);
|
|
22
|
+
};
|
|
23
|
+
collect();
|
|
24
|
+
const findActive = (ids) => {
|
|
25
|
+
let active = "";
|
|
26
|
+
for (const id of ids) {
|
|
27
|
+
const el = document.getElementById(id);
|
|
28
|
+
if (!el)
|
|
29
|
+
continue;
|
|
30
|
+
if (el.getBoundingClientRect().top - headerOffset <= 0)
|
|
31
|
+
active = id;
|
|
32
|
+
else
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
return active;
|
|
36
|
+
};
|
|
37
|
+
const computeActive = () => {
|
|
38
|
+
const parent = findActive(parentIds) || parentEls[0]?.id || "";
|
|
39
|
+
if (!parent)
|
|
40
|
+
return;
|
|
41
|
+
if (activeParentRef.current !== parent) {
|
|
42
|
+
if (transitionTimeoutRef.current)
|
|
43
|
+
clearTimeout(transitionTimeoutRef.current);
|
|
44
|
+
if (activeParentRef.current) {
|
|
45
|
+
// Delay parent transitions to prevent flashing
|
|
46
|
+
transitionTimeoutRef.current = setTimeout(() => {
|
|
47
|
+
activeParentRef.current = parent;
|
|
48
|
+
setActiveParentId(parent);
|
|
49
|
+
}, 250);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
activeParentRef.current = parent;
|
|
53
|
+
setActiveParentId(parent);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const child = findActive(childIdsByParent[parent] || []);
|
|
57
|
+
if (activeChildRef.current !== child) {
|
|
58
|
+
activeChildRef.current = child;
|
|
59
|
+
setActiveChildId(child);
|
|
60
|
+
}
|
|
61
|
+
const grandchild = findActive(grandchildIdsByChild[child] || []);
|
|
62
|
+
if (activeGrandchildRef.current !== grandchild) {
|
|
63
|
+
activeGrandchildRef.current = grandchild;
|
|
64
|
+
setActiveGrandchildId(grandchild);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const onScroll = () => {
|
|
68
|
+
if (!ticking.current) {
|
|
69
|
+
ticking.current = true;
|
|
70
|
+
requestAnimationFrame(() => {
|
|
71
|
+
computeActive();
|
|
72
|
+
ticking.current = false;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const onResize = () => {
|
|
77
|
+
collect();
|
|
78
|
+
computeActive();
|
|
79
|
+
};
|
|
80
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
81
|
+
window.addEventListener("resize", onResize);
|
|
82
|
+
// Initial compute
|
|
83
|
+
computeActive();
|
|
84
|
+
return () => {
|
|
85
|
+
window.removeEventListener("scroll", onScroll);
|
|
86
|
+
window.removeEventListener("resize", onResize);
|
|
87
|
+
if (transitionTimeoutRef.current)
|
|
88
|
+
clearTimeout(transitionTimeoutRef.current);
|
|
89
|
+
};
|
|
90
|
+
// Only stable values in dep array — NO state variables
|
|
91
|
+
}, [parentIds.join("|"), childKey, grandchildKey, headerOffset]);
|
|
92
|
+
const setActiveSection = useCallback((id) => {
|
|
93
|
+
const newHash = `#${id}`;
|
|
94
|
+
if (window.location.hash !== newHash) {
|
|
95
|
+
window.history.replaceState(null, "", newHash);
|
|
96
|
+
}
|
|
97
|
+
}, []);
|
|
98
|
+
return { activeParentId, activeChildId, activeGrandchildId, setActiveSection };
|
|
99
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SectionContent } from "../schemas/sections";
|
|
2
|
+
import type { SiteIndex } from "../schemas/site-config";
|
|
3
|
+
export declare function useEditorPersistence(siteIndexRef: React.RefObject<SiteIndex>): {
|
|
4
|
+
markSectionDirty: (sectionId: string, content: SectionContent) => void;
|
|
5
|
+
markSectionDeleted: (sectionId: string) => void;
|
|
6
|
+
markIndexDirty: () => void;
|
|
7
|
+
persistConfig: (config: Record<string, unknown>) => Promise<void>;
|
|
8
|
+
flushNow: () => Promise<void>;
|
|
9
|
+
cancelPendingFlush: () => void;
|
|
10
|
+
isConfigDirty: () => boolean;
|
|
11
|
+
clearConfigDirty: () => void;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useEditorPersistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorPersistence.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPersistence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAUxD,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;kCA2C7D,MAAM,WAAW,cAAc;oCAQ/B,MAAM;;4BAc6B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;EAyBzE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useCallback, useRef, useEffect } from "react";
|
|
2
|
+
import { persistAll, persistSiteConfig } from "../lib/dexie";
|
|
3
|
+
export function useEditorPersistence(siteIndexRef) {
|
|
4
|
+
const state = useRef({
|
|
5
|
+
pendingSections: new Map(),
|
|
6
|
+
pendingDeletes: new Set(),
|
|
7
|
+
indexDirty: false,
|
|
8
|
+
configDirty: false,
|
|
9
|
+
});
|
|
10
|
+
const flushTimerRef = useRef(null);
|
|
11
|
+
const flushToDexie = useCallback(async () => {
|
|
12
|
+
const s = state.current;
|
|
13
|
+
if (s.pendingSections.size === 0 && !s.indexDirty && s.pendingDeletes.size === 0)
|
|
14
|
+
return;
|
|
15
|
+
const entries = Array.from(s.pendingSections.entries()).map(([sectionId, content]) => ({
|
|
16
|
+
sectionId,
|
|
17
|
+
content,
|
|
18
|
+
}));
|
|
19
|
+
const deletedIds = Array.from(s.pendingDeletes);
|
|
20
|
+
s.pendingSections = new Map();
|
|
21
|
+
s.pendingDeletes = new Set();
|
|
22
|
+
const wasIndexDirty = s.indexDirty;
|
|
23
|
+
s.indexDirty = false;
|
|
24
|
+
await persistAll(entries, wasIndexDirty ? siteIndexRef.current : undefined, deletedIds.length > 0 ? deletedIds : undefined);
|
|
25
|
+
}, [siteIndexRef]);
|
|
26
|
+
const scheduleFlush = useCallback(() => {
|
|
27
|
+
if (flushTimerRef.current)
|
|
28
|
+
clearTimeout(flushTimerRef.current);
|
|
29
|
+
flushTimerRef.current = setTimeout(flushToDexie, 500);
|
|
30
|
+
}, [flushToDexie]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
return () => {
|
|
33
|
+
if (flushTimerRef.current)
|
|
34
|
+
clearTimeout(flushTimerRef.current);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
const markSectionDirty = useCallback((sectionId, content) => {
|
|
38
|
+
state.current.pendingSections.set(sectionId, content);
|
|
39
|
+
scheduleFlush();
|
|
40
|
+
}, [scheduleFlush]);
|
|
41
|
+
const markSectionDeleted = useCallback((sectionId) => {
|
|
42
|
+
state.current.pendingSections.delete(sectionId);
|
|
43
|
+
state.current.pendingDeletes.add(sectionId);
|
|
44
|
+
state.current.indexDirty = true;
|
|
45
|
+
scheduleFlush();
|
|
46
|
+
}, [scheduleFlush]);
|
|
47
|
+
const markIndexDirty = useCallback(() => {
|
|
48
|
+
state.current.indexDirty = true;
|
|
49
|
+
scheduleFlush();
|
|
50
|
+
}, [scheduleFlush]);
|
|
51
|
+
const persistConfig = useCallback(async (config) => {
|
|
52
|
+
state.current.configDirty = true;
|
|
53
|
+
await persistSiteConfig(config);
|
|
54
|
+
}, []);
|
|
55
|
+
const cancelPendingFlush = useCallback(() => {
|
|
56
|
+
if (flushTimerRef.current) {
|
|
57
|
+
clearTimeout(flushTimerRef.current);
|
|
58
|
+
flushTimerRef.current = null;
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
const isConfigDirty = useCallback(() => state.current.configDirty, []);
|
|
62
|
+
const clearConfigDirty = useCallback(() => { state.current.configDirty = false; }, []);
|
|
63
|
+
return {
|
|
64
|
+
markSectionDirty,
|
|
65
|
+
markSectionDeleted,
|
|
66
|
+
markIndexDirty,
|
|
67
|
+
persistConfig,
|
|
68
|
+
flushNow: flushToDexie,
|
|
69
|
+
cancelPendingFlush,
|
|
70
|
+
isConfigDirty,
|
|
71
|
+
clearConfigDirty,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SiteIndex, SiteConfig } from "../schemas/site-config";
|
|
2
|
+
import type { LoadedSection } from "../lib/loader";
|
|
3
|
+
import type { MediaManifest, MediaItem } from "../media/types";
|
|
4
|
+
interface PublishDeps {
|
|
5
|
+
flushNow: () => Promise<void>;
|
|
6
|
+
cancelPendingFlush: () => void;
|
|
7
|
+
isConfigDirty: () => boolean;
|
|
8
|
+
clearConfigDirty: () => void;
|
|
9
|
+
siteIndexRef: React.RefObject<SiteIndex>;
|
|
10
|
+
siteConfig: SiteConfig | null;
|
|
11
|
+
sections: LoadedSection[];
|
|
12
|
+
onSuccess: () => void;
|
|
13
|
+
mediaManifest: MediaManifest;
|
|
14
|
+
pendingMediaItems: MediaItem[];
|
|
15
|
+
pendingMediaDeletions: string[];
|
|
16
|
+
onMediaPublished: (publishedItems: MediaItem[], publishedDeletions: string[]) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function useEditorPublish({ flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, onSuccess, mediaManifest, pendingMediaItems, pendingMediaDeletions, onMediaPublished, }: PublishDeps): {
|
|
19
|
+
isPublishing: boolean;
|
|
20
|
+
publishFeedback: string | null;
|
|
21
|
+
handlePublish: () => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=useEditorPublish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorPublish.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPublish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAe/D,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,CAAC,cAAc,EAAE,SAAS,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACvF;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GACjB,EAAE,WAAW;;;;EA4Ib"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useState, useCallback, useRef, useEffect } from "react";
|
|
2
|
+
import { getDirtySections, hasLocalChanges, discardLocalChanges, cacheContent, getPendingMediaLocalUrls, clearPendingMedia } from "../lib/dexie";
|
|
3
|
+
function blobToBase64(blob) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const reader = new FileReader();
|
|
6
|
+
reader.onload = () => {
|
|
7
|
+
const dataUrl = reader.result;
|
|
8
|
+
resolve(dataUrl.split(",")[1]);
|
|
9
|
+
};
|
|
10
|
+
reader.onerror = reject;
|
|
11
|
+
reader.readAsDataURL(blob);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function useEditorPublish({ flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, onSuccess, mediaManifest, pendingMediaItems, pendingMediaDeletions, onMediaPublished, }) {
|
|
15
|
+
const [isPublishing, setIsPublishing] = useState(false);
|
|
16
|
+
const [publishFeedback, setPublishFeedback] = useState(null);
|
|
17
|
+
const feedbackTimerRef = useRef(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
return () => {
|
|
20
|
+
if (feedbackTimerRef.current)
|
|
21
|
+
clearTimeout(feedbackTimerRef.current);
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
const handlePublish = useCallback(async () => {
|
|
25
|
+
if (!siteConfig)
|
|
26
|
+
return;
|
|
27
|
+
setIsPublishing(true);
|
|
28
|
+
setPublishFeedback(null);
|
|
29
|
+
try {
|
|
30
|
+
cancelPendingFlush();
|
|
31
|
+
await flushNow();
|
|
32
|
+
const hasChanges = await hasLocalChanges();
|
|
33
|
+
const hasMediaChanges = pendingMediaItems.length > 0 || pendingMediaDeletions.length > 0;
|
|
34
|
+
if (!hasChanges && !isConfigDirty() && !hasMediaChanges) {
|
|
35
|
+
setIsPublishing(false);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const dirty = await getDirtySections();
|
|
39
|
+
// Gather pending media for the commit
|
|
40
|
+
const mediaUploads = [];
|
|
41
|
+
const blobUrlsToRevoke = [];
|
|
42
|
+
for (const item of pendingMediaItems) {
|
|
43
|
+
const localUrls = await getPendingMediaLocalUrls(item.id);
|
|
44
|
+
if (!localUrls)
|
|
45
|
+
continue;
|
|
46
|
+
for (const url of Object.values(localUrls)) {
|
|
47
|
+
blobUrlsToRevoke.push(url);
|
|
48
|
+
}
|
|
49
|
+
const blobs = [];
|
|
50
|
+
const failedBlobFetches = [];
|
|
51
|
+
const mimeExt = {
|
|
52
|
+
"image/gif": "gif", "image/apng": "apng", "video/mp4": "mp4", "video/webm": "webm",
|
|
53
|
+
};
|
|
54
|
+
for (const [key, url] of Object.entries(localUrls)) {
|
|
55
|
+
if (key === "primary" && item.kind === "image")
|
|
56
|
+
continue;
|
|
57
|
+
try {
|
|
58
|
+
const resp = await fetch(url);
|
|
59
|
+
const blob = await resp.blob();
|
|
60
|
+
const base64 = await blobToBase64(blob);
|
|
61
|
+
if (key === "primary") {
|
|
62
|
+
const ext = mimeExt[item.mimeType] ?? "bin";
|
|
63
|
+
blobs.push({ path: `assets/images/${item.folder}/original.${ext}`, base64 });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
blobs.push({ path: `assets/images/${item.folder}/${key}.webp`, base64 });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
failedBlobFetches.push(`${item.id}/${key}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (failedBlobFetches.length > 0) {
|
|
74
|
+
throw new Error(`Media upload failed: could not read blob data for ${failedBlobFetches.join(", ")}`);
|
|
75
|
+
}
|
|
76
|
+
if (blobs.length > 0) {
|
|
77
|
+
mediaUploads.push({ item, blobs });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Build updated manifest
|
|
81
|
+
let updatedManifest;
|
|
82
|
+
if (hasMediaChanges) {
|
|
83
|
+
const images = { ...mediaManifest.images };
|
|
84
|
+
for (const upload of mediaUploads) {
|
|
85
|
+
images[upload.item.id] = upload.item;
|
|
86
|
+
}
|
|
87
|
+
for (const id of pendingMediaDeletions) {
|
|
88
|
+
delete images[id];
|
|
89
|
+
}
|
|
90
|
+
updatedManifest = { images };
|
|
91
|
+
}
|
|
92
|
+
const response = await fetch("/api/save", {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: { "Content-Type": "application/json" },
|
|
95
|
+
body: JSON.stringify({
|
|
96
|
+
sections: dirty.map(({ sectionId, content }) => ({
|
|
97
|
+
id: sectionId,
|
|
98
|
+
content,
|
|
99
|
+
})),
|
|
100
|
+
siteIndex: siteIndexRef.current,
|
|
101
|
+
...(isConfigDirty() ? { siteConfig } : {}),
|
|
102
|
+
...(hasMediaChanges ? {
|
|
103
|
+
media: {
|
|
104
|
+
uploads: mediaUploads.map(({ item, blobs }) => ({ item, blobs })),
|
|
105
|
+
deletions: pendingMediaDeletions.map((id) => ({
|
|
106
|
+
id,
|
|
107
|
+
folder: mediaManifest.images[id]?.folder,
|
|
108
|
+
})).filter((d) => d.folder),
|
|
109
|
+
manifest: updatedManifest,
|
|
110
|
+
},
|
|
111
|
+
} : {}),
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
if (!response.ok) {
|
|
115
|
+
const errorBody = await response.json().catch(() => ({}));
|
|
116
|
+
throw new Error(errorBody.error || "Publish failed");
|
|
117
|
+
}
|
|
118
|
+
const { sha } = await response.json();
|
|
119
|
+
await discardLocalChanges();
|
|
120
|
+
await clearPendingMedia();
|
|
121
|
+
await cacheContent(sha, sections, siteIndexRef.current, siteConfig);
|
|
122
|
+
clearConfigDirty();
|
|
123
|
+
onSuccess();
|
|
124
|
+
onMediaPublished(pendingMediaItems, pendingMediaDeletions);
|
|
125
|
+
for (const url of blobUrlsToRevoke) {
|
|
126
|
+
URL.revokeObjectURL(url);
|
|
127
|
+
}
|
|
128
|
+
setPublishFeedback("Published");
|
|
129
|
+
if (feedbackTimerRef.current)
|
|
130
|
+
clearTimeout(feedbackTimerRef.current);
|
|
131
|
+
feedbackTimerRef.current = setTimeout(() => setPublishFeedback(null), 3000);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error("Publish failed:", error);
|
|
135
|
+
setPublishFeedback("Publish failed");
|
|
136
|
+
if (feedbackTimerRef.current)
|
|
137
|
+
clearTimeout(feedbackTimerRef.current);
|
|
138
|
+
feedbackTimerRef.current = setTimeout(() => setPublishFeedback(null), 5000);
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
setIsPublishing(false);
|
|
142
|
+
}
|
|
143
|
+
}, [flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, onSuccess, mediaManifest, pendingMediaItems, pendingMediaDeletions, onMediaPublished]);
|
|
144
|
+
return { isPublishing, publishFeedback, handlePublish };
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWlD,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,QA6C/E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
const FOCUSABLE_SELECTOR = [
|
|
3
|
+
"a[href]",
|
|
4
|
+
"button:not([disabled])",
|
|
5
|
+
"input:not([disabled])",
|
|
6
|
+
"select:not([disabled])",
|
|
7
|
+
"textarea:not([disabled])",
|
|
8
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
9
|
+
].join(", ");
|
|
10
|
+
export function useFocusTrap(ref, active) {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!active || !ref.current)
|
|
13
|
+
return;
|
|
14
|
+
const container = ref.current;
|
|
15
|
+
const previouslyFocused = document.activeElement;
|
|
16
|
+
const getFocusable = () => Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
17
|
+
// Focus first element on activation
|
|
18
|
+
const focusable = getFocusable();
|
|
19
|
+
if (focusable.length > 0) {
|
|
20
|
+
focusable[0].focus();
|
|
21
|
+
}
|
|
22
|
+
const handleKeyDown = (e) => {
|
|
23
|
+
if (e.key !== "Tab")
|
|
24
|
+
return;
|
|
25
|
+
const elements = getFocusable();
|
|
26
|
+
if (elements.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
const first = elements[0];
|
|
29
|
+
const last = elements[elements.length - 1];
|
|
30
|
+
if (e.shiftKey) {
|
|
31
|
+
if (document.activeElement === first) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
last.focus();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (document.activeElement === last) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
first.focus();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
container.addEventListener("keydown", handleKeyDown);
|
|
44
|
+
return () => {
|
|
45
|
+
container.removeEventListener("keydown", handleKeyDown);
|
|
46
|
+
if (previouslyFocused && document.body.contains(previouslyFocused)) {
|
|
47
|
+
previouslyFocused.focus();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}, [active, ref]);
|
|
51
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type QueueItem } from "../media/queue";
|
|
2
|
+
import type { MediaManifest } from "../media/types";
|
|
3
|
+
import type { SiteConfig } from "../schemas/site-config";
|
|
4
|
+
import type { SectionContent } from "../schemas/sections";
|
|
5
|
+
import type { LoadedSection } from "../lib/loader";
|
|
6
|
+
import type { MediaLibraryContextValue } from "../components/shell/MediaLibraryContext";
|
|
7
|
+
interface UseMediaPipelineInput {
|
|
8
|
+
siteConfig: SiteConfig | null;
|
|
9
|
+
mediaManifest: MediaManifest;
|
|
10
|
+
setMediaManifest: React.Dispatch<React.SetStateAction<MediaManifest>>;
|
|
11
|
+
sections: LoadedSection[];
|
|
12
|
+
setSections: React.Dispatch<React.SetStateAction<LoadedSection[]>>;
|
|
13
|
+
setLocalChangesExist: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
|
+
setDirtySectionIds: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
15
|
+
markSectionDirty: (sectionId: string, content: SectionContent) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function useMediaPipeline({ siteConfig, mediaManifest, setMediaManifest, sections, setSections, setLocalChangesExist, setDirtySectionIds, markSectionDirty, }: UseMediaPipelineInput): {
|
|
18
|
+
processingItems: QueueItem[];
|
|
19
|
+
pendingMediaItems: {
|
|
20
|
+
id: string;
|
|
21
|
+
hash: string;
|
|
22
|
+
kind: "image" | "video" | "animated";
|
|
23
|
+
originalName: string;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
mimeType: string;
|
|
27
|
+
size: number;
|
|
28
|
+
folder: string;
|
|
29
|
+
variants: {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
size: number;
|
|
33
|
+
}[];
|
|
34
|
+
alt: string;
|
|
35
|
+
}[];
|
|
36
|
+
setPendingMediaItems: import("react").Dispatch<import("react").SetStateAction<{
|
|
37
|
+
id: string;
|
|
38
|
+
hash: string;
|
|
39
|
+
kind: "image" | "video" | "animated";
|
|
40
|
+
originalName: string;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
mimeType: string;
|
|
44
|
+
size: number;
|
|
45
|
+
folder: string;
|
|
46
|
+
variants: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
size: number;
|
|
50
|
+
}[];
|
|
51
|
+
alt: string;
|
|
52
|
+
}[]>>;
|
|
53
|
+
pendingLocalUrls: Record<string, string>;
|
|
54
|
+
setPendingLocalUrls: import("react").Dispatch<import("react").SetStateAction<Record<string, string>>>;
|
|
55
|
+
pendingDeletions: string[];
|
|
56
|
+
setPendingDeletions: import("react").Dispatch<import("react").SetStateAction<string[]>>;
|
|
57
|
+
handleMediaUpload: (files: File[]) => Promise<void>;
|
|
58
|
+
handleMediaDelete: (ids: string[]) => Promise<void>;
|
|
59
|
+
handleMediaAltChange: (id: string, alt: string) => void;
|
|
60
|
+
referenceCountMap: Record<string, number>;
|
|
61
|
+
contextValue: MediaLibraryContextValue;
|
|
62
|
+
enqueueFile: (file: File, onComplete?: (imageId: string) => void) => void;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=useMediaPipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaPipeline.d.ts","sourceRoot":"","sources":["../../src/hooks/useMediaPipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAwBxF,UAAU,qBAAqB;IAC7B,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IACtE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IACnE,oBAAoB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtE,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,GACjB,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA8G8B,IAAI,EAAE;6BAwBR,MAAM,EAAE;+BAuBZ,MAAM,OAAO,MAAM;;;wBA+B1B,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;EAqEpF"}
|