@drawnagency/primitives 0.1.56 → 0.1.58

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.
Files changed (165) hide show
  1. package/dist/adapter-HH47ZPGM.js +1779 -0
  2. package/dist/auth/index.js +1 -0
  3. package/dist/{chunk-EU6NZ4GS.js → chunk-AN62WPW7.js} +22 -163
  4. package/dist/chunk-ESE5UBQI.js +73 -0
  5. package/dist/{chunk-KGYWQDBB.js → chunk-ICLXLWQ5.js} +9 -72
  6. package/dist/chunk-JSBRDJBE.js +30 -0
  7. package/dist/chunk-NSCT3AMV.js +32 -0
  8. package/dist/chunk-RFZNNCAS.js +160 -0
  9. package/dist/chunk-TG43X7JO.js +123 -0
  10. package/dist/{chunk-7IAWF7LE.js → chunk-V7JN2DDU.js} +2 -19
  11. package/dist/chunk-VKAGMEKE.js +90 -0
  12. package/dist/chunk-ZU2MKPTG.js +29 -0
  13. package/dist/closest-edge-EBOXL3YW.js +72 -0
  14. package/dist/components/editor/ChildBlockWrapper.d.ts +19 -0
  15. package/dist/components/editor/ChildBlockWrapper.d.ts.map +1 -0
  16. package/dist/components/editor/ColSpanControl.d.ts +9 -0
  17. package/dist/components/editor/ColSpanControl.d.ts.map +1 -0
  18. package/dist/components/editor/SectionWrapper.d.ts +1 -1
  19. package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
  20. package/dist/components/editor/SettingsForm.d.ts +5 -1
  21. package/dist/components/editor/SettingsForm.d.ts.map +1 -1
  22. package/dist/components/primitives/EditableGrid.d.ts.map +1 -1
  23. package/dist/components/primitives/IconPicker.d.ts +7 -1
  24. package/dist/components/primitives/IconPicker.d.ts.map +1 -1
  25. package/dist/components/sections/Container/Container.d.ts +20 -0
  26. package/dist/components/sections/Container/Container.d.ts.map +1 -0
  27. package/dist/components/sections/Container/ContainerSettingsForm.d.ts +17 -0
  28. package/dist/components/sections/Container/ContainerSettingsForm.d.ts.map +1 -0
  29. package/dist/components/sections/Container/index.d.ts +11 -0
  30. package/dist/components/sections/Container/index.d.ts.map +1 -0
  31. package/dist/components/sections/IconList/IconList.d.ts +1 -0
  32. package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
  33. package/dist/components/sections/IconList/IconListSettings.d.ts +3 -4
  34. package/dist/components/sections/IconList/IconListSettings.d.ts.map +1 -1
  35. package/dist/components/sections/IconList/index.d.ts +1 -0
  36. package/dist/components/sections/IconList/index.d.ts.map +1 -1
  37. package/dist/components/sections/Media/MediaBlock.d.ts +19 -0
  38. package/dist/components/sections/Media/MediaBlock.d.ts.map +1 -0
  39. package/dist/components/sections/{MediaGrid → Media}/index.d.ts +15 -25
  40. package/dist/components/sections/Media/index.d.ts.map +1 -0
  41. package/dist/components/sections/Prose/index.d.ts.map +1 -1
  42. package/dist/components/sections/Spacer/Spacer.d.ts +2 -0
  43. package/dist/components/sections/Spacer/Spacer.d.ts.map +1 -0
  44. package/dist/components/sections/Spacer/index.d.ts +6 -0
  45. package/dist/components/sections/Spacer/index.d.ts.map +1 -0
  46. package/dist/components/sections/all-sections.d.ts +29 -103
  47. package/dist/components/sections/all-sections.d.ts.map +1 -1
  48. package/dist/components/sections/register-schemas.d.ts.map +1 -1
  49. package/dist/components/sections/register-schemas.js +4094 -0
  50. package/dist/components/shared/Tabs.d.ts +24 -0
  51. package/dist/components/shared/Tabs.d.ts.map +1 -0
  52. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  53. package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -1
  54. package/dist/components/shell/blockMoveDispatch.d.ts +21 -0
  55. package/dist/components/shell/blockMoveDispatch.d.ts.map +1 -0
  56. package/dist/hooks/useBlockDnd.d.ts +48 -0
  57. package/dist/hooks/useBlockDnd.d.ts.map +1 -0
  58. package/dist/index.js +69 -56
  59. package/dist/lib/block-dnd.d.ts +42 -0
  60. package/dist/lib/block-dnd.d.ts.map +1 -0
  61. package/dist/lib/block-move.d.ts +31 -0
  62. package/dist/lib/block-move.d.ts.map +1 -0
  63. package/dist/lib/container-grid.d.ts +29 -0
  64. package/dist/lib/container-grid.d.ts.map +1 -0
  65. package/dist/lib/container-ops.d.ts +44 -0
  66. package/dist/lib/container-ops.d.ts.map +1 -0
  67. package/dist/lib/dexie.d.ts.map +1 -1
  68. package/dist/lib/dexie.js +15 -0
  69. package/dist/lib/env.js +1 -0
  70. package/dist/lib/index.js +19 -13
  71. package/dist/lib/loader.d.ts.map +1 -1
  72. package/dist/lib/migrate-sections-transform.d.ts +12 -0
  73. package/dist/lib/migrate-sections-transform.d.ts.map +1 -0
  74. package/dist/lib/migrate-sections-transform.js +7 -0
  75. package/dist/lib/registry.d.ts +39 -0
  76. package/dist/lib/registry.d.ts.map +1 -1
  77. package/dist/lib/registry.js +27 -0
  78. package/dist/media/index.js +1 -0
  79. package/dist/schemas/auth.js +1 -0
  80. package/dist/schemas/block.d.ts +20 -0
  81. package/dist/schemas/block.d.ts.map +1 -0
  82. package/dist/schemas/block.js +15 -0
  83. package/dist/schemas/index.js +13 -4
  84. package/dist/schemas/link.d.ts +7 -0
  85. package/dist/schemas/link.d.ts.map +1 -1
  86. package/dist/schemas/rich-text.d.ts +9 -0
  87. package/dist/schemas/rich-text.d.ts.map +1 -0
  88. package/dist/schemas/sections.d.ts +2 -0
  89. package/dist/schemas/sections.d.ts.map +1 -1
  90. package/dist/schemas/shared.d.ts +30 -0
  91. package/dist/schemas/shared.d.ts.map +1 -1
  92. package/dist/types/database.js +2 -0
  93. package/package.json +17 -1
  94. package/src/components/brandguide/Colors.tsx +35 -33
  95. package/src/components/editor/ChildBlockWrapper.tsx +108 -0
  96. package/src/components/editor/ColSpanControl.tsx +56 -0
  97. package/src/components/editor/SectionWrapper.tsx +44 -20
  98. package/src/components/editor/SettingsForm.tsx +100 -73
  99. package/src/components/primitives/EditableGrid.tsx +40 -36
  100. package/src/components/primitives/IconPicker.tsx +116 -26
  101. package/src/components/sections/Container/Container.tsx +354 -0
  102. package/src/components/sections/Container/ContainerSettingsForm.tsx +113 -0
  103. package/src/components/sections/Container/index.tsx +51 -0
  104. package/src/components/sections/IconList/IconList.tsx +113 -43
  105. package/src/components/sections/IconList/IconListSettings.tsx +2 -2
  106. package/src/components/sections/IconList/index.tsx +1 -1
  107. package/src/components/sections/Media/MediaBlock.tsx +103 -0
  108. package/src/components/sections/Media/index.tsx +85 -0
  109. package/src/components/sections/Prose/index.tsx +1 -0
  110. package/src/components/sections/Spacer/Spacer.tsx +6 -0
  111. package/src/components/sections/Spacer/index.tsx +18 -0
  112. package/src/components/sections/all-sections.ts +10 -8
  113. package/src/components/sections/register-schemas.ts +5 -2
  114. package/src/components/shared/Tabs.tsx +63 -0
  115. package/src/components/shell/EditorShell.tsx +105 -13
  116. package/src/components/shell/SiteSettingsModal.tsx +41 -51
  117. package/src/components/shell/blockMoveDispatch.ts +40 -0
  118. package/src/hooks/useBlockDnd.ts +144 -0
  119. package/src/lib/block-dnd.ts +58 -0
  120. package/src/lib/block-move.ts +236 -0
  121. package/src/lib/container-grid.ts +58 -0
  122. package/src/lib/container-ops.ts +159 -0
  123. package/src/lib/dexie.ts +22 -0
  124. package/src/lib/loader.ts +16 -4
  125. package/src/lib/migrate-sections-transform.ts +147 -0
  126. package/src/lib/registry.ts +48 -0
  127. package/src/schemas/block.ts +40 -0
  128. package/src/schemas/link.ts +19 -1
  129. package/src/schemas/rich-text.ts +11 -0
  130. package/src/schemas/sections.ts +5 -1
  131. package/src/schemas/shared.ts +6 -0
  132. package/dist/components/brandguide/DoDontList.d.ts +0 -16
  133. package/dist/components/brandguide/DoDontList.d.ts.map +0 -1
  134. package/dist/components/brandguide/DoDontMediaGrid.d.ts +0 -16
  135. package/dist/components/brandguide/DoDontMediaGrid.d.ts.map +0 -1
  136. package/dist/components/primitives/MediaSettingsForms.d.ts +0 -23
  137. package/dist/components/primitives/MediaSettingsForms.d.ts.map +0 -1
  138. package/dist/components/sections/DoDontList/index.d.ts +0 -21
  139. package/dist/components/sections/DoDontList/index.d.ts.map +0 -1
  140. package/dist/components/sections/DoDontMediaGrid/index.d.ts +0 -55
  141. package/dist/components/sections/DoDontMediaGrid/index.d.ts.map +0 -1
  142. package/dist/components/sections/MediaGrid/MediaGrid.d.ts +0 -17
  143. package/dist/components/sections/MediaGrid/MediaGrid.d.ts.map +0 -1
  144. package/dist/components/sections/MediaGrid/index.d.ts.map +0 -1
  145. package/dist/components/sections/SplitContent/SplitContent.d.ts +0 -14
  146. package/dist/components/sections/SplitContent/SplitContent.d.ts.map +0 -1
  147. package/dist/components/sections/SplitContent/index.d.ts +0 -13
  148. package/dist/components/sections/SplitContent/index.d.ts.map +0 -1
  149. package/src/components/brandguide/DoDontList.d.ts.map +0 -1
  150. package/src/components/brandguide/DoDontList.tsx +0 -67
  151. package/src/components/brandguide/DoDontMediaGrid.d.ts.map +0 -1
  152. package/src/components/brandguide/DoDontMediaGrid.tsx +0 -19
  153. package/src/components/primitives/MediaSettingsForms.tsx +0 -128
  154. package/src/components/sections/DoDontList/index.d.ts.map +0 -1
  155. package/src/components/sections/DoDontList/index.tsx +0 -45
  156. package/src/components/sections/DoDontMediaGrid/index.d.ts.map +0 -1
  157. package/src/components/sections/DoDontMediaGrid/index.tsx +0 -63
  158. package/src/components/sections/MediaGrid/MediaGrid.d.ts.map +0 -1
  159. package/src/components/sections/MediaGrid/MediaGrid.tsx +0 -239
  160. package/src/components/sections/MediaGrid/index.d.ts.map +0 -1
  161. package/src/components/sections/MediaGrid/index.tsx +0 -57
  162. package/src/components/sections/SplitContent/SplitContent.d.ts.map +0 -1
  163. package/src/components/sections/SplitContent/SplitContent.tsx +0 -84
  164. package/src/components/sections/SplitContent/index.d.ts.map +0 -1
  165. package/src/components/sections/SplitContent/index.tsx +0 -55
@@ -26,6 +26,11 @@ export type SettingsFieldDef = {
26
26
  default: string;
27
27
  target?: "content" | "options";
28
28
  coerce?: "number";
29
+ /** When set, an empty-string ("") selection is normalized to `undefined`
30
+ * before the content/options split, so an optional-enum field clears cleanly
31
+ * (e.g. Media `dodont`, whose enum is strictly ["do","dont"]). Opt-in so other
32
+ * selects keep their "" value. */
33
+ emptyIsUndefined?: boolean;
29
34
  options: {
30
35
  label: string;
31
36
  value: string;
@@ -68,6 +73,8 @@ export interface WrapperProps {
68
73
  dirty?: boolean;
69
74
  index: number;
70
75
  isLast: boolean;
76
+ containerId: string;
77
+ isContainerBlock: boolean;
71
78
  definition: SectionDefinition;
72
79
  options?: Record<string, unknown>;
73
80
  audiences: Audience[];
@@ -79,6 +86,7 @@ export interface WrapperProps {
79
86
  onRequestInsert?: (index: number) => void;
80
87
  onDelete?: () => void;
81
88
  onMoveSection?: () => void;
89
+ onAddChild?: () => void;
82
90
  mainStatus?: string | null;
83
91
  contentDiffersFromMain?: boolean;
84
92
  isLocalOnly?: boolean;
@@ -96,6 +104,22 @@ export interface SectionDefinition<T = unknown> {
96
104
  getLabel?(content: T): string;
97
105
  getThumbnails?(content: T): Thumbnail[];
98
106
  navRole?: "h1" | "h2" | "h3";
107
+ /** content-relative field paths that hold HTML rich text (for the sanitizer). */
108
+ richTextFields?: readonly string[];
109
+ /**
110
+ * Option keys (under this type's `options`) that a parent container may set as a
111
+ * default for all children via `content.childDefaults`. v1: typed primitives only.
112
+ */
113
+ inheritableSettings?: readonly string[];
114
+ /**
115
+ * Optional grouping of `settings` fields into labeled tabs for the settings modal;
116
+ * presentation-only — does not change content/options routing; omitted fields fall
117
+ * into a trailing 'Other' tab.
118
+ */
119
+ settingsTabs?: {
120
+ label: string;
121
+ fields: string[];
122
+ }[];
99
123
  }
100
124
  type DefineSectionInput<S extends ZodType> = {
101
125
  type: string;
@@ -109,6 +133,17 @@ type DefineSectionInput<S extends ZodType> = {
109
133
  getLabel?(content: z.infer<S>): string;
110
134
  getThumbnails?(content: z.infer<S>): Thumbnail[];
111
135
  navRole?: "h1" | "h2" | "h3";
136
+ richTextFields?: readonly string[];
137
+ inheritableSettings?: readonly string[];
138
+ /**
139
+ * Optional grouping of `settings` fields into labeled tabs for the settings modal;
140
+ * presentation-only — does not change content/options routing; omitted fields fall
141
+ * into a trailing 'Other' tab.
142
+ */
143
+ settingsTabs?: {
144
+ label: string;
145
+ fields: string[];
146
+ }[];
112
147
  };
113
148
  export declare function defineSection<S extends ZodType>(def: DefineSectionInput<S>): SectionDefinition<z.infer<S>>;
114
149
  export interface SectionRegistry {
@@ -118,11 +153,15 @@ export interface SectionRegistry {
118
153
  getSchema(type: string): ZodType | undefined;
119
154
  getAllSections(): SectionDefinition[];
120
155
  getAllSchemas(): ZodType[];
156
+ registerRichText(type: string, fields: readonly string[]): void;
157
+ getRichTextFields(type: string): readonly string[];
121
158
  clearRegistry(): void;
122
159
  }
123
160
  export declare function createRegistry(): SectionRegistry;
124
161
  export declare function registerSection(def: SectionDefinition<any>): void;
125
162
  export declare function registerSchema(type: string, schema: ZodType): void;
163
+ export declare function registerRichText(type: string, fields: readonly string[]): void;
164
+ export declare function getRichTextFields(type: string): readonly string[];
126
165
  export declare function getSection(type: string): SectionDefinition | undefined;
127
166
  export declare function getSchema(type: string): ZodType | undefined;
128
167
  export declare function getAllSections(): SectionDefinition[];
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib/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;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,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,EA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CAAC;IACnD,aAAa,IAAI,IAAI,CAAC;CACvB;AAED,wBAAgB,cAAc,IAAI,eAAe,CA0ChD;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,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAE9E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAEjE;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"}
@@ -0,0 +1,27 @@
1
+ import {
2
+ clearRegistry,
3
+ createRegistry,
4
+ defineSection,
5
+ getAllSchemas,
6
+ getAllSections,
7
+ getRichTextFields,
8
+ getSchema,
9
+ getSection,
10
+ registerRichText,
11
+ registerSchema,
12
+ registerSection
13
+ } from "../chunk-VKAGMEKE.js";
14
+ import "../chunk-JSBRDJBE.js";
15
+ export {
16
+ clearRegistry,
17
+ createRegistry,
18
+ defineSection,
19
+ getAllSchemas,
20
+ getAllSections,
21
+ getRichTextFields,
22
+ getSchema,
23
+ getSection,
24
+ registerRichText,
25
+ registerSchema,
26
+ registerSection
27
+ };
@@ -20,6 +20,7 @@ import {
20
20
  MediaItemSchema,
21
21
  VariantSchema
22
22
  } from "../chunk-DKOUFIP6.js";
23
+ import "../chunk-JSBRDJBE.js";
23
24
  export {
24
25
  EXT_TO_MIME,
25
26
  ImageManifestSchema,
@@ -4,6 +4,7 @@ import {
4
4
  SessionSchema,
5
5
  SiteUserSchema
6
6
  } from "../chunk-LZKVV4K2.js";
7
+ import "../chunk-JSBRDJBE.js";
7
8
  export {
8
9
  AudienceSchema,
9
10
  RoleSchema,
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A block's participation in its parent container's layout — distinct from its
4
+ * content. Optional, and absent at the page root (the root is an implicit single
5
+ * column). Intentionally NOT strict so future keys (rowSpan, alignSelf) are
6
+ * forward-compatible.
7
+ */
8
+ export declare const LayoutEnvelopeSchema: z.ZodObject<{
9
+ colSpan: z.ZodOptional<z.ZodNumber>;
10
+ }, z.core.$strip>;
11
+ export type LayoutEnvelope = z.infer<typeof LayoutEnvelopeSchema>;
12
+ /** v1 nesting cap: a top-level container (depth 2) may hold leaves but not containers. */
13
+ export declare const MAX_BLOCK_DEPTH = 2;
14
+ /** Content-agnostic: any block whose `content.children` is an array is a container. */
15
+ export declare function getBlockChildren(block: unknown): unknown[];
16
+ /** Depth of a block tree: a leaf is 1; a container is 1 + max(child depths). */
17
+ export declare function blockDepth(block: unknown): number;
18
+ /** Throws if the block tree is deeper than `max`. */
19
+ export declare function assertMaxDepth(block: unknown, max?: number): void;
20
+ //# sourceMappingURL=block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/schemas/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,0FAA0F;AAC1F,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,CAM1D;AAED,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIjD;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAE,MAAwB,GAAG,IAAI,CAKlF"}
@@ -0,0 +1,15 @@
1
+ import {
2
+ LayoutEnvelopeSchema,
3
+ MAX_BLOCK_DEPTH,
4
+ assertMaxDepth,
5
+ blockDepth,
6
+ getBlockChildren
7
+ } from "../chunk-NSCT3AMV.js";
8
+ import "../chunk-JSBRDJBE.js";
9
+ export {
10
+ LayoutEnvelopeSchema,
11
+ MAX_BLOCK_DEPTH,
12
+ assertMaxDepth,
13
+ blockDepth,
14
+ getBlockChildren
15
+ };
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  AudienceColorSchema,
3
3
  AudienceNameSchema,
4
+ MediaGridOptionsSchema,
5
+ slugifyAudienceName
6
+ } from "../chunk-V7JN2DDU.js";
7
+ import {
4
8
  DEFAULT_LINK,
5
9
  LinkTargetSchema,
6
10
  LinkValueSchema,
7
- MediaGridOptionsSchema,
8
- slugifyAudienceName
9
- } from "../chunk-7IAWF7LE.js";
11
+ isSafeHref
12
+ } from "../chunk-ZU2MKPTG.js";
10
13
  import {
11
14
  AudienceSchema,
12
15
  RoleSchema,
@@ -24,18 +27,22 @@ import {
24
27
  PageStatusSchema,
25
28
  RESERVED_SLUGS,
26
29
  SectionMetaSchema,
30
+ SingleMediaReferenceSchema,
27
31
  SiteConfigSchema,
28
32
  TextLineSchema,
29
33
  getSectionContentSchema,
30
34
  getSectionSchema,
31
35
  normalizeSiteIndex
32
- } from "../chunk-KGYWQDBB.js";
36
+ } from "../chunk-ICLXLWQ5.js";
33
37
  import {
34
38
  ImageManifestSchema,
35
39
  MediaConfigSchema,
36
40
  MediaItemSchema,
37
41
  VariantSchema
38
42
  } from "../chunk-DKOUFIP6.js";
43
+ import "../chunk-NSCT3AMV.js";
44
+ import "../chunk-VKAGMEKE.js";
45
+ import "../chunk-JSBRDJBE.js";
39
46
  export {
40
47
  AudienceColorSchema,
41
48
  AudienceNameSchema,
@@ -59,12 +66,14 @@ export {
59
66
  RoleSchema,
60
67
  SectionMetaSchema,
61
68
  SessionSchema,
69
+ SingleMediaReferenceSchema,
62
70
  SiteConfigSchema,
63
71
  SiteUserSchema,
64
72
  TextLineSchema,
65
73
  VariantSchema,
66
74
  getSectionContentSchema,
67
75
  getSectionSchema,
76
+ isSafeHref,
68
77
  normalizeSiteIndex,
69
78
  slugifyAudienceName
70
79
  };
@@ -3,6 +3,13 @@ export declare const LinkTargetSchema: z.ZodEnum<{
3
3
  _self: "_self";
4
4
  _blank: "_blank";
5
5
  }>;
6
+ /**
7
+ * Block dangerous href schemes (javascript:, data:, vbscript:) and protocol-
8
+ * relative URLs at the schema boundary. Allows empty (unset), relative paths /
9
+ * fragments / queries, and http(s)/mailto absolute URLs. Links are not walked by
10
+ * the recursive sanitizer, so this is the only XSS guard for stored link hrefs.
11
+ */
12
+ export declare function isSafeHref(href: string): boolean;
6
13
  export declare const LinkValueSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
14
  kind: z.ZodLiteral<"external">;
8
15
  href: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/schemas/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;EAA8B,CAAC;AAE5D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;2BAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,SAA2D,CAAC"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/schemas/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;EAA8B,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUhD;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;2BAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,SAA2D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Marks a schema field as HTML rich text. Readability marker only — the runtime
4
+ * source of truth for sanitization is each block definition's `richTextFields`
5
+ * list (see registry). Kept as a helper so schemas read self-documentingly
6
+ * (`body: richText()`) and a future Zod version could make it introspectable.
7
+ */
8
+ export declare function richText(): z.ZodString;
9
+ //# sourceMappingURL=rich-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../src/schemas/rich-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,wBAAgB,QAAQ,gBAEvB"}
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { type LayoutEnvelope } from "./block";
2
3
  export interface SectionContent<C = Record<string, unknown>> {
3
4
  type: string;
4
5
  content: C;
@@ -6,6 +7,7 @@ export interface SectionContent<C = Record<string, unknown>> {
6
7
  }
7
8
  export interface Section<C = Record<string, unknown>> extends SectionContent<C> {
8
9
  id: string;
10
+ layout?: LayoutEnvelope;
9
11
  }
10
12
  export declare function getSectionContentSchema(): z.ZodType<SectionContent>;
11
13
  export declare function getSectionSchema(): z.ZodType<Section>;
@@ -1 +1 @@
1
- {"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../src/schemas/sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,M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export declare const MediaReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
77
77
  linkText: z.ZodOptional<z.ZodString>;
78
78
  }, z.core.$strip>], "type">;
79
79
  export type MediaReference = z.infer<typeof MediaReferenceSchema>;
80
+ /** A single image or video reference — for the standalone `media` block
81
+ * (excludes the grid-only doDontImage/linkedImage variants). */
82
+ export declare const SingleMediaReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
83
+ imageId: z.ZodDefault<z.ZodString>;
84
+ caption: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
85
+ background: z.ZodOptional<z.ZodString>;
86
+ invertFrom: z.ZodOptional<z.ZodString>;
87
+ border: z.ZodOptional<z.ZodBoolean>;
88
+ objectFit: z.ZodOptional<z.ZodEnum<{
89
+ cover: "cover";
90
+ contain: "contain";
91
+ }>>;
92
+ type: z.ZodLiteral<"image">;
93
+ }, z.core.$strip>, z.ZodObject<{
94
+ imageId: z.ZodDefault<z.ZodString>;
95
+ caption: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
96
+ background: z.ZodOptional<z.ZodString>;
97
+ invertFrom: z.ZodOptional<z.ZodString>;
98
+ border: z.ZodOptional<z.ZodBoolean>;
99
+ objectFit: z.ZodOptional<z.ZodEnum<{
100
+ cover: "cover";
101
+ contain: "contain";
102
+ }>>;
103
+ type: z.ZodLiteral<"video">;
104
+ poster: z.ZodOptional<z.ZodString>;
105
+ autoplay: z.ZodOptional<z.ZodBoolean>;
106
+ loop: z.ZodOptional<z.ZodBoolean>;
107
+ muted: z.ZodOptional<z.ZodBoolean>;
108
+ }, z.core.$strip>], "type">;
109
+ export type SingleMediaReference = z.infer<typeof SingleMediaReferenceSchema>;
80
110
  export declare const HexColorSchema: z.ZodString;
81
111
  export declare const FontNameSchema: z.ZodString;
82
112
  export declare const ColorSpaceSchema: z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sour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AO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAqD,CAAC;AAE7F,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAG9E,eAAO,MAAM,cAAc,aAEiC,CAAC;AAO7D,eAAO,MAAM,cAAc,aAG6C,CAAC;AAEzE,eAAO,MAAM,gBAAgB;;;;;iBAQ5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;;;;;iBAG1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,3 +1,5 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
1
3
  // src/types/database.ts
2
4
  var Constants = {
3
5
  graphql_public: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawnagency/primitives",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -16,6 +16,10 @@
16
16
  "types": "./dist/schemas/auth.d.ts",
17
17
  "default": "./dist/schemas/auth.js"
18
18
  },
19
+ "./schemas/block": {
20
+ "types": "./dist/schemas/block.d.ts",
21
+ "default": "./dist/schemas/block.js"
22
+ },
19
23
  "./schemas/link": {
20
24
  "types": "./dist/schemas/link.d.ts",
21
25
  "default": "./dist/schemas/link.js"
@@ -32,6 +36,18 @@
32
36
  "types": "./dist/lib/env.d.ts",
33
37
  "default": "./dist/lib/env.js"
34
38
  },
39
+ "./lib/registry": {
40
+ "types": "./dist/lib/registry.d.ts",
41
+ "default": "./dist/lib/registry.js"
42
+ },
43
+ "./lib/migrate-sections-transform": {
44
+ "types": "./dist/lib/migrate-sections-transform.d.ts",
45
+ "default": "./dist/lib/migrate-sections-transform.js"
46
+ },
47
+ "./components/sections/register-schemas": {
48
+ "types": "./dist/components/sections/register-schemas.d.ts",
49
+ "default": "./dist/components/sections/register-schemas.js"
50
+ },
35
51
  "./auth": {
36
52
  "types": "./dist/auth/index.d.ts",
37
53
  "default": "./dist/auth/index.js"
@@ -1,7 +1,7 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { Eye, EyeOff } from "lucide-react";
3
3
  import { cn } from "../../lib/cn";
4
- import { gridColsClass } from "../../lib/grid";
4
+ import { containerGridClass } from "../../lib/container-grid";
5
5
  import { EditableGrid } from "../primitives/EditableGrid";
6
6
  import { EditablePlainText } from "../primitives/EditablePlainText";
7
7
  import type { ReactNode } from "react";
@@ -119,40 +119,42 @@ function ColorsView({
119
119
  </div>
120
120
  )}
121
121
 
122
- <div className={cn("grid gap-4", gridColsClass[columns] || "grid-cols-3")}>
123
- {colors.map((color, i) => {
124
- const hex = color.spaces[0]?.hex;
125
- const contrast = getContrastClass(hex);
126
- return (
127
- <div key={i} className="overflow-hidden rounded-md border border-base-200">
128
- <div className={cn("relative flex min-h-[80px] items-end p-3", contrast)} style={{ backgroundColor: hex || "#ccc" }}>
129
- {color.name && <span className="text-sm font-bold">{color.name}</span>}
130
- {copiedIndex === i && (
131
- <span className={cn(
132
- "absolute top-2 right-2 rounded-full px-2.5 py-0.5 text-xs font-medium",
133
- getContrastClass(hex) === "text-black" ? "bg-black/15 text-black" : "bg-white/25 text-white",
134
- )}>
135
- Copied!
136
- </span>
137
- )}
138
- </div>
139
- {expanded && (
140
- <div className="space-y-1 bg-base-accent p-3 text-sm">
141
- {color.spaces.map((space, j) =>
142
- Object.entries(space).map(([key, value]) =>
143
- value ? (
144
- <button key={`${j}-${key}`} onClick={() => handleCopy(value, i)} className="cursor-pointer flex w-full justify-between hover:text-primary">
145
- <span className="font-medium uppercase">{key}</span>
146
- <span>{value}</span>
147
- </button>
148
- ) : null
149
- )
122
+ <div className="@container">
123
+ <div className={cn("grid gap-4", containerGridClass[columns] || containerGridClass[3])}>
124
+ {colors.map((color, i) => {
125
+ const hex = color.spaces[0]?.hex;
126
+ const contrast = getContrastClass(hex);
127
+ return (
128
+ <div key={i} className="overflow-hidden rounded-md border border-base-200">
129
+ <div className={cn("relative flex min-h-[80px] items-end p-3", contrast)} style={{ backgroundColor: hex || "#ccc" }}>
130
+ {color.name && <span className="text-sm font-bold">{color.name}</span>}
131
+ {copiedIndex === i && (
132
+ <span className={cn(
133
+ "absolute top-2 right-2 rounded-full px-2.5 py-0.5 text-xs font-medium",
134
+ getContrastClass(hex) === "text-black" ? "bg-black/15 text-black" : "bg-white/25 text-white",
135
+ )}>
136
+ Copied!
137
+ </span>
150
138
  )}
151
139
  </div>
152
- )}
153
- </div>
154
- );
155
- })}
140
+ {expanded && (
141
+ <div className="space-y-1 bg-base-accent p-3 text-sm">
142
+ {color.spaces.map((space, j) =>
143
+ Object.entries(space).map(([key, value]) =>
144
+ value ? (
145
+ <button key={`${j}-${key}`} onClick={() => handleCopy(value, i)} className="cursor-pointer flex w-full justify-between hover:text-primary">
146
+ <span className="font-medium uppercase">{key}</span>
147
+ <span>{value}</span>
148
+ </button>
149
+ ) : null
150
+ )
151
+ )}
152
+ </div>
153
+ )}
154
+ </div>
155
+ );
156
+ })}
157
+ </div>
156
158
  </div>
157
159
  </div>
158
160
  );
@@ -0,0 +1,108 @@
1
+ import { forwardRef, type ReactNode, type Ref } from "react";
2
+ import type { Edge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
3
+ import { CopyPlus } from "lucide-react";
4
+ import { DragHandle } from "./DragHandle";
5
+ import { DeleteButton } from "./DeleteButton";
6
+ import { SettingsButton } from "./SettingsButton";
7
+ import { ColSpanControl } from "./ColSpanControl";
8
+ import { cn } from "../../lib/cn";
9
+
10
+ export interface ChildBlockWrapperProps {
11
+ label: string;
12
+ columns: number;
13
+ colSpan: number;
14
+ closestEdge: Edge | null;
15
+ isDragging: boolean;
16
+ hasSettings: boolean;
17
+ /** Forwarded to the drag handle button (pragmatic-dnd dragHandle target). */
18
+ dragHandleRef?: Ref<HTMLButtonElement>;
19
+ onDelete: () => void;
20
+ onDuplicate: () => void;
21
+ onColSpanChange: (span: number) => void;
22
+ onOpenSettings?: () => void;
23
+ children: ReactNode;
24
+ }
25
+
26
+ export const ChildBlockWrapper = forwardRef<HTMLDivElement, ChildBlockWrapperProps>(
27
+ function ChildBlockWrapper(
28
+ {
29
+ label,
30
+ columns,
31
+ colSpan,
32
+ closestEdge,
33
+ isDragging,
34
+ hasSettings,
35
+ dragHandleRef,
36
+ onDelete,
37
+ onDuplicate,
38
+ onColSpanChange,
39
+ onOpenSettings,
40
+ children,
41
+ },
42
+ ref,
43
+ ) {
44
+ return (
45
+ <div
46
+ ref={ref}
47
+ className={cn(
48
+ "group/childblock relative h-full rounded-sm",
49
+ isDragging && "opacity-50",
50
+ "hover:outline hover:outline-2 hover:outline-primary/30",
51
+ )}
52
+ >
53
+ {/* Controls — vertical rail in the cell's LEFT gutter. Revealed on hover OR
54
+ focus-within, so an open col-span popover (which traps focus) keeps the rail
55
+ visible even when the pointer moves off the block to reach an option. */}
56
+ <div className="absolute top-0 left-0 -translate-x-full z-20 flex flex-col items-center gap-1 opacity-0 transition-opacity group-hover/childblock:opacity-100 group-focus-within/childblock:opacity-100 pointer-events-none">
57
+ <span className="sr-only">{label}</span>
58
+ <div className="pointer-events-auto">
59
+ <DragHandle ref={dragHandleRef} />
60
+ </div>
61
+ <div className="pointer-events-auto">
62
+ <ColSpanControl colSpan={colSpan} columns={columns} onChange={onColSpanChange} />
63
+ </div>
64
+ {hasSettings && onOpenSettings && (
65
+ <div className="pointer-events-auto">
66
+ <SettingsButton onClick={onOpenSettings} />
67
+ </div>
68
+ )}
69
+ <div className="pointer-events-auto">
70
+ <button
71
+ type="button"
72
+ aria-label="Duplicate block"
73
+ onClick={onDuplicate}
74
+ className="cursor-pointer rounded p-1 text-base-contrast-light hover:text-primary"
75
+ >
76
+ <CopyPlus size={16} />
77
+ </button>
78
+ </div>
79
+ <div className="pointer-events-auto">
80
+ <DeleteButton onDelete={onDelete} />
81
+ </div>
82
+ </div>
83
+
84
+ {/* Drop-edge indicators */}
85
+ {closestEdge === "left" && (
86
+ <div
87
+ data-drop-edge="left"
88
+ className="absolute bottom-0 left-0 top-0 z-10 w-0.5 -translate-x-1 bg-primary"
89
+ />
90
+ )}
91
+ {closestEdge === "right" && (
92
+ <div
93
+ data-drop-edge="right"
94
+ className="absolute bottom-0 right-0 top-0 z-10 w-0.5 translate-x-1 bg-primary"
95
+ />
96
+ )}
97
+ {closestEdge === "top" && (
98
+ <div data-drop-edge="top" className="absolute left-0 right-0 top-0 z-10 h-0.5 -translate-y-1 bg-primary" />
99
+ )}
100
+ {closestEdge === "bottom" && (
101
+ <div data-drop-edge="bottom" className="absolute left-0 right-0 bottom-0 z-10 h-0.5 translate-y-1 bg-primary" />
102
+ )}
103
+
104
+ {children}
105
+ </div>
106
+ );
107
+ },
108
+ );
@@ -0,0 +1,56 @@
1
+ import { useRef, useState } from "react";
2
+ import { Columns3 } from "lucide-react";
3
+ import { Popover } from "../shared/Popover";
4
+ import { PopoverItem } from "../shared/PopoverItem";
5
+ import { cn } from "../../lib/cn";
6
+
7
+ interface ColSpanControlProps {
8
+ colSpan: number;
9
+ columns: number;
10
+ onChange: (span: number) => void;
11
+ }
12
+
13
+ /** Contextual col-span picker — only meaningful inside a multi-column container. */
14
+ export function ColSpanControl({ colSpan, columns, onChange }: ColSpanControlProps) {
15
+ const buttonRef = useRef<HTMLButtonElement>(null);
16
+ const [open, setOpen] = useState(false);
17
+
18
+ if (columns <= 1) return null;
19
+
20
+ const current = Math.min(Math.max(colSpan, 1), columns);
21
+
22
+ return (
23
+ <div className="relative">
24
+ <button
25
+ ref={buttonRef}
26
+ type="button"
27
+ aria-label="Column span"
28
+ aria-haspopup="true"
29
+ aria-expanded={open}
30
+ onClick={() => setOpen((v) => !v)}
31
+ className="pointer-events-auto inline-flex cursor-pointer items-center gap-1 rounded p-1 text-xs text-base-contrast-light hover:text-primary"
32
+ >
33
+ <Columns3 size={14} />
34
+ </button>
35
+
36
+ <Popover isOpen={open} onClose={() => setOpen(false)} anchorRef={buttonRef} className="min-w-28">
37
+ <ul role="list" className="py-1">
38
+ {Array.from({ length: columns }, (_, i) => i + 1).map((span) => (
39
+ <li key={span}>
40
+ <PopoverItem
41
+ aria-current={span === current}
42
+ onClick={() => {
43
+ onChange(span);
44
+ setOpen(false);
45
+ }}
46
+ className={cn(span === current && "font-semibold text-primary")}
47
+ >
48
+ Span {span}
49
+ </PopoverItem>
50
+ </li>
51
+ ))}
52
+ </ul>
53
+ </Popover>
54
+ </div>
55
+ );
56
+ }