@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,53 @@
|
|
|
1
|
+
export function generateVideoPoster(
|
|
2
|
+
blob: Blob,
|
|
3
|
+
quality: number,
|
|
4
|
+
): Promise<{ posterBlob: Blob; width: number; height: number }> {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const video = document.createElement("video");
|
|
7
|
+
const url = URL.createObjectURL(blob);
|
|
8
|
+
video.muted = true;
|
|
9
|
+
video.preload = "auto";
|
|
10
|
+
video.src = url;
|
|
11
|
+
|
|
12
|
+
const cleanup = () => {
|
|
13
|
+
URL.revokeObjectURL(url);
|
|
14
|
+
video.removeAttribute("src");
|
|
15
|
+
video.load();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
video.addEventListener("loadeddata", () => {
|
|
19
|
+
video.addEventListener("seeked", () => {
|
|
20
|
+
try {
|
|
21
|
+
const w = video.videoWidth;
|
|
22
|
+
const h = video.videoHeight;
|
|
23
|
+
const canvas = document.createElement("canvas");
|
|
24
|
+
canvas.width = w;
|
|
25
|
+
canvas.height = h;
|
|
26
|
+
const ctx = canvas.getContext("2d")!;
|
|
27
|
+
ctx.drawImage(video, 0, 0);
|
|
28
|
+
canvas.toBlob(
|
|
29
|
+
(posterBlob) => {
|
|
30
|
+
cleanup();
|
|
31
|
+
if (!posterBlob) {
|
|
32
|
+
reject(new Error("Failed to create poster blob"));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
resolve({ posterBlob, width: w, height: h });
|
|
36
|
+
},
|
|
37
|
+
"image/webp",
|
|
38
|
+
quality / 100,
|
|
39
|
+
);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
cleanup();
|
|
42
|
+
reject(err);
|
|
43
|
+
}
|
|
44
|
+
}, { once: true });
|
|
45
|
+
video.currentTime = isFinite(video.duration) ? Math.min(0.1, video.duration / 2) : 0;
|
|
46
|
+
}, { once: true });
|
|
47
|
+
|
|
48
|
+
video.addEventListener("error", () => {
|
|
49
|
+
cleanup();
|
|
50
|
+
reject(new Error("Failed to load video for poster generation"));
|
|
51
|
+
}, { once: true });
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
interface ProcessMessage {
|
|
2
|
+
type: "process";
|
|
3
|
+
id: string;
|
|
4
|
+
buffer: ArrayBuffer;
|
|
5
|
+
originalName: string;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
kind: "image" | "animated" | "video";
|
|
9
|
+
sizes: number[];
|
|
10
|
+
quality: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ProgressMessage {
|
|
14
|
+
type: "progress";
|
|
15
|
+
id: string;
|
|
16
|
+
percent: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface CompleteMessage {
|
|
20
|
+
type: "complete";
|
|
21
|
+
id: string;
|
|
22
|
+
variants: { width: number; height: number; size: number; blob: Blob }[];
|
|
23
|
+
primaryBlob: Blob;
|
|
24
|
+
posterBlob?: Blob;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ErrorMessage {
|
|
30
|
+
type: "error";
|
|
31
|
+
id: string;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
self.onmessage = async (e: MessageEvent<ProcessMessage>) => {
|
|
36
|
+
const msg = e.data;
|
|
37
|
+
if (msg.type !== "process") return;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const post = (data: ProgressMessage | CompleteMessage | ErrorMessage) =>
|
|
41
|
+
self.postMessage(data);
|
|
42
|
+
|
|
43
|
+
post({ type: "progress", id: msg.id, percent: 5 });
|
|
44
|
+
|
|
45
|
+
if (msg.kind === "animated" || msg.kind === "video") {
|
|
46
|
+
const primaryBlob = new Blob([msg.buffer], { type: msg.mimeType });
|
|
47
|
+
let posterBlob: Blob | undefined;
|
|
48
|
+
let width = 0;
|
|
49
|
+
let height = 0;
|
|
50
|
+
|
|
51
|
+
if (msg.kind === "animated") {
|
|
52
|
+
const bitmap = await createImageBitmap(primaryBlob);
|
|
53
|
+
width = bitmap.width;
|
|
54
|
+
height = bitmap.height;
|
|
55
|
+
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
|
|
56
|
+
const ctx = canvas.getContext("2d")!;
|
|
57
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
58
|
+
posterBlob = await canvas.convertToBlob({ type: "image/webp", quality: msg.quality / 100 });
|
|
59
|
+
bitmap.close();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (msg.kind === "video") {
|
|
63
|
+
width = 0;
|
|
64
|
+
height = 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
post({ type: "progress", id: msg.id, percent: 100 });
|
|
68
|
+
post({ type: "complete", id: msg.id, variants: [], primaryBlob, posterBlob, width, height });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Static image processing
|
|
73
|
+
const originalBlob = new Blob([msg.buffer], { type: msg.mimeType });
|
|
74
|
+
const bitmap = await createImageBitmap(originalBlob);
|
|
75
|
+
const origWidth = bitmap.width;
|
|
76
|
+
const origHeight = bitmap.height;
|
|
77
|
+
|
|
78
|
+
post({ type: "progress", id: msg.id, percent: 25 });
|
|
79
|
+
|
|
80
|
+
const applicableSizes = msg.sizes
|
|
81
|
+
.filter((s) => s <= origWidth)
|
|
82
|
+
.sort((a, b) => b - a);
|
|
83
|
+
|
|
84
|
+
if (applicableSizes.length === 0) {
|
|
85
|
+
applicableSizes.push(origWidth);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const variants: { width: number; height: number; size: number; blob: Blob }[] = [];
|
|
89
|
+
const totalVariants = applicableSizes.length;
|
|
90
|
+
|
|
91
|
+
for (let i = 0; i < applicableSizes.length; i++) {
|
|
92
|
+
const targetWidth = applicableSizes[i];
|
|
93
|
+
const scale = targetWidth / origWidth;
|
|
94
|
+
const targetHeight = Math.round(origHeight * scale);
|
|
95
|
+
|
|
96
|
+
const canvas = new OffscreenCanvas(targetWidth, targetHeight);
|
|
97
|
+
const ctx = canvas.getContext("2d")!;
|
|
98
|
+
ctx.drawImage(bitmap, 0, 0, targetWidth, targetHeight);
|
|
99
|
+
|
|
100
|
+
const blob = await canvas.convertToBlob({ type: "image/webp", quality: msg.quality / 100 });
|
|
101
|
+
variants.push({ width: targetWidth, height: targetHeight, size: blob.size, blob });
|
|
102
|
+
|
|
103
|
+
const percent = 25 + Math.round(((i + 1) / totalVariants) * 75);
|
|
104
|
+
post({ type: "progress", id: msg.id, percent });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
bitmap.close();
|
|
108
|
+
|
|
109
|
+
const primaryBlob = variants[0]?.blob ?? originalBlob;
|
|
110
|
+
post({
|
|
111
|
+
type: "complete",
|
|
112
|
+
id: msg.id,
|
|
113
|
+
variants,
|
|
114
|
+
primaryBlob,
|
|
115
|
+
width: origWidth,
|
|
116
|
+
height: origHeight,
|
|
117
|
+
});
|
|
118
|
+
} catch (err) {
|
|
119
|
+
const message = err instanceof Error ? err.message : "Processing failed";
|
|
120
|
+
self.postMessage({ type: "error", id: msg.id, message });
|
|
121
|
+
}
|
|
122
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { HexColorSchema } from "./shared";
|
|
3
|
+
|
|
4
|
+
export const AudienceNameSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.max(32)
|
|
8
|
+
.regex(
|
|
9
|
+
/^[a-z0-9]([a-z0-9_-]*[a-z0-9])?$/,
|
|
10
|
+
"lowercase alphanumeric, dashes and underscores allowed",
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const AudienceColorSchema = HexColorSchema.nullable();
|
|
14
|
+
|
|
15
|
+
export type AudienceName = z.infer<typeof AudienceNameSchema>;
|
|
16
|
+
export type AudienceColor = z.infer<typeof AudienceColorSchema>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Convert a friendly display string into an audience slug.
|
|
20
|
+
* Lowercases, replaces non-alphanumeric runs with single dashes,
|
|
21
|
+
* strips leading/trailing dashes. Result must pass AudienceNameSchema.
|
|
22
|
+
*/
|
|
23
|
+
export function slugifyAudienceName(input: string): string {
|
|
24
|
+
return input
|
|
25
|
+
.toLowerCase()
|
|
26
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
27
|
+
.replace(/^-+|-+$/g, "");
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const RoleSchema = z.enum(["owner", "editor"]);
|
|
4
|
+
|
|
5
|
+
export const SessionSchema = z.object({
|
|
6
|
+
userId: z.string().nullable(),
|
|
7
|
+
email: z.string().nullable(),
|
|
8
|
+
role: RoleSchema,
|
|
9
|
+
siteId: z.string(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const SiteUserSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
email: z.string(),
|
|
15
|
+
role: RoleSchema,
|
|
16
|
+
createdAt: z.string(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const AudienceSchema = z.object({
|
|
20
|
+
name: z.string(),
|
|
21
|
+
displayName: z.string(),
|
|
22
|
+
color: z.string().nullable(),
|
|
23
|
+
readonly: z.boolean(),
|
|
24
|
+
hasPassword: z.boolean(),
|
|
25
|
+
isDefault: z.boolean(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type Session = z.infer<typeof SessionSchema>;
|
|
29
|
+
export type SiteUser = z.infer<typeof SiteUserSchema>;
|
|
30
|
+
export type Audience = z.infer<typeof AudienceSchema>;
|
|
31
|
+
export type Role = z.infer<typeof RoleSchema>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VariantSchema = z.object({
|
|
4
|
+
width: z.number().int().positive(),
|
|
5
|
+
height: z.number().int().positive(),
|
|
6
|
+
size: z.number().int().nonnegative(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Variant = z.infer<typeof VariantSchema>;
|
|
10
|
+
|
|
11
|
+
export const MediaItemSchema = z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
hash: z.string(),
|
|
14
|
+
kind: z.enum(["image", "animated", "video"]),
|
|
15
|
+
originalName: z.string(),
|
|
16
|
+
width: z.number().int().positive(),
|
|
17
|
+
height: z.number().int().positive(),
|
|
18
|
+
mimeType: z.string(),
|
|
19
|
+
size: z.number().int().nonnegative(),
|
|
20
|
+
folder: z.string(),
|
|
21
|
+
variants: z.array(VariantSchema),
|
|
22
|
+
alt: z.string().default(""),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type MediaItem = z.infer<typeof MediaItemSchema>;
|
|
26
|
+
|
|
27
|
+
export const ImageManifestSchema = z.object({
|
|
28
|
+
images: z.record(z.string(), MediaItemSchema),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type MediaManifest = z.infer<typeof ImageManifestSchema>;
|
|
32
|
+
|
|
33
|
+
export const MediaConfigSchema = z.object({
|
|
34
|
+
adapter: z.enum(["github"]).default("github"),
|
|
35
|
+
sizes: z.array(z.number()).default([640, 1080, 1920]),
|
|
36
|
+
maxFileSize: z.number().default(5242880),
|
|
37
|
+
quality: z.number().min(1).max(100).default(85),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export type MediaConfig = z.infer<typeof MediaConfigSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getAllSchemas } from "../lib/registry";
|
|
3
|
+
|
|
4
|
+
export interface SectionContent<C = Record<string, unknown>> {
|
|
5
|
+
type: string;
|
|
6
|
+
content: C;
|
|
7
|
+
options?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Section<C = Record<string, unknown>> extends SectionContent<C> {
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getSectionContentSchema(): z.ZodType<SectionContent> {
|
|
15
|
+
const schemas = getAllSchemas() as [z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]];
|
|
16
|
+
if (schemas.length < 2) {
|
|
17
|
+
throw new Error("At least 2 section schemas must be registered before validation");
|
|
18
|
+
}
|
|
19
|
+
return z.union(schemas) as z.ZodType<SectionContent>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getSectionSchema(): z.ZodType<Section> {
|
|
23
|
+
return z.object({ id: z.string() }).and(getSectionContentSchema()) as z.ZodType<Section>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// --- Text ---
|
|
4
|
+
const TextHeadingLine = z.object({
|
|
5
|
+
type: z.literal("heading"),
|
|
6
|
+
text: z.string(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const TextParagraphLine = z.object({
|
|
10
|
+
type: z.enum(["paragraph", "paragraph_large"]),
|
|
11
|
+
text: z.string(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const TextLabelValueLine = z.object({
|
|
15
|
+
type: z.literal("label_value"),
|
|
16
|
+
label: z.string(),
|
|
17
|
+
text: z.string(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const TextListItemLine = z.object({
|
|
21
|
+
type: z.enum(["list_item_unordered", "list_item_ordered"]),
|
|
22
|
+
text: z.string(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const TextLineSchema = z.discriminatedUnion("type", [
|
|
26
|
+
TextHeadingLine,
|
|
27
|
+
TextParagraphLine,
|
|
28
|
+
TextLabelValueLine,
|
|
29
|
+
TextListItemLine,
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export type TextLine = z.infer<typeof TextLineSchema>;
|
|
33
|
+
|
|
34
|
+
// --- Media References ---
|
|
35
|
+
const BaseMediaRef = z.object({
|
|
36
|
+
imageId: z.string().default(""),
|
|
37
|
+
caption: z.union([z.string(), z.array(z.string())]).optional(),
|
|
38
|
+
background: z.string().optional(),
|
|
39
|
+
invertFrom: z.string().optional(),
|
|
40
|
+
border: z.boolean().optional(),
|
|
41
|
+
objectFit: z.enum(["cover", "contain"]).optional(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const ImageRef = BaseMediaRef.extend({
|
|
45
|
+
type: z.literal("image"),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const VideoRef = BaseMediaRef.extend({
|
|
49
|
+
type: z.literal("video"),
|
|
50
|
+
poster: z.string().optional(),
|
|
51
|
+
autoplay: z.boolean().optional(),
|
|
52
|
+
loop: z.boolean().optional(),
|
|
53
|
+
muted: z.boolean().optional(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const DoDontImageRef = BaseMediaRef.extend({
|
|
57
|
+
type: z.literal("doDontImage"),
|
|
58
|
+
doDont: z.enum(["do", "dont"]),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const LinkedImageRef = BaseMediaRef.extend({
|
|
62
|
+
type: z.literal("linkedImage"),
|
|
63
|
+
href: z.string(),
|
|
64
|
+
target: z.string().optional(),
|
|
65
|
+
linkText: z.string().optional(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const MediaReferenceSchema = z.discriminatedUnion("type", [
|
|
69
|
+
ImageRef, VideoRef, DoDontImageRef, LinkedImageRef,
|
|
70
|
+
]);
|
|
71
|
+
|
|
72
|
+
export type MediaReference = z.infer<typeof MediaReferenceSchema>;
|
|
73
|
+
|
|
74
|
+
// --- Colors ---
|
|
75
|
+
export const HexColorSchema = z
|
|
76
|
+
.string()
|
|
77
|
+
.regex(/^#[0-9a-fA-F]{6}$/, "must be a 6-digit hex color");
|
|
78
|
+
|
|
79
|
+
export const ColorSpaceSchema = z.object({
|
|
80
|
+
hex: HexColorSchema.optional(),
|
|
81
|
+
rgb: z.string().optional(),
|
|
82
|
+
cmyk: z.string().optional(),
|
|
83
|
+
pantone: z.string().optional(),
|
|
84
|
+
}).refine(
|
|
85
|
+
(data) => data.hex !== undefined || data.rgb !== undefined || data.cmyk !== undefined || data.pantone !== undefined,
|
|
86
|
+
{ message: "At least one color space must be defined" },
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export type ColorSpace = z.infer<typeof ColorSpaceSchema>;
|
|
90
|
+
|
|
91
|
+
export const ColorItemSchema = z.object({
|
|
92
|
+
name: z.string().optional(),
|
|
93
|
+
spaces: z.array(ColorSpaceSchema).min(1),
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export type ColorItem = z.infer<typeof ColorItemSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MediaConfigSchema } from "./media";
|
|
3
|
+
import { HexColorSchema } from "./shared";
|
|
4
|
+
|
|
5
|
+
export const SectionMetaSchema = z.object({
|
|
6
|
+
type: z.string(),
|
|
7
|
+
status: z.enum(["draft", "published", "archived"]),
|
|
8
|
+
access: z.array(z.string()),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type SectionMeta = z.infer<typeof SectionMetaSchema>;
|
|
12
|
+
|
|
13
|
+
export const IndexSchema = z.object({
|
|
14
|
+
siteId: z.string(),
|
|
15
|
+
order: z.array(z.string()),
|
|
16
|
+
sections: z.record(z.string(), SectionMetaSchema),
|
|
17
|
+
}).refine(
|
|
18
|
+
(data) => data.order.every((id) => id in data.sections),
|
|
19
|
+
{ message: "All order entries must have a corresponding section in sections" }
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export type SiteIndex = z.infer<typeof IndexSchema>;
|
|
23
|
+
|
|
24
|
+
export const SiteConfigSchema = z.object({
|
|
25
|
+
siteName: z.string().default("Brand Portal"),
|
|
26
|
+
primaryColor: HexColorSchema.default("#009ca6"),
|
|
27
|
+
primaryContrast: HexColorSchema.default("#f0f0f0"),
|
|
28
|
+
darkMode: z.enum(["light", "dark", "optional"]).default("light"),
|
|
29
|
+
headingFont: z.string().default("system-ui"),
|
|
30
|
+
bodyFont: z.string().default("system-ui"),
|
|
31
|
+
googleFontsUrl: z.string()
|
|
32
|
+
.refine(url => url.startsWith("https://fonts.googleapis.com/"), "Must be a Google Fonts URL")
|
|
33
|
+
.nullable()
|
|
34
|
+
.default(null),
|
|
35
|
+
media: MediaConfigSchema.default(MediaConfigSchema.parse({})),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type SiteConfig = z.infer<typeof SiteConfigSchema>;
|