@drawnagency/primitives 0.1.56 → 0.1.57
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/{chunk-KGYWQDBB.js → chunk-ICLXLWQ5.js} +9 -72
- package/dist/chunk-NSCT3AMV.js +32 -0
- package/dist/{chunk-EU6NZ4GS.js → chunk-PRKUXM7E.js} +23 -9
- package/dist/{chunk-7IAWF7LE.js → chunk-PYWS3MOJ.js} +12 -2
- package/dist/chunk-TG43X7JO.js +123 -0
- package/dist/chunk-VKAGMEKE.js +90 -0
- package/dist/components/editor/ChildBlockWrapper.d.ts +19 -0
- package/dist/components/editor/ChildBlockWrapper.d.ts.map +1 -0
- package/dist/components/editor/ColSpanControl.d.ts +9 -0
- package/dist/components/editor/ColSpanControl.d.ts.map +1 -0
- 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 +5 -1
- package/dist/components/editor/SettingsForm.d.ts.map +1 -1
- package/dist/components/primitives/EditableGrid.d.ts.map +1 -1
- package/dist/components/primitives/IconPicker.d.ts +7 -1
- package/dist/components/primitives/IconPicker.d.ts.map +1 -1
- package/dist/components/sections/Container/Container.d.ts +20 -0
- package/dist/components/sections/Container/Container.d.ts.map +1 -0
- package/dist/components/sections/Container/ContainerSettingsForm.d.ts +17 -0
- package/dist/components/sections/Container/ContainerSettingsForm.d.ts.map +1 -0
- package/dist/components/sections/Container/index.d.ts +11 -0
- package/dist/components/sections/Container/index.d.ts.map +1 -0
- package/dist/components/sections/IconList/IconList.d.ts +1 -0
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconListSettings.d.ts +3 -4
- 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 +19 -0
- package/dist/components/sections/Media/MediaBlock.d.ts.map +1 -0
- package/dist/components/sections/{MediaGrid → Media}/index.d.ts +15 -25
- package/dist/components/sections/Media/index.d.ts.map +1 -0
- package/dist/components/sections/Prose/index.d.ts.map +1 -1
- package/dist/components/sections/Spacer/Spacer.d.ts +2 -0
- package/dist/components/sections/Spacer/Spacer.d.ts.map +1 -0
- package/dist/components/sections/Spacer/index.d.ts +6 -0
- package/dist/components/sections/Spacer/index.d.ts.map +1 -0
- package/dist/components/sections/all-sections.d.ts +29 -103
- package/dist/components/sections/all-sections.d.ts.map +1 -1
- package/dist/components/sections/register-schemas.d.ts.map +1 -1
- package/dist/components/shared/Tabs.d.ts +24 -0
- package/dist/components/shared/Tabs.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -1
- package/dist/components/shell/blockMoveDispatch.d.ts +21 -0
- package/dist/components/shell/blockMoveDispatch.d.ts.map +1 -0
- package/dist/hooks/useBlockDnd.d.ts +48 -0
- package/dist/hooks/useBlockDnd.d.ts.map +1 -0
- package/dist/index.js +56 -48
- package/dist/lib/block-dnd.d.ts +42 -0
- package/dist/lib/block-dnd.d.ts.map +1 -0
- package/dist/lib/block-move.d.ts +31 -0
- package/dist/lib/block-move.d.ts.map +1 -0
- package/dist/lib/container-grid.d.ts +29 -0
- package/dist/lib/container-grid.d.ts.map +1 -0
- package/dist/lib/container-ops.d.ts +44 -0
- package/dist/lib/container-ops.d.ts.map +1 -0
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +13 -0
- package/dist/lib/index.js +10 -7
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/migrate-sections-transform.d.ts +12 -0
- package/dist/lib/migrate-sections-transform.d.ts.map +1 -0
- package/dist/lib/migrate-sections-transform.js +6 -0
- package/dist/lib/registry.d.ts +39 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +26 -0
- package/dist/schemas/block.d.ts +20 -0
- package/dist/schemas/block.d.ts.map +1 -0
- package/dist/schemas/block.js +14 -0
- package/dist/schemas/index.js +8 -2
- package/dist/schemas/link.d.ts +7 -0
- package/dist/schemas/link.d.ts.map +1 -1
- package/dist/schemas/rich-text.d.ts +9 -0
- package/dist/schemas/rich-text.d.ts.map +1 -0
- package/dist/schemas/sections.d.ts +2 -0
- package/dist/schemas/sections.d.ts.map +1 -1
- package/dist/schemas/shared.d.ts +30 -0
- package/dist/schemas/shared.d.ts.map +1 -1
- package/package.json +13 -1
- package/src/components/brandguide/Colors.tsx +35 -33
- package/src/components/editor/ChildBlockWrapper.tsx +108 -0
- package/src/components/editor/ColSpanControl.tsx +56 -0
- package/src/components/editor/SectionWrapper.tsx +44 -20
- package/src/components/editor/SettingsForm.tsx +100 -73
- package/src/components/primitives/EditableGrid.tsx +40 -36
- package/src/components/primitives/IconPicker.tsx +116 -26
- package/src/components/sections/Container/Container.tsx +354 -0
- package/src/components/sections/Container/ContainerSettingsForm.tsx +113 -0
- package/src/components/sections/Container/index.tsx +51 -0
- package/src/components/sections/IconList/IconList.tsx +113 -43
- package/src/components/sections/IconList/IconListSettings.tsx +2 -2
- package/src/components/sections/IconList/index.tsx +1 -1
- package/src/components/sections/Media/MediaBlock.tsx +103 -0
- package/src/components/sections/Media/index.tsx +85 -0
- package/src/components/sections/Prose/index.tsx +1 -0
- package/src/components/sections/Spacer/Spacer.tsx +6 -0
- package/src/components/sections/Spacer/index.tsx +18 -0
- package/src/components/sections/all-sections.ts +10 -8
- package/src/components/sections/register-schemas.ts +5 -2
- package/src/components/shared/Tabs.tsx +63 -0
- package/src/components/shell/EditorShell.tsx +105 -13
- package/src/components/shell/SiteSettingsModal.tsx +41 -51
- package/src/components/shell/blockMoveDispatch.ts +40 -0
- package/src/hooks/useBlockDnd.ts +144 -0
- package/src/lib/block-dnd.ts +58 -0
- package/src/lib/block-move.ts +236 -0
- package/src/lib/container-grid.ts +58 -0
- package/src/lib/container-ops.ts +159 -0
- package/src/lib/dexie.ts +22 -0
- package/src/lib/loader.ts +16 -4
- package/src/lib/migrate-sections-transform.ts +147 -0
- package/src/lib/registry.ts +48 -0
- package/src/schemas/block.ts +40 -0
- package/src/schemas/link.ts +19 -1
- package/src/schemas/rich-text.ts +11 -0
- package/src/schemas/sections.ts +5 -1
- package/src/schemas/shared.ts +6 -0
- package/dist/components/brandguide/DoDontList.d.ts +0 -16
- package/dist/components/brandguide/DoDontList.d.ts.map +0 -1
- package/dist/components/brandguide/DoDontMediaGrid.d.ts +0 -16
- package/dist/components/brandguide/DoDontMediaGrid.d.ts.map +0 -1
- package/dist/components/primitives/MediaSettingsForms.d.ts +0 -23
- package/dist/components/primitives/MediaSettingsForms.d.ts.map +0 -1
- package/dist/components/sections/DoDontList/index.d.ts +0 -21
- package/dist/components/sections/DoDontList/index.d.ts.map +0 -1
- package/dist/components/sections/DoDontMediaGrid/index.d.ts +0 -55
- package/dist/components/sections/DoDontMediaGrid/index.d.ts.map +0 -1
- package/dist/components/sections/MediaGrid/MediaGrid.d.ts +0 -17
- package/dist/components/sections/MediaGrid/MediaGrid.d.ts.map +0 -1
- package/dist/components/sections/MediaGrid/index.d.ts.map +0 -1
- package/dist/components/sections/SplitContent/SplitContent.d.ts +0 -14
- package/dist/components/sections/SplitContent/SplitContent.d.ts.map +0 -1
- package/dist/components/sections/SplitContent/index.d.ts +0 -13
- package/dist/components/sections/SplitContent/index.d.ts.map +0 -1
- package/src/components/brandguide/DoDontList.d.ts.map +0 -1
- package/src/components/brandguide/DoDontList.tsx +0 -67
- package/src/components/brandguide/DoDontMediaGrid.d.ts.map +0 -1
- package/src/components/brandguide/DoDontMediaGrid.tsx +0 -19
- package/src/components/primitives/MediaSettingsForms.tsx +0 -128
- package/src/components/sections/DoDontList/index.d.ts.map +0 -1
- package/src/components/sections/DoDontList/index.tsx +0 -45
- package/src/components/sections/DoDontMediaGrid/index.d.ts.map +0 -1
- package/src/components/sections/DoDontMediaGrid/index.tsx +0 -63
- package/src/components/sections/MediaGrid/MediaGrid.d.ts.map +0 -1
- package/src/components/sections/MediaGrid/MediaGrid.tsx +0 -239
- package/src/components/sections/MediaGrid/index.d.ts.map +0 -1
- package/src/components/sections/MediaGrid/index.tsx +0 -57
- package/src/components/sections/SplitContent/SplitContent.d.ts.map +0 -1
- package/src/components/sections/SplitContent/SplitContent.tsx +0 -84
- package/src/components/sections/SplitContent/index.d.ts.map +0 -1
- package/src/components/sections/SplitContent/index.tsx +0 -55
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MediaConfigSchema
|
|
3
3
|
} from "./chunk-DKOUFIP6.js";
|
|
4
|
+
import {
|
|
5
|
+
LayoutEnvelopeSchema
|
|
6
|
+
} from "./chunk-NSCT3AMV.js";
|
|
7
|
+
import {
|
|
8
|
+
getAllSchemas
|
|
9
|
+
} from "./chunk-VKAGMEKE.js";
|
|
4
10
|
|
|
5
11
|
// src/schemas/shared.ts
|
|
6
12
|
import { z } from "zod";
|
|
@@ -61,6 +67,7 @@ var MediaReferenceSchema = z.discriminatedUnion("type", [
|
|
|
61
67
|
DoDontImageRef,
|
|
62
68
|
LinkedImageRef
|
|
63
69
|
]);
|
|
70
|
+
var SingleMediaReferenceSchema = z.discriminatedUnion("type", [ImageRef, VideoRef]);
|
|
64
71
|
var HexColorSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a 6-digit hex color");
|
|
65
72
|
var FontNameSchema = z.string().max(120).regex(/^[a-zA-Z0-9 ,'"-]+$/, "contains invalid font-name characters");
|
|
66
73
|
var ColorSpaceSchema = z.object({
|
|
@@ -77,68 +84,6 @@ var ColorItemSchema = z.object({
|
|
|
77
84
|
spaces: z.array(ColorSpaceSchema).min(1)
|
|
78
85
|
});
|
|
79
86
|
|
|
80
|
-
// src/lib/registry.ts
|
|
81
|
-
function defineSection(def) {
|
|
82
|
-
return def;
|
|
83
|
-
}
|
|
84
|
-
function createRegistry() {
|
|
85
|
-
const sections = /* @__PURE__ */ new Map();
|
|
86
|
-
const schemas = /* @__PURE__ */ new Map();
|
|
87
|
-
return {
|
|
88
|
-
registerSection(def) {
|
|
89
|
-
sections.set(def.type, def);
|
|
90
|
-
},
|
|
91
|
-
registerSchema(type, schema) {
|
|
92
|
-
schemas.set(type, schema);
|
|
93
|
-
},
|
|
94
|
-
getSection(type) {
|
|
95
|
-
return sections.get(type);
|
|
96
|
-
},
|
|
97
|
-
getSchema(type) {
|
|
98
|
-
return schemas.get(type) ?? sections.get(type)?.schema;
|
|
99
|
-
},
|
|
100
|
-
getAllSections() {
|
|
101
|
-
return Array.from(sections.values());
|
|
102
|
-
},
|
|
103
|
-
getAllSchemas() {
|
|
104
|
-
const merged = new Map(schemas);
|
|
105
|
-
for (const [type, def] of sections) {
|
|
106
|
-
if (!merged.has(type)) merged.set(type, def.schema);
|
|
107
|
-
}
|
|
108
|
-
return Array.from(merged.values());
|
|
109
|
-
},
|
|
110
|
-
clearRegistry() {
|
|
111
|
-
sections.clear();
|
|
112
|
-
schemas.clear();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@drawnagency/primitives/registry");
|
|
117
|
-
var g = globalThis;
|
|
118
|
-
if (!g[REGISTRY_KEY]) g[REGISTRY_KEY] = createRegistry();
|
|
119
|
-
var defaultRegistry = g[REGISTRY_KEY];
|
|
120
|
-
function registerSection(def) {
|
|
121
|
-
defaultRegistry.registerSection(def);
|
|
122
|
-
}
|
|
123
|
-
function registerSchema(type, schema) {
|
|
124
|
-
defaultRegistry.registerSchema(type, schema);
|
|
125
|
-
}
|
|
126
|
-
function getSection(type) {
|
|
127
|
-
return defaultRegistry.getSection(type);
|
|
128
|
-
}
|
|
129
|
-
function getSchema(type) {
|
|
130
|
-
return defaultRegistry.getSchema(type);
|
|
131
|
-
}
|
|
132
|
-
function getAllSections() {
|
|
133
|
-
return defaultRegistry.getAllSections();
|
|
134
|
-
}
|
|
135
|
-
function getAllSchemas() {
|
|
136
|
-
return defaultRegistry.getAllSchemas();
|
|
137
|
-
}
|
|
138
|
-
function clearRegistry() {
|
|
139
|
-
defaultRegistry.clearRegistry();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
87
|
// src/schemas/sections.ts
|
|
143
88
|
import { z as z2 } from "zod";
|
|
144
89
|
function getSectionContentSchema() {
|
|
@@ -149,7 +94,7 @@ function getSectionContentSchema() {
|
|
|
149
94
|
return z2.union(schemas);
|
|
150
95
|
}
|
|
151
96
|
function getSectionSchema() {
|
|
152
|
-
return z2.object({ id: z2.string() }).and(getSectionContentSchema());
|
|
97
|
+
return z2.object({ id: z2.string(), layout: LayoutEnvelopeSchema.optional() }).and(getSectionContentSchema());
|
|
153
98
|
}
|
|
154
99
|
|
|
155
100
|
// src/schemas/site-config.ts
|
|
@@ -276,19 +221,11 @@ var SiteConfigSchema = z3.object({
|
|
|
276
221
|
export {
|
|
277
222
|
TextLineSchema,
|
|
278
223
|
MediaReferenceSchema,
|
|
224
|
+
SingleMediaReferenceSchema,
|
|
279
225
|
HexColorSchema,
|
|
280
226
|
FontNameSchema,
|
|
281
227
|
ColorSpaceSchema,
|
|
282
228
|
ColorItemSchema,
|
|
283
|
-
defineSection,
|
|
284
|
-
createRegistry,
|
|
285
|
-
registerSection,
|
|
286
|
-
registerSchema,
|
|
287
|
-
getSection,
|
|
288
|
-
getSchema,
|
|
289
|
-
getAllSections,
|
|
290
|
-
getAllSchemas,
|
|
291
|
-
clearRegistry,
|
|
292
229
|
getSectionContentSchema,
|
|
293
230
|
getSectionSchema,
|
|
294
231
|
SectionMetaSchema,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/schemas/block.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var LayoutEnvelopeSchema = z.object({
|
|
4
|
+
colSpan: z.number().int().min(1).optional()
|
|
5
|
+
});
|
|
6
|
+
var MAX_BLOCK_DEPTH = 2;
|
|
7
|
+
function getBlockChildren(block) {
|
|
8
|
+
if (typeof block !== "object" || block === null) return [];
|
|
9
|
+
const content = block.content;
|
|
10
|
+
if (typeof content !== "object" || content === null) return [];
|
|
11
|
+
const children = content.children;
|
|
12
|
+
return Array.isArray(children) ? children : [];
|
|
13
|
+
}
|
|
14
|
+
function blockDepth(block) {
|
|
15
|
+
const children = getBlockChildren(block);
|
|
16
|
+
if (children.length === 0) return 1;
|
|
17
|
+
return 1 + Math.max(...children.map(blockDepth));
|
|
18
|
+
}
|
|
19
|
+
function assertMaxDepth(block, max = MAX_BLOCK_DEPTH) {
|
|
20
|
+
const depth = blockDepth(block);
|
|
21
|
+
if (depth > max) {
|
|
22
|
+
throw new Error(`Block tree depth ${depth} exceeds MAX_BLOCK_DEPTH (${max})`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
LayoutEnvelopeSchema,
|
|
28
|
+
MAX_BLOCK_DEPTH,
|
|
29
|
+
getBlockChildren,
|
|
30
|
+
blockDepth,
|
|
31
|
+
assertMaxDepth
|
|
32
|
+
};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
getSection,
|
|
5
|
-
getSectionSchema
|
|
6
|
-
} from "./chunk-KGYWQDBB.js";
|
|
2
|
+
upgradeLegacySection
|
|
3
|
+
} from "./chunk-TG43X7JO.js";
|
|
7
4
|
import {
|
|
8
5
|
safeNextPath
|
|
9
6
|
} from "./chunk-S2L3BPLS.js";
|
|
7
|
+
import {
|
|
8
|
+
IndexSchema,
|
|
9
|
+
getSectionSchema
|
|
10
|
+
} from "./chunk-ICLXLWQ5.js";
|
|
11
|
+
import {
|
|
12
|
+
MAX_BLOCK_DEPTH,
|
|
13
|
+
blockDepth
|
|
14
|
+
} from "./chunk-NSCT3AMV.js";
|
|
15
|
+
import {
|
|
16
|
+
getAllSchemas,
|
|
17
|
+
getSection
|
|
18
|
+
} from "./chunk-VKAGMEKE.js";
|
|
10
19
|
|
|
11
20
|
// src/lib/cn.ts
|
|
12
21
|
import { clsx } from "clsx";
|
|
@@ -245,11 +254,14 @@ function mergeSiteContent(index, sectionFiles) {
|
|
|
245
254
|
const schema = canValidate ? getSectionSchema() : null;
|
|
246
255
|
const orderedIds = index.pages.flatMap((p) => p.order);
|
|
247
256
|
for (const id of orderedIds) {
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
257
|
+
const rawFile = sectionFiles[id];
|
|
258
|
+
if (!rawFile) {
|
|
250
259
|
console.warn(`Section file missing for id: ${id}, skipping`);
|
|
251
260
|
continue;
|
|
252
261
|
}
|
|
262
|
+
const raw = upgradeLegacySection(rawFile);
|
|
263
|
+
const baseMeta = index.sections[id];
|
|
264
|
+
const meta = raw !== rawFile ? { ...baseMeta, type: "container" } : baseMeta;
|
|
253
265
|
if (canValidate && schema) {
|
|
254
266
|
const result = schema.safeParse(raw);
|
|
255
267
|
if (!result.success) {
|
|
@@ -257,10 +269,12 @@ function mergeSiteContent(index, sectionFiles) {
|
|
|
257
269
|
console.warn(`Skipping section "${id}" (type: ${type}): invalid schema`);
|
|
258
270
|
continue;
|
|
259
271
|
}
|
|
260
|
-
|
|
272
|
+
if (blockDepth(result.data) > MAX_BLOCK_DEPTH) {
|
|
273
|
+
console.warn(`Skipping section "${id}": block tree depth exceeds ${MAX_BLOCK_DEPTH}`);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
261
276
|
sections.push({ section: result.data, meta });
|
|
262
277
|
} else {
|
|
263
|
-
const meta = index.sections[id];
|
|
264
278
|
sections.push({ section: raw, meta });
|
|
265
279
|
}
|
|
266
280
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HexColorSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ICLXLWQ5.js";
|
|
4
4
|
|
|
5
5
|
// src/schemas/audience.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -25,8 +25,17 @@ var MediaGridOptionsSchema = z2.object({
|
|
|
25
25
|
// src/schemas/link.ts
|
|
26
26
|
import { z as z3 } from "zod";
|
|
27
27
|
var LinkTargetSchema = z3.enum(["_self", "_blank"]);
|
|
28
|
+
function isSafeHref(href) {
|
|
29
|
+
const normalized = href.replace(/[\t\r\n]/g, "").trimStart();
|
|
30
|
+
if (normalized === "") return true;
|
|
31
|
+
if (normalized.startsWith("//")) return false;
|
|
32
|
+
const scheme = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(normalized);
|
|
33
|
+
if (!scheme) return true;
|
|
34
|
+
const s = scheme[1].toLowerCase();
|
|
35
|
+
return s === "http" || s === "https" || s === "mailto";
|
|
36
|
+
}
|
|
28
37
|
var LinkValueSchema = z3.discriminatedUnion("kind", [
|
|
29
|
-
z3.object({ kind: z3.literal("external"), href: z3.string(), target: LinkTargetSchema }),
|
|
38
|
+
z3.object({ kind: z3.literal("external"), href: z3.string().refine(isSafeHref, "Unsafe href scheme"), target: LinkTargetSchema }),
|
|
30
39
|
z3.object({
|
|
31
40
|
kind: z3.literal("internal"),
|
|
32
41
|
pageId: z3.string(),
|
|
@@ -42,6 +51,7 @@ export {
|
|
|
42
51
|
slugifyAudienceName,
|
|
43
52
|
MediaGridOptionsSchema,
|
|
44
53
|
LinkTargetSchema,
|
|
54
|
+
isSafeHref,
|
|
45
55
|
LinkValueSchema,
|
|
46
56
|
DEFAULT_LINK
|
|
47
57
|
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// src/lib/migrate-sections-transform.ts
|
|
2
|
+
var RETIRED = /* @__PURE__ */ new Set(["split_content", "media_grid", "do_dont_grid", "do_dont"]);
|
|
3
|
+
function upgradeLegacySection(raw) {
|
|
4
|
+
if (!raw || typeof raw !== "object") return raw;
|
|
5
|
+
const section = raw;
|
|
6
|
+
if (!RETIRED.has(section.type)) return raw;
|
|
7
|
+
if (section.type === "split_content") return upgradeSplitContent(section);
|
|
8
|
+
if (section.type === "do_dont") return upgradeDoDont(section);
|
|
9
|
+
return upgradeGrid(section);
|
|
10
|
+
}
|
|
11
|
+
function buildRef(item, forceImage) {
|
|
12
|
+
const type = forceImage ? "image" : item.type;
|
|
13
|
+
const ref = { type, imageId: item.imageId ?? "" };
|
|
14
|
+
if (item.caption !== void 0) ref.caption = item.caption;
|
|
15
|
+
if (item.background !== void 0) ref.background = item.background;
|
|
16
|
+
if (item.invertFrom !== void 0) ref.invertFrom = item.invertFrom;
|
|
17
|
+
if (item.border !== void 0) ref.border = item.border;
|
|
18
|
+
if (item.objectFit !== void 0) ref.objectFit = item.objectFit;
|
|
19
|
+
if (type === "video") {
|
|
20
|
+
if (item.poster !== void 0) ref.poster = item.poster;
|
|
21
|
+
if (item.autoplay !== void 0) ref.autoplay = item.autoplay;
|
|
22
|
+
if (item.loop !== void 0) ref.loop = item.loop;
|
|
23
|
+
if (item.muted !== void 0) ref.muted = item.muted;
|
|
24
|
+
}
|
|
25
|
+
return ref;
|
|
26
|
+
}
|
|
27
|
+
function mapRefItem(item, parentId, index) {
|
|
28
|
+
const content = {};
|
|
29
|
+
if (item.type === "linkedImage") {
|
|
30
|
+
content.ref = buildRef(item, true);
|
|
31
|
+
content.link = { kind: "external", href: item.href ?? "", target: item.target === "_blank" ? "_blank" : "_self" };
|
|
32
|
+
} else if (item.type === "doDontImage") {
|
|
33
|
+
content.ref = buildRef(item, true);
|
|
34
|
+
if (item.doDont !== void 0) content.dodont = item.doDont;
|
|
35
|
+
} else {
|
|
36
|
+
content.ref = buildRef(item, false);
|
|
37
|
+
}
|
|
38
|
+
return { id: `${parentId}__media_${index}`, type: "media", content, options: {} };
|
|
39
|
+
}
|
|
40
|
+
function upgradeGrid(section) {
|
|
41
|
+
const id = section.id;
|
|
42
|
+
const content = section.content ?? {};
|
|
43
|
+
const options = section.options ?? {};
|
|
44
|
+
const media = Array.isArray(content.media) ? content.media : [];
|
|
45
|
+
const childDefaults = {};
|
|
46
|
+
if (options.square !== void 0) childDefaults.square = options.square;
|
|
47
|
+
if (options.showCaptions !== void 0) childDefaults.showCaption = options.showCaptions;
|
|
48
|
+
if (options.border !== void 0) childDefaults.border = options.border;
|
|
49
|
+
if (options.crop) childDefaults.objectFit = "cover";
|
|
50
|
+
const out = {
|
|
51
|
+
id,
|
|
52
|
+
type: "container",
|
|
53
|
+
content: {
|
|
54
|
+
columns: content.columns,
|
|
55
|
+
flow: "row",
|
|
56
|
+
children: media.map((item, i) => mapRefItem(item, id, i))
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
if (Object.keys(childDefaults).length > 0) out.content.childDefaults = childDefaults;
|
|
60
|
+
if (section.layout !== void 0) out.layout = section.layout;
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
function upgradeSplitContent(section) {
|
|
64
|
+
const id = section.id;
|
|
65
|
+
const content = section.content ?? {};
|
|
66
|
+
const options = section.options ?? {};
|
|
67
|
+
const mediaChild = {
|
|
68
|
+
id: `${id}__media_0`,
|
|
69
|
+
type: "media",
|
|
70
|
+
content: { ref: { type: "image", imageId: content.imageId ?? "" } },
|
|
71
|
+
options: options.border !== void 0 ? { border: options.border } : {}
|
|
72
|
+
};
|
|
73
|
+
const proseChild = {
|
|
74
|
+
id: `${id}__prose_1`,
|
|
75
|
+
type: "prose",
|
|
76
|
+
content: { body: content.body ?? "" }
|
|
77
|
+
};
|
|
78
|
+
const children = options.imagePosition === "right" ? [proseChild, mediaChild] : [mediaChild, proseChild];
|
|
79
|
+
const out = { id, type: "container", content: { columns: 2, flow: "row", children } };
|
|
80
|
+
if (section.layout !== void 0) out.layout = section.layout;
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
function dodontChildOptions(options) {
|
|
84
|
+
const out = {};
|
|
85
|
+
if (options.showLabel !== void 0) out.showLabel = options.showLabel;
|
|
86
|
+
if (options.stackText !== void 0) out.stackText = options.stackText;
|
|
87
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
88
|
+
}
|
|
89
|
+
function dodontChild(items, parentId, index, tag, options) {
|
|
90
|
+
const child = {
|
|
91
|
+
id: `${parentId}__icon_list_${index}`,
|
|
92
|
+
type: "icon_list",
|
|
93
|
+
content: { items: items.map((it) => ({ label: it.label ?? "", text: it.text ?? "", dodont: tag })) }
|
|
94
|
+
};
|
|
95
|
+
if (options !== void 0) child.options = options;
|
|
96
|
+
return child;
|
|
97
|
+
}
|
|
98
|
+
function upgradeDoDont(section) {
|
|
99
|
+
const id = section.id;
|
|
100
|
+
const content = section.content ?? {};
|
|
101
|
+
const options = section.options ?? {};
|
|
102
|
+
const doItems = Array.isArray(content.doItems) ? content.doItems : [];
|
|
103
|
+
const dontItems = Array.isArray(content.dontItems) ? content.dontItems : [];
|
|
104
|
+
const childOptions = dodontChildOptions(options);
|
|
105
|
+
const out = {
|
|
106
|
+
id,
|
|
107
|
+
type: "container",
|
|
108
|
+
content: {
|
|
109
|
+
columns: 2,
|
|
110
|
+
flow: "row",
|
|
111
|
+
children: [
|
|
112
|
+
dodontChild(doItems, id, 0, "do", childOptions),
|
|
113
|
+
dodontChild(dontItems, id, 1, "dont", childOptions)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
if (section.layout !== void 0) out.layout = section.layout;
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
upgradeLegacySection
|
|
123
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/lib/registry.ts
|
|
2
|
+
function defineSection(def) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
5
|
+
function createRegistry() {
|
|
6
|
+
const sections = /* @__PURE__ */ new Map();
|
|
7
|
+
const schemas = /* @__PURE__ */ new Map();
|
|
8
|
+
const richText = /* @__PURE__ */ new Map();
|
|
9
|
+
return {
|
|
10
|
+
registerSection(def) {
|
|
11
|
+
sections.set(def.type, def);
|
|
12
|
+
if (def.richTextFields) richText.set(def.type, def.richTextFields);
|
|
13
|
+
},
|
|
14
|
+
registerSchema(type, schema) {
|
|
15
|
+
schemas.set(type, schema);
|
|
16
|
+
},
|
|
17
|
+
registerRichText(type, fields) {
|
|
18
|
+
richText.set(type, fields);
|
|
19
|
+
},
|
|
20
|
+
getRichTextFields(type) {
|
|
21
|
+
return richText.get(type) ?? [];
|
|
22
|
+
},
|
|
23
|
+
getSection(type) {
|
|
24
|
+
return sections.get(type);
|
|
25
|
+
},
|
|
26
|
+
getSchema(type) {
|
|
27
|
+
return schemas.get(type) ?? sections.get(type)?.schema;
|
|
28
|
+
},
|
|
29
|
+
getAllSections() {
|
|
30
|
+
return Array.from(sections.values());
|
|
31
|
+
},
|
|
32
|
+
getAllSchemas() {
|
|
33
|
+
const merged = new Map(schemas);
|
|
34
|
+
for (const [type, def] of sections) {
|
|
35
|
+
if (!merged.has(type)) merged.set(type, def.schema);
|
|
36
|
+
}
|
|
37
|
+
return Array.from(merged.values());
|
|
38
|
+
},
|
|
39
|
+
clearRegistry() {
|
|
40
|
+
sections.clear();
|
|
41
|
+
schemas.clear();
|
|
42
|
+
richText.clear();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@drawnagency/primitives/registry");
|
|
47
|
+
var g = globalThis;
|
|
48
|
+
if (!g[REGISTRY_KEY]) g[REGISTRY_KEY] = createRegistry();
|
|
49
|
+
var defaultRegistry = g[REGISTRY_KEY];
|
|
50
|
+
function registerSection(def) {
|
|
51
|
+
defaultRegistry.registerSection(def);
|
|
52
|
+
}
|
|
53
|
+
function registerSchema(type, schema) {
|
|
54
|
+
defaultRegistry.registerSchema(type, schema);
|
|
55
|
+
}
|
|
56
|
+
function registerRichText(type, fields) {
|
|
57
|
+
defaultRegistry.registerRichText(type, fields);
|
|
58
|
+
}
|
|
59
|
+
function getRichTextFields(type) {
|
|
60
|
+
return defaultRegistry.getRichTextFields(type);
|
|
61
|
+
}
|
|
62
|
+
function getSection(type) {
|
|
63
|
+
return defaultRegistry.getSection(type);
|
|
64
|
+
}
|
|
65
|
+
function getSchema(type) {
|
|
66
|
+
return defaultRegistry.getSchema(type);
|
|
67
|
+
}
|
|
68
|
+
function getAllSections() {
|
|
69
|
+
return defaultRegistry.getAllSections();
|
|
70
|
+
}
|
|
71
|
+
function getAllSchemas() {
|
|
72
|
+
return defaultRegistry.getAllSchemas();
|
|
73
|
+
}
|
|
74
|
+
function clearRegistry() {
|
|
75
|
+
defaultRegistry.clearRegistry();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
defineSection,
|
|
80
|
+
createRegistry,
|
|
81
|
+
registerSection,
|
|
82
|
+
registerSchema,
|
|
83
|
+
registerRichText,
|
|
84
|
+
getRichTextFields,
|
|
85
|
+
getSection,
|
|
86
|
+
getSchema,
|
|
87
|
+
getAllSections,
|
|
88
|
+
getAllSchemas,
|
|
89
|
+
clearRegistry
|
|
90
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { Edge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
3
|
+
export interface ChildBlockWrapperProps {
|
|
4
|
+
label: string;
|
|
5
|
+
columns: number;
|
|
6
|
+
colSpan: number;
|
|
7
|
+
closestEdge: Edge | null;
|
|
8
|
+
isDragging: boolean;
|
|
9
|
+
hasSettings: boolean;
|
|
10
|
+
/** Forwarded to the drag handle button (pragmatic-dnd dragHandle target). */
|
|
11
|
+
dragHandleRef?: Ref<HTMLButtonElement>;
|
|
12
|
+
onDelete: () => void;
|
|
13
|
+
onDuplicate: () => void;
|
|
14
|
+
onColSpanChange: (span: number) => void;
|
|
15
|
+
onOpenSettings?: () => void;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare const ChildBlockWrapper: import("react").ForwardRefExoticComponent<ChildBlockWrapperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//# sourceMappingURL=ChildBlockWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildBlockWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/ChildBlockWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uDAAuD,CAAC;AAQlF,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,mHAkF7B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ColSpanControlProps {
|
|
2
|
+
colSpan: number;
|
|
3
|
+
columns: number;
|
|
4
|
+
onChange: (span: number) => void;
|
|
5
|
+
}
|
|
6
|
+
/** Contextual col-span picker — only meaningful inside a multi-column container. */
|
|
7
|
+
export declare function ColSpanControl({ colSpan, columns, onChange }: ColSpanControlProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ColSpanControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColSpanControl.d.ts","sourceRoot":"","sources":["../../../src/components/editor/ColSpanControl.tsx"],"names":[],"mappings":"AAMA,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,mBAAmB,kDA0CjF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { WrapperProps } from "../../lib/registry";
|
|
2
|
-
export declare function SectionWrapper({ sectionId, sectionType, status, dirty, index, isLast, definition, options, audiences, access, onAccessChange, onStatusChange, onSectionChange, onReorder, onRequestInsert, onDelete, onMoveSection, mainStatus, contentDiffersFromMain, isLocalOnly, children, }: WrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function SectionWrapper({ sectionId, sectionType, status, dirty, index, isLast, containerId, isContainerBlock, definition, options, audiences, access, onAccessChange, onStatusChange, onSectionChange, onReorder, onRequestInsert, onDelete, onMoveSection, onAddChild, mainStatus, contentDiffersFromMain, isLocalOnly, children, }: WrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=SectionWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionWrapper.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SectionWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionWrapper.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,WAAW,EACX,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,SAAS,EACT,MAAM,EACN,cAAc,EACd,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,QAAQ,EACR,aAAa,EACb,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,QAAQ,GACT,EAAE,YAAY,2CAgTd"}
|
|
@@ -7,7 +7,11 @@ interface SettingsFormProps {
|
|
|
7
7
|
schema: SettingsSchema;
|
|
8
8
|
values: Record<string, unknown>;
|
|
9
9
|
onChange: (result: SettingsFormResult) => void;
|
|
10
|
+
tabs?: {
|
|
11
|
+
label: string;
|
|
12
|
+
fields: string[];
|
|
13
|
+
}[];
|
|
10
14
|
}
|
|
11
|
-
export declare function SettingsForm({ schema, values, onChange }: SettingsFormProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function SettingsForm({ schema, values, onChange, tabs }: SettingsFormProps): import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export {};
|
|
13
17
|
//# sourceMappingURL=SettingsForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsForm.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SettingsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsForm.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SettingsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAU3E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC9C;AAqJD,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,iBAAiB,2CA2BjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableGrid.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/EditableGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQpE,UAAU,iBAAiB,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IAClF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,EAAE,iBAAiB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"EditableGrid.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/EditableGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQpE,UAAU,iBAAiB,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IAClF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAqFtB"}
|
|
@@ -3,7 +3,13 @@ interface IconPickerProps {
|
|
|
3
3
|
onSelect: (iconId: string | null) => void;
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
showRemove?: boolean;
|
|
6
|
+
/** Opt-in: render the None / Do-Don't mode toggle. Default false → grid-only. */
|
|
7
|
+
allowDoDont?: boolean;
|
|
8
|
+
/** Current per-item Do/Don't tag (only meaningful when allowDoDont). */
|
|
9
|
+
dodont?: "do" | "dont";
|
|
10
|
+
/** Commit a Do/Don't choice; pass undefined to clear the tag (None). */
|
|
11
|
+
onSelectDoDont?: (v: "do" | "dont" | undefined) => void;
|
|
6
12
|
}
|
|
7
|
-
export declare function IconPicker({ selected, onSelect, onClose, showRemove }: IconPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function IconPicker({ selected, onSelect, onClose, showRemove, allowDoDont, dodont, onSelectDoDont, }: IconPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
14
|
export {};
|
|
9
15
|
//# sourceMappingURL=IconPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconPicker.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/IconPicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconPicker.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/IconPicker.tsx"],"names":[],"mappings":"AAKA,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iFAAiF;IACjF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wEAAwE;IACxE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACvB,wEAAwE;IACxE,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACzD;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAiB,EACjB,WAAmB,EACnB,MAAM,EACN,cAAc,GACf,EAAE,eAAe,2CA2HjB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { Section } from "../../../schemas/sections";
|
|
3
|
+
interface ContainerContent {
|
|
4
|
+
columns: number;
|
|
5
|
+
flow: string;
|
|
6
|
+
childDefaults?: Record<string, unknown>;
|
|
7
|
+
children: Section[];
|
|
8
|
+
}
|
|
9
|
+
export interface ContainerProps {
|
|
10
|
+
content: {
|
|
11
|
+
id?: string;
|
|
12
|
+
content: ContainerContent;
|
|
13
|
+
};
|
|
14
|
+
isEditMode: boolean;
|
|
15
|
+
onChange?: (content: unknown) => void;
|
|
16
|
+
openModal?: (title: string, content: ReactNode) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function Container({ content, isEditMode, onChange, openModal }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Container/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAgB3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAqGzD,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,gBAAgB,CAAA;KAAE,CAAC;IACpD,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;CACzD;AAkDD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,2CA8KrF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ChildLike {
|
|
2
|
+
type: string;
|
|
3
|
+
options?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
interface ContainerSettingsFormProps {
|
|
6
|
+
columns?: number;
|
|
7
|
+
flow?: string;
|
|
8
|
+
childDefaults?: Record<string, unknown>;
|
|
9
|
+
children?: ChildLike[];
|
|
10
|
+
onChange: (result: {
|
|
11
|
+
content: Record<string, unknown>;
|
|
12
|
+
options: Record<string, unknown>;
|
|
13
|
+
}) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function ContainerSettingsForm({ columns, flow, childDefaults, children, onChange, }: ContainerSettingsFormProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ContainerSettingsForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerSettingsForm.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Container/ContainerSettingsForm.tsx"],"names":[],"mappings":"AAMA,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,UAAU,0BAA0B;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;CACpG;AAgBD,wBAAgB,qBAAqB,CAAC,EACpC,OAAW,EACX,IAAY,EACZ,aAAkB,EAClB,QAAa,EACb,QAAQ,GACT,EAAE,0BAA0B,2CAyE5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: import("../../..").SectionDefinition<{
|
|
2
|
+
type: "container";
|
|
3
|
+
content: {
|
|
4
|
+
children: import("../../..").Section<Record<string, unknown>>[];
|
|
5
|
+
columns: number;
|
|
6
|
+
flow: "row" | "column";
|
|
7
|
+
childDefaults?: Record<string, unknown> | undefined;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Container/index.tsx"],"names":[],"mappings":";;;;;;;;;AAiCA,wBAiBG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconList.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/IconList/IconList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"IconList.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/IconList/IconList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAUhE,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CACxB;AAED,UAAU,KAAK;IACb,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,IAAW,EACX,SAAgB,EAChB,SAAiB,EACjB,cAA+C,EAC/C,aAA0C,EAC1C,aAA8B,EAC9B,QAAQ,EACR,aAAa,GACd,EAAE,KAAK,2CAyCP"}
|
|
@@ -2,10 +2,9 @@ export declare function IconListSettings({ icon: initialIcon, showLabel: initial
|
|
|
2
2
|
icon: string | null;
|
|
3
3
|
showLabel: boolean;
|
|
4
4
|
stackText: boolean;
|
|
5
|
-
onChange: (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
stackText: boolean;
|
|
5
|
+
onChange: (result: {
|
|
6
|
+
content: Record<string, unknown>;
|
|
7
|
+
options: Record<string, unknown>;
|
|
9
8
|
}) => void;
|
|
10
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
//# sourceMappingURL=IconListSettings.d.ts.map
|