@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const MediaGridOptionsSchema: z.ZodDefault<z.ZodObject<{
|
|
3
|
+
square: z.ZodOptional<z.ZodBoolean>;
|
|
4
|
+
border: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
crop: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
showCaptions: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
//# sourceMappingURL=media-grid-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-grid-options.d.ts","sourceRoot":"","sources":["../../src/schemas/media-grid-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;kBAKrB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const VariantSchema: z.ZodObject<{
|
|
3
|
+
width: z.ZodNumber;
|
|
4
|
+
height: z.ZodNumber;
|
|
5
|
+
size: z.ZodNumber;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type Variant = z.infer<typeof VariantSchema>;
|
|
8
|
+
export declare const MediaItemSchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
hash: z.ZodString;
|
|
11
|
+
kind: z.ZodEnum<{
|
|
12
|
+
image: "image";
|
|
13
|
+
video: "video";
|
|
14
|
+
animated: "animated";
|
|
15
|
+
}>;
|
|
16
|
+
originalName: z.ZodString;
|
|
17
|
+
width: z.ZodNumber;
|
|
18
|
+
height: z.ZodNumber;
|
|
19
|
+
mimeType: z.ZodString;
|
|
20
|
+
size: z.ZodNumber;
|
|
21
|
+
folder: z.ZodString;
|
|
22
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
23
|
+
width: z.ZodNumber;
|
|
24
|
+
height: z.ZodNumber;
|
|
25
|
+
size: z.ZodNumber;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
alt: z.ZodDefault<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type MediaItem = z.infer<typeof MediaItemSchema>;
|
|
30
|
+
export declare const ImageManifestSchema: z.ZodObject<{
|
|
31
|
+
images: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
hash: z.ZodString;
|
|
34
|
+
kind: z.ZodEnum<{
|
|
35
|
+
image: "image";
|
|
36
|
+
video: "video";
|
|
37
|
+
animated: "animated";
|
|
38
|
+
}>;
|
|
39
|
+
originalName: z.ZodString;
|
|
40
|
+
width: z.ZodNumber;
|
|
41
|
+
height: z.ZodNumber;
|
|
42
|
+
mimeType: z.ZodString;
|
|
43
|
+
size: z.ZodNumber;
|
|
44
|
+
folder: z.ZodString;
|
|
45
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
46
|
+
width: z.ZodNumber;
|
|
47
|
+
height: z.ZodNumber;
|
|
48
|
+
size: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
alt: z.ZodDefault<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type MediaManifest = z.infer<typeof ImageManifestSchema>;
|
|
54
|
+
export declare const MediaConfigSchema: z.ZodObject<{
|
|
55
|
+
adapter: z.ZodDefault<z.ZodEnum<{
|
|
56
|
+
github: "github";
|
|
57
|
+
}>>;
|
|
58
|
+
sizes: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
59
|
+
maxFileSize: z.ZodDefault<z.ZodNumber>;
|
|
60
|
+
quality: z.ZodDefault<z.ZodNumber>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type MediaConfig = z.infer<typeof MediaConfigSchema>;
|
|
63
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/schemas/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;iBAIxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;iBAY1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;iBAE9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,iBAAiB;;;;;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const VariantSchema = z.object({
|
|
3
|
+
width: z.number().int().positive(),
|
|
4
|
+
height: z.number().int().positive(),
|
|
5
|
+
size: z.number().int().nonnegative(),
|
|
6
|
+
});
|
|
7
|
+
export const MediaItemSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
hash: z.string(),
|
|
10
|
+
kind: z.enum(["image", "animated", "video"]),
|
|
11
|
+
originalName: z.string(),
|
|
12
|
+
width: z.number().int().positive(),
|
|
13
|
+
height: z.number().int().positive(),
|
|
14
|
+
mimeType: z.string(),
|
|
15
|
+
size: z.number().int().nonnegative(),
|
|
16
|
+
folder: z.string(),
|
|
17
|
+
variants: z.array(VariantSchema),
|
|
18
|
+
alt: z.string().default(""),
|
|
19
|
+
});
|
|
20
|
+
export const ImageManifestSchema = z.object({
|
|
21
|
+
images: z.record(z.string(), MediaItemSchema),
|
|
22
|
+
});
|
|
23
|
+
export const MediaConfigSchema = z.object({
|
|
24
|
+
adapter: z.enum(["github"]).default("github"),
|
|
25
|
+
sizes: z.array(z.number()).default([640, 1080, 1920]),
|
|
26
|
+
maxFileSize: z.number().default(5242880),
|
|
27
|
+
quality: z.number().min(1).max(100).default(85),
|
|
28
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export interface SectionContent<C = Record<string, unknown>> {
|
|
3
|
+
type: string;
|
|
4
|
+
content: C;
|
|
5
|
+
options?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface Section<C = Record<string, unknown>> extends SectionContent<C> {
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function getSectionContentSchema(): z.ZodType<SectionContent>;
|
|
11
|
+
export declare function getSectionSchema(): z.ZodType<Section>;
|
|
12
|
+
//# sourceMappingURL=sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../src/schemas/sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IAC7E,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,uBAAuB,IAAI,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAMnE;AAED,wBAAgB,gBAAgB,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAErD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getAllSchemas } from "../lib/registry";
|
|
3
|
+
export function getSectionContentSchema() {
|
|
4
|
+
const schemas = getAllSchemas();
|
|
5
|
+
if (schemas.length < 2) {
|
|
6
|
+
throw new Error("At least 2 section schemas must be registered before validation");
|
|
7
|
+
}
|
|
8
|
+
return z.union(schemas);
|
|
9
|
+
}
|
|
10
|
+
export function getSectionSchema() {
|
|
11
|
+
return z.object({ id: z.string() }).and(getSectionContentSchema());
|
|
12
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TextLineSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"heading">;
|
|
4
|
+
text: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
type: z.ZodEnum<{
|
|
7
|
+
paragraph: "paragraph";
|
|
8
|
+
paragraph_large: "paragraph_large";
|
|
9
|
+
}>;
|
|
10
|
+
text: z.ZodString;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
type: z.ZodLiteral<"label_value">;
|
|
13
|
+
label: z.ZodString;
|
|
14
|
+
text: z.ZodString;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
type: z.ZodEnum<{
|
|
17
|
+
list_item_unordered: "list_item_unordered";
|
|
18
|
+
list_item_ordered: "list_item_ordered";
|
|
19
|
+
}>;
|
|
20
|
+
text: z.ZodString;
|
|
21
|
+
}, z.core.$strip>], "type">;
|
|
22
|
+
export type TextLine = z.infer<typeof TextLineSchema>;
|
|
23
|
+
export declare const MediaReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
imageId: z.ZodDefault<z.ZodString>;
|
|
25
|
+
caption: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
26
|
+
background: z.ZodOptional<z.ZodString>;
|
|
27
|
+
invertFrom: z.ZodOptional<z.ZodString>;
|
|
28
|
+
border: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
objectFit: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
cover: "cover";
|
|
31
|
+
contain: "contain";
|
|
32
|
+
}>>;
|
|
33
|
+
type: z.ZodLiteral<"image">;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
imageId: z.ZodDefault<z.ZodString>;
|
|
36
|
+
caption: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
37
|
+
background: z.ZodOptional<z.ZodString>;
|
|
38
|
+
invertFrom: z.ZodOptional<z.ZodString>;
|
|
39
|
+
border: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
objectFit: z.ZodOptional<z.ZodEnum<{
|
|
41
|
+
cover: "cover";
|
|
42
|
+
contain: "contain";
|
|
43
|
+
}>>;
|
|
44
|
+
type: z.ZodLiteral<"video">;
|
|
45
|
+
poster: z.ZodOptional<z.ZodString>;
|
|
46
|
+
autoplay: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
loop: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
muted: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
imageId: z.ZodDefault<z.ZodString>;
|
|
51
|
+
caption: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
52
|
+
background: z.ZodOptional<z.ZodString>;
|
|
53
|
+
invertFrom: z.ZodOptional<z.ZodString>;
|
|
54
|
+
border: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
objectFit: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
cover: "cover";
|
|
57
|
+
contain: "contain";
|
|
58
|
+
}>>;
|
|
59
|
+
type: z.ZodLiteral<"doDontImage">;
|
|
60
|
+
doDont: z.ZodEnum<{
|
|
61
|
+
do: "do";
|
|
62
|
+
dont: "dont";
|
|
63
|
+
}>;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
imageId: z.ZodDefault<z.ZodString>;
|
|
66
|
+
caption: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
67
|
+
background: z.ZodOptional<z.ZodString>;
|
|
68
|
+
invertFrom: z.ZodOptional<z.ZodString>;
|
|
69
|
+
border: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
objectFit: z.ZodOptional<z.ZodEnum<{
|
|
71
|
+
cover: "cover";
|
|
72
|
+
contain: "contain";
|
|
73
|
+
}>>;
|
|
74
|
+
type: z.ZodLiteral<"linkedImage">;
|
|
75
|
+
href: z.ZodString;
|
|
76
|
+
target: z.ZodOptional<z.ZodString>;
|
|
77
|
+
linkText: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strip>], "type">;
|
|
79
|
+
export type MediaReference = z.infer<typeof MediaReferenceSchema>;
|
|
80
|
+
export declare const HexColorSchema: z.ZodString;
|
|
81
|
+
export declare const ColorSpaceSchema: z.ZodObject<{
|
|
82
|
+
hex: z.ZodOptional<z.ZodString>;
|
|
83
|
+
rgb: z.ZodOptional<z.ZodString>;
|
|
84
|
+
cmyk: z.ZodOptional<z.ZodString>;
|
|
85
|
+
pantone: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export type ColorSpace = z.infer<typeof ColorSpaceSchema>;
|
|
88
|
+
export declare const ColorItemSchema: z.ZodObject<{
|
|
89
|
+
name: z.ZodOptional<z.ZodString>;
|
|
90
|
+
spaces: z.ZodArray<z.ZodObject<{
|
|
91
|
+
hex: z.ZodOptional<z.ZodString>;
|
|
92
|
+
rgb: z.ZodOptional<z.ZodString>;
|
|
93
|
+
cmyk: z.ZodOptional<z.ZodString>;
|
|
94
|
+
pantone: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export type ColorItem = z.infer<typeof ColorItemSchema>;
|
|
98
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/schemas/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;2BAKzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAoCtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAE/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,eAAO,MAAM,cAAc,aAEiC,CAAC;AAE7D,eAAO,MAAM,gBAAgB;;;;;iBAQ5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;;;;;iBAG1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// --- Text ---
|
|
3
|
+
const TextHeadingLine = z.object({
|
|
4
|
+
type: z.literal("heading"),
|
|
5
|
+
text: z.string(),
|
|
6
|
+
});
|
|
7
|
+
const TextParagraphLine = z.object({
|
|
8
|
+
type: z.enum(["paragraph", "paragraph_large"]),
|
|
9
|
+
text: z.string(),
|
|
10
|
+
});
|
|
11
|
+
const TextLabelValueLine = z.object({
|
|
12
|
+
type: z.literal("label_value"),
|
|
13
|
+
label: z.string(),
|
|
14
|
+
text: z.string(),
|
|
15
|
+
});
|
|
16
|
+
const TextListItemLine = z.object({
|
|
17
|
+
type: z.enum(["list_item_unordered", "list_item_ordered"]),
|
|
18
|
+
text: z.string(),
|
|
19
|
+
});
|
|
20
|
+
export const TextLineSchema = z.discriminatedUnion("type", [
|
|
21
|
+
TextHeadingLine,
|
|
22
|
+
TextParagraphLine,
|
|
23
|
+
TextLabelValueLine,
|
|
24
|
+
TextListItemLine,
|
|
25
|
+
]);
|
|
26
|
+
// --- Media References ---
|
|
27
|
+
const BaseMediaRef = z.object({
|
|
28
|
+
imageId: z.string().default(""),
|
|
29
|
+
caption: z.union([z.string(), z.array(z.string())]).optional(),
|
|
30
|
+
background: z.string().optional(),
|
|
31
|
+
invertFrom: z.string().optional(),
|
|
32
|
+
border: z.boolean().optional(),
|
|
33
|
+
objectFit: z.enum(["cover", "contain"]).optional(),
|
|
34
|
+
});
|
|
35
|
+
const ImageRef = BaseMediaRef.extend({
|
|
36
|
+
type: z.literal("image"),
|
|
37
|
+
});
|
|
38
|
+
const VideoRef = BaseMediaRef.extend({
|
|
39
|
+
type: z.literal("video"),
|
|
40
|
+
poster: z.string().optional(),
|
|
41
|
+
autoplay: z.boolean().optional(),
|
|
42
|
+
loop: z.boolean().optional(),
|
|
43
|
+
muted: z.boolean().optional(),
|
|
44
|
+
});
|
|
45
|
+
const DoDontImageRef = BaseMediaRef.extend({
|
|
46
|
+
type: z.literal("doDontImage"),
|
|
47
|
+
doDont: z.enum(["do", "dont"]),
|
|
48
|
+
});
|
|
49
|
+
const LinkedImageRef = BaseMediaRef.extend({
|
|
50
|
+
type: z.literal("linkedImage"),
|
|
51
|
+
href: z.string(),
|
|
52
|
+
target: z.string().optional(),
|
|
53
|
+
linkText: z.string().optional(),
|
|
54
|
+
});
|
|
55
|
+
export const MediaReferenceSchema = z.discriminatedUnion("type", [
|
|
56
|
+
ImageRef, VideoRef, DoDontImageRef, LinkedImageRef,
|
|
57
|
+
]);
|
|
58
|
+
// --- Colors ---
|
|
59
|
+
export const HexColorSchema = z
|
|
60
|
+
.string()
|
|
61
|
+
.regex(/^#[0-9a-fA-F]{6}$/, "must be a 6-digit hex color");
|
|
62
|
+
export const ColorSpaceSchema = z.object({
|
|
63
|
+
hex: HexColorSchema.optional(),
|
|
64
|
+
rgb: z.string().optional(),
|
|
65
|
+
cmyk: z.string().optional(),
|
|
66
|
+
pantone: z.string().optional(),
|
|
67
|
+
}).refine((data) => data.hex !== undefined || data.rgb !== undefined || data.cmyk !== undefined || data.pantone !== undefined, { message: "At least one color space must be defined" });
|
|
68
|
+
export const ColorItemSchema = z.object({
|
|
69
|
+
name: z.string().optional(),
|
|
70
|
+
spaces: z.array(ColorSpaceSchema).min(1),
|
|
71
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SectionMetaSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodString;
|
|
4
|
+
status: z.ZodEnum<{
|
|
5
|
+
draft: "draft";
|
|
6
|
+
published: "published";
|
|
7
|
+
archived: "archived";
|
|
8
|
+
}>;
|
|
9
|
+
access: z.ZodArray<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type SectionMeta = z.infer<typeof SectionMetaSchema>;
|
|
12
|
+
export declare const IndexSchema: z.ZodObject<{
|
|
13
|
+
siteId: z.ZodString;
|
|
14
|
+
order: z.ZodArray<z.ZodString>;
|
|
15
|
+
sections: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
16
|
+
type: z.ZodString;
|
|
17
|
+
status: z.ZodEnum<{
|
|
18
|
+
draft: "draft";
|
|
19
|
+
published: "published";
|
|
20
|
+
archived: "archived";
|
|
21
|
+
}>;
|
|
22
|
+
access: z.ZodArray<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type SiteIndex = z.infer<typeof IndexSchema>;
|
|
26
|
+
export declare const SiteConfigSchema: z.ZodObject<{
|
|
27
|
+
siteName: z.ZodDefault<z.ZodString>;
|
|
28
|
+
primaryColor: z.ZodDefault<z.ZodString>;
|
|
29
|
+
primaryContrast: z.ZodDefault<z.ZodString>;
|
|
30
|
+
darkMode: z.ZodDefault<z.ZodEnum<{
|
|
31
|
+
optional: "optional";
|
|
32
|
+
light: "light";
|
|
33
|
+
dark: "dark";
|
|
34
|
+
}>>;
|
|
35
|
+
headingFont: z.ZodDefault<z.ZodString>;
|
|
36
|
+
bodyFont: z.ZodDefault<z.ZodString>;
|
|
37
|
+
googleFontsUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
media: z.ZodDefault<z.ZodObject<{
|
|
39
|
+
adapter: z.ZodDefault<z.ZodEnum<{
|
|
40
|
+
github: "github";
|
|
41
|
+
}>>;
|
|
42
|
+
sizes: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
43
|
+
maxFileSize: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
quality: z.ZodDefault<z.ZodNumber>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type SiteConfig = z.infer<typeof SiteConfigSchema>;
|
|
48
|
+
//# sourceMappingURL=site-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-config.d.ts","sourceRoot":"","sources":["../../src/schemas/site-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;;;iBAI5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,WAAW;;;;;;;;;;;;iBAOvB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;iBAY3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MediaConfigSchema } from "./media";
|
|
3
|
+
import { HexColorSchema } from "./shared";
|
|
4
|
+
export const SectionMetaSchema = z.object({
|
|
5
|
+
type: z.string(),
|
|
6
|
+
status: z.enum(["draft", "published", "archived"]),
|
|
7
|
+
access: z.array(z.string()),
|
|
8
|
+
});
|
|
9
|
+
export const IndexSchema = z.object({
|
|
10
|
+
siteId: z.string(),
|
|
11
|
+
order: z.array(z.string()),
|
|
12
|
+
sections: z.record(z.string(), SectionMetaSchema),
|
|
13
|
+
}).refine((data) => data.order.every((id) => id in data.sections), { message: "All order entries must have a corresponding section in sections" });
|
|
14
|
+
export const SiteConfigSchema = z.object({
|
|
15
|
+
siteName: z.string().default("Brand Portal"),
|
|
16
|
+
primaryColor: HexColorSchema.default("#009ca6"),
|
|
17
|
+
primaryContrast: HexColorSchema.default("#f0f0f0"),
|
|
18
|
+
darkMode: z.enum(["light", "dark", "optional"]).default("light"),
|
|
19
|
+
headingFont: z.string().default("system-ui"),
|
|
20
|
+
bodyFont: z.string().default("system-ui"),
|
|
21
|
+
googleFontsUrl: z.string()
|
|
22
|
+
.refine(url => url.startsWith("https://fonts.googleapis.com/"), "Must be a Google Fonts URL")
|
|
23
|
+
.nullable()
|
|
24
|
+
.default(null),
|
|
25
|
+
media: MediaConfigSchema.default(MediaConfigSchema.parse({})),
|
|
26
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@drawnagency/primitives",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"default": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./schemas": {
|
|
11
|
+
"types": "./dist/schemas/index.d.ts",
|
|
12
|
+
"default": "./dist/schemas/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./lib": {
|
|
15
|
+
"types": "./dist/lib/index.d.ts",
|
|
16
|
+
"default": "./dist/lib/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./auth": {
|
|
19
|
+
"types": "./dist/auth/index.d.ts",
|
|
20
|
+
"default": "./dist/auth/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./media": {
|
|
23
|
+
"types": "./dist/media/index.d.ts",
|
|
24
|
+
"default": "./dist/media/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"src"
|
|
31
|
+
],
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-dom": "^19.0.0"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"zod": "^4.3.6",
|
|
38
|
+
"clsx": "^2.1.1",
|
|
39
|
+
"tailwind-merge": "^3.5.0",
|
|
40
|
+
"isomorphic-dompurify": "^3.10.0",
|
|
41
|
+
"lucide-react": "^1.7.0",
|
|
42
|
+
"jose": "^6.2.2",
|
|
43
|
+
"dexie": "^4.4.2",
|
|
44
|
+
"@tiptap/core": "^3.20.4",
|
|
45
|
+
"@tiptap/extension-link": "^3.20.4",
|
|
46
|
+
"@tiptap/extension-underline": "^3.20.4",
|
|
47
|
+
"@tiptap/pm": "^3.20.4",
|
|
48
|
+
"@tiptap/react": "^3.20.4",
|
|
49
|
+
"@tiptap/starter-kit": "^3.20.4",
|
|
50
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.7.10",
|
|
51
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc",
|
|
55
|
+
"dev": "tsc --watch"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as jose from "jose";
|
|
2
|
+
import type { Session, CookieLike } from "./types";
|
|
3
|
+
import { requireSessionSecret } from "./security";
|
|
4
|
+
|
|
5
|
+
export const SESSION_COOKIE = "bp-session";
|
|
6
|
+
export const AUDIENCE_COOKIE = "bp-audience";
|
|
7
|
+
export const SESSION_MAX_AGE_SECONDS = 60 * 60 * 24;
|
|
8
|
+
|
|
9
|
+
export async function signSessionToken(session: Session): Promise<string> {
|
|
10
|
+
return new jose.SignJWT({
|
|
11
|
+
userId: session.userId,
|
|
12
|
+
email: session.email,
|
|
13
|
+
role: session.role,
|
|
14
|
+
siteId: session.siteId,
|
|
15
|
+
})
|
|
16
|
+
.setProtectedHeader({ alg: "HS256" })
|
|
17
|
+
.setExpirationTime(`${SESSION_MAX_AGE_SECONDS}s`)
|
|
18
|
+
.setIssuedAt()
|
|
19
|
+
.sign(requireSessionSecret());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function verifySessionToken(token: string): Promise<Session | null> {
|
|
23
|
+
const secret = requireSessionSecret(); // throws on misconfiguration, before try
|
|
24
|
+
try {
|
|
25
|
+
const { payload } = await jose.jwtVerify(token, secret);
|
|
26
|
+
const role = payload.role;
|
|
27
|
+
if (role !== "owner" && role !== "editor") return null;
|
|
28
|
+
return {
|
|
29
|
+
userId: (payload.userId as string) ?? null,
|
|
30
|
+
email: (payload.email as string) ?? null,
|
|
31
|
+
role,
|
|
32
|
+
siteId: payload.siteId as string,
|
|
33
|
+
};
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function setSessionCookie(
|
|
40
|
+
cookies: CookieLike,
|
|
41
|
+
token: string,
|
|
42
|
+
isProduction: boolean,
|
|
43
|
+
): void {
|
|
44
|
+
cookies.set(SESSION_COOKIE, token, {
|
|
45
|
+
httpOnly: true,
|
|
46
|
+
secure: isProduction,
|
|
47
|
+
sameSite: "lax",
|
|
48
|
+
path: "/",
|
|
49
|
+
maxAge: SESSION_MAX_AGE_SECONDS,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when a mutation would leave a site with zero owners.
|
|
3
|
+
* API routes should translate this to HTTP 409 Conflict with the message.
|
|
4
|
+
*/
|
|
5
|
+
export class LastOwnerError extends Error {
|
|
6
|
+
constructor(message = "Cannot remove the last owner") {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "LastOwnerError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
Role,
|
|
3
|
+
Session,
|
|
4
|
+
SiteUser,
|
|
5
|
+
Audience,
|
|
6
|
+
SignInMethod,
|
|
7
|
+
SignInResult,
|
|
8
|
+
AuthProvider,
|
|
9
|
+
CookieLike,
|
|
10
|
+
AuthContext,
|
|
11
|
+
} from "./types";
|
|
12
|
+
|
|
13
|
+
export { requireSessionSecret, isSameOriginRequest, safeNextPath } from "./security";
|
|
14
|
+
export { signSessionToken, verifySessionToken, setSessionCookie, SESSION_COOKIE, AUDIENCE_COOKIE, SESSION_MAX_AGE_SECONDS } from "./cookies";
|
|
15
|
+
export { LastOwnerError } from "./errors";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared auth security primitives: session secret loader, same-origin check,
|
|
3
|
+
* redirect-path validator. Imported by cookies.ts, middleware, and auth API routes.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function requireSessionSecret(): Uint8Array {
|
|
7
|
+
const secret = import.meta.env.SESSION_SECRET;
|
|
8
|
+
if (!secret) {
|
|
9
|
+
throw new Error("SESSION_SECRET is required but not set");
|
|
10
|
+
}
|
|
11
|
+
const bytes = new TextEncoder().encode(secret);
|
|
12
|
+
if (bytes.byteLength < 32) {
|
|
13
|
+
throw new Error("SESSION_SECRET must be at least 32 bytes");
|
|
14
|
+
}
|
|
15
|
+
return bytes;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Same-origin check for CSRF protection on state-changing requests.
|
|
20
|
+
* Combine with an HTTP-method guard at the call site — this does not
|
|
21
|
+
* discriminate between safe (GET/HEAD) and unsafe methods.
|
|
22
|
+
*/
|
|
23
|
+
export function isSameOriginRequest(request: Request): boolean {
|
|
24
|
+
const origin = request.headers.get("Origin");
|
|
25
|
+
const referer = request.headers.get("Referer");
|
|
26
|
+
const source = origin ?? referer;
|
|
27
|
+
if (!source) return false;
|
|
28
|
+
try {
|
|
29
|
+
const sourceOrigin = new URL(source).origin;
|
|
30
|
+
const requestOrigin = new URL(request.url).origin;
|
|
31
|
+
return sourceOrigin === requestOrigin;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function safeNextPath(next: string | null | undefined): string | null {
|
|
38
|
+
if (!next) return null;
|
|
39
|
+
if (!next.startsWith("/")) return null;
|
|
40
|
+
if (next.startsWith("//")) return null;
|
|
41
|
+
if (next.includes("\\")) return null;
|
|
42
|
+
if (/[\x00-\x1f]/.test(next)) return null;
|
|
43
|
+
return next;
|
|
44
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type { Role, Session, SiteUser, Audience } from "../schemas/auth";
|
|
2
|
+
import type { Role, Session, SiteUser, Audience } from "../schemas/auth";
|
|
3
|
+
|
|
4
|
+
export type SignInMethod =
|
|
5
|
+
| { type: "oauth"; provider: "google" | "github" }
|
|
6
|
+
| { type: "email"; email: string; password: string }
|
|
7
|
+
| { type: "password"; password: string };
|
|
8
|
+
|
|
9
|
+
export type SignInResult =
|
|
10
|
+
| { success: true; session: Session; token: string }
|
|
11
|
+
| { success: true; redirectUrl: string }
|
|
12
|
+
| { success: false; error: string };
|
|
13
|
+
|
|
14
|
+
export interface AuthProvider {
|
|
15
|
+
capabilities: {
|
|
16
|
+
oauth: boolean;
|
|
17
|
+
emailPassword: boolean;
|
|
18
|
+
passwordOnly: boolean;
|
|
19
|
+
userManagement: boolean;
|
|
20
|
+
audienceManagement: boolean;
|
|
21
|
+
passwordToggle: boolean;
|
|
22
|
+
};
|
|
23
|
+
oauthProviders?: ("google" | "github")[];
|
|
24
|
+
|
|
25
|
+
resolveSession(ctx: AuthContext): Promise<Session | null>;
|
|
26
|
+
signIn(method: SignInMethod, ctx: AuthContext): Promise<SignInResult>;
|
|
27
|
+
signOut(ctx: AuthContext): Promise<void>;
|
|
28
|
+
|
|
29
|
+
listSiteUsers?(): Promise<SiteUser[]>;
|
|
30
|
+
inviteUser?(email: string, role: Role): Promise<void>;
|
|
31
|
+
revokeUser?(userId: string): Promise<void>;
|
|
32
|
+
|
|
33
|
+
listAudiences(): Promise<Audience[]>;
|
|
34
|
+
verifyAudiencePassword(name: string, password: string): Promise<boolean>;
|
|
35
|
+
|
|
36
|
+
// Optional — single-row lookup (present when the adapter can efficiently query one audience).
|
|
37
|
+
getAudience?(name: string): Promise<Audience | null>;
|
|
38
|
+
|
|
39
|
+
// Optional — present only when capabilities.audienceManagement === true
|
|
40
|
+
createAudience?(displayName: string, color: string | null, password: string): Promise<void>;
|
|
41
|
+
setAudiencePassword?(name: string, password: string): Promise<void>;
|
|
42
|
+
setAudienceColor?(name: string, color: string | null): Promise<void>;
|
|
43
|
+
setAudienceDisplayName?(name: string, displayName: string): Promise<void>;
|
|
44
|
+
deleteAudience?(name: string): Promise<void>;
|
|
45
|
+
|
|
46
|
+
getPasswordEnabled(): Promise<boolean>;
|
|
47
|
+
setPasswordEnabled?(enabled: boolean): Promise<void>;
|
|
48
|
+
|
|
49
|
+
handleCallback?(request: Request, ctx: AuthContext): Promise<Response>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CookieLike {
|
|
53
|
+
get(name: string): { value: string } | undefined;
|
|
54
|
+
set(name: string, value: string, options?: Record<string, unknown>): void;
|
|
55
|
+
delete(name: string): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AuthContext {
|
|
59
|
+
cookies: CookieLike;
|
|
60
|
+
cookieHeader: string;
|
|
61
|
+
}
|