@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.
- package/dist/adapter-HH47ZPGM.js +1779 -0
- package/dist/auth/index.js +1 -0
- package/dist/{chunk-EU6NZ4GS.js → chunk-AN62WPW7.js} +22 -163
- package/dist/chunk-ESE5UBQI.js +73 -0
- package/dist/{chunk-KGYWQDBB.js → chunk-ICLXLWQ5.js} +9 -72
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/chunk-NSCT3AMV.js +32 -0
- package/dist/chunk-RFZNNCAS.js +160 -0
- package/dist/chunk-TG43X7JO.js +123 -0
- package/dist/{chunk-7IAWF7LE.js → chunk-V7JN2DDU.js} +2 -19
- package/dist/chunk-VKAGMEKE.js +90 -0
- package/dist/chunk-ZU2MKPTG.js +29 -0
- package/dist/closest-edge-EBOXL3YW.js +72 -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/sections/register-schemas.js +4094 -0
- 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 +69 -56
- 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 +15 -0
- package/dist/lib/env.js +1 -0
- package/dist/lib/index.js +19 -13
- 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 +7 -0
- package/dist/lib/registry.d.ts +39 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +27 -0
- package/dist/media/index.js +1 -0
- package/dist/schemas/auth.js +1 -0
- package/dist/schemas/block.d.ts +20 -0
- package/dist/schemas/block.d.ts.map +1 -0
- package/dist/schemas/block.js +15 -0
- package/dist/schemas/index.js +13 -4
- 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/dist/types/database.js +2 -0
- package/package.json +17 -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
package/dist/auth/index.js
CHANGED
|
@@ -1,79 +1,20 @@
|
|
|
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";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (slug) return slug;
|
|
22
|
-
let hash = 0;
|
|
23
|
-
for (let i = 0; i < text.length; i++) {
|
|
24
|
-
hash = (hash << 5) - hash + text.charCodeAt(i) | 0;
|
|
25
|
-
}
|
|
26
|
-
return `section-${Math.abs(hash).toString(36)}`;
|
|
27
|
-
}
|
|
28
|
-
function generateNavLinks(sections, registry) {
|
|
29
|
-
const nav = [];
|
|
30
|
-
let currentParent = null;
|
|
31
|
-
let currentChild = null;
|
|
32
|
-
const lookupRole = (type) => {
|
|
33
|
-
const def = registry ? registry.getSection(type) : getSection(type);
|
|
34
|
-
return def?.navRole;
|
|
35
|
-
};
|
|
36
|
-
for (const { section, meta } of sections) {
|
|
37
|
-
const content = section.content;
|
|
38
|
-
if (!content.heading) continue;
|
|
39
|
-
const role = lookupRole(section.type);
|
|
40
|
-
if (!role) continue;
|
|
41
|
-
if (role === "h1") {
|
|
42
|
-
if (content.excludeFromNav) {
|
|
43
|
-
currentParent = null;
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
currentParent = {
|
|
47
|
-
href: `#${toSectionId(content.heading)}`,
|
|
48
|
-
label: content.heading,
|
|
49
|
-
status: meta.status,
|
|
50
|
-
children: []
|
|
51
|
-
};
|
|
52
|
-
currentChild = null;
|
|
53
|
-
nav.push(currentParent);
|
|
54
|
-
} else if (role === "h2") {
|
|
55
|
-
if (content.excludeFromNav) continue;
|
|
56
|
-
if (!currentParent) continue;
|
|
57
|
-
currentChild = {
|
|
58
|
-
href: `#${toSectionId(content.heading)}`,
|
|
59
|
-
label: content.heading,
|
|
60
|
-
status: meta.status,
|
|
61
|
-
children: []
|
|
62
|
-
};
|
|
63
|
-
currentParent.children.push(currentChild);
|
|
64
|
-
} else if (role === "h3") {
|
|
65
|
-
if (content.excludeFromNav) continue;
|
|
66
|
-
if (!currentChild) continue;
|
|
67
|
-
currentChild.children.push({
|
|
68
|
-
href: `#${toSectionId(content.heading)}`,
|
|
69
|
-
label: content.heading,
|
|
70
|
-
status: meta.status,
|
|
71
|
-
children: []
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return nav;
|
|
76
|
-
}
|
|
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
|
+
} from "./chunk-VKAGMEKE.js";
|
|
77
18
|
|
|
78
19
|
// src/lib/contrast.ts
|
|
79
20
|
function deriveContrast(hex) {
|
|
@@ -86,36 +27,6 @@ function deriveContrast(hex) {
|
|
|
86
27
|
return luminance >= 0.5 ? "#1a1a1a" : "#f0f0f0";
|
|
87
28
|
}
|
|
88
29
|
|
|
89
|
-
// src/lib/sanitize.ts
|
|
90
|
-
var purifierPromise = null;
|
|
91
|
-
var purifier = null;
|
|
92
|
-
if (typeof window !== "undefined") {
|
|
93
|
-
purifierPromise = import("dompurify").then((mod) => {
|
|
94
|
-
const DOMPurify = mod.default ?? mod;
|
|
95
|
-
purifier = (html) => DOMPurify.sanitize(html);
|
|
96
|
-
return mod;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
var sanitizeCache = /* @__PURE__ */ new Map();
|
|
100
|
-
var SANITIZE_CACHE_LIMIT = 500;
|
|
101
|
-
function sanitizeHtml(html) {
|
|
102
|
-
if (!html) return "";
|
|
103
|
-
if (!purifier) return html;
|
|
104
|
-
const cached = sanitizeCache.get(html);
|
|
105
|
-
if (cached !== void 0) return cached;
|
|
106
|
-
const clean = purifier(html);
|
|
107
|
-
if (sanitizeCache.size >= SANITIZE_CACHE_LIMIT) {
|
|
108
|
-
const oldest = sanitizeCache.keys().next().value;
|
|
109
|
-
if (oldest !== void 0) sanitizeCache.delete(oldest);
|
|
110
|
-
}
|
|
111
|
-
sanitizeCache.set(html, clean);
|
|
112
|
-
return clean;
|
|
113
|
-
}
|
|
114
|
-
async function ensureSanitizer() {
|
|
115
|
-
if (typeof window === "undefined") return;
|
|
116
|
-
if (!purifier && purifierPromise) await purifierPromise;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
30
|
// src/lib/grid.ts
|
|
120
31
|
var gridColsClass = {
|
|
121
32
|
1: "grid-cols-1",
|
|
@@ -125,56 +36,6 @@ var gridColsClass = {
|
|
|
125
36
|
5: "grid-cols-2 min-sm:grid-cols-3 lg:grid-cols-5"
|
|
126
37
|
};
|
|
127
38
|
|
|
128
|
-
// src/lib/icons.ts
|
|
129
|
-
import {
|
|
130
|
-
Check,
|
|
131
|
-
X,
|
|
132
|
-
ArrowRight,
|
|
133
|
-
Star,
|
|
134
|
-
Info,
|
|
135
|
-
AlertTriangle,
|
|
136
|
-
Heart,
|
|
137
|
-
Lightbulb,
|
|
138
|
-
Flag,
|
|
139
|
-
Shield,
|
|
140
|
-
Zap,
|
|
141
|
-
Eye,
|
|
142
|
-
Lock,
|
|
143
|
-
Globe,
|
|
144
|
-
Users,
|
|
145
|
-
Target,
|
|
146
|
-
Bookmark,
|
|
147
|
-
Clock,
|
|
148
|
-
ThumbsUp,
|
|
149
|
-
ThumbsDown
|
|
150
|
-
} from "lucide-react";
|
|
151
|
-
var curatedIcons = [
|
|
152
|
-
{ id: "check", label: "Check", icon: Check },
|
|
153
|
-
{ id: "x", label: "X", icon: X },
|
|
154
|
-
{ id: "arrow-right", label: "Arrow Right", icon: ArrowRight },
|
|
155
|
-
{ id: "star", label: "Star", icon: Star },
|
|
156
|
-
{ id: "info", label: "Info", icon: Info },
|
|
157
|
-
{ id: "alert-triangle", label: "Warning", icon: AlertTriangle },
|
|
158
|
-
{ id: "heart", label: "Heart", icon: Heart },
|
|
159
|
-
{ id: "lightbulb", label: "Lightbulb", icon: Lightbulb },
|
|
160
|
-
{ id: "flag", label: "Flag", icon: Flag },
|
|
161
|
-
{ id: "shield", label: "Shield", icon: Shield },
|
|
162
|
-
{ id: "zap", label: "Zap", icon: Zap },
|
|
163
|
-
{ id: "eye", label: "Eye", icon: Eye },
|
|
164
|
-
{ id: "lock", label: "Lock", icon: Lock },
|
|
165
|
-
{ id: "globe", label: "Globe", icon: Globe },
|
|
166
|
-
{ id: "users", label: "Users", icon: Users },
|
|
167
|
-
{ id: "target", label: "Target", icon: Target },
|
|
168
|
-
{ id: "bookmark", label: "Bookmark", icon: Bookmark },
|
|
169
|
-
{ id: "clock", label: "Clock", icon: Clock },
|
|
170
|
-
{ id: "thumbs-up", label: "Thumbs Up", icon: ThumbsUp },
|
|
171
|
-
{ id: "thumbs-down", label: "Thumbs Down", icon: ThumbsDown }
|
|
172
|
-
];
|
|
173
|
-
var iconMap = new Map(curatedIcons.map((e) => [e.id, e]));
|
|
174
|
-
function getIcon(id) {
|
|
175
|
-
return iconMap.get(id);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
39
|
// src/lib/google-fonts.ts
|
|
179
40
|
function buildGoogleFontsUrl(headingFont, bodyFont) {
|
|
180
41
|
const fonts = /* @__PURE__ */ new Set();
|
|
@@ -245,11 +106,14 @@ function mergeSiteContent(index, sectionFiles) {
|
|
|
245
106
|
const schema = canValidate ? getSectionSchema() : null;
|
|
246
107
|
const orderedIds = index.pages.flatMap((p) => p.order);
|
|
247
108
|
for (const id of orderedIds) {
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
109
|
+
const rawFile = sectionFiles[id];
|
|
110
|
+
if (!rawFile) {
|
|
250
111
|
console.warn(`Section file missing for id: ${id}, skipping`);
|
|
251
112
|
continue;
|
|
252
113
|
}
|
|
114
|
+
const raw = upgradeLegacySection(rawFile);
|
|
115
|
+
const baseMeta = index.sections[id];
|
|
116
|
+
const meta = raw !== rawFile ? { ...baseMeta, type: "container" } : baseMeta;
|
|
253
117
|
if (canValidate && schema) {
|
|
254
118
|
const result = schema.safeParse(raw);
|
|
255
119
|
if (!result.success) {
|
|
@@ -257,10 +121,12 @@ function mergeSiteContent(index, sectionFiles) {
|
|
|
257
121
|
console.warn(`Skipping section "${id}" (type: ${type}): invalid schema`);
|
|
258
122
|
continue;
|
|
259
123
|
}
|
|
260
|
-
|
|
124
|
+
if (blockDepth(result.data) > MAX_BLOCK_DEPTH) {
|
|
125
|
+
console.warn(`Skipping section "${id}": block tree depth exceeds ${MAX_BLOCK_DEPTH}`);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
261
128
|
sections.push({ section: result.data, meta });
|
|
262
129
|
} else {
|
|
263
|
-
const meta = index.sections[id];
|
|
264
130
|
sections.push({ section: raw, meta });
|
|
265
131
|
}
|
|
266
132
|
}
|
|
@@ -290,15 +156,8 @@ async function loadSiteContent(contentDir) {
|
|
|
290
156
|
}
|
|
291
157
|
|
|
292
158
|
export {
|
|
293
|
-
cn,
|
|
294
|
-
toSectionId,
|
|
295
|
-
generateNavLinks,
|
|
296
159
|
deriveContrast,
|
|
297
|
-
sanitizeHtml,
|
|
298
|
-
ensureSanitizer,
|
|
299
160
|
gridColsClass,
|
|
300
|
-
curatedIcons,
|
|
301
|
-
getIcon,
|
|
302
161
|
buildGoogleFontsUrl,
|
|
303
162
|
formatTimestamp,
|
|
304
163
|
safeRedirect,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS
|
|
3
|
+
} from "./chunk-JSBRDJBE.js";
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/typeof.js
|
|
6
|
+
var require_typeof = __commonJS({
|
|
7
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/typeof.js"(exports, module) {
|
|
8
|
+
"use strict";
|
|
9
|
+
function _typeof(o) {
|
|
10
|
+
"@babel/helpers - typeof";
|
|
11
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
12
|
+
return typeof o2;
|
|
13
|
+
} : function(o2) {
|
|
14
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
15
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
16
|
+
}
|
|
17
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/toPrimitive.js
|
|
22
|
+
var require_toPrimitive = __commonJS({
|
|
23
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/toPrimitive.js"(exports, module) {
|
|
24
|
+
"use strict";
|
|
25
|
+
var _typeof = require_typeof()["default"];
|
|
26
|
+
function toPrimitive(t, r) {
|
|
27
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
28
|
+
var e = t[Symbol.toPrimitive];
|
|
29
|
+
if (void 0 !== e) {
|
|
30
|
+
var i = e.call(t, r || "default");
|
|
31
|
+
if ("object" != _typeof(i)) return i;
|
|
32
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
33
|
+
}
|
|
34
|
+
return ("string" === r ? String : Number)(t);
|
|
35
|
+
}
|
|
36
|
+
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/toPropertyKey.js
|
|
41
|
+
var require_toPropertyKey = __commonJS({
|
|
42
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/toPropertyKey.js"(exports, module) {
|
|
43
|
+
"use strict";
|
|
44
|
+
var _typeof = require_typeof()["default"];
|
|
45
|
+
var toPrimitive = require_toPrimitive();
|
|
46
|
+
function toPropertyKey(t) {
|
|
47
|
+
var i = toPrimitive(t, "string");
|
|
48
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
49
|
+
}
|
|
50
|
+
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/defineProperty.js
|
|
55
|
+
var require_defineProperty = __commonJS({
|
|
56
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/defineProperty.js"(exports, module) {
|
|
57
|
+
"use strict";
|
|
58
|
+
var toPropertyKey = require_toPropertyKey();
|
|
59
|
+
function _defineProperty(e, r, t) {
|
|
60
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
61
|
+
value: t,
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true
|
|
65
|
+
}) : e[r] = t, e;
|
|
66
|
+
}
|
|
67
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
require_defineProperty
|
|
73
|
+
};
|
|
@@ -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,30 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
__commonJS,
|
|
29
|
+
__toESM
|
|
30
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getSection
|
|
3
|
+
} from "./chunk-VKAGMEKE.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/cn.ts
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/lib/nav.ts
|
|
13
|
+
function toSectionId(text) {
|
|
14
|
+
const slug = text.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
|
|
15
|
+
if (slug) return slug;
|
|
16
|
+
let hash = 0;
|
|
17
|
+
for (let i = 0; i < text.length; i++) {
|
|
18
|
+
hash = (hash << 5) - hash + text.charCodeAt(i) | 0;
|
|
19
|
+
}
|
|
20
|
+
return `section-${Math.abs(hash).toString(36)}`;
|
|
21
|
+
}
|
|
22
|
+
function generateNavLinks(sections, registry) {
|
|
23
|
+
const nav = [];
|
|
24
|
+
let currentParent = null;
|
|
25
|
+
let currentChild = null;
|
|
26
|
+
const lookupRole = (type) => {
|
|
27
|
+
const def = registry ? registry.getSection(type) : getSection(type);
|
|
28
|
+
return def?.navRole;
|
|
29
|
+
};
|
|
30
|
+
for (const { section, meta } of sections) {
|
|
31
|
+
const content = section.content;
|
|
32
|
+
if (!content.heading) continue;
|
|
33
|
+
const role = lookupRole(section.type);
|
|
34
|
+
if (!role) continue;
|
|
35
|
+
if (role === "h1") {
|
|
36
|
+
if (content.excludeFromNav) {
|
|
37
|
+
currentParent = null;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
currentParent = {
|
|
41
|
+
href: `#${toSectionId(content.heading)}`,
|
|
42
|
+
label: content.heading,
|
|
43
|
+
status: meta.status,
|
|
44
|
+
children: []
|
|
45
|
+
};
|
|
46
|
+
currentChild = null;
|
|
47
|
+
nav.push(currentParent);
|
|
48
|
+
} else if (role === "h2") {
|
|
49
|
+
if (content.excludeFromNav) continue;
|
|
50
|
+
if (!currentParent) continue;
|
|
51
|
+
currentChild = {
|
|
52
|
+
href: `#${toSectionId(content.heading)}`,
|
|
53
|
+
label: content.heading,
|
|
54
|
+
status: meta.status,
|
|
55
|
+
children: []
|
|
56
|
+
};
|
|
57
|
+
currentParent.children.push(currentChild);
|
|
58
|
+
} else if (role === "h3") {
|
|
59
|
+
if (content.excludeFromNav) continue;
|
|
60
|
+
if (!currentChild) continue;
|
|
61
|
+
currentChild.children.push({
|
|
62
|
+
href: `#${toSectionId(content.heading)}`,
|
|
63
|
+
label: content.heading,
|
|
64
|
+
status: meta.status,
|
|
65
|
+
children: []
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return nav;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/lib/sanitize.ts
|
|
73
|
+
var purifierPromise = null;
|
|
74
|
+
var purifier = null;
|
|
75
|
+
if (typeof window !== "undefined") {
|
|
76
|
+
purifierPromise = import("dompurify").then((mod) => {
|
|
77
|
+
const DOMPurify = mod.default ?? mod;
|
|
78
|
+
purifier = (html) => DOMPurify.sanitize(html);
|
|
79
|
+
return mod;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
var sanitizeCache = /* @__PURE__ */ new Map();
|
|
83
|
+
var SANITIZE_CACHE_LIMIT = 500;
|
|
84
|
+
function sanitizeHtml(html) {
|
|
85
|
+
if (!html) return "";
|
|
86
|
+
if (!purifier) return html;
|
|
87
|
+
const cached = sanitizeCache.get(html);
|
|
88
|
+
if (cached !== void 0) return cached;
|
|
89
|
+
const clean = purifier(html);
|
|
90
|
+
if (sanitizeCache.size >= SANITIZE_CACHE_LIMIT) {
|
|
91
|
+
const oldest = sanitizeCache.keys().next().value;
|
|
92
|
+
if (oldest !== void 0) sanitizeCache.delete(oldest);
|
|
93
|
+
}
|
|
94
|
+
sanitizeCache.set(html, clean);
|
|
95
|
+
return clean;
|
|
96
|
+
}
|
|
97
|
+
async function ensureSanitizer() {
|
|
98
|
+
if (typeof window === "undefined") return;
|
|
99
|
+
if (!purifier && purifierPromise) await purifierPromise;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/lib/icons.ts
|
|
103
|
+
import {
|
|
104
|
+
Check,
|
|
105
|
+
X,
|
|
106
|
+
ArrowRight,
|
|
107
|
+
Star,
|
|
108
|
+
Info,
|
|
109
|
+
AlertTriangle,
|
|
110
|
+
Heart,
|
|
111
|
+
Lightbulb,
|
|
112
|
+
Flag,
|
|
113
|
+
Shield,
|
|
114
|
+
Zap,
|
|
115
|
+
Eye,
|
|
116
|
+
Lock,
|
|
117
|
+
Globe,
|
|
118
|
+
Users,
|
|
119
|
+
Target,
|
|
120
|
+
Bookmark,
|
|
121
|
+
Clock,
|
|
122
|
+
ThumbsUp,
|
|
123
|
+
ThumbsDown
|
|
124
|
+
} from "lucide-react";
|
|
125
|
+
var curatedIcons = [
|
|
126
|
+
{ id: "check", label: "Check", icon: Check },
|
|
127
|
+
{ id: "x", label: "X", icon: X },
|
|
128
|
+
{ id: "arrow-right", label: "Arrow Right", icon: ArrowRight },
|
|
129
|
+
{ id: "star", label: "Star", icon: Star },
|
|
130
|
+
{ id: "info", label: "Info", icon: Info },
|
|
131
|
+
{ id: "alert-triangle", label: "Warning", icon: AlertTriangle },
|
|
132
|
+
{ id: "heart", label: "Heart", icon: Heart },
|
|
133
|
+
{ id: "lightbulb", label: "Lightbulb", icon: Lightbulb },
|
|
134
|
+
{ id: "flag", label: "Flag", icon: Flag },
|
|
135
|
+
{ id: "shield", label: "Shield", icon: Shield },
|
|
136
|
+
{ id: "zap", label: "Zap", icon: Zap },
|
|
137
|
+
{ id: "eye", label: "Eye", icon: Eye },
|
|
138
|
+
{ id: "lock", label: "Lock", icon: Lock },
|
|
139
|
+
{ id: "globe", label: "Globe", icon: Globe },
|
|
140
|
+
{ id: "users", label: "Users", icon: Users },
|
|
141
|
+
{ id: "target", label: "Target", icon: Target },
|
|
142
|
+
{ id: "bookmark", label: "Bookmark", icon: Bookmark },
|
|
143
|
+
{ id: "clock", label: "Clock", icon: Clock },
|
|
144
|
+
{ id: "thumbs-up", label: "Thumbs Up", icon: ThumbsUp },
|
|
145
|
+
{ id: "thumbs-down", label: "Thumbs Down", icon: ThumbsDown }
|
|
146
|
+
];
|
|
147
|
+
var iconMap = new Map(curatedIcons.map((e) => [e.id, e]));
|
|
148
|
+
function getIcon(id) {
|
|
149
|
+
return iconMap.get(id);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export {
|
|
153
|
+
cn,
|
|
154
|
+
toSectionId,
|
|
155
|
+
generateNavLinks,
|
|
156
|
+
sanitizeHtml,
|
|
157
|
+
ensureSanitizer,
|
|
158
|
+
curatedIcons,
|
|
159
|
+
getIcon
|
|
160
|
+
};
|