@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,219 @@
|
|
|
1
|
+
import type { MediaReference } from "../../../schemas/shared";
|
|
2
|
+
import type { SectionContent } from "../../../schemas/sections";
|
|
3
|
+
import { cn } from "../../../lib/cn";
|
|
4
|
+
import { gridColsClass } from "../../../lib/grid";
|
|
5
|
+
import { EditableGrid } from "../../primitives/EditableGrid";
|
|
6
|
+
import { ResolvedMedia } from "../../primitives/ResolvedMedia";
|
|
7
|
+
import { ImageSettingsForm, DoDontImageSettingsForm } from "../../primitives/MediaSettingsForms";
|
|
8
|
+
import { EditablePlainText } from "../../primitives/EditablePlainText";
|
|
9
|
+
import type { ReactNode } from "react";
|
|
10
|
+
import { Check, X } from "lucide-react";
|
|
11
|
+
import { useMediaLibrary } from "../../shell/MediaLibraryContext";
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
media: MediaReference[];
|
|
15
|
+
columns: number;
|
|
16
|
+
square?: boolean;
|
|
17
|
+
border?: boolean;
|
|
18
|
+
crop?: boolean;
|
|
19
|
+
showCaptions?: boolean;
|
|
20
|
+
sectionType?: string;
|
|
21
|
+
onChange?: (content: SectionContent) => void;
|
|
22
|
+
openModal?: (title: string, content: ReactNode) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function MediaGrid({ media, columns, square, border, crop, showCaptions, sectionType, onChange, openModal }: Props) {
|
|
26
|
+
if (onChange && openModal) {
|
|
27
|
+
return (
|
|
28
|
+
<MediaGridEditable
|
|
29
|
+
media={media}
|
|
30
|
+
columns={columns}
|
|
31
|
+
square={square}
|
|
32
|
+
border={border}
|
|
33
|
+
crop={crop}
|
|
34
|
+
showCaptions={showCaptions}
|
|
35
|
+
sectionType={sectionType}
|
|
36
|
+
onChange={onChange}
|
|
37
|
+
openModal={openModal}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className={cn("grid gap-4", gridColsClass[columns] || "grid-cols-1")}>
|
|
44
|
+
{media.map((item, i) => (
|
|
45
|
+
<MediaGridItem
|
|
46
|
+
key={i}
|
|
47
|
+
item={item}
|
|
48
|
+
isEditMode={false}
|
|
49
|
+
square={square}
|
|
50
|
+
border={border}
|
|
51
|
+
crop={crop}
|
|
52
|
+
showCaptions={showCaptions}
|
|
53
|
+
/>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function MediaGridEditable({ media, columns, square, border, crop, showCaptions, sectionType = "media_grid", onChange, openModal }: Props & { onChange: (content: SectionContent) => void; openModal: (title: string, content: ReactNode) => void }) {
|
|
60
|
+
const mediaLibrary = useMediaLibrary();
|
|
61
|
+
|
|
62
|
+
const opts = square || border || crop || showCaptions
|
|
63
|
+
? { options: { square, border, crop, showCaptions } }
|
|
64
|
+
: {};
|
|
65
|
+
|
|
66
|
+
const createItem = (): MediaReference =>
|
|
67
|
+
sectionType === "do_dont_grid"
|
|
68
|
+
? { type: "doDontImage", imageId: "", doDont: "do" }
|
|
69
|
+
: { type: "image", imageId: "" };
|
|
70
|
+
|
|
71
|
+
const handleItemSettings = (index: number) => {
|
|
72
|
+
const item = media[index];
|
|
73
|
+
|
|
74
|
+
if (item.type === "doDontImage") {
|
|
75
|
+
openModal(
|
|
76
|
+
"Image Settings",
|
|
77
|
+
<DoDontImageSettingsForm
|
|
78
|
+
border={item.border}
|
|
79
|
+
objectFit={item.objectFit}
|
|
80
|
+
doDont={item.doDont}
|
|
81
|
+
onChange={(updated) => {
|
|
82
|
+
const newMedia = media.map((m, i) => i === index ? { ...m, ...updated } : m);
|
|
83
|
+
onChange({ type: sectionType, content: { columns, media: newMedia }, ...opts } as SectionContent);
|
|
84
|
+
}}
|
|
85
|
+
/>,
|
|
86
|
+
);
|
|
87
|
+
} else {
|
|
88
|
+
openModal(
|
|
89
|
+
"Image Settings",
|
|
90
|
+
<ImageSettingsForm
|
|
91
|
+
border={item.border}
|
|
92
|
+
objectFit={item.objectFit}
|
|
93
|
+
onChange={(updated) => {
|
|
94
|
+
const newMedia = media.map((m, i) => i === index ? { ...m, ...updated } : m);
|
|
95
|
+
onChange({ type: sectionType, content: { columns, media: newMedia }, ...opts } as SectionContent);
|
|
96
|
+
}}
|
|
97
|
+
/>,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const handleItemImageClick = (index: number) => {
|
|
103
|
+
mediaLibrary?.openSelectModal((imageId) => {
|
|
104
|
+
const newMedia = media.map((m, i) => i === index ? { ...m, imageId } : m);
|
|
105
|
+
onChange({ type: sectionType, content: { columns, media: newMedia }, ...opts } as SectionContent);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<EditableGrid
|
|
111
|
+
items={media}
|
|
112
|
+
columns={columns}
|
|
113
|
+
onChange={(newMedia) =>
|
|
114
|
+
onChange({ type: sectionType, content: { columns, media: newMedia as MediaReference[] }, ...opts } as SectionContent)
|
|
115
|
+
}
|
|
116
|
+
createItem={createItem}
|
|
117
|
+
isEditMode={true}
|
|
118
|
+
onItemSettings={handleItemSettings}
|
|
119
|
+
onItemImageClick={mediaLibrary ? handleItemImageClick : undefined}
|
|
120
|
+
chromeTopClass={sectionType === "do_dont_grid" ? "top-[50px]" : undefined}
|
|
121
|
+
renderItem={(item, { isEditMode, index }) => (
|
|
122
|
+
<MediaGridItem
|
|
123
|
+
item={item}
|
|
124
|
+
isEditMode={isEditMode}
|
|
125
|
+
square={square}
|
|
126
|
+
border={border}
|
|
127
|
+
crop={crop}
|
|
128
|
+
showCaptions={showCaptions}
|
|
129
|
+
onCaptionChange={(caption) => {
|
|
130
|
+
const newMedia = media.map((m, i) => i === index ? { ...m, caption: caption || undefined } : m);
|
|
131
|
+
onChange({ type: sectionType, content: { columns, media: newMedia }, ...opts } as SectionContent);
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
)}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function MediaGridItem({
|
|
140
|
+
item,
|
|
141
|
+
isEditMode,
|
|
142
|
+
square,
|
|
143
|
+
border,
|
|
144
|
+
crop,
|
|
145
|
+
showCaptions,
|
|
146
|
+
onCaptionChange,
|
|
147
|
+
}: {
|
|
148
|
+
item: MediaReference;
|
|
149
|
+
isEditMode: boolean;
|
|
150
|
+
square?: boolean;
|
|
151
|
+
border?: boolean;
|
|
152
|
+
crop?: boolean;
|
|
153
|
+
showCaptions?: boolean;
|
|
154
|
+
onCaptionChange?: (caption: string) => void;
|
|
155
|
+
}) {
|
|
156
|
+
const isDoDont = item.type === "doDontImage";
|
|
157
|
+
|
|
158
|
+
const showBorder = item.border ?? border;
|
|
159
|
+
const itemFit = item.objectFit ?? (crop ? "cover" : undefined);
|
|
160
|
+
|
|
161
|
+
const fitClass = itemFit === "cover" ? "object-cover" : "object-contain";
|
|
162
|
+
|
|
163
|
+
const captionStr = item.caption
|
|
164
|
+
? (Array.isArray(item.caption) ? item.caption.join("\n") : item.caption)
|
|
165
|
+
: "";
|
|
166
|
+
|
|
167
|
+
const media = (
|
|
168
|
+
<ResolvedMedia
|
|
169
|
+
imageId={item.imageId || undefined}
|
|
170
|
+
className="h-full w-full"
|
|
171
|
+
imgClassName={fitClass}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<figure>
|
|
177
|
+
{isDoDont && (
|
|
178
|
+
<div className="flex h-10 items-center justify-center pb-1">
|
|
179
|
+
{item.doDont === "do"
|
|
180
|
+
? <Check size={28} className="text-green-600" />
|
|
181
|
+
: <X size={28} className="text-red-600" />
|
|
182
|
+
}
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
<div className={cn(
|
|
187
|
+
"overflow-hidden rounded-md",
|
|
188
|
+
showBorder && "border border-base-200",
|
|
189
|
+
square && "aspect-square",
|
|
190
|
+
)}>
|
|
191
|
+
{item.type === "linkedImage" && !isEditMode ? (
|
|
192
|
+
<a href={item.href} target={item.target} className="group block">
|
|
193
|
+
{media}
|
|
194
|
+
{item.linkText && (
|
|
195
|
+
<span className="mt-2 block text-sm text-primary group-hover:underline">{item.linkText}</span>
|
|
196
|
+
)}
|
|
197
|
+
</a>
|
|
198
|
+
) : media}
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
{showCaptions && (
|
|
202
|
+
<figcaption className="mt-2 min-h-[1em] text-sm text-base-contrast-light">
|
|
203
|
+
{isEditMode && onCaptionChange ? (
|
|
204
|
+
<EditablePlainText
|
|
205
|
+
tag="span"
|
|
206
|
+
value={captionStr}
|
|
207
|
+
onChange={onCaptionChange}
|
|
208
|
+
isEditMode={true}
|
|
209
|
+
placeholder="Caption"
|
|
210
|
+
className="block min-h-[1em]"
|
|
211
|
+
/>
|
|
212
|
+
) : (
|
|
213
|
+
captionStr || " "
|
|
214
|
+
)}
|
|
215
|
+
</figcaption>
|
|
216
|
+
)}
|
|
217
|
+
</figure>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineSection } from "../../../lib/registry";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { MediaReferenceSchema } from "../../../schemas/shared";
|
|
4
|
+
import { MediaGridOptionsSchema } from "../../../schemas/media-grid-options";
|
|
5
|
+
import MediaGrid from "./MediaGrid";
|
|
6
|
+
|
|
7
|
+
const schema = z.object({
|
|
8
|
+
type: z.literal("media_grid"),
|
|
9
|
+
content: z.object({
|
|
10
|
+
columns: z.number().int().min(1).max(5),
|
|
11
|
+
media: z.array(MediaReferenceSchema),
|
|
12
|
+
}),
|
|
13
|
+
options: MediaGridOptionsSchema,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default defineSection({
|
|
17
|
+
type: "media_grid",
|
|
18
|
+
label: "Media Grid",
|
|
19
|
+
schema,
|
|
20
|
+
component: ({ content, options, onChange, openModal }) => (
|
|
21
|
+
<MediaGrid
|
|
22
|
+
media={content.content.media}
|
|
23
|
+
columns={content.content.columns}
|
|
24
|
+
square={options?.square as boolean}
|
|
25
|
+
border={options?.border as boolean}
|
|
26
|
+
crop={options?.crop as boolean}
|
|
27
|
+
showCaptions={options?.showCaptions as boolean}
|
|
28
|
+
onChange={onChange ? (c) => onChange(c as typeof content) : undefined}
|
|
29
|
+
openModal={openModal}
|
|
30
|
+
/>
|
|
31
|
+
),
|
|
32
|
+
defaults: () => ({
|
|
33
|
+
type: "media_grid" as const,
|
|
34
|
+
content: { columns: 2, media: [{ type: "image" as const, imageId: "" }] },
|
|
35
|
+
options: {},
|
|
36
|
+
}),
|
|
37
|
+
settings: {
|
|
38
|
+
columns: {
|
|
39
|
+
type: "select", label: "Columns", default: "2", target: "content", coerce: "number",
|
|
40
|
+
options: [{ label: "1", value: "1" }, { label: "2", value: "2" }, { label: "3", value: "3" }, { label: "4", value: "4" }],
|
|
41
|
+
},
|
|
42
|
+
border: { type: "checkbox", label: "Show border", default: false },
|
|
43
|
+
square: { type: "checkbox", label: "Square aspect ratio", default: false },
|
|
44
|
+
crop: { type: "checkbox", label: "Crop to fill", default: false },
|
|
45
|
+
showCaptions: { type: "checkbox", label: "Show captions", default: false },
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EditableRichText } from "../../primitives/EditableRichText";
|
|
2
|
+
import { sanitizeHtml } from "../../../lib/sanitize";
|
|
3
|
+
import type { SectionContent } from "../../../schemas/sections";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
body: string;
|
|
7
|
+
onChange?: (content: SectionContent) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Prose({ body, onChange }: Props) {
|
|
11
|
+
if (onChange) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="prose-content">
|
|
14
|
+
<EditableRichText
|
|
15
|
+
value={body}
|
|
16
|
+
onChange={(html) =>
|
|
17
|
+
onChange({ type: "prose", content: { body: html } })
|
|
18
|
+
}
|
|
19
|
+
isEditMode={true}
|
|
20
|
+
preset="rich"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// View mode: renders server-side via Astro SSR; content comes from trusted project JSON files.
|
|
27
|
+
// eslint-disable-next-line react/no-danger
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className="prose-content"
|
|
31
|
+
dangerouslySetInnerHTML={{ __html: sanitizeHtml(body) }}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineSection } from "../../../lib/registry";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import Prose from "./Prose";
|
|
4
|
+
|
|
5
|
+
const schema = z.object({
|
|
6
|
+
type: z.literal("prose"),
|
|
7
|
+
content: z.object({ body: z.string() }),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default defineSection({
|
|
11
|
+
type: "prose",
|
|
12
|
+
label: "Prose",
|
|
13
|
+
schema,
|
|
14
|
+
component: ({ content, onChange }) => (
|
|
15
|
+
<Prose body={content.content.body} onChange={onChange ? (c) => onChange(c as typeof content) : undefined} />
|
|
16
|
+
),
|
|
17
|
+
defaults: () => ({ type: "prose" as const, content: { body: "<p></p>" } }),
|
|
18
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/cn";
|
|
3
|
+
|
|
4
|
+
const categoryMap: Record<string, string> = {
|
|
5
|
+
link_heading: "section-heading",
|
|
6
|
+
sub_heading: "section-subheading",
|
|
7
|
+
sub_sub_heading: "section-subheading",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function getSectionCategory(type: string): string {
|
|
11
|
+
return categoryMap[type] ?? "section-content";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
type: string;
|
|
16
|
+
status?: string;
|
|
17
|
+
dimNonPublished?: boolean;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function SectionLayout({ type, status, dimNonPublished, children }: Props) {
|
|
22
|
+
const isDimmed = dimNonPublished && status && status !== "published";
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={cn("section-wrapper group", getSectionCategory(type), isDimmed && "opacity-50")}>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { getSectionCategory };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { cn } from "../../../lib/cn";
|
|
2
|
+
import { sanitizeHtml } from "../../../lib/sanitize";
|
|
3
|
+
import { ResolvedMedia } from "../../primitives/ResolvedMedia";
|
|
4
|
+
import { EditableRichText } from "../../primitives/EditableRichText";
|
|
5
|
+
import { IconButton } from "../../shared/IconButton";
|
|
6
|
+
import type { SectionContent } from "../../../schemas/sections";
|
|
7
|
+
import { useMediaLibrary } from "../../shell/MediaLibraryContext";
|
|
8
|
+
import { ImageIcon } from "lucide-react";
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
imageId: string | undefined;
|
|
12
|
+
body: string;
|
|
13
|
+
border?: boolean;
|
|
14
|
+
imagePosition?: "left" | "right";
|
|
15
|
+
onChange?: (content: SectionContent) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function SplitContent({ imageId, body, border, imagePosition = "left", onChange }: Props) {
|
|
19
|
+
const mediaLibrary = useMediaLibrary();
|
|
20
|
+
|
|
21
|
+
const handleImageChange = (newImageId: string) => {
|
|
22
|
+
onChange?.({
|
|
23
|
+
type: "split_content",
|
|
24
|
+
content: { imageId: newImageId, body },
|
|
25
|
+
options: { border, imagePosition },
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleBodyChange = (html: string) => {
|
|
30
|
+
onChange?.({
|
|
31
|
+
type: "split_content",
|
|
32
|
+
content: { imageId, body: html },
|
|
33
|
+
options: { border, imagePosition },
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleImageClick = () => {
|
|
38
|
+
mediaLibrary?.openSelectModal(handleImageChange);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className={cn(
|
|
43
|
+
"flex flex-col gap-6 lg:flex-row lg:items-start",
|
|
44
|
+
imagePosition === "right" && "lg:flex-row-reverse",
|
|
45
|
+
)}>
|
|
46
|
+
<div className={cn("group/img relative flex-shrink-0 lg:w-1/2", border && "overflow-hidden rounded-md border border-base-200")}>
|
|
47
|
+
<ResolvedMedia
|
|
48
|
+
imageId={imageId}
|
|
49
|
+
className="w-full"
|
|
50
|
+
/>
|
|
51
|
+
{onChange && mediaLibrary && (
|
|
52
|
+
<div className="absolute top-1.5 right-1.5 z-10 opacity-0 transition-opacity group-hover/img:opacity-100">
|
|
53
|
+
<IconButton
|
|
54
|
+
icon={<ImageIcon size={16} />}
|
|
55
|
+
label="Change image"
|
|
56
|
+
onClick={handleImageClick}
|
|
57
|
+
className="bg-base/80 shadow-sm"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
<div className="prose-content lg:w-1/2">
|
|
63
|
+
{onChange ? (
|
|
64
|
+
<EditableRichText
|
|
65
|
+
value={body}
|
|
66
|
+
onChange={handleBodyChange}
|
|
67
|
+
isEditMode={true}
|
|
68
|
+
preset="rich"
|
|
69
|
+
/>
|
|
70
|
+
) : (
|
|
71
|
+
// eslint-disable-next-line react/no-danger
|
|
72
|
+
<div dangerouslySetInnerHTML={{ __html: sanitizeHtml(body) }} />
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Select } from "../../shared/Select";
|
|
3
|
+
import { Checkbox } from "../../shared/Checkbox";
|
|
4
|
+
|
|
5
|
+
export function SplitContentSettings({
|
|
6
|
+
imagePosition: initialPos,
|
|
7
|
+
border: initialBorder,
|
|
8
|
+
onChange,
|
|
9
|
+
}: {
|
|
10
|
+
imagePosition: "left" | "right";
|
|
11
|
+
border: boolean;
|
|
12
|
+
onChange: (values: { imagePosition: "left" | "right"; border: boolean }) => void;
|
|
13
|
+
}) {
|
|
14
|
+
const [imagePosition, setImagePosition] = useState(initialPos);
|
|
15
|
+
const [border, setBorder] = useState(initialBorder);
|
|
16
|
+
|
|
17
|
+
const emit = (overrides: Partial<{ imagePosition: "left" | "right"; border: boolean }>) =>
|
|
18
|
+
onChange({ imagePosition, border, ...overrides });
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className="space-y-4">
|
|
22
|
+
<Select
|
|
23
|
+
label="Image Position"
|
|
24
|
+
value={imagePosition}
|
|
25
|
+
onChange={(val) => {
|
|
26
|
+
const v = val as "left" | "right";
|
|
27
|
+
setImagePosition(v);
|
|
28
|
+
emit({ imagePosition: v });
|
|
29
|
+
}}
|
|
30
|
+
options={[
|
|
31
|
+
{ value: "left", label: "Left" },
|
|
32
|
+
{ value: "right", label: "Right" },
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
<Checkbox
|
|
36
|
+
checked={border}
|
|
37
|
+
onChange={(v) => { setBorder(v); emit({ border: v }); }}
|
|
38
|
+
label="Show border"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineSection } from "../../../lib/registry";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import SplitContent from "./SplitContent";
|
|
4
|
+
import { SplitContentSettings } from "./SplitContentSettings";
|
|
5
|
+
|
|
6
|
+
const schema = z.object({
|
|
7
|
+
type: z.literal("split_content"),
|
|
8
|
+
content: z.object({
|
|
9
|
+
imageId: z.string().optional(),
|
|
10
|
+
body: z.string(),
|
|
11
|
+
}),
|
|
12
|
+
options: z.object({
|
|
13
|
+
border: z.boolean().optional(),
|
|
14
|
+
imagePosition: z.enum(["left", "right"]).optional(),
|
|
15
|
+
}).optional(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default defineSection({
|
|
19
|
+
type: "split_content",
|
|
20
|
+
label: "Split Content",
|
|
21
|
+
schema,
|
|
22
|
+
component: ({ content, options, onChange }) => (
|
|
23
|
+
<SplitContent
|
|
24
|
+
imageId={content.content.imageId as string | undefined}
|
|
25
|
+
body={content.content.body as string}
|
|
26
|
+
border={options?.border as boolean}
|
|
27
|
+
imagePosition={options?.imagePosition as "left" | "right"}
|
|
28
|
+
onChange={onChange ? (c) => onChange(c as typeof content) : undefined}
|
|
29
|
+
/>
|
|
30
|
+
),
|
|
31
|
+
defaults: () => ({
|
|
32
|
+
type: "split_content" as const,
|
|
33
|
+
content: { imageId: undefined, body: "<p></p>" },
|
|
34
|
+
}),
|
|
35
|
+
settingsForm: SplitContentSettings,
|
|
36
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineSection } from "../../../lib/registry";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { HeadingSection } from "../../primitives/HeadingSection";
|
|
4
|
+
|
|
5
|
+
const schema = z.object({
|
|
6
|
+
type: z.literal("sub_heading"),
|
|
7
|
+
content: z.object({ heading: z.string(), excludeFromNav: z.boolean().optional() }),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default defineSection({
|
|
11
|
+
type: "sub_heading",
|
|
12
|
+
label: "Sub Heading",
|
|
13
|
+
schema,
|
|
14
|
+
component: ({ content, onChange }) => (
|
|
15
|
+
<HeadingSection
|
|
16
|
+
heading={content.content.heading}
|
|
17
|
+
tag="h3"
|
|
18
|
+
placeholder="Sub heading"
|
|
19
|
+
className="text-base-contrast"
|
|
20
|
+
onChange={onChange ? (heading: string) => onChange({ ...content, content: { ...content.content, heading } }) : undefined}
|
|
21
|
+
/>
|
|
22
|
+
),
|
|
23
|
+
defaults: () => ({ type: "sub_heading" as const, content: { heading: "New Sub Heading" } }),
|
|
24
|
+
settings: {
|
|
25
|
+
excludeFromNav: { type: "checkbox", label: "Exclude from navigation", default: false, target: "content" },
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineSection } from "../../../lib/registry";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { HeadingSection } from "../../primitives/HeadingSection";
|
|
4
|
+
|
|
5
|
+
const schema = z.object({
|
|
6
|
+
type: z.literal("sub_sub_heading"),
|
|
7
|
+
content: z.object({ heading: z.string(), excludeFromNav: z.boolean().optional() }),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default defineSection({
|
|
11
|
+
type: "sub_sub_heading",
|
|
12
|
+
label: "Sub Sub Heading",
|
|
13
|
+
schema,
|
|
14
|
+
component: ({ content, onChange }) => (
|
|
15
|
+
<HeadingSection
|
|
16
|
+
heading={content.content.heading}
|
|
17
|
+
tag="h4"
|
|
18
|
+
placeholder="Sub sub heading"
|
|
19
|
+
className="text-lg font-bold text-base-contrast"
|
|
20
|
+
onChange={onChange ? (heading: string) => onChange({ ...content, content: { ...content.content, heading } }) : undefined}
|
|
21
|
+
/>
|
|
22
|
+
),
|
|
23
|
+
defaults: () => ({ type: "sub_sub_heading" as const, content: { heading: "New Sub Sub Heading" } }),
|
|
24
|
+
settings: {
|
|
25
|
+
excludeFromNav: { type: "checkbox", label: "Exclude from navigation", default: false, target: "content" },
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "./register";
|
|
2
|
+
import { getSection } from "../../lib/registry";
|
|
3
|
+
import { SectionLayout } from "./SectionLayout";
|
|
4
|
+
import type { LoadedSection } from "../../lib/loader";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
sections: LoadedSection[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function ViewRenderer({ sections }: Props) {
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
{sections.map(({ section, meta }) => {
|
|
14
|
+
const def = getSection(section.type);
|
|
15
|
+
if (!def) return null;
|
|
16
|
+
const Component = def.component;
|
|
17
|
+
return (
|
|
18
|
+
<SectionLayout key={section.id} type={section.type} status={meta.status} dimNonPublished>
|
|
19
|
+
<Component
|
|
20
|
+
content={section}
|
|
21
|
+
options={"options" in section ? (section.options as Record<string, unknown>) : undefined}
|
|
22
|
+
isEditMode={false}
|
|
23
|
+
/>
|
|
24
|
+
</SectionLayout>
|
|
25
|
+
);
|
|
26
|
+
})}
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { registerSchema } from "../../lib/registry";
|
|
2
|
+
import linkHeading from "./LinkHeading";
|
|
3
|
+
import subHeading from "./SubHeading";
|
|
4
|
+
import subSubHeading from "./SubSubHeading";
|
|
5
|
+
import prose from "./Prose";
|
|
6
|
+
import mediaGrid from "./MediaGrid";
|
|
7
|
+
import splitContent from "./SplitContent";
|
|
8
|
+
import button from "./Button";
|
|
9
|
+
import colors from "./Colors";
|
|
10
|
+
import doDontList from "./DoDontList";
|
|
11
|
+
import doDontImageGrid from "./DoDontMediaGrid";
|
|
12
|
+
import iconList from "./IconList";
|
|
13
|
+
|
|
14
|
+
[linkHeading, subHeading, subSubHeading, prose, mediaGrid,
|
|
15
|
+
splitContent, button, colors, doDontList, doDontImageGrid, iconList,
|
|
16
|
+
].forEach((def) => registerSchema(def.type, def.schema));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { registerSection } from "../../lib/registry";
|
|
2
|
+
import linkHeading from "./LinkHeading";
|
|
3
|
+
import subHeading from "./SubHeading";
|
|
4
|
+
import subSubHeading from "./SubSubHeading";
|
|
5
|
+
import prose from "./Prose";
|
|
6
|
+
import mediaGrid from "./MediaGrid";
|
|
7
|
+
import splitContent from "./SplitContent";
|
|
8
|
+
import button from "./Button";
|
|
9
|
+
import colors from "./Colors";
|
|
10
|
+
import doDontList from "./DoDontList";
|
|
11
|
+
import doDontImageGrid from "./DoDontMediaGrid";
|
|
12
|
+
import iconList from "./IconList";
|
|
13
|
+
|
|
14
|
+
[linkHeading, subHeading, subSubHeading, prose, mediaGrid,
|
|
15
|
+
splitContent, button, colors, doDontList, doDontImageGrid, iconList,
|
|
16
|
+
].forEach(registerSection);
|