@drawnagency/primitives 0.1.113 → 0.1.115
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 +1 -1
- package/dist/auth/cookies.d.ts +39 -0
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/index.js +3 -3
- package/dist/chunk-4WQ36ZP7.js +83 -0
- package/dist/{chunk-REDDTTGJ.js → chunk-4Y2JQQZL.js} +19 -1
- package/dist/chunk-5GFACGSN.js +6 -0
- package/dist/{chunk-AHALSCQH.js → chunk-67P34WNW.js} +76 -131
- package/dist/{chunk-S2L3BPLS.js → chunk-7SX42OP4.js} +1 -1
- package/dist/{chunk-GGXZZ77Z.js → chunk-AASEGXNT.js} +18 -1
- package/dist/chunk-APIJPTFG.js +64 -0
- package/dist/{chunk-WKZ7OENC.js → chunk-BQ5TZZUE.js} +5 -1
- package/dist/chunk-CDBURDPX.js +90 -0
- package/dist/chunk-DFKTF3CH.js +0 -0
- package/dist/chunk-DIMDRBFK.js +11 -0
- package/dist/chunk-DJABADOO.js +131 -0
- package/dist/{chunk-NHN2LSIU.js → chunk-DJOGPSRU.js} +31 -68
- package/dist/{chunk-KR2MHTNJ.js → chunk-FHTKSELX.js} +610 -62
- package/dist/{chunk-WUJ3XNFI.js → chunk-GGYY3JQJ.js} +19 -24
- package/dist/chunk-GNF6KFQ7.js +18 -0
- package/dist/{chunk-FRE2CCLV.js → chunk-HHNPSKPT.js} +5 -79
- package/dist/{chunk-IINIZBQB.js → chunk-JCDZAFX2.js} +30 -10
- package/dist/chunk-JR24U7FJ.js +120 -0
- package/dist/{chunk-BDFTMGCL.js → chunk-JXATNKLV.js} +11 -10
- package/dist/{chunk-SW6PCQQD.js → chunk-KQA772WQ.js} +2 -1
- package/dist/{chunk-6BZ2KNTP.js → chunk-NX7TFHA4.js} +195 -65
- package/dist/{chunk-VWWY5TL5.js → chunk-O37AV27P.js} +14 -75
- package/dist/chunk-RIITGTV3.js +275 -0
- package/dist/{chunk-HBULBDGP.js → chunk-S37DZPHW.js} +1 -1
- package/dist/chunk-S7QRHUWO.js +8 -0
- package/dist/{chunk-Z7W3DQTR.js → chunk-T26HAKW3.js} +424 -42
- package/dist/{chunk-4I5OO5UB.js → chunk-TEOAKGZA.js} +0 -1
- package/dist/{chunk-GPPVYLEI.js → chunk-UUUSJDIG.js} +1 -1
- package/dist/chunk-VY3IFGE3.js +70 -0
- package/dist/chunk-WYOFQHKI.js +176 -0
- package/dist/{chunk-4RNF2DRG.js → chunk-XDEPXTBY.js} +0 -2
- package/dist/{chunk-DS4GCYV2.js → chunk-YV3YSZEB.js} +223 -16
- package/dist/collab/rebase.d.ts +2 -1
- package/dist/collab/rebase.d.ts.map +1 -1
- package/dist/collab/rebase.js +24 -9
- package/dist/components/brandguide/ColorsEditable.d.ts.map +1 -1
- package/dist/components/chat/ChatPanel.d.ts.map +1 -1
- package/dist/components/chat/ChatWidget.d.ts.map +1 -1
- package/dist/components/docfile/DocFilePane.d.ts.map +1 -1
- package/dist/components/editor/ChildBlockWrapper.d.ts.map +1 -1
- package/dist/components/editor/ConflictDialog.d.ts.map +1 -1
- package/dist/components/editor/DragHandle.d.ts +12 -2
- package/dist/components/editor/DragHandle.d.ts.map +1 -1
- package/dist/components/editor/DropEdgeIndicator.d.ts +15 -6
- package/dist/components/editor/DropEdgeIndicator.d.ts.map +1 -1
- package/dist/components/editor/NavGroupRow.d.ts +4 -1
- package/dist/components/editor/NavGroupRow.d.ts.map +1 -1
- package/dist/components/editor/PagesModal.d.ts.map +1 -1
- package/dist/components/editor/SectionWrapper.d.ts +1 -1
- package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
- package/dist/components/editor/SettingsForm.d.ts.map +1 -1
- package/dist/components/editor/TagIndicator.d.ts +15 -0
- package/dist/components/editor/TagIndicator.d.ts.map +1 -0
- package/dist/components/editor/index.js +150 -79
- package/dist/components/primitives/DocumentDropZone.d.ts +1 -1
- package/dist/components/primitives/EditableGrid.d.ts.map +1 -1
- package/dist/components/primitives/EditableList.d.ts.map +1 -1
- package/dist/components/primitives/HeadingSection.d.ts +4 -1
- package/dist/components/primitives/HeadingSection.d.ts.map +1 -1
- package/dist/components/primitives/ResolvedMedia.d.ts +5 -1
- package/dist/components/primitives/ResolvedMedia.d.ts.map +1 -1
- package/dist/components/primitives/{defineHeadingSection.d.ts → define-heading-section.d.ts} +1 -1
- package/dist/components/primitives/define-heading-section.d.ts.map +1 -0
- package/dist/components/primitives/{gridDrop.d.ts → grid-drop.d.ts} +1 -1
- package/dist/components/primitives/grid-drop.d.ts.map +1 -0
- package/dist/components/primitives/index.d.ts +1 -1
- package/dist/components/primitives/index.d.ts.map +1 -1
- package/dist/components/primitives/index.js +22 -154
- package/dist/components/sections/Button/CTAButton.d.ts.map +1 -1
- package/dist/components/sections/DoDontMedia/DoDontMediaBlock.d.ts +2 -6
- package/dist/components/sections/DoDontMedia/DoDontMediaBlock.d.ts.map +1 -1
- package/dist/components/sections/DoDontMedia/index.d.ts +8 -0
- package/dist/components/sections/DoDontMedia/index.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconList.d.ts +2 -1
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconListSettings.d.ts +2 -1
- package/dist/components/sections/IconList/IconListSettings.d.ts.map +1 -1
- package/dist/components/sections/IconList/index.d.ts +1 -0
- package/dist/components/sections/IconList/index.d.ts.map +1 -1
- package/dist/components/sections/Media/MediaBlock.d.ts +2 -1
- package/dist/components/sections/Media/MediaBlock.d.ts.map +1 -1
- package/dist/components/sections/Media/index.d.ts +8 -0
- package/dist/components/sections/Media/index.d.ts.map +1 -1
- package/dist/components/sections/Reference/ReferenceList.d.ts +35 -0
- package/dist/components/sections/Reference/ReferenceList.d.ts.map +1 -0
- package/dist/components/sections/Reference/ReferenceSettings.d.ts +12 -0
- package/dist/components/sections/Reference/ReferenceSettings.d.ts.map +1 -0
- package/dist/components/sections/Reference/index.d.ts +9 -0
- package/dist/components/sections/Reference/index.d.ts.map +1 -0
- package/dist/components/sections/SectionSummary/SectionSummaryBlock.d.ts +38 -0
- package/dist/components/sections/SectionSummary/SectionSummaryBlock.d.ts.map +1 -0
- package/dist/components/sections/SectionSummary/SectionSummarySettings.d.ts +20 -0
- package/dist/components/sections/SectionSummary/SectionSummarySettings.d.ts.map +1 -0
- package/dist/components/sections/SectionSummary/index.d.ts +33 -0
- package/dist/components/sections/SectionSummary/index.d.ts.map +1 -0
- package/dist/components/sections/all-sections.d.ts +53 -0
- package/dist/components/sections/all-sections.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.d.ts +41 -2
- package/dist/components/sections/brand-guide.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +17 -10
- package/dist/components/sections/core-sections.d.ts +14 -0
- package/dist/components/sections/core-sections.d.ts.map +1 -1
- package/dist/components/sections/register-schemas.js +25 -18
- package/dist/components/sections/register.js +25 -18
- package/dist/components/shared/BrandSwatchesContext.d.ts +9 -0
- package/dist/components/shared/BrandSwatchesContext.d.ts.map +1 -0
- package/dist/components/shared/Button.d.ts +11 -3
- package/dist/components/shared/Button.d.ts.map +1 -1
- package/dist/components/shared/Checkbox.d.ts +6 -0
- package/dist/components/shared/Checkbox.d.ts.map +1 -1
- package/dist/components/shared/ConfirmDialog.d.ts +25 -0
- package/dist/components/shared/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/shared/ConfirmInline.d.ts +25 -0
- package/dist/components/shared/ConfirmInline.d.ts.map +1 -0
- package/dist/components/shared/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/shared/Fab.d.ts +11 -2
- package/dist/components/shared/Fab.d.ts.map +1 -1
- package/dist/components/shared/FabStack.d.ts +22 -0
- package/dist/components/shared/FabStack.d.ts.map +1 -0
- package/dist/components/shared/HistoryChangesModal.d.ts.map +1 -1
- package/dist/components/shared/HistoryPopover.d.ts.map +1 -1
- package/dist/components/shared/ImageBackgroundField.d.ts +9 -0
- package/dist/components/shared/ImageBackgroundField.d.ts.map +1 -0
- package/dist/components/shared/{UploadRejectionAlert.d.ts → InlineAlert.d.ts} +4 -2
- package/dist/components/shared/InlineAlert.d.ts.map +1 -0
- package/dist/components/shared/Input.d.ts +10 -0
- package/dist/components/shared/Input.d.ts.map +1 -1
- package/dist/components/shared/Navigation.d.ts.map +1 -1
- package/dist/components/shared/Notice.d.ts +10 -0
- package/dist/components/shared/Notice.d.ts.map +1 -0
- package/dist/components/shared/Popover.d.ts.map +1 -1
- package/dist/components/shared/ReferenceSourcesContext.d.ts +25 -0
- package/dist/components/shared/ReferenceSourcesContext.d.ts.map +1 -0
- package/dist/components/shared/Select.d.ts +3 -2
- package/dist/components/shared/Select.d.ts.map +1 -1
- package/dist/components/shared/SplitButton.d.ts.map +1 -1
- package/dist/components/shared/SummaryAnchorsContext.d.ts +10 -0
- package/dist/components/shared/SummaryAnchorsContext.d.ts.map +1 -0
- package/dist/components/shared/Textarea.d.ts +7 -0
- package/dist/components/shared/Textarea.d.ts.map +1 -1
- package/dist/components/shared/ToolbarFrame.d.ts +17 -0
- package/dist/components/shared/ToolbarFrame.d.ts.map +1 -0
- package/dist/components/shared/copy.d.ts +13 -0
- package/dist/components/shared/copy.d.ts.map +1 -0
- package/dist/components/shared/icons.d.ts +0 -12
- package/dist/components/shared/icons.d.ts.map +1 -1
- package/dist/components/shell/AudienceDetailsPanel.d.ts +7 -1
- package/dist/components/shell/AudienceDetailsPanel.d.ts.map +1 -1
- package/dist/components/shell/AudienceRow.d.ts.map +1 -1
- package/dist/components/shell/BugReportFAB.d.ts +7 -1
- package/dist/components/shell/BugReportFAB.d.ts.map +1 -1
- package/dist/components/shell/CredentialList.d.ts.map +1 -1
- package/dist/components/shell/DocInspector.d.ts.map +1 -1
- package/dist/components/shell/DocumentEditorOverlay.d.ts.map +1 -1
- package/dist/components/shell/EditorContext.d.ts +4 -0
- package/dist/components/shell/EditorContext.d.ts.map +1 -1
- package/dist/components/shell/EditorLoginForm.d.ts.map +1 -1
- package/dist/components/shell/EditorModal.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/HistoryToolbar.d.ts.map +1 -1
- package/dist/components/shell/MediaFolderTile.d.ts +4 -1
- package/dist/components/shell/MediaFolderTile.d.ts.map +1 -1
- package/dist/components/shell/MediaLibraryModal.d.ts.map +1 -1
- package/dist/components/shell/RestoreModal.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsChatbot.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsDisplay.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsModal.d.ts +3 -1
- package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsTags.d.ts +13 -0
- package/dist/components/shell/SiteSettingsTags.d.ts.map +1 -0
- package/dist/components/shell/SiteSettingsUsers.d.ts.map +1 -1
- package/dist/components/shell/ViewerLoginForm.d.ts.map +1 -1
- package/dist/components/shell/{blockMoveDispatch.d.ts → block-move-dispatch.d.ts} +1 -1
- package/dist/components/shell/block-move-dispatch.d.ts.map +1 -0
- package/dist/components/shell/reference-sources.d.ts +22 -0
- package/dist/components/shell/reference-sources.d.ts.map +1 -0
- package/dist/deck/index.d.ts +2 -2
- package/dist/deck/index.d.ts.map +1 -1
- package/dist/deck/index.js +1 -3
- package/dist/deck-builder/index.js +10 -17
- package/dist/document/index.d.ts +2 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/hooks/useBlockDnd.d.ts +11 -0
- package/dist/hooks/useBlockDnd.d.ts.map +1 -1
- package/dist/hooks/useBuildStatus.d.ts +1 -1
- package/dist/hooks/useBuildStatus.d.ts.map +1 -1
- package/dist/hooks/useDocumentUploads.d.ts +1 -1
- package/dist/hooks/useDocumentUploads.d.ts.map +1 -1
- package/dist/hooks/useEditorPersistence.d.ts +5 -1
- package/dist/hooks/useEditorPersistence.d.ts.map +1 -1
- package/dist/hooks/useEditorPublish.d.ts +6 -3
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/hooks/useMediaPipeline.d.ts.map +1 -1
- package/dist/hooks/useNotice.d.ts +19 -0
- package/dist/hooks/useNotice.d.ts.map +1 -0
- package/dist/hooks/useSortableNavRow.d.ts +11 -0
- package/dist/hooks/useSortableNavRow.d.ts.map +1 -1
- package/dist/hooks/useSortableRow.d.ts +11 -0
- package/dist/hooks/useSortableRow.d.ts.map +1 -1
- package/dist/hooks/useStackedEscape.d.ts +32 -0
- package/dist/hooks/useStackedEscape.d.ts.map +1 -0
- package/dist/index.js +95 -48
- package/dist/lib/audience-secret.js +2 -2
- package/dist/lib/block-dnd.d.ts +5 -0
- package/dist/lib/block-dnd.d.ts.map +1 -1
- package/dist/lib/block-move.d.ts.map +1 -1
- package/dist/lib/brand-swatches.d.ts +12 -0
- package/dist/lib/brand-swatches.d.ts.map +1 -0
- package/dist/lib/container-ops.d.ts +3 -2
- package/dist/lib/container-ops.d.ts.map +1 -1
- package/dist/lib/dexie.d.ts +7 -1
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +12 -3
- package/dist/lib/env.d.ts +4 -0
- package/dist/lib/env.d.ts.map +1 -1
- package/dist/lib/env.js +5 -3
- package/dist/lib/events.d.ts +1 -2
- package/dist/lib/events.d.ts.map +1 -1
- package/dist/lib/image-background.d.ts +8 -0
- package/dist/lib/image-background.d.ts.map +1 -0
- package/dist/lib/image-variant-plan.d.ts +42 -0
- package/dist/lib/image-variant-plan.d.ts.map +1 -0
- package/dist/lib/image-variant-plan.js +53 -0
- package/dist/lib/index-ops.d.ts.map +1 -1
- package/dist/lib/index-ops.js +21 -17
- package/dist/lib/index.d.ts +7 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +55 -26
- package/dist/lib/loader.d.ts +25 -12
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/media-ops.d.ts +73 -0
- package/dist/lib/media-ops.d.ts.map +1 -0
- package/dist/lib/media-ops.js +60 -0
- package/dist/lib/nav-tree.d.ts +7 -0
- package/dist/lib/nav-tree.d.ts.map +1 -1
- package/dist/lib/nav.d.ts +38 -0
- package/dist/lib/nav.d.ts.map +1 -1
- package/dist/lib/pages.d.ts +2 -1
- package/dist/lib/pages.d.ts.map +1 -1
- package/dist/lib/platform-broker.d.ts +4 -2
- package/dist/lib/platform-broker.d.ts.map +1 -1
- package/dist/lib/platform-broker.js +21 -13
- package/dist/lib/reference-type.d.ts +2 -0
- package/dist/lib/reference-type.d.ts.map +1 -0
- package/dist/lib/reference-validation.d.ts +31 -0
- package/dist/lib/reference-validation.d.ts.map +1 -0
- package/dist/lib/reference-validation.js +39 -0
- package/dist/lib/references.d.ts +74 -0
- package/dist/lib/references.d.ts.map +1 -0
- package/dist/lib/registry.d.ts +35 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/{safeRedirect.d.ts → safe-redirect.d.ts} +1 -1
- package/dist/lib/safe-redirect.d.ts.map +1 -0
- package/dist/lib/sidecar-diagnostics.d.ts +20 -0
- package/dist/lib/sidecar-diagnostics.d.ts.map +1 -0
- package/dist/lib/sidecars.d.ts +118 -0
- package/dist/lib/sidecars.d.ts.map +1 -0
- package/dist/lib/sidecars.js +23 -0
- package/dist/lib/slug.d.ts +2 -0
- package/dist/lib/slug.d.ts.map +1 -0
- package/dist/lib/storage-tier.d.ts +17 -0
- package/dist/lib/storage-tier.d.ts.map +1 -0
- package/dist/lib/storage-tier.js +29 -0
- package/dist/lib/tags.d.ts +64 -0
- package/dist/lib/tags.d.ts.map +1 -0
- package/dist/lib/theme-vars.d.ts +9 -0
- package/dist/lib/theme-vars.d.ts.map +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +18 -14
- package/dist/media/queue.d.ts +2 -0
- package/dist/media/queue.d.ts.map +1 -1
- package/dist/media/utils.d.ts +2 -0
- package/dist/media/utils.d.ts.map +1 -1
- package/dist/media/{videoPoster.d.ts → video-poster.d.ts} +1 -1
- package/dist/media/video-poster.d.ts.map +1 -0
- package/dist/media/worker.d.ts +1 -35
- package/dist/media/worker.d.ts.map +1 -1
- package/dist/schemas/audience.js +2 -2
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +25 -13
- package/dist/schemas/media.d.ts +4 -0
- package/dist/schemas/media.d.ts.map +1 -1
- package/dist/schemas/shared.d.ts +26 -0
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/schemas/site-config.d.ts +6 -0
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/schemas/tags.d.ts +27 -0
- package/dist/schemas/tags.d.ts.map +1 -0
- package/dist/storage/index.js +2 -1
- package/dist/storage/memory.d.ts +21 -0
- package/dist/storage/memory.d.ts.map +1 -0
- package/dist/storage/memory.js +129 -0
- package/dist/storage/types.d.ts +9 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +26 -1
- package/src/auth/cookies.ts +111 -0
- package/src/collab/rebase.ts +29 -9
- package/src/components/brandguide/ColorSwatchSettings.tsx +1 -1
- package/src/components/brandguide/ColorsEditable.tsx +1 -0
- package/src/components/chat/ChatPanel.tsx +2 -3
- package/src/components/chat/ChatWidget.tsx +2 -3
- package/src/components/docfile/DocFilePane.tsx +4 -12
- package/src/components/editor/ChildBlockWrapper.tsx +13 -19
- package/src/components/editor/ConflictDialog.tsx +27 -35
- package/src/components/editor/DeleteButton.tsx +2 -2
- package/src/components/editor/DragHandle.tsx +16 -3
- package/src/components/editor/DropEdgeIndicator.tsx +36 -10
- package/src/components/editor/InsertButton.tsx +2 -2
- package/src/components/editor/NavGroupRow.tsx +43 -14
- package/src/components/editor/PagesModal.tsx +99 -26
- package/src/components/editor/SectionWrapper.tsx +64 -23
- package/src/components/editor/SettingsButton.tsx +2 -2
- package/src/components/editor/SettingsForm.tsx +19 -2
- package/src/components/editor/StatusIndicator.tsx +4 -4
- package/src/components/editor/TagIndicator.tsx +80 -0
- package/src/components/primitives/DocumentDropZone.tsx +1 -1
- package/src/components/primitives/EditableGrid.tsx +15 -14
- package/src/components/primitives/EditableList.tsx +27 -74
- package/src/components/primitives/HeadingSection.tsx +5 -2
- package/src/components/primitives/ResolvedMedia.tsx +13 -0
- package/src/components/primitives/{defineHeadingSection.tsx → define-heading-section.tsx} +1 -0
- package/src/components/primitives/index.ts +1 -1
- package/src/components/primitives/useEditablePlainText.ts +5 -5
- package/src/components/sections/Button/CTAButton.tsx +3 -1
- package/src/components/sections/DoDontMedia/DoDontMediaBlock.tsx +4 -4
- package/src/components/sections/DoDontMedia/index.tsx +12 -3
- package/src/components/sections/IconList/DoDontToggle.tsx +2 -2
- package/src/components/sections/IconList/IconList.tsx +70 -37
- package/src/components/sections/IconList/IconListSettings.tsx +55 -17
- package/src/components/sections/IconList/index.tsx +10 -3
- package/src/components/sections/LinkHeading/index.tsx +1 -1
- package/src/components/sections/Media/MediaBlock.tsx +13 -2
- package/src/components/sections/Media/index.tsx +12 -4
- package/src/components/sections/Reference/ReferenceList.tsx +214 -0
- package/src/components/sections/Reference/ReferenceSettings.tsx +159 -0
- package/src/components/sections/Reference/index.tsx +47 -0
- package/src/components/sections/SectionSummary/SectionSummaryBlock.tsx +476 -0
- package/src/components/sections/SectionSummary/SectionSummarySettings.tsx +126 -0
- package/src/components/sections/SectionSummary/index.tsx +149 -0
- package/src/components/sections/SubHeading/index.tsx +1 -1
- package/src/components/sections/SubSubHeading/index.tsx +1 -1
- package/src/components/sections/brand-guide.ts +4 -3
- package/src/components/sections/core-sections.ts +2 -0
- package/src/components/shared/BrandSwatchesContext.ts +13 -0
- package/src/components/shared/Button.tsx +47 -34
- package/src/components/shared/Checkbox.tsx +21 -12
- package/src/components/shared/ConfirmDialog.tsx +87 -0
- package/src/components/shared/ConfirmInline.tsx +90 -0
- package/src/components/shared/ErrorBoundary.tsx +6 -18
- package/src/components/shared/Fab.tsx +15 -5
- package/src/components/shared/FabStack.tsx +28 -0
- package/src/components/shared/HistoryChangesModal.tsx +43 -41
- package/src/components/shared/HistoryPopover.tsx +7 -20
- package/src/components/shared/ImageBackgroundField.tsx +92 -0
- package/src/components/shared/{UploadRejectionAlert.tsx → InlineAlert.tsx} +21 -5
- package/src/components/shared/Input.tsx +23 -7
- package/src/components/shared/Navigation.tsx +22 -17
- package/src/components/shared/Notice.tsx +59 -0
- package/src/components/shared/Popover.tsx +7 -11
- package/src/components/shared/ReferenceSourcesContext.ts +27 -0
- package/src/components/shared/Select.tsx +5 -2
- package/src/components/shared/SplitButton.tsx +11 -17
- package/src/components/shared/SummaryAnchorsContext.ts +11 -0
- package/src/components/shared/Textarea.tsx +17 -2
- package/src/components/shared/ToolbarFrame.tsx +28 -0
- package/src/components/shared/VideoSourceField.tsx +1 -1
- package/src/components/shared/copy.ts +18 -0
- package/src/components/shared/icons.tsx +1 -17
- package/src/components/shell/AudienceAddForm.tsx +2 -2
- package/src/components/shell/AudienceDetailsPanel.tsx +23 -5
- package/src/components/shell/AudienceRow.tsx +22 -15
- package/src/components/shell/BugReportFAB.tsx +50 -40
- package/src/components/shell/CredentialList.tsx +33 -13
- package/src/components/shell/DocInspector.tsx +3 -12
- package/src/components/shell/DocumentEditorOverlay.tsx +33 -23
- package/src/components/shell/EditorContext.tsx +7 -0
- package/src/components/shell/EditorLoginForm.tsx +26 -36
- package/src/components/shell/EditorModal.tsx +8 -10
- package/src/components/shell/EditorShell.tsx +501 -338
- package/src/components/shell/HistoryToolbar.tsx +24 -26
- package/src/components/shell/MediaFolderTile.tsx +8 -3
- package/src/components/shell/MediaLibraryModal.tsx +59 -60
- package/src/components/shell/ProcessingIndicator.tsx +2 -2
- package/src/components/shell/RestoreModal.tsx +17 -16
- package/src/components/shell/SetPasswordForm.tsx +3 -3
- package/src/components/shell/SiteSettingsChatbot.tsx +61 -42
- package/src/components/shell/SiteSettingsDisplay.tsx +10 -20
- package/src/components/shell/SiteSettingsModal.tsx +24 -2
- package/src/components/shell/SiteSettingsTags.tsx +143 -0
- package/src/components/shell/SiteSettingsUsers.tsx +36 -26
- package/src/components/shell/SiteSettingsViewerAccess.tsx +2 -2
- package/src/components/shell/ViewerLoginForm.tsx +5 -4
- package/src/components/shell/reference-sources.ts +36 -0
- package/src/deck/index.ts +2 -2
- package/src/document/index.ts +2 -2
- package/src/hooks/useBlockDnd.ts +11 -0
- package/src/hooks/useBuildStatus.ts +53 -6
- package/src/hooks/useDocumentUploads.ts +1 -1
- package/src/hooks/useEditorPersistence.ts +141 -35
- package/src/hooks/useEditorPublish.ts +27 -31
- package/src/hooks/useMediaPipeline.ts +30 -24
- package/src/hooks/useNotice.ts +45 -0
- package/src/hooks/useSortableNavRow.ts +11 -0
- package/src/hooks/useSortableRow.ts +22 -2
- package/src/hooks/useStackedEscape.ts +62 -0
- package/src/lib/block-dnd.ts +6 -1
- package/src/lib/block-move.ts +3 -0
- package/src/lib/brand-swatches.ts +32 -0
- package/src/lib/container-ops.ts +5 -3
- package/src/lib/dexie.ts +24 -2
- package/src/lib/env.ts +9 -0
- package/src/lib/events.ts +1 -2
- package/src/lib/image-background.ts +31 -0
- package/src/lib/image-variant-plan.ts +92 -0
- package/src/lib/index-ops.ts +9 -18
- package/src/lib/index.ts +20 -4
- package/src/lib/loader.ts +28 -88
- package/src/lib/media-ops.ts +112 -0
- package/src/lib/nav-tree.ts +104 -4
- package/src/lib/nav.ts +196 -36
- package/src/lib/pages.ts +2 -3
- package/src/lib/platform-broker.ts +32 -14
- package/src/lib/reference-type.ts +3 -0
- package/src/lib/reference-validation.ts +69 -0
- package/src/lib/references.ts +130 -0
- package/src/lib/registry.ts +37 -0
- package/src/lib/sidecar-diagnostics.ts +29 -0
- package/src/lib/sidecars.ts +221 -0
- package/src/lib/slug.ts +6 -0
- package/src/lib/storage-tier.ts +38 -0
- package/src/lib/tags.ts +165 -0
- package/src/lib/theme-vars.ts +23 -0
- package/src/media/index.ts +1 -1
- package/src/media/queue.ts +3 -0
- package/src/media/utils.ts +19 -1
- package/src/media/{videoPoster.ts → video-poster.ts} +2 -2
- package/src/media/worker.ts +17 -8
- package/src/schemas/index.ts +1 -0
- package/src/schemas/media.ts +7 -2
- package/src/schemas/shared.ts +24 -1
- package/src/schemas/site-config.ts +6 -1
- package/src/schemas/tags.ts +33 -0
- package/src/storage/memory.ts +178 -0
- package/src/storage/types.ts +16 -3
- package/src/types/database.ts +2 -0
- package/dist/chunk-DNY72JZN.js +0 -86
- package/dist/chunk-F2LYQPXV.js +0 -77
- package/dist/chunk-JH762VUH.js +0 -128
- package/dist/chunk-K7DYZXVU.js +0 -138
- package/dist/components/primitives/defineHeadingSection.d.ts.map +0 -1
- package/dist/components/primitives/gridDrop.d.ts.map +0 -1
- package/dist/components/shared/UploadRejectionAlert.d.ts.map +0 -1
- package/dist/components/shell/BuildStatusIndicator.d.ts +0 -7
- package/dist/components/shell/BuildStatusIndicator.d.ts.map +0 -1
- package/dist/components/shell/blockMoveDispatch.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -9
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/lib/grid.d.ts +0 -2
- package/dist/lib/grid.d.ts.map +0 -1
- package/dist/lib/safeRedirect.d.ts.map +0 -1
- package/dist/media/videoPoster.d.ts.map +0 -1
- package/src/components/brandguide/ColorSwatchSettings.d.ts.map +0 -1
- package/src/components/brandguide/Colors.d.ts.map +0 -1
- package/src/components/primitives/CustomParagraph.d.ts.map +0 -1
- package/src/components/primitives/EditableGrid.d.ts.map +0 -1
- package/src/components/primitives/EditablePlainText.d.ts.map +0 -1
- package/src/components/primitives/EditableRichText.d.ts.map +0 -1
- package/src/components/primitives/HeadingSection.d.ts.map +0 -1
- package/src/components/primitives/IconPicker.d.ts.map +0 -1
- package/src/components/primitives/LinkPopover.d.ts.map +0 -1
- package/src/components/primitives/MediaSettingsForms.d.ts.map +0 -1
- package/src/components/primitives/ResolvedMedia.d.ts.map +0 -1
- package/src/components/primitives/RichTextToolbar.d.ts.map +0 -1
- package/src/components/primitives/tiptap-presets.d.ts.map +0 -1
- package/src/components/primitives/useEditableCollection.d.ts.map +0 -1
- package/src/components/primitives/useEditablePlainText.d.ts.map +0 -1
- package/src/components/primitives/useEditableRichText.d.ts.map +0 -1
- package/src/components/sections/Button/CTAButton.d.ts.map +0 -1
- package/src/components/sections/Button/index.d.ts.map +0 -1
- package/src/components/sections/Colors/index.d.ts.map +0 -1
- package/src/components/sections/IconList/IconList.d.ts.map +0 -1
- package/src/components/sections/IconList/IconListSettings.d.ts.map +0 -1
- package/src/components/sections/IconList/index.d.ts.map +0 -1
- package/src/components/sections/LinkHeading/index.d.ts.map +0 -1
- package/src/components/sections/Prose/Prose.d.ts.map +0 -1
- package/src/components/sections/Prose/index.d.ts.map +0 -1
- package/src/components/sections/SubHeading/index.d.ts.map +0 -1
- package/src/components/sections/SubSubHeading/index.d.ts.map +0 -1
- package/src/components/sections/register-schemas.d.ts.map +0 -1
- package/src/components/shared/Button.d.ts.map +0 -1
- package/src/components/shared/Checkbox.d.ts.map +0 -1
- package/src/components/shared/FormLabel.d.ts.map +0 -1
- package/src/components/shared/IconButton.d.ts.map +0 -1
- package/src/components/shared/Input.d.ts.map +0 -1
- package/src/components/shared/Select.d.ts.map +0 -1
- package/src/components/shared/icons.d.ts.map +0 -1
- package/src/components/shell/BuildStatusIndicator.tsx +0 -59
- package/src/components/shell/MediaLibraryContext.d.ts.map +0 -1
- package/src/hooks/index.ts +0 -8
- package/src/hooks/useResolvedMedia.d.ts.map +0 -1
- package/src/lib/cn.d.ts.map +0 -1
- package/src/lib/grid.d.ts.map +0 -1
- package/src/lib/grid.ts +0 -7
- package/src/lib/icons.d.ts.map +0 -1
- package/src/lib/loader.d.ts.map +0 -1
- package/src/lib/nav.d.ts.map +0 -1
- package/src/lib/registry.d.ts.map +0 -1
- package/src/lib/sanitize.d.ts.map +0 -1
- package/src/media/github.d.ts.map +0 -1
- package/src/media/index.d.ts.map +0 -1
- package/src/media/queue.d.ts.map +0 -1
- package/src/media/resolve.d.ts.map +0 -1
- package/src/media/types.d.ts.map +0 -1
- package/src/media/utils.d.ts.map +0 -1
- package/src/media/videoPoster.d.ts.map +0 -1
- package/src/schemas/auth.d.ts.map +0 -1
- package/src/schemas/media-grid-options.d.ts.map +0 -1
- package/src/schemas/media.d.ts.map +0 -1
- package/src/schemas/sections.d.ts.map +0 -1
- package/src/schemas/shared.d.ts.map +0 -1
- package/src/schemas/site-config.d.ts.map +0 -1
- /package/dist/{chunk-B7VBSE5X.js → chunk-3JDTXOIG.js} +0 -0
- /package/dist/{chunk-CXZ5YJG4.js → chunk-L45X7DKX.js} +0 -0
- /package/src/components/primitives/{gridDrop.ts → grid-drop.ts} +0 -0
- /package/src/components/shell/{blockMoveDispatch.ts → block-move-dispatch.ts} +0 -0
- /package/src/lib/{safeRedirect.ts → safe-redirect.ts} +0 -0
package/src/media/worker.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { planImageVariants, type ImageVariantPlan } from "../lib/image-variant-plan";
|
|
2
|
+
|
|
1
3
|
interface ProcessMessage {
|
|
2
4
|
type: "process";
|
|
3
5
|
id: string;
|
|
@@ -24,6 +26,8 @@ interface CompleteMessage {
|
|
|
24
26
|
posterBlob?: Blob;
|
|
25
27
|
width: number;
|
|
26
28
|
height: number;
|
|
29
|
+
/** Static images only — the shared plan the variants were rendered from. */
|
|
30
|
+
plan?: ImageVariantPlan;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
interface ErrorMessage {
|
|
@@ -77,13 +81,17 @@ self.onmessage = async (e: MessageEvent<ProcessMessage>) => {
|
|
|
77
81
|
|
|
78
82
|
post({ type: "progress", id: msg.id, percent: 25 });
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
// Widths, names and paths come from the shared plan (the sharp path uses
|
|
85
|
+
// the same one); this worker only draws. Encoded largest first so the
|
|
86
|
+
// primary blob is the largest variant.
|
|
87
|
+
const plan = planImageVariants({
|
|
88
|
+
hash: msg.hash,
|
|
89
|
+
fileName: msg.originalName,
|
|
90
|
+
width: origWidth,
|
|
91
|
+
height: origHeight,
|
|
92
|
+
media: { sizes: msg.sizes, quality: msg.quality },
|
|
93
|
+
});
|
|
94
|
+
const applicableSizes = plan.variants.map((v) => v.width).reverse();
|
|
87
95
|
|
|
88
96
|
const variants: { width: number; height: number; size: number; blob: Blob }[] = [];
|
|
89
97
|
const totalVariants = applicableSizes.length;
|
|
@@ -97,7 +105,7 @@ self.onmessage = async (e: MessageEvent<ProcessMessage>) => {
|
|
|
97
105
|
const ctx = canvas.getContext("2d")!;
|
|
98
106
|
ctx.drawImage(bitmap, 0, 0, targetWidth, targetHeight);
|
|
99
107
|
|
|
100
|
-
const blob = await canvas.convertToBlob({ type: "image/webp", quality:
|
|
108
|
+
const blob = await canvas.convertToBlob({ type: "image/webp", quality: plan.quality / 100 });
|
|
101
109
|
variants.push({ width: targetWidth, height: targetHeight, size: blob.size, blob });
|
|
102
110
|
|
|
103
111
|
const percent = 25 + Math.round(((i + 1) / totalVariants) * 75);
|
|
@@ -114,6 +122,7 @@ self.onmessage = async (e: MessageEvent<ProcessMessage>) => {
|
|
|
114
122
|
primaryBlob,
|
|
115
123
|
width: origWidth,
|
|
116
124
|
height: origHeight,
|
|
125
|
+
plan,
|
|
117
126
|
});
|
|
118
127
|
} catch (err) {
|
|
119
128
|
const message = err instanceof Error ? err.message : "Processing failed";
|
package/src/schemas/index.ts
CHANGED
package/src/schemas/media.ts
CHANGED
|
@@ -55,13 +55,18 @@ export const ImageManifestSchema = z.object({
|
|
|
55
55
|
|
|
56
56
|
export type MediaManifest = z.infer<typeof ImageManifestSchema>;
|
|
57
57
|
|
|
58
|
+
/** Default git-tier cap for media (bytes); a site may override it as `media.maxFileSize`. */
|
|
59
|
+
export const MEDIA_GIT_MAX_BYTES = 5_242_880;
|
|
60
|
+
/** Default bucket-tier cap for media (bytes); a site may override it as `media.maxAssetSize`. */
|
|
61
|
+
export const MEDIA_BUCKET_MAX_BYTES = 209_715_200;
|
|
62
|
+
|
|
58
63
|
export const MediaConfigSchema = z.object({
|
|
59
64
|
sizes: z.array(z.number()).default([640, 1080, 1920]),
|
|
60
|
-
maxFileSize: z.number().default(
|
|
65
|
+
maxFileSize: z.number().default(MEDIA_GIT_MAX_BYTES),
|
|
61
66
|
quality: z.number().min(1).max(100).default(85),
|
|
62
67
|
// Per-file cap for bucket-backed video uploads (bytes). The git-path cap is
|
|
63
68
|
// maxFileSize; anything between the two routes to the AssetStore.
|
|
64
|
-
maxAssetSize: z.number().default(
|
|
69
|
+
maxAssetSize: z.number().default(MEDIA_BUCKET_MAX_BYTES),
|
|
65
70
|
});
|
|
66
71
|
|
|
67
72
|
export type MediaConfig = z.infer<typeof MediaConfigSchema>;
|
package/src/schemas/shared.ts
CHANGED
|
@@ -38,7 +38,7 @@ const BaseMediaRef = z.object({
|
|
|
38
38
|
.union([z.string(), z.array(z.string())])
|
|
39
39
|
.optional()
|
|
40
40
|
.describe("Optional caption: a single string, or multiple lines as an array of strings."),
|
|
41
|
-
background: z.string().optional().describe("
|
|
41
|
+
background: z.string().optional().describe("Legacy; not rendered. For a backdrop behind a media section's image, use the section's options.background."),
|
|
42
42
|
invertFrom: z
|
|
43
43
|
.string()
|
|
44
44
|
.optional()
|
|
@@ -91,6 +91,29 @@ export const HexColorSchema = z
|
|
|
91
91
|
.string()
|
|
92
92
|
.regex(/^#[0-9a-fA-F]{6}$/, "must be a 6-digit hex color");
|
|
93
93
|
|
|
94
|
+
const ImageBackgroundSurfaceSchema = z.enum(["none", "light", "dark"]);
|
|
95
|
+
export type ImageBackgroundSurface = z.infer<typeof ImageBackgroundSurfaceSchema>;
|
|
96
|
+
|
|
97
|
+
/** Per-placement backdrop painted behind an image (e.g. a dark plate under a
|
|
98
|
+
* white transparent logo). Absent = no backdrop. */
|
|
99
|
+
export const ImageBackgroundSchema = z.discriminatedUnion("mode", [
|
|
100
|
+
z.object({
|
|
101
|
+
mode: z.literal("theme").describe("Pick a site surface separately for light and dark mode."),
|
|
102
|
+
light: ImageBackgroundSurfaceSchema.describe(
|
|
103
|
+
"Backdrop in light mode: 'none', the site's light surface, or its dark surface.",
|
|
104
|
+
),
|
|
105
|
+
dark: ImageBackgroundSurfaceSchema.describe(
|
|
106
|
+
"Backdrop in dark mode: 'none', the site's light surface, or its dark surface.",
|
|
107
|
+
),
|
|
108
|
+
}),
|
|
109
|
+
z.object({
|
|
110
|
+
mode: z.literal("custom").describe("Use one custom color in both modes."),
|
|
111
|
+
color: HexColorSchema.describe("One backdrop color for both light and dark mode, as a 6-digit hex."),
|
|
112
|
+
}),
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
export type ImageBackground = z.infer<typeof ImageBackgroundSchema>;
|
|
116
|
+
|
|
94
117
|
// Font-family names are interpolated raw into the `style` attribute on <html>
|
|
95
118
|
// (`--font-heading: ${headingFont}, ...`). Astro HTML-escapes the attribute, so
|
|
96
119
|
// the residual risk is CSS-declaration injection via `;`/`{}`. Allow only the
|
|
@@ -7,6 +7,7 @@ import { CORNER_RADIUS_OPTIONS } from "../lib/corner-radius";
|
|
|
7
7
|
// document options block onto PageSchema.
|
|
8
8
|
import { documentOptionsSchema } from "../document/engine/settings";
|
|
9
9
|
import type { NavEntry } from "./nav";
|
|
10
|
+
import type { TagEntry } from "./tags";
|
|
10
11
|
|
|
11
12
|
export const StatusSchema = z.enum(["draft", "live", "archived", "published"]).transform(
|
|
12
13
|
(val) => val === "published" ? "live" as const : val,
|
|
@@ -176,8 +177,12 @@ export const IndexSchema = RawIndexSchema.transform(normalizeRawIndex).pipe(Cano
|
|
|
176
177
|
* index.json. It is optional because most SiteIndex values (tests, legacy
|
|
177
178
|
* content, partial writes) have no nav — reads go through navEntries(), which
|
|
178
179
|
* reconciles a missing nav into a flat one.
|
|
180
|
+
*
|
|
181
|
+
* `tags` follows the same rules for the src/content/tags.json sidecar; read it
|
|
182
|
+
* only through siteTags() (lib/tags.ts). Absent means "not loaded", which every
|
|
183
|
+
* writer treats as "leave tags.json alone" — not as "no tags".
|
|
179
184
|
*/
|
|
180
|
-
export type SiteIndex = z.infer<typeof CanonicalIndexSchema> & { nav?: NavEntry[] };
|
|
185
|
+
export type SiteIndex = z.infer<typeof CanonicalIndexSchema> & { nav?: NavEntry[]; tags?: TagEntry[] };
|
|
181
186
|
|
|
182
187
|
/** Parse + normalize any raw index (legacy or canonical) to the canonical shape. */
|
|
183
188
|
export function normalizeSiteIndex(raw: unknown): SiteIndex {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The site's section tags, persisted to `src/content/tags.json`.
|
|
5
|
+
*
|
|
6
|
+
* A sidecar for the same reason nav.json is (see schemas/nav.ts): an older
|
|
7
|
+
* writer re-serializes the Zod-parsed index and silently deletes any key it
|
|
8
|
+
* does not know, so tags must never be a key on index.json or a section file.
|
|
9
|
+
*
|
|
10
|
+
* Each tag owns its assignments (`sectionIds`), so deleting a tag removes it
|
|
11
|
+
* from every section by construction; a deleted section is pruned by
|
|
12
|
+
* `reconcileTags` (lib/tags.ts). Array order is the registry's display order.
|
|
13
|
+
*/
|
|
14
|
+
export const TagEntrySchema = z.object({
|
|
15
|
+
id: z.string().min(1),
|
|
16
|
+
/** May be blank — agent-authored files can omit it; UI falls back to "Untitled tag". */
|
|
17
|
+
label: z.string().catch(""),
|
|
18
|
+
// Everything but `id` repairs rather than rejects. A rejected entry marks the
|
|
19
|
+
// read degraded, and a degraded tags.json refuses EVERY tags write until
|
|
20
|
+
// someone fixes the file by hand — far too heavy a price for one blank id in
|
|
21
|
+
// one tag's list, which reconcileTags would drop anyway.
|
|
22
|
+
sectionIds: z
|
|
23
|
+
.array(z.unknown())
|
|
24
|
+
.catch([])
|
|
25
|
+
.transform((ids) => ids.filter((id): id is string => typeof id === "string" && id !== "")),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const TagsFileSchema = z.object({
|
|
29
|
+
tags: z.array(TagEntrySchema),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type TagEntry = z.infer<typeof TagEntrySchema>;
|
|
33
|
+
export type TagsFile = z.infer<typeof TagsFileSchema>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IDEMPOTENCY_TRAILER,
|
|
3
|
+
NothingToPublishError,
|
|
4
|
+
StorageConflictError,
|
|
5
|
+
type FileWrite,
|
|
6
|
+
type StorageProvider,
|
|
7
|
+
} from "./types";
|
|
8
|
+
|
|
9
|
+
// An in-memory StorageProvider with real commit history: a `main` branch, an
|
|
10
|
+
// optional draft branch, and commits addressable by sha. It exists so the write
|
|
11
|
+
// path can be tested end to end without mocking it, which is only worth
|
|
12
|
+
// anything if it behaves like the GitHub adapter — the storage contract suite
|
|
13
|
+
// runs the same cases against both. Anything that differs from GitHub here is a
|
|
14
|
+
// bug in this file.
|
|
15
|
+
|
|
16
|
+
type Tree = Map<string, Uint8Array>;
|
|
17
|
+
type Commit = { tree: Tree; parent: string | null; message: string };
|
|
18
|
+
type Files = Record<string, string | Uint8Array | null>;
|
|
19
|
+
|
|
20
|
+
// Mirrors promoteDraft in the GitHub adapter: only these subtrees publish;
|
|
21
|
+
// everything else on main is inherited from main.
|
|
22
|
+
const PUBLISHED_PREFIXES = ["src/content/", "assets/"];
|
|
23
|
+
|
|
24
|
+
export type MemoryStorage = StorageProvider & {
|
|
25
|
+
/**
|
|
26
|
+
* Commit straight to a branch as another writer would — a concurrent editor
|
|
27
|
+
* save on the draft (created from main if absent), or a merge onto main.
|
|
28
|
+
* Returns the new commit's sha.
|
|
29
|
+
*/
|
|
30
|
+
commit(branch: "main" | "draft", files: Files, message?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Run `fn` once at the start of the next `writeFiles`, before its
|
|
33
|
+
* `baseVersion` check: a writer landing between a caller's read and its write.
|
|
34
|
+
*/
|
|
35
|
+
beforeNextWrite(fn: () => void): void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function createMemoryStorage(seed: { main?: Files; draft?: Files } = {}): MemoryStorage {
|
|
39
|
+
const commits = new Map<string, Commit>();
|
|
40
|
+
let counter = 0;
|
|
41
|
+
let mainHead: string;
|
|
42
|
+
let draftHead: string | null = null;
|
|
43
|
+
let pendingHook: (() => void) | null = null;
|
|
44
|
+
|
|
45
|
+
function newCommit(tree: Tree, parent: string | null, message: string): string {
|
|
46
|
+
counter += 1;
|
|
47
|
+
const sha = counter.toString(16).padStart(40, "0");
|
|
48
|
+
commits.set(sha, { tree, parent, message });
|
|
49
|
+
return sha;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function applyFiles(base: Tree, files: Files): Tree {
|
|
53
|
+
const tree = new Map(base);
|
|
54
|
+
for (const [path, content] of Object.entries(files)) {
|
|
55
|
+
if (content === null) tree.delete(path);
|
|
56
|
+
else tree.set(path, toBytes(content));
|
|
57
|
+
}
|
|
58
|
+
return tree;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function commitTo(branch: "main" | "draft", files: Files, message = "commit"): string {
|
|
62
|
+
if (branch === "main") {
|
|
63
|
+
mainHead = newCommit(applyFiles(commits.get(mainHead)!.tree, files), mainHead, message);
|
|
64
|
+
return mainHead;
|
|
65
|
+
}
|
|
66
|
+
const parent = draftHead ?? mainHead;
|
|
67
|
+
draftHead = newCommit(applyFiles(commits.get(parent)!.tree, files), parent, message);
|
|
68
|
+
return draftHead;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Unknown branch or sha reads as absent, as GitHub's 404 does.
|
|
72
|
+
function treeFor(options?: { draft?: boolean; at?: string }): Tree | null {
|
|
73
|
+
if (options?.at !== undefined) return commits.get(options.at)?.tree ?? null;
|
|
74
|
+
if (options?.draft) return draftHead === null ? null : commits.get(draftHead)!.tree;
|
|
75
|
+
return commits.get(mainHead)!.tree;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function checkBase(options?: { baseVersion?: string | null }): void {
|
|
79
|
+
if (options && "baseVersion" in options) {
|
|
80
|
+
const expected = options.baseVersion ?? null;
|
|
81
|
+
if (expected !== draftHead) throw new StorageConflictError(draftHead);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
mainHead = newCommit(applyFiles(new Map(), seed.main ?? {}), null, "initial");
|
|
86
|
+
if (seed.draft) commitTo("draft", seed.draft, "seed draft");
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
commit: commitTo,
|
|
90
|
+
|
|
91
|
+
beforeNextWrite(fn) {
|
|
92
|
+
pendingHook = fn;
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
async writeFiles(files: FileWrite[], message: string, options?: { baseVersion?: string | null }) {
|
|
96
|
+
const hook = pendingHook;
|
|
97
|
+
pendingHook = null;
|
|
98
|
+
hook?.();
|
|
99
|
+
|
|
100
|
+
checkBase(options);
|
|
101
|
+
if (files.length === 0) return { version: draftHead ?? mainHead };
|
|
102
|
+
|
|
103
|
+
const parentTree = commits.get(draftHead ?? mainHead)!.tree;
|
|
104
|
+
const changes: Files = {};
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
// GitHub's createTree rejects deleting a path its base tree does not hold.
|
|
107
|
+
if (file.content === null && !parentTree.has(file.path)) {
|
|
108
|
+
throw new Error(`Cannot delete ${file.path}: it is not on the branch`);
|
|
109
|
+
}
|
|
110
|
+
changes[file.path] =
|
|
111
|
+
file.content === null || file.content instanceof Uint8Array || file.encoding !== "base64"
|
|
112
|
+
? file.content
|
|
113
|
+
: fromBase64(file.content);
|
|
114
|
+
}
|
|
115
|
+
return { version: commitTo("draft", changes, message) };
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
async readFile(path, options) {
|
|
119
|
+
return treeFor(options)?.get(path) ?? null;
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
async listDirectory(path, options) {
|
|
123
|
+
const tree = treeFor(options);
|
|
124
|
+
if (!tree) return [];
|
|
125
|
+
const prefix = path.endsWith("/") ? path : `${path}/`;
|
|
126
|
+
const names: string[] = [];
|
|
127
|
+
for (const key of tree.keys()) {
|
|
128
|
+
if (!key.startsWith(prefix)) continue;
|
|
129
|
+
const rest = key.slice(prefix.length);
|
|
130
|
+
if (!rest.includes("/")) names.push(rest);
|
|
131
|
+
}
|
|
132
|
+
return names;
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
async getVersion() {
|
|
136
|
+
return mainHead;
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
async getDraftVersion() {
|
|
140
|
+
return draftHead;
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
async promoteDraft() {
|
|
144
|
+
if (draftHead === null) throw new NothingToPublishError();
|
|
145
|
+
const draft = commits.get(draftHead)!.tree;
|
|
146
|
+
const main = commits.get(mainHead)!.tree;
|
|
147
|
+
const published = (p: string) => PUBLISHED_PREFIXES.some((prefix) => p.startsWith(prefix));
|
|
148
|
+
if (![...draft.keys(), ...main.keys()].some(published)) {
|
|
149
|
+
throw new Error("No editor-managed content found on the saved branch — refusing to publish.");
|
|
150
|
+
}
|
|
151
|
+
const tree = new Map([...main].filter(([p]) => !published(p)));
|
|
152
|
+
for (const [p, bytes] of draft) if (published(p)) tree.set(p, bytes);
|
|
153
|
+
mainHead = newCommit(tree, mainHead, "Publish content via Brand Portal");
|
|
154
|
+
draftHead = null;
|
|
155
|
+
return { version: mainHead };
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
async findCommitByIdempotencyKey(key, options) {
|
|
159
|
+
const limit = Math.min(Math.max(options?.limit ?? 30, 1), 100);
|
|
160
|
+
const trailer = `${IDEMPOTENCY_TRAILER}: ${key}`;
|
|
161
|
+
let sha = draftHead;
|
|
162
|
+
for (let seen = 0; sha !== null && seen < limit; seen += 1) {
|
|
163
|
+
const commit = commits.get(sha)!;
|
|
164
|
+
if (commit.message.split("\n").some((line) => line.trim() === trailer)) return sha;
|
|
165
|
+
sha = commit.parent;
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function toBytes(content: string | Uint8Array): Uint8Array {
|
|
173
|
+
return typeof content === "string" ? new TextEncoder().encode(content) : content;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function fromBase64(content: string): Uint8Array {
|
|
177
|
+
return Uint8Array.from(atob(content), (c) => c.charCodeAt(0));
|
|
178
|
+
}
|
package/src/storage/types.ts
CHANGED
|
@@ -34,16 +34,29 @@ export interface StorageProvider {
|
|
|
34
34
|
options?: { baseVersion?: string | null },
|
|
35
35
|
): Promise<{ version: string }>;
|
|
36
36
|
|
|
37
|
+
// `draft` reads the draft branch by name: null when there is no draft — a
|
|
38
|
+
// caller that wants "draft, else main" falls back itself. `at` reads as of a
|
|
39
|
+
// commit and wins over `draft`. Two reads by branch name can see two different
|
|
40
|
+
// commits moments after a write, so a read that must agree with another read
|
|
41
|
+
// (an index and the listing it is diffed against) pins both to one commit.
|
|
37
42
|
readFile(
|
|
38
43
|
path: string,
|
|
39
|
-
options?: { draft?: boolean },
|
|
44
|
+
options?: { draft?: boolean; at?: string },
|
|
40
45
|
): Promise<Uint8Array | null>;
|
|
41
46
|
|
|
42
47
|
promoteDraft(): Promise<{ version: string }>;
|
|
43
48
|
|
|
49
|
+
/** The published branch's head. Never a valid `baseVersion`. */
|
|
44
50
|
getVersion(): Promise<string>;
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
/**
|
|
53
|
+
* The draft branch's head, or null when no draft exists — exactly the value
|
|
54
|
+
* `writeFiles` accepts as `baseVersion`.
|
|
55
|
+
*/
|
|
56
|
+
getDraftVersion(): Promise<string | null>;
|
|
57
|
+
|
|
58
|
+
/** File basenames directly under `path` (no subdirectories); `[]` when absent. Same options as `readFile`. */
|
|
59
|
+
listDirectory(path: string, options?: { draft?: boolean; at?: string }): Promise<string[]>;
|
|
47
60
|
|
|
48
61
|
/**
|
|
49
62
|
* Find a recent commit on the draft branch whose message carries the given
|
|
@@ -86,7 +99,7 @@ export interface StorageProvider {
|
|
|
86
99
|
*/
|
|
87
100
|
export class IdempotencyLookupUnavailableError extends Error {
|
|
88
101
|
constructor(override readonly cause?: unknown) {
|
|
89
|
-
super("
|
|
102
|
+
super("Couldn't search draft history for the idempotency key");
|
|
90
103
|
this.name = "IdempotencyLookupUnavailableError";
|
|
91
104
|
}
|
|
92
105
|
}
|
package/src/types/database.ts
CHANGED
package/dist/chunk-DNY72JZN.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getContainerChildren
|
|
3
|
-
} from "./chunk-CXZ5YJG4.js";
|
|
4
|
-
import {
|
|
5
|
-
getSection
|
|
6
|
-
} from "./chunk-FTPETWXE.js";
|
|
7
|
-
|
|
8
|
-
// src/lib/nav.ts
|
|
9
|
-
function toSectionId(text) {
|
|
10
|
-
const slug = text.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
|
|
11
|
-
if (slug) return slug;
|
|
12
|
-
let hash = 0;
|
|
13
|
-
for (let i = 0; i < text.length; i++) {
|
|
14
|
-
hash = (hash << 5) - hash + text.charCodeAt(i) | 0;
|
|
15
|
-
}
|
|
16
|
-
return `section-${Math.abs(hash).toString(36)}`;
|
|
17
|
-
}
|
|
18
|
-
function flattenForNav(sections) {
|
|
19
|
-
const flat = [];
|
|
20
|
-
const walk = (loaded) => {
|
|
21
|
-
flat.push(loaded);
|
|
22
|
-
for (const child of getContainerChildren(loaded.section)) {
|
|
23
|
-
walk({ section: child, meta: loaded.meta });
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
sections.forEach(walk);
|
|
27
|
-
return flat;
|
|
28
|
-
}
|
|
29
|
-
function generateNavLinks(sections, registry) {
|
|
30
|
-
const nav = [];
|
|
31
|
-
let currentParent = null;
|
|
32
|
-
let currentChild = null;
|
|
33
|
-
const lookupRole = (type) => {
|
|
34
|
-
const def = registry ? registry.getSection(type) : getSection(type);
|
|
35
|
-
return def?.navRole;
|
|
36
|
-
};
|
|
37
|
-
for (const { section, meta } of flattenForNav(sections)) {
|
|
38
|
-
const content = section.content;
|
|
39
|
-
if (!content.heading) continue;
|
|
40
|
-
const role = lookupRole(section.type);
|
|
41
|
-
if (!role) continue;
|
|
42
|
-
if (role === "h1") {
|
|
43
|
-
if (content.excludeFromNav) {
|
|
44
|
-
currentParent = null;
|
|
45
|
-
currentChild = null;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
currentParent = {
|
|
49
|
-
href: `#${toSectionId(content.heading)}`,
|
|
50
|
-
label: content.heading,
|
|
51
|
-
status: meta.status,
|
|
52
|
-
children: []
|
|
53
|
-
};
|
|
54
|
-
currentChild = null;
|
|
55
|
-
nav.push(currentParent);
|
|
56
|
-
} else if (role === "h2") {
|
|
57
|
-
if (content.excludeFromNav) {
|
|
58
|
-
currentChild = null;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (!currentParent) continue;
|
|
62
|
-
currentChild = {
|
|
63
|
-
href: `#${toSectionId(content.heading)}`,
|
|
64
|
-
label: content.heading,
|
|
65
|
-
status: meta.status,
|
|
66
|
-
children: []
|
|
67
|
-
};
|
|
68
|
-
currentParent.children.push(currentChild);
|
|
69
|
-
} else if (role === "h3") {
|
|
70
|
-
if (content.excludeFromNav) continue;
|
|
71
|
-
if (!currentChild) continue;
|
|
72
|
-
currentChild.children.push({
|
|
73
|
-
href: `#${toSectionId(content.heading)}`,
|
|
74
|
-
label: content.heading,
|
|
75
|
-
status: meta.status,
|
|
76
|
-
children: []
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return nav;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
toSectionId,
|
|
85
|
-
generateNavLinks
|
|
86
|
-
};
|
package/dist/chunk-F2LYQPXV.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-7EOSDFS3.js";
|
|
4
|
-
|
|
5
|
-
// src/components/shared/Checkbox.tsx
|
|
6
|
-
import { useId } from "react";
|
|
7
|
-
import { Check } from "lucide-react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
function Checkbox({
|
|
10
|
-
checked,
|
|
11
|
-
onChange,
|
|
12
|
-
label,
|
|
13
|
-
description,
|
|
14
|
-
disabled,
|
|
15
|
-
className,
|
|
16
|
-
startAdornment,
|
|
17
|
-
align = "start"
|
|
18
|
-
}) {
|
|
19
|
-
const id = useId();
|
|
20
|
-
return /* @__PURE__ */ jsxs(
|
|
21
|
-
"label",
|
|
22
|
-
{
|
|
23
|
-
htmlFor: id,
|
|
24
|
-
className: cn(
|
|
25
|
-
"flex cursor-pointer gap-3 select-none hover:opacity-80",
|
|
26
|
-
align === "start" ? "items-start" : "items-center",
|
|
27
|
-
disabled && "cursor-not-allowed opacity-50",
|
|
28
|
-
className
|
|
29
|
-
),
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ jsxs(
|
|
32
|
-
"span",
|
|
33
|
-
{
|
|
34
|
-
className: cn(
|
|
35
|
-
"relative flex h-5 w-5 shrink-0 items-center justify-center",
|
|
36
|
-
align === "start" && "mt-0.5"
|
|
37
|
-
),
|
|
38
|
-
children: [
|
|
39
|
-
/* @__PURE__ */ jsx(
|
|
40
|
-
"input",
|
|
41
|
-
{
|
|
42
|
-
id,
|
|
43
|
-
type: "checkbox",
|
|
44
|
-
checked,
|
|
45
|
-
disabled,
|
|
46
|
-
onChange: (e) => onChange(e.target.checked),
|
|
47
|
-
className: "sr-only"
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
/* @__PURE__ */ jsx(
|
|
51
|
-
"span",
|
|
52
|
-
{
|
|
53
|
-
"aria-hidden": "true",
|
|
54
|
-
className: cn(
|
|
55
|
-
"flex h-5 w-5 items-center justify-center rounded border transition-colors",
|
|
56
|
-
checked ? "border-primary bg-primary text-primary-contrast" : "border-base-300 bg-base hover:border-primary",
|
|
57
|
-
disabled && "pointer-events-none"
|
|
58
|
-
),
|
|
59
|
-
children: checked && /* @__PURE__ */ jsx(Check, { size: 14, strokeWidth: 3 })
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
startAdornment,
|
|
66
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
67
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-base-contrast", children: label }),
|
|
68
|
-
description && /* @__PURE__ */ jsx("span", { className: "block text-base-contrast-light", children: description })
|
|
69
|
-
] })
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export {
|
|
76
|
-
Checkbox
|
|
77
|
-
};
|