@drawnagency/primitives 0.1.7 → 0.1.10
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/dist/auth/index.js +2 -2
- package/dist/auth/security.d.ts.map +1 -1
- package/dist/{chunk-T4BJ6RSB.js → chunk-32H6Q6CX.js} +1 -1
- package/dist/{chunk-HOJAF4VD.js → chunk-6SK5BLG3.js} +16 -9
- package/dist/{chunk-2VTPWODA.js → chunk-F32I6ZZV.js} +1 -1
- package/dist/{chunk-CS7F6IOY.js → chunk-F3Z6RISI.js} +4 -1
- package/dist/{chunk-UKEVUCIZ.js → chunk-XQXZHDNR.js} +4 -4
- package/dist/components/editor/SectionWrapper.d.ts.map +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/EditableRichText.d.ts +2 -1
- package/dist/components/primitives/EditableRichText.d.ts.map +1 -1
- package/dist/components/primitives/ResolvedMedia.d.ts +4 -1
- package/dist/components/primitives/ResolvedMedia.d.ts.map +1 -1
- package/dist/components/primitives/useEditableRichText.d.ts +2 -1
- package/dist/components/primitives/useEditableRichText.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
- package/dist/components/sections/Prose/Prose.d.ts.map +1 -1
- package/dist/components/sections/SplitContent/SplitContent.d.ts +4 -1
- package/dist/components/sections/SplitContent/SplitContent.d.ts.map +1 -1
- package/dist/components/sections/SplitContent/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/lib/index.js +3 -3
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -2
- package/package.json +11 -10
- package/src/auth/security.ts +5 -1
- package/src/components/brandguide/ColorSwatchSettings.d.ts +8 -0
- package/src/components/brandguide/ColorSwatchSettings.d.ts.map +1 -0
- package/src/components/brandguide/Colors.d.ts +15 -0
- package/src/components/brandguide/Colors.d.ts.map +1 -0
- package/src/components/brandguide/DoDontList.d.ts +16 -0
- package/src/components/brandguide/DoDontList.d.ts.map +1 -0
- package/src/components/brandguide/DoDontMediaGrid.d.ts +16 -0
- package/src/components/brandguide/DoDontMediaGrid.d.ts.map +1 -0
- package/src/components/editor/SectionWrapper.tsx +65 -58
- package/src/components/primitives/CustomParagraph.d.ts +2 -0
- package/src/components/primitives/CustomParagraph.d.ts.map +1 -0
- package/src/components/primitives/EditableGrid.d.ts +19 -0
- package/src/components/primitives/EditableGrid.d.ts.map +1 -0
- package/src/components/primitives/EditableGrid.tsx +70 -47
- package/src/components/primitives/EditableList.tsx +32 -21
- package/src/components/primitives/EditablePlainText.d.ts +12 -0
- package/src/components/primitives/EditablePlainText.d.ts.map +1 -0
- package/src/components/primitives/EditableRichText.d.ts +12 -0
- package/src/components/primitives/EditableRichText.d.ts.map +1 -0
- package/src/components/primitives/EditableRichText.tsx +19 -3
- package/src/components/primitives/HeadingSection.d.ts +10 -0
- package/src/components/primitives/HeadingSection.d.ts.map +1 -0
- package/src/components/primitives/IconPicker.d.ts +9 -0
- package/src/components/primitives/IconPicker.d.ts.map +1 -0
- package/src/components/primitives/LinkPopover.d.ts +8 -0
- package/src/components/primitives/LinkPopover.d.ts.map +1 -0
- package/src/components/primitives/MediaSettingsForms.d.ts +19 -0
- package/src/components/primitives/MediaSettingsForms.d.ts.map +1 -0
- package/src/components/primitives/ResolvedMedia.d.ts +8 -0
- package/src/components/primitives/ResolvedMedia.d.ts.map +1 -0
- package/src/components/primitives/ResolvedMedia.tsx +12 -1
- package/src/components/primitives/RichTextToolbar.d.ts +9 -0
- package/src/components/primitives/RichTextToolbar.d.ts.map +1 -0
- package/src/components/primitives/tiptap-presets.d.ts +4 -0
- package/src/components/primitives/tiptap-presets.d.ts.map +1 -0
- package/src/components/primitives/useEditableCollection.d.ts +19 -0
- package/src/components/primitives/useEditableCollection.d.ts.map +1 -0
- package/src/components/primitives/useEditablePlainText.d.ts +14 -0
- package/src/components/primitives/useEditablePlainText.d.ts.map +1 -0
- package/src/components/primitives/useEditableRichText.d.ts +17 -0
- package/src/components/primitives/useEditableRichText.d.ts.map +1 -0
- package/src/components/primitives/useEditableRichText.ts +8 -2
- package/src/components/sections/Button/CTAButton.d.ts +11 -0
- package/src/components/sections/Button/CTAButton.d.ts.map +1 -0
- package/src/components/sections/Button/index.d.ts +11 -0
- package/src/components/sections/Button/index.d.ts.map +1 -0
- package/src/components/sections/Colors/index.d.ts +22 -0
- package/src/components/sections/Colors/index.d.ts.map +1 -0
- package/src/components/sections/DoDontList/index.d.ts +21 -0
- package/src/components/sections/DoDontList/index.d.ts.map +1 -0
- package/src/components/sections/DoDontMediaGrid/index.d.ts +55 -0
- package/src/components/sections/DoDontMediaGrid/index.d.ts.map +1 -0
- package/src/components/sections/IconList/IconList.d.ts +20 -0
- package/src/components/sections/IconList/IconList.d.ts.map +1 -0
- package/src/components/sections/IconList/IconList.tsx +57 -36
- package/src/components/sections/IconList/IconListSettings.d.ts +11 -0
- package/src/components/sections/IconList/IconListSettings.d.ts.map +1 -0
- package/src/components/sections/IconList/index.d.ts +17 -0
- package/src/components/sections/IconList/index.d.ts.map +1 -0
- package/src/components/sections/LinkHeading/index.d.ts +8 -0
- package/src/components/sections/LinkHeading/index.d.ts.map +1 -0
- package/src/components/sections/MediaGrid/MediaGrid.d.ts +17 -0
- package/src/components/sections/MediaGrid/MediaGrid.d.ts.map +1 -0
- package/src/components/sections/MediaGrid/MediaGrid.tsx +4 -0
- package/src/components/sections/MediaGrid/index.d.ts +55 -0
- package/src/components/sections/MediaGrid/index.d.ts.map +1 -0
- package/src/components/sections/Prose/Prose.d.ts +8 -0
- package/src/components/sections/Prose/Prose.d.ts.map +1 -0
- package/src/components/sections/Prose/Prose.tsx +1 -0
- package/src/components/sections/Prose/index.d.ts +8 -0
- package/src/components/sections/Prose/index.d.ts.map +1 -0
- package/src/components/sections/SplitContent/SplitContent.d.ts +11 -0
- package/src/components/sections/SplitContent/SplitContent.d.ts.map +1 -0
- package/src/components/sections/SplitContent/SplitContent.tsx +7 -1
- package/src/components/sections/SplitContent/SplitContentSettings.d.ts +9 -0
- package/src/components/sections/SplitContent/SplitContentSettings.d.ts.map +1 -0
- package/src/components/sections/SplitContent/index.d.ts +13 -0
- package/src/components/sections/SplitContent/index.d.ts.map +1 -0
- package/src/components/sections/SplitContent/index.tsx +3 -0
- package/src/components/sections/SubHeading/index.d.ts +9 -0
- package/src/components/sections/SubHeading/index.d.ts.map +1 -0
- package/src/components/sections/SubSubHeading/index.d.ts +9 -0
- package/src/components/sections/SubSubHeading/index.d.ts.map +1 -0
- package/src/components/sections/register-schemas.d.ts +2 -0
- package/src/components/sections/register-schemas.d.ts.map +1 -0
- package/src/components/shared/Button.d.ts +15 -0
- package/src/components/shared/Button.d.ts.map +1 -0
- package/src/components/shared/Checkbox.d.ts +14 -0
- package/src/components/shared/Checkbox.d.ts.map +1 -0
- package/src/components/shared/FormLabel.d.ts +8 -0
- package/src/components/shared/FormLabel.d.ts.map +1 -0
- package/src/components/shared/IconButton.d.ts +12 -0
- package/src/components/shared/IconButton.d.ts.map +1 -0
- package/src/components/shared/Input.d.ts +8 -0
- package/src/components/shared/Input.d.ts.map +1 -0
- package/src/components/shared/Select.d.ts +16 -0
- package/src/components/shared/Select.d.ts.map +1 -0
- package/src/components/shared/icons.d.ts +17 -0
- package/src/components/shared/icons.d.ts.map +1 -0
- package/src/components/shell/MediaLibraryContext.d.ts +14 -0
- package/src/components/shell/MediaLibraryContext.d.ts.map +1 -0
- package/src/hooks/useResolvedMedia.d.ts +9 -0
- package/src/hooks/useResolvedMedia.d.ts.map +1 -0
- package/src/lib/cn.d.ts +3 -0
- package/src/lib/cn.d.ts.map +1 -0
- package/src/lib/grid.d.ts +2 -0
- package/src/lib/grid.d.ts.map +1 -0
- package/src/lib/icons.d.ts +9 -0
- package/src/lib/icons.d.ts.map +1 -0
- package/src/lib/loader.d.ts +28 -0
- package/src/lib/loader.d.ts.map +1 -0
- package/src/lib/loader.ts +15 -7
- package/src/lib/nav.d.ts +15 -0
- package/src/lib/nav.d.ts.map +1 -0
- package/src/lib/registry.d.ts +110 -0
- package/src/lib/registry.d.ts.map +1 -0
- package/src/lib/registry.ts +6 -4
- package/src/lib/sanitize.d.ts +2 -0
- package/src/lib/sanitize.d.ts.map +1 -0
- package/src/media/github.d.ts +3 -0
- package/src/media/github.d.ts.map +1 -0
- package/src/media/index.d.ts +8 -0
- package/src/media/index.d.ts.map +1 -0
- package/src/media/queue.d.ts +74 -0
- package/src/media/queue.d.ts.map +1 -0
- package/src/media/resolve.d.ts +14 -0
- package/src/media/resolve.d.ts.map +1 -0
- package/src/media/types.d.ts +42 -0
- package/src/media/types.d.ts.map +1 -0
- package/src/media/utils.d.ts +7 -0
- package/src/media/utils.d.ts.map +1 -0
- package/src/media/videoPoster.d.ts +6 -0
- package/src/media/videoPoster.d.ts.map +1 -0
- package/src/schemas/auth.d.ts +36 -0
- package/src/schemas/auth.d.ts.map +1 -0
- package/src/schemas/media-grid-options.d.ts +8 -0
- package/src/schemas/media-grid-options.d.ts.map +1 -0
- package/src/schemas/media.d.ts +63 -0
- package/src/schemas/media.d.ts.map +1 -0
- package/src/schemas/sections.d.ts +12 -0
- package/src/schemas/sections.d.ts.map +1 -0
- package/src/schemas/shared.d.ts +98 -0
- package/src/schemas/shared.d.ts.map +1 -0
- package/src/schemas/site-config.d.ts +48 -0
- package/src/schemas/site-config.d.ts.map +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface SelectOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface SelectProps {
|
|
6
|
+
label?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
selectClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function Select({ label, value, onChange, options, disabled, className, selectClassName, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["Select.tsx"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,eAAe,GAChB,EAAE,WAAW,2CA+Bb"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function DragHandle({ size }: {
|
|
2
|
+
size?: number;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function AddIcon({ size }: {
|
|
5
|
+
size?: number;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function RemoveIcon({ size }: {
|
|
8
|
+
size?: number;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function DeleteIcon({ size }: {
|
|
11
|
+
size?: number;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function SettingsIcon({ size }: {
|
|
14
|
+
size?: number;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export { GripVertical, Plus, Trash2, X, Settings } from "lucide-react";
|
|
17
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["icons.tsx"],"names":[],"mappings":"AAOA,wBAAgB,UAAU,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2CAE1D;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2CAEvD;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2CAE1D;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2CAE1D;AAED,wBAAgB,YAAY,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,2CAE5D;AAED,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MediaManifest, MediaItem } from "../../media/types";
|
|
2
|
+
import type { SiteConfig } from "../../schemas/site-config";
|
|
3
|
+
export interface MediaLibraryContextValue {
|
|
4
|
+
openSelectModal: (onSelect: (imageId: string) => void) => void;
|
|
5
|
+
uploadFile: (file: File) => void;
|
|
6
|
+
uploadFileWithCallback: (file: File, onComplete: (imageId: string) => void) => string;
|
|
7
|
+
manifest: MediaManifest;
|
|
8
|
+
pendingItems: MediaItem[];
|
|
9
|
+
pendingLocalUrls: Record<string, string>;
|
|
10
|
+
siteConfig: SiteConfig | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const MediaLibraryContext: import("react").Context<MediaLibraryContextValue | null>;
|
|
13
|
+
export declare function useMediaLibrary(): MediaLibraryContextValue | null;
|
|
14
|
+
//# sourceMappingURL=MediaLibraryContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaLibraryContext.d.ts","sourceRoot":"","sources":["MediaLibraryContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC/D,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAAK,MAAM,CAAC;IACtF,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,0DAAuD,CAAC;AAExF,wBAAgB,eAAe,IAAI,wBAAwB,GAAG,IAAI,CAEjE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ResolvedMediaResult {
|
|
2
|
+
src: string | undefined;
|
|
3
|
+
srcset: string | undefined;
|
|
4
|
+
poster: string | undefined;
|
|
5
|
+
alt: string;
|
|
6
|
+
kind: "image" | "animated" | "video";
|
|
7
|
+
}
|
|
8
|
+
export declare function useResolvedMedia(imageId: string | undefined): ResolvedMediaResult;
|
|
9
|
+
//# sourceMappingURL=useResolvedMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedMedia.d.ts","sourceRoot":"","sources":["useResolvedMedia.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;CACtC;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAyCjF"}
|
package/src/lib/cn.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["grid.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMhD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
export interface IconEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon: LucideIcon;
|
|
6
|
+
}
|
|
7
|
+
export declare const curatedIcons: IconEntry[];
|
|
8
|
+
export declare function getIcon(id: string): IconEntry | undefined;
|
|
9
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAqBL,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,EAqBnC,CAAC;AAIF,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEzD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Section } from "../schemas/sections";
|
|
2
|
+
import { type SiteIndex, type SectionMeta } from "../schemas/site-config";
|
|
3
|
+
export interface LoadedSection {
|
|
4
|
+
section: Section;
|
|
5
|
+
meta: SectionMeta;
|
|
6
|
+
}
|
|
7
|
+
export interface SiteContent {
|
|
8
|
+
sections: LoadedSection[];
|
|
9
|
+
index: SiteIndex;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Merge a validated index with raw section file contents.
|
|
13
|
+
* Validates each section file against its Zod schema.
|
|
14
|
+
* Returns sections in the order specified by index.order.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeSiteContent(index: SiteIndex, sectionFiles: Record<string, unknown>): SiteContent;
|
|
17
|
+
/**
|
|
18
|
+
* Build a SiteContent from a Vite `import.meta.glob` result.
|
|
19
|
+
* Callers glob the section JSON files at build time, pass the parsed index, and
|
|
20
|
+
* receive sections merged in index.order.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadStaticSiteContent(index: SiteIndex, sectionGlob: Record<string, unknown>): SiteContent;
|
|
23
|
+
/**
|
|
24
|
+
* Load site content from the filesystem.
|
|
25
|
+
* For use in scripts and tests — Astro pages should use import.meta.glob instead.
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadSiteContent(contentDir: string): Promise<SiteContent>;
|
|
28
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGvF,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,WAAW,CA2Bb;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,WAAW,CAQb;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAe9E"}
|
package/src/lib/loader.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getSectionSchema, type Section } from "../schemas/sections";
|
|
2
2
|
import { IndexSchema, type SiteIndex, type SectionMeta } from "../schemas/site-config";
|
|
3
|
+
import { getAllSchemas } from "./registry";
|
|
3
4
|
|
|
4
5
|
export interface LoadedSection {
|
|
5
6
|
section: Section;
|
|
@@ -22,20 +23,27 @@ export function mergeSiteContent(
|
|
|
22
23
|
): SiteContent {
|
|
23
24
|
const sections: LoadedSection[] = [];
|
|
24
25
|
|
|
26
|
+
const canValidate = getAllSchemas().length >= 2;
|
|
27
|
+
|
|
25
28
|
for (const id of index.order) {
|
|
26
29
|
const raw = sectionFiles[id];
|
|
27
30
|
if (!raw) {
|
|
28
31
|
console.warn(`Section file missing for id: ${id}, skipping`);
|
|
29
32
|
continue;
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
if (canValidate) {
|
|
35
|
+
const result = getSectionSchema().safeParse(raw);
|
|
36
|
+
if (!result.success) {
|
|
37
|
+
const type = (raw as Record<string, unknown>).type ?? "unknown";
|
|
38
|
+
console.warn(`Skipping section "${id}" (type: ${type}): invalid schema`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const meta = index.sections[id];
|
|
42
|
+
sections.push({ section: result.data, meta });
|
|
43
|
+
} else {
|
|
44
|
+
const meta = index.sections[id];
|
|
45
|
+
sections.push({ section: raw as Section, meta });
|
|
36
46
|
}
|
|
37
|
-
const meta = index.sections[id];
|
|
38
|
-
sections.push({ section: result.data, meta });
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
return { sections, index };
|
package/src/lib/nav.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LoadedSection } from "./loader";
|
|
2
|
+
export interface NavItem {
|
|
3
|
+
href: string;
|
|
4
|
+
label: string;
|
|
5
|
+
status?: string;
|
|
6
|
+
children: NavItem[];
|
|
7
|
+
}
|
|
8
|
+
export declare function toSectionId(text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a three-tier navigation structure from sections.
|
|
11
|
+
* link_heading → top-level, sub_heading → second-level, sub_sub_heading → third-level.
|
|
12
|
+
* Non-heading sections are skipped.
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateNavLinks(sections: LoadedSection[]): NavItem[];
|
|
15
|
+
//# sourceMappingURL=nav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAyCrE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ZodType, z } from "zod";
|
|
2
|
+
import type { ComponentType, ReactNode } from "react";
|
|
3
|
+
import type { Audience } from "../schemas/auth";
|
|
4
|
+
export type SettingsFieldDef = {
|
|
5
|
+
type: "text";
|
|
6
|
+
label: string;
|
|
7
|
+
default: string;
|
|
8
|
+
target?: "content" | "options";
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "number";
|
|
12
|
+
label: string;
|
|
13
|
+
default: number;
|
|
14
|
+
target?: "content" | "options";
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: "checkbox";
|
|
19
|
+
label: string;
|
|
20
|
+
default: boolean;
|
|
21
|
+
target?: "content" | "options";
|
|
22
|
+
} | {
|
|
23
|
+
type: "select";
|
|
24
|
+
label: string;
|
|
25
|
+
default: string;
|
|
26
|
+
target?: "content" | "options";
|
|
27
|
+
coerce?: "number";
|
|
28
|
+
options: {
|
|
29
|
+
label: string;
|
|
30
|
+
value: string;
|
|
31
|
+
}[];
|
|
32
|
+
} | {
|
|
33
|
+
type: "range";
|
|
34
|
+
label: string;
|
|
35
|
+
default: number;
|
|
36
|
+
target?: "content" | "options";
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
step?: number;
|
|
40
|
+
};
|
|
41
|
+
export type SettingsSchema = Record<string, SettingsFieldDef>;
|
|
42
|
+
export type CustomSettingsFormProps = Record<string, any>;
|
|
43
|
+
export interface SectionProps<T = unknown> {
|
|
44
|
+
content: T;
|
|
45
|
+
options?: Record<string, unknown>;
|
|
46
|
+
onChange?: (content: T) => void;
|
|
47
|
+
isEditMode: boolean;
|
|
48
|
+
openModal?: (title: string, content: ReactNode) => void;
|
|
49
|
+
}
|
|
50
|
+
export interface WrapperProps {
|
|
51
|
+
sectionId: string;
|
|
52
|
+
sectionType: string;
|
|
53
|
+
status: string;
|
|
54
|
+
dirty?: boolean;
|
|
55
|
+
index: number;
|
|
56
|
+
isLast: boolean;
|
|
57
|
+
definition: SectionDefinition;
|
|
58
|
+
options?: Record<string, unknown>;
|
|
59
|
+
audiences: Audience[];
|
|
60
|
+
access: string[];
|
|
61
|
+
onAccessChange?: (access: string[]) => void;
|
|
62
|
+
onStatusChange?: (status: "draft" | "published" | "archived") => void;
|
|
63
|
+
onSectionChange?: (options: Record<string, unknown>) => void;
|
|
64
|
+
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
65
|
+
onRequestInsert?: (index: number) => void;
|
|
66
|
+
onDelete?: () => void;
|
|
67
|
+
children: React.ReactNode;
|
|
68
|
+
}
|
|
69
|
+
export interface SectionDefinition<T = unknown> {
|
|
70
|
+
type: string;
|
|
71
|
+
label: string;
|
|
72
|
+
icon?: string;
|
|
73
|
+
schema: ZodType<T>;
|
|
74
|
+
component: ComponentType<SectionProps<T>>;
|
|
75
|
+
defaults: () => T;
|
|
76
|
+
wrapper?: ComponentType<WrapperProps>;
|
|
77
|
+
settings?: SettingsSchema;
|
|
78
|
+
settingsForm?: ComponentType<any>;
|
|
79
|
+
}
|
|
80
|
+
type DefineSectionInput<S extends ZodType> = {
|
|
81
|
+
type: string;
|
|
82
|
+
label: string;
|
|
83
|
+
icon?: string;
|
|
84
|
+
schema: S;
|
|
85
|
+
component: ComponentType<SectionProps<z.infer<S>>>;
|
|
86
|
+
defaults: () => z.infer<S>;
|
|
87
|
+
wrapper?: ComponentType<WrapperProps>;
|
|
88
|
+
settings?: SettingsSchema;
|
|
89
|
+
settingsForm?: ComponentType<any>;
|
|
90
|
+
};
|
|
91
|
+
export declare function defineSection<S extends ZodType>(def: DefineSectionInput<S>): SectionDefinition<z.infer<S>>;
|
|
92
|
+
export interface SectionRegistry {
|
|
93
|
+
registerSection(def: SectionDefinition<any>): void;
|
|
94
|
+
registerSchema(type: string, schema: ZodType): void;
|
|
95
|
+
getSection(type: string): SectionDefinition | undefined;
|
|
96
|
+
getSchema(type: string): ZodType | undefined;
|
|
97
|
+
getAllSections(): SectionDefinition[];
|
|
98
|
+
getAllSchemas(): ZodType[];
|
|
99
|
+
clearRegistry(): void;
|
|
100
|
+
}
|
|
101
|
+
export declare function createRegistry(): SectionRegistry;
|
|
102
|
+
export declare function registerSection(def: SectionDefinition<any>): void;
|
|
103
|
+
export declare function registerSchema(type: string, schema: ZodType): void;
|
|
104
|
+
export declare function getSection(type: string): SectionDefinition | undefined;
|
|
105
|
+
export declare function getSchema(type: string): ZodType | undefined;
|
|
106
|
+
export declare function getAllSections(): SectionDefinition[];
|
|
107
|
+
export declare function getAllSchemas(): ZodType[];
|
|
108
|
+
export declare function clearRegistry(): void;
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,MAAM,gBAAgB,GACxB;IACE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;I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E,CAAC;IAC3B,aAAa,IAAI,IAAI,CAAC;CACvB;AAED,wBAAgB,cAAc,IAAI,eAAe,CAiChD;AAYD,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAI,CAEjE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAElE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEtE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE3D;AAED,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD;AAED,wBAAgB,aAAa,IAAI,OAAO,EAAE,CAEzC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
package/src/lib/registry.ts
CHANGED
|
@@ -137,9 +137,6 @@ export function createRegistry(): SectionRegistry {
|
|
|
137
137
|
|
|
138
138
|
return {
|
|
139
139
|
registerSection(def) {
|
|
140
|
-
if (sections.has(def.type)) {
|
|
141
|
-
throw new Error(`Section type "${def.type}" is already registered`);
|
|
142
|
-
}
|
|
143
140
|
sections.set(def.type, def);
|
|
144
141
|
},
|
|
145
142
|
registerSchema(type, schema) {
|
|
@@ -169,8 +166,13 @@ export function createRegistry(): SectionRegistry {
|
|
|
169
166
|
}
|
|
170
167
|
|
|
171
168
|
// --- Default instance & module-level convenience functions ---
|
|
169
|
+
// Use a global symbol key so the singleton survives module duplication
|
|
170
|
+
// by Rollup/Vite during SSR code-splitting.
|
|
172
171
|
|
|
173
|
-
const
|
|
172
|
+
const REGISTRY_KEY = Symbol.for("@drawnagency/primitives/registry");
|
|
173
|
+
const g = globalThis as unknown as Record<symbol, SectionRegistry>;
|
|
174
|
+
if (!g[REGISTRY_KEY]) g[REGISTRY_KEY] = createRegistry();
|
|
175
|
+
const defaultRegistry = g[REGISTRY_KEY];
|
|
174
176
|
|
|
175
177
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
176
178
|
export function registerSection(def: SectionDefinition<any>): void {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["sanitize.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["github.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAwB,aAAa,EAAiB,MAAM,SAAS,CAAC;AAGhG,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY,CAoE9E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MediaAdapter, MediaManifest } from "./types";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./utils";
|
|
4
|
+
export * from "./queue";
|
|
5
|
+
export * from "./resolve";
|
|
6
|
+
export { generateVideoPoster } from "./videoPoster";
|
|
7
|
+
export declare function createMediaAdapter(manifest: MediaManifest): MediaAdapter;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG3D,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY,CAExE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { MediaKind } from "./types";
|
|
2
|
+
export interface QueueInput {
|
|
3
|
+
buffer: ArrayBuffer;
|
|
4
|
+
originalName: string;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
hash: string;
|
|
7
|
+
kind: MediaKind;
|
|
8
|
+
}
|
|
9
|
+
export interface QueueItem {
|
|
10
|
+
id: string;
|
|
11
|
+
originalName: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
kind: MediaKind;
|
|
15
|
+
percent: number;
|
|
16
|
+
state: "queued" | "active" | "complete" | "error";
|
|
17
|
+
error?: string;
|
|
18
|
+
result?: {
|
|
19
|
+
variants: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
size: number;
|
|
23
|
+
blob: Blob;
|
|
24
|
+
}[];
|
|
25
|
+
primaryBlob: Blob;
|
|
26
|
+
posterBlob?: Blob;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export type QueueEvent = {
|
|
32
|
+
type: "queued";
|
|
33
|
+
item: QueueItem;
|
|
34
|
+
} | {
|
|
35
|
+
type: "started";
|
|
36
|
+
item: QueueItem;
|
|
37
|
+
} | {
|
|
38
|
+
type: "progress";
|
|
39
|
+
item: QueueItem;
|
|
40
|
+
} | {
|
|
41
|
+
type: "complete";
|
|
42
|
+
item: QueueItem;
|
|
43
|
+
} | {
|
|
44
|
+
type: "error";
|
|
45
|
+
item: QueueItem;
|
|
46
|
+
};
|
|
47
|
+
interface QueueOptions {
|
|
48
|
+
sizes: number[];
|
|
49
|
+
quality: number;
|
|
50
|
+
maxConcurrent: number;
|
|
51
|
+
createWorker: () => Worker;
|
|
52
|
+
onEvent: (event: QueueEvent) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare class ProcessingQueue {
|
|
55
|
+
private items;
|
|
56
|
+
private pending;
|
|
57
|
+
private activeWorkers;
|
|
58
|
+
private options;
|
|
59
|
+
private nextId;
|
|
60
|
+
constructor(options: QueueOptions);
|
|
61
|
+
add(input: QueueInput): string;
|
|
62
|
+
getStatus(): {
|
|
63
|
+
active: number;
|
|
64
|
+
queued: number;
|
|
65
|
+
total: number;
|
|
66
|
+
items: QueueItem[];
|
|
67
|
+
};
|
|
68
|
+
private processNext;
|
|
69
|
+
private startProcessing;
|
|
70
|
+
private cleanupWorker;
|
|
71
|
+
destroy(): void;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE;QACP,QAAQ,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,IAAI,CAAA;SAAE,EAAE,CAAC;QACxE,WAAW,EAAE,IAAI,CAAC;QAClB,UAAU,CAAC,EAAE,IAAI,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;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
3
|
+
imageId?: string;
|
|
4
|
+
src?: string;
|
|
5
|
+
}, manifest: MediaManifest, sizes: number[]): ResolvedMedia | null;
|
|
6
|
+
/**
|
|
7
|
+
* Deep-walk section content and resolve any { imageId } references to
|
|
8
|
+
* { src, srcset } values using the media manifest.
|
|
9
|
+
*
|
|
10
|
+
* This lets view-mode section components use `item.src` and `item.srcset`
|
|
11
|
+
* without needing to know about the manifest themselves.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveManifestReferences(content: unknown, manifest: MediaManifest, sizes: number[]): unknown;
|
|
14
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG5D,wBAAgB,YAAY,CAC1B,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EACxC,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,MAAM,EAAE,GACd,aAAa,GAAG,IAAI,CAItB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAsCT"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { VariantSchema, MediaItemSchema, ImageManifestSchema, MediaConfigSchema, type Variant, type MediaItem, type MediaManifest, type MediaConfig, } from "../schemas/media";
|
|
2
|
+
import type { MediaItem } from "../schemas/media";
|
|
3
|
+
export type MediaKind = "image" | "animated" | "video";
|
|
4
|
+
export interface MediaFile {
|
|
5
|
+
buffer: ArrayBuffer;
|
|
6
|
+
originalName: string;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ResolvedImage {
|
|
10
|
+
tag: "img";
|
|
11
|
+
src: string;
|
|
12
|
+
srcSet?: string;
|
|
13
|
+
sizes?: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ResolvedAnimated {
|
|
18
|
+
tag: "img";
|
|
19
|
+
src: string;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ResolvedVideo {
|
|
24
|
+
tag: "video";
|
|
25
|
+
src: string;
|
|
26
|
+
poster?: string;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
autoplay: boolean;
|
|
30
|
+
loop: boolean;
|
|
31
|
+
muted: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type ResolvedMedia = ResolvedImage | ResolvedAnimated | ResolvedVideo;
|
|
34
|
+
export interface MediaAdapter {
|
|
35
|
+
hash(file: MediaFile): Promise<string>;
|
|
36
|
+
exists(hash: string): Promise<boolean>;
|
|
37
|
+
process(file: MediaFile, hash: string, sizes: number[]): Promise<MediaItem>;
|
|
38
|
+
delete(id: string): Promise<void>;
|
|
39
|
+
resolve(id: string, sizes: number[]): ResolvedMedia | null;
|
|
40
|
+
list(): Promise<MediaItem[]>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,MAAM,E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AAG,aAAa,GAAG,IAAI,CAAC;IAC3D,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;CAC9B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function hashFileBuffer(buffer: ArrayBuffer): Promise<string>;
|
|
2
|
+
export declare function sanitizeMediaName(name: string): string;
|
|
3
|
+
export declare const MIME_TO_EXT: Record<string, string>;
|
|
4
|
+
export declare const EXT_TO_MIME: Record<string, string>;
|
|
5
|
+
export declare function mimeToExt(mime: string): string;
|
|
6
|
+
export declare function displayFilenameExt(mime: string): string;
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,wBAAsB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBzE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI9C,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK9C,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"videoPoster.d.ts","sourceRoot":"","sources":["videoPoster.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAiD9D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const RoleSchema: z.ZodEnum<{
|
|
3
|
+
owner: "owner";
|
|
4
|
+
editor: "editor";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const SessionSchema: z.ZodObject<{
|
|
7
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
8
|
+
email: z.ZodNullable<z.ZodString>;
|
|
9
|
+
role: z.ZodEnum<{
|
|
10
|
+
owner: "owner";
|
|
11
|
+
editor: "editor";
|
|
12
|
+
}>;
|
|
13
|
+
siteId: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const SiteUserSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
email: z.ZodString;
|
|
18
|
+
role: z.ZodEnum<{
|
|
19
|
+
owner: "owner";
|
|
20
|
+
editor: "editor";
|
|
21
|
+
}>;
|
|
22
|
+
createdAt: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const AudienceSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
displayName: z.ZodString;
|
|
27
|
+
color: z.ZodNullable<z.ZodString>;
|
|
28
|
+
readonly: z.ZodBoolean;
|
|
29
|
+
hasPassword: z.ZodBoolean;
|
|
30
|
+
isDefault: z.ZodBoolean;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type Session = z.infer<typeof SessionSchema>;
|
|
33
|
+
export type SiteUser = z.infer<typeof SiteUserSchema>;
|
|
34
|
+
export type Audience = z.infer<typeof AudienceSchema>;
|
|
35
|
+
export type Role = z.infer<typeof RoleSchema>;
|
|
36
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;EAA8B,CAAC;AAEtD,eAAO,MAAM,aAAa;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;iBAKzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;iBAOzB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,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":["media-grid-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;kBAKrB,CAAC"}
|