@drawnagency/primitives 0.1.115 → 0.1.116

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 (32) hide show
  1. package/dist/chunk-26V4YNOR.js +108 -0
  2. package/dist/chunk-DKZCHCV3.js +64 -0
  3. package/dist/chunk-FGQXHUAE.js +39 -0
  4. package/dist/{chunk-JXATNKLV.js → chunk-HUOW3ZV2.js} +5 -5
  5. package/dist/{chunk-FHTKSELX.js → chunk-LNQUUC2S.js} +5 -5
  6. package/dist/{chunk-T26HAKW3.js → chunk-MSBHMY3C.js} +34 -34
  7. package/dist/components/editor/index.js +8 -8
  8. package/dist/components/primitives/index.js +7 -7
  9. package/dist/components/sections/brand-guide.js +5 -5
  10. package/dist/components/sections/register-schemas.js +12 -12
  11. package/dist/components/sections/register.js +12 -12
  12. package/dist/deck-builder/index.js +8 -8
  13. package/dist/index.js +12 -12
  14. package/dist/lib/document-refs.d.ts +8 -0
  15. package/dist/lib/document-refs.d.ts.map +1 -1
  16. package/dist/lib/document-refs.js +14 -0
  17. package/dist/lib/index-ops.js +3 -3
  18. package/dist/lib/index.js +12 -12
  19. package/dist/lib/reference-validation.js +4 -33
  20. package/dist/lib/section-check.d.ts +49 -0
  21. package/dist/lib/section-check.d.ts.map +1 -0
  22. package/dist/lib/section-check.js +14 -0
  23. package/dist/lib/site-validation.d.ts +123 -0
  24. package/dist/lib/site-validation.d.ts.map +1 -0
  25. package/dist/lib/site-validation.js +230 -0
  26. package/package.json +14 -1
  27. package/src/lib/document-refs.ts +30 -0
  28. package/src/lib/section-check.ts +166 -0
  29. package/src/lib/site-validation.ts +269 -0
  30. package/dist/{chunk-NX7TFHA4.js → chunk-CEFFP3CH.js} +7 -7
  31. package/dist/{chunk-YV3YSZEB.js → chunk-L7WTERU5.js} +3 -3
  32. package/dist/{chunk-WYOFQHKI.js → chunk-W72BPGR3.js} +3 -3
@@ -0,0 +1,108 @@
1
+ import {
2
+ REFERENCE_TYPE
3
+ } from "./chunk-5GFACGSN.js";
4
+ import {
5
+ getRichTextFields,
6
+ getSchema
7
+ } from "./chunk-FTPETWXE.js";
8
+ import {
9
+ LayoutEnvelopeSchema,
10
+ MAX_BLOCK_DEPTH,
11
+ blockDepth
12
+ } from "./chunk-NSCT3AMV.js";
13
+
14
+ // src/lib/section-check.ts
15
+ import { decodeHTMLStrict } from "entities";
16
+ function checkSection(type, body) {
17
+ const schema = getSchema(type);
18
+ if (!schema) {
19
+ return { unregistered: true, error: blockDepth(body) > MAX_BLOCK_DEPTH ? { code: "depth" } : null, entities: [] };
20
+ }
21
+ const fail = (error) => ({ unregistered: false, error, entities: [] });
22
+ const result = schema.safeParse(body);
23
+ if (!result.success) return fail({ code: "schema", zodError: result.error });
24
+ const rawLayout = body?.layout;
25
+ if (rawLayout !== void 0) {
26
+ const layoutResult = LayoutEnvelopeSchema.safeParse(rawLayout);
27
+ if (!layoutResult.success) return fail({ code: "layout", zodError: layoutResult.error });
28
+ }
29
+ if (blockDepth(result.data) > MAX_BLOCK_DEPTH) return fail({ code: "depth" });
30
+ const children = result.data.content?.children;
31
+ if (Array.isArray(children) && children.some((child) => child?.type === REFERENCE_TYPE)) {
32
+ return fail({ code: "reference-in-container" });
33
+ }
34
+ const entities = [];
35
+ walkSectionForEntities(type, result.data, "", (path, tokens) => {
36
+ entities.push({ path, entities: tokens });
37
+ });
38
+ return { unregistered: false, error: null, entities };
39
+ }
40
+ var ENTITY_RE = /&(#\d{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z][a-zA-Z0-9]{1,31});/g;
41
+ function entitiesIn(value) {
42
+ const found = [];
43
+ for (const m of value.matchAll(ENTITY_RE)) {
44
+ const token = m[0];
45
+ if ((m[1].startsWith("#") || decodeHTMLStrict(token) !== token) && !found.includes(token)) {
46
+ found.push(token);
47
+ }
48
+ }
49
+ return found;
50
+ }
51
+ function visitPlainLeaf(value, path, report) {
52
+ if (typeof value === "string") {
53
+ const tokens = entitiesIn(value);
54
+ if (tokens.length > 0) report(path, tokens);
55
+ return;
56
+ }
57
+ if (Array.isArray(value)) {
58
+ value.forEach((v, i) => visitPlainLeaf(v, `${path}[${i}]`, report));
59
+ return;
60
+ }
61
+ if (typeof value === "object" && value !== null) {
62
+ for (const [k, v] of Object.entries(value)) visitPlainLeaf(v, `${path}.${k}`, report);
63
+ }
64
+ }
65
+ function walkSectionForEntities(type, block, prefix, report) {
66
+ const { content, options } = block;
67
+ if (typeof content === "object" && content !== null) {
68
+ const rich = new Set(getRichTextFields(type));
69
+ for (const [key, value] of Object.entries(content)) {
70
+ if (rich.has(key)) continue;
71
+ if (key === "children" && Array.isArray(value)) {
72
+ value.forEach((child, i) => {
73
+ const c = child;
74
+ if (c && typeof c === "object" && typeof c.type === "string") {
75
+ walkSectionForEntities(c.type, c, `${prefix}content.children[${i}].`, report);
76
+ }
77
+ });
78
+ continue;
79
+ }
80
+ visitPlainLeaf(value, `${prefix}content.${key}`, report);
81
+ }
82
+ }
83
+ if (typeof options === "object" && options !== null) {
84
+ visitPlainLeaf(options, `${prefix}options`, report);
85
+ }
86
+ }
87
+ function sectionCheckMessage(sectionId, type, code) {
88
+ switch (code) {
89
+ case "schema":
90
+ return `Validation failed: section "${sectionId}" (${type})`;
91
+ case "layout":
92
+ return `Validation failed: section "${sectionId}" has an invalid layout envelope`;
93
+ case "depth":
94
+ return `Validation failed: section "${sectionId}" exceeds max nesting depth (${MAX_BLOCK_DEPTH})`;
95
+ case "reference-in-container":
96
+ return `Validation failed: section "${sectionId}" holds a Reference, which can only sit at the top level of a page, not inside a container`;
97
+ }
98
+ }
99
+ function entityWarning(sectionId, { path, entities }) {
100
+ const noun = entities.length > 1 ? "entities" : "entity";
101
+ return `section "${sectionId}": "${path}" contains HTML ${noun} ${entities.join(", ")} \u2014 this is a plain-text field, so entities render literally; if a character was intended, use the character itself.`;
102
+ }
103
+
104
+ export {
105
+ checkSection,
106
+ sectionCheckMessage,
107
+ entityWarning
108
+ };
@@ -0,0 +1,64 @@
1
+ import {
2
+ getContainerChildren
3
+ } from "./chunk-L45X7DKX.js";
4
+
5
+ // src/lib/document-refs.ts
6
+ function documentIdOf(section) {
7
+ if (section.type !== "document") return "";
8
+ return section.content.doc?.documentId ?? "";
9
+ }
10
+ function tallyDocumentIds(value, counts = /* @__PURE__ */ new Map()) {
11
+ if (Array.isArray(value)) {
12
+ for (const item of value) tallyDocumentIds(item, counts);
13
+ return counts;
14
+ }
15
+ const section = value;
16
+ const documentId = documentIdOf(section);
17
+ if (documentId) counts.set(documentId, (counts.get(documentId) ?? 0) + 1);
18
+ for (const child of getContainerChildren(section)) tallyDocumentIds(child, counts);
19
+ return counts;
20
+ }
21
+ function clearDocumentRefs(section, ids) {
22
+ const documentId = documentIdOf(section);
23
+ if (documentId && ids.has(documentId)) {
24
+ const content = section.content;
25
+ return {
26
+ changed: true,
27
+ section: { ...section, content: { ...section.content, doc: { ...content.doc, documentId: "" } } }
28
+ };
29
+ }
30
+ const children = getContainerChildren(section);
31
+ if (children.length === 0) return { changed: false, section };
32
+ let changed = false;
33
+ const next = children.map((child) => {
34
+ const result = clearDocumentRefs(child, ids);
35
+ if (result.changed) changed = true;
36
+ return result.section;
37
+ });
38
+ if (!changed) return { changed: false, section };
39
+ return { changed: true, section: { ...section, content: { ...section.content, children: next } } };
40
+ }
41
+ function collectDocumentIds(value, out = /* @__PURE__ */ new Set()) {
42
+ if (Array.isArray(value)) {
43
+ for (const item of value) collectDocumentIds(item, out);
44
+ return out;
45
+ }
46
+ if (typeof value !== "object" || value === null) return out;
47
+ const node = value;
48
+ const content = node.content;
49
+ if (typeof content !== "object" || content === null || Array.isArray(content)) return out;
50
+ const record = content;
51
+ if (node.type === "document") {
52
+ const doc = record.doc;
53
+ const documentId = typeof doc === "object" && doc !== null ? doc.documentId : void 0;
54
+ if (typeof documentId === "string" && documentId !== "") out.add(documentId);
55
+ }
56
+ if (Array.isArray(record.children)) collectDocumentIds(record.children, out);
57
+ return out;
58
+ }
59
+
60
+ export {
61
+ tallyDocumentIds,
62
+ clearDocumentRefs,
63
+ collectDocumentIds
64
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ REFERENCE_TYPE
3
+ } from "./chunk-5GFACGSN.js";
4
+
5
+ // src/lib/reference-validation.ts
6
+ var strings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
7
+ function referenceProblems(sections, index, tagIds) {
8
+ const onPage = new Set(index.pages.flatMap((p) => p.order));
9
+ const problems = [];
10
+ for (const { id, content } of sections) {
11
+ const body = content;
12
+ if (body?.type !== REFERENCE_TYPE && index.sections[id]?.type !== REFERENCE_TYPE) continue;
13
+ const picks = strings(body?.content?.sectionIds).filter((pick) => pick !== id);
14
+ const problem = {
15
+ referenceId: id,
16
+ unknownTagIds: tagIds ? strings(body?.content?.tagIds).filter((tag) => !tagIds.has(tag)) : [],
17
+ unplacedSectionIds: picks.filter((pick) => !onPage.has(pick)),
18
+ referencePickIds: picks.filter((pick) => onPage.has(pick) && index.sections[pick]?.type === REFERENCE_TYPE),
19
+ picksItself: strings(body?.content?.sectionIds).includes(id)
20
+ };
21
+ if (problem.unknownTagIds.length || problem.unplacedSectionIds.length || problem.referencePickIds.length || problem.picksItself) problems.push(problem);
22
+ }
23
+ return problems;
24
+ }
25
+ function describeReferenceProblem(problem) {
26
+ const list = (ids) => ids.map((id) => `"${id}"`).join(", ");
27
+ const issues = [
28
+ ...problem.unknownTagIds.length ? [`tagIds ${list(problem.unknownTagIds)} are not tags on this site`] : [],
29
+ ...problem.unplacedSectionIds.length ? [`sectionIds ${list(problem.unplacedSectionIds)} are not top-level sections on any page (a container's child cannot be picked \u2014 pick the container)`] : [],
30
+ ...problem.referencePickIds.length ? [`sectionIds ${list(problem.referencePickIds)} are References, which a Reference never shows`] : [],
31
+ ...problem.picksItself ? ["sectionIds includes the Reference itself"] : []
32
+ ];
33
+ return `Reference "${problem.referenceId}": ${issues.join("; ")}.`;
34
+ }
35
+
36
+ export {
37
+ referenceProblems,
38
+ describeReferenceProblem
39
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  EditablePlainText
3
- } from "./chunk-YV3YSZEB.js";
4
- import {
5
- Button
6
- } from "./chunk-GGYY3JQJ.js";
3
+ } from "./chunk-L7WTERU5.js";
7
4
  import {
8
5
  usePages
9
6
  } from "./chunk-RIITGTV3.js";
7
+ import {
8
+ Button
9
+ } from "./chunk-GGYY3JQJ.js";
10
10
  import {
11
11
  toSectionId
12
- } from "./chunk-WYOFQHKI.js";
12
+ } from "./chunk-W72BPGR3.js";
13
13
  import {
14
14
  ensureSanitizer,
15
15
  isSanitizerReady,
@@ -1,3 +1,7 @@
1
+ import {
2
+ Checkbox,
3
+ Tabs
4
+ } from "./chunk-JR24U7FJ.js";
1
5
  import {
2
6
  EditableGrid,
3
7
  EditableList,
@@ -5,11 +9,7 @@ import {
5
9
  MediaBlock,
6
10
  containerGridClass,
7
11
  useEditableCollection
8
- } from "./chunk-YV3YSZEB.js";
9
- import {
10
- Checkbox,
11
- Tabs
12
- } from "./chunk-JR24U7FJ.js";
12
+ } from "./chunk-L7WTERU5.js";
13
13
  import {
14
14
  DragHandle,
15
15
  DropEdgeIndicator,
@@ -1,25 +1,10 @@
1
- import {
2
- EditableRichText,
3
- defineHeadingSection,
4
- useSanitizedHtml
5
- } from "./chunk-JXATNKLV.js";
6
1
  import {
7
2
  SummaryAnchorsContext,
8
3
  brandGuideSectionDefs,
9
4
  pluralize,
10
5
  stripHtmlToPlainText,
11
6
  truncate
12
- } from "./chunk-FHTKSELX.js";
13
- import {
14
- EditablePlainText,
15
- ImageDropZone,
16
- MAX_CONTAINER_COLUMNS,
17
- MediaBlock,
18
- colSpanClass,
19
- containerGridClass,
20
- masonryColumnsClass,
21
- spacerHiddenClass
22
- } from "./chunk-YV3YSZEB.js";
7
+ } from "./chunk-LNQUUC2S.js";
23
8
  import {
24
9
  DeleteButton,
25
10
  DragHandle,
@@ -30,26 +15,41 @@ import {
30
15
  canDropBlock,
31
16
  isBlockDragData,
32
17
  useOptionalEditorContext
33
- } from "./chunk-NX7TFHA4.js";
34
- import {
35
- Kbd,
36
- Popover,
37
- PopoverItem,
38
- Tooltip
39
- } from "./chunk-JCDZAFX2.js";
40
- import {
41
- Button
42
- } from "./chunk-GGYY3JQJ.js";
18
+ } from "./chunk-CEFFP3CH.js";
43
19
  import {
44
20
  Checkbox,
45
21
  CheckboxBox,
46
22
  Tabs
47
23
  } from "./chunk-JR24U7FJ.js";
24
+ import {
25
+ EditableRichText,
26
+ defineHeadingSection,
27
+ useSanitizedHtml
28
+ } from "./chunk-HUOW3ZV2.js";
29
+ import {
30
+ EditablePlainText,
31
+ ImageDropZone,
32
+ MAX_CONTAINER_COLUMNS,
33
+ MediaBlock,
34
+ colSpanClass,
35
+ containerGridClass,
36
+ masonryColumnsClass,
37
+ spacerHiddenClass
38
+ } from "./chunk-L7WTERU5.js";
48
39
  import {
49
40
  DropEdgeIndicator,
50
41
  useMediaLibrary,
51
42
  useResolvedMedia
52
43
  } from "./chunk-RIITGTV3.js";
44
+ import {
45
+ Kbd,
46
+ Popover,
47
+ PopoverItem,
48
+ Tooltip
49
+ } from "./chunk-JCDZAFX2.js";
50
+ import {
51
+ Button
52
+ } from "./chunk-GGYY3JQJ.js";
53
53
  import {
54
54
  embedUrl
55
55
  } from "./chunk-Y4JQGO6G.js";
@@ -58,7 +58,14 @@ import {
58
58
  } from "./chunk-HHNPSKPT.js";
59
59
  import {
60
60
  referenceItems
61
- } from "./chunk-WYOFQHKI.js";
61
+ } from "./chunk-W72BPGR3.js";
62
+ import {
63
+ cn
64
+ } from "./chunk-7EOSDFS3.js";
65
+ import {
66
+ audiencePasses,
67
+ pageDisplayTitle
68
+ } from "./chunk-VY3IFGE3.js";
62
69
  import {
63
70
  duplicateChildAt,
64
71
  isSpacer,
@@ -67,13 +74,6 @@ import {
67
74
  setChildColSpan,
68
75
  trimTrailingSpacers
69
76
  } from "./chunk-L45X7DKX.js";
70
- import {
71
- cn
72
- } from "./chunk-7EOSDFS3.js";
73
- import {
74
- audiencePasses,
75
- pageDisplayTitle
76
- } from "./chunk-VY3IFGE3.js";
77
77
  import {
78
78
  pagesInNavOrder
79
79
  } from "./chunk-DJOGPSRU.js";
@@ -8,7 +8,13 @@ import {
8
8
  canDropBlock,
9
9
  isBlockDragData,
10
10
  useEditorContext
11
- } from "../../chunk-NX7TFHA4.js";
11
+ } from "../../chunk-CEFFP3CH.js";
12
+ import {
13
+ CheckboxBox
14
+ } from "../../chunk-JR24U7FJ.js";
15
+ import {
16
+ DropEdgeIndicator
17
+ } from "../../chunk-RIITGTV3.js";
12
18
  import {
13
19
  Kbd,
14
20
  Popover,
@@ -16,12 +22,6 @@ import {
16
22
  Tooltip
17
23
  } from "../../chunk-JCDZAFX2.js";
18
24
  import "../../chunk-GGYY3JQJ.js";
19
- import {
20
- CheckboxBox
21
- } from "../../chunk-JR24U7FJ.js";
22
- import {
23
- DropEdgeIndicator
24
- } from "../../chunk-RIITGTV3.js";
25
25
  import {
26
26
  IconButton
27
27
  } from "../../chunk-IIDKW7AV.js";
@@ -31,11 +31,11 @@ import "../../chunk-XDEPXTBY.js";
31
31
  import {
32
32
  cn
33
33
  } from "../../chunk-7EOSDFS3.js";
34
+ import "../../chunk-S7QRHUWO.js";
34
35
  import {
35
36
  tagDisplayLabel
36
37
  } from "../../chunk-4WQ36ZP7.js";
37
38
  import "../../chunk-GNF6KFQ7.js";
38
- import "../../chunk-S7QRHUWO.js";
39
39
  import {
40
40
  REFERENCE_TYPE
41
41
  } from "../../chunk-5GFACGSN.js";
@@ -2,7 +2,7 @@ import {
2
2
  EditableRichText,
3
3
  LinkPopover,
4
4
  defineHeadingSection
5
- } from "../../chunk-JXATNKLV.js";
5
+ } from "../../chunk-HUOW3ZV2.js";
6
6
  import {
7
7
  EditableGrid,
8
8
  EditableList,
@@ -10,26 +10,26 @@ import {
10
10
  ImageDropZone,
11
11
  MediaBlock,
12
12
  ResolvedMedia
13
- } from "../../chunk-YV3YSZEB.js";
14
- import "../../chunk-DIMDRBFK.js";
15
- import "../../chunk-GGYY3JQJ.js";
13
+ } from "../../chunk-L7WTERU5.js";
16
14
  import {
17
15
  LinkField,
18
16
  PagesContext,
19
17
  usePages
20
18
  } from "../../chunk-RIITGTV3.js";
19
+ import "../../chunk-DIMDRBFK.js";
20
+ import "../../chunk-GGYY3JQJ.js";
21
21
  import "../../chunk-IIDKW7AV.js";
22
22
  import "../../chunk-HHNPSKPT.js";
23
23
  import "../../chunk-CDBURDPX.js";
24
- import "../../chunk-WYOFQHKI.js";
24
+ import "../../chunk-W72BPGR3.js";
25
25
  import "../../chunk-QQ3S3P5P.js";
26
- import "../../chunk-L45X7DKX.js";
27
26
  import "../../chunk-7EOSDFS3.js";
28
27
  import "../../chunk-VY3IFGE3.js";
28
+ import "../../chunk-S7QRHUWO.js";
29
+ import "../../chunk-L45X7DKX.js";
29
30
  import "../../chunk-DJOGPSRU.js";
30
31
  import "../../chunk-4WQ36ZP7.js";
31
32
  import "../../chunk-GNF6KFQ7.js";
32
- import "../../chunk-S7QRHUWO.js";
33
33
  import "../../chunk-5GFACGSN.js";
34
34
  import "../../chunk-67P34WNW.js";
35
35
  import "../../chunk-4TZJZU2T.js";
@@ -2,22 +2,22 @@ import {
2
2
  ColorItemSchema,
3
3
  ColorSpaceSchema,
4
4
  brandGuideSectionDefs
5
- } from "../../chunk-FHTKSELX.js";
6
- import "../../chunk-YV3YSZEB.js";
7
- import "../../chunk-DIMDRBFK.js";
5
+ } from "../../chunk-LNQUUC2S.js";
8
6
  import "../../chunk-JR24U7FJ.js";
7
+ import "../../chunk-L7WTERU5.js";
9
8
  import "../../chunk-RIITGTV3.js";
9
+ import "../../chunk-DIMDRBFK.js";
10
10
  import "../../chunk-IIDKW7AV.js";
11
11
  import "../../chunk-HHNPSKPT.js";
12
12
  import "../../chunk-CDBURDPX.js";
13
13
  import "../../chunk-WDSVHKAH.js";
14
- import "../../chunk-L45X7DKX.js";
15
14
  import "../../chunk-XDEPXTBY.js";
16
15
  import "../../chunk-7EOSDFS3.js";
17
16
  import "../../chunk-VY3IFGE3.js";
17
+ import "../../chunk-S7QRHUWO.js";
18
+ import "../../chunk-L45X7DKX.js";
18
19
  import "../../chunk-DJOGPSRU.js";
19
20
  import "../../chunk-GNF6KFQ7.js";
20
- import "../../chunk-S7QRHUWO.js";
21
21
  import "../../chunk-5GFACGSN.js";
22
22
  import "../../chunk-67P34WNW.js";
23
23
  import "../../chunk-4TZJZU2T.js";
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  allSectionDefs
3
- } from "../../chunk-T26HAKW3.js";
4
- import "../../chunk-JXATNKLV.js";
5
- import "../../chunk-FHTKSELX.js";
6
- import "../../chunk-YV3YSZEB.js";
7
- import "../../chunk-DIMDRBFK.js";
8
- import "../../chunk-NX7TFHA4.js";
9
- import "../../chunk-JCDZAFX2.js";
10
- import "../../chunk-GGYY3JQJ.js";
3
+ } from "../../chunk-MSBHMY3C.js";
4
+ import "../../chunk-LNQUUC2S.js";
5
+ import "../../chunk-CEFFP3CH.js";
11
6
  import "../../chunk-JR24U7FJ.js";
7
+ import "../../chunk-HUOW3ZV2.js";
8
+ import "../../chunk-L7WTERU5.js";
12
9
  import "../../chunk-RIITGTV3.js";
10
+ import "../../chunk-JCDZAFX2.js";
11
+ import "../../chunk-DIMDRBFK.js";
12
+ import "../../chunk-GGYY3JQJ.js";
13
13
  import "../../chunk-IIDKW7AV.js";
14
14
  import "../../chunk-Y4JQGO6G.js";
15
15
  import "../../chunk-HHNPSKPT.js";
16
16
  import "../../chunk-CDBURDPX.js";
17
- import "../../chunk-WYOFQHKI.js";
18
- import "../../chunk-QQ3S3P5P.js";
19
17
  import "../../chunk-WDSVHKAH.js";
20
- import "../../chunk-L45X7DKX.js";
21
18
  import "../../chunk-XDEPXTBY.js";
19
+ import "../../chunk-W72BPGR3.js";
20
+ import "../../chunk-QQ3S3P5P.js";
22
21
  import "../../chunk-7EOSDFS3.js";
23
22
  import "../../chunk-VY3IFGE3.js";
23
+ import "../../chunk-S7QRHUWO.js";
24
+ import "../../chunk-L45X7DKX.js";
24
25
  import "../../chunk-DJOGPSRU.js";
25
26
  import "../../chunk-4WQ36ZP7.js";
26
27
  import "../../chunk-GNF6KFQ7.js";
27
- import "../../chunk-S7QRHUWO.js";
28
28
  import "../../chunk-5GFACGSN.js";
29
29
  import "../../chunk-DMCGN5AS.js";
30
30
  import "../../chunk-67P34WNW.js";
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  allSectionDefs
3
- } from "../../chunk-T26HAKW3.js";
4
- import "../../chunk-JXATNKLV.js";
5
- import "../../chunk-FHTKSELX.js";
6
- import "../../chunk-YV3YSZEB.js";
7
- import "../../chunk-DIMDRBFK.js";
8
- import "../../chunk-NX7TFHA4.js";
9
- import "../../chunk-JCDZAFX2.js";
10
- import "../../chunk-GGYY3JQJ.js";
3
+ } from "../../chunk-MSBHMY3C.js";
4
+ import "../../chunk-LNQUUC2S.js";
5
+ import "../../chunk-CEFFP3CH.js";
11
6
  import "../../chunk-JR24U7FJ.js";
7
+ import "../../chunk-HUOW3ZV2.js";
8
+ import "../../chunk-L7WTERU5.js";
12
9
  import "../../chunk-RIITGTV3.js";
10
+ import "../../chunk-JCDZAFX2.js";
11
+ import "../../chunk-DIMDRBFK.js";
12
+ import "../../chunk-GGYY3JQJ.js";
13
13
  import "../../chunk-IIDKW7AV.js";
14
14
  import "../../chunk-Y4JQGO6G.js";
15
15
  import "../../chunk-HHNPSKPT.js";
16
16
  import "../../chunk-CDBURDPX.js";
17
- import "../../chunk-WYOFQHKI.js";
18
- import "../../chunk-QQ3S3P5P.js";
19
17
  import "../../chunk-WDSVHKAH.js";
20
- import "../../chunk-L45X7DKX.js";
21
18
  import "../../chunk-XDEPXTBY.js";
19
+ import "../../chunk-W72BPGR3.js";
20
+ import "../../chunk-QQ3S3P5P.js";
22
21
  import "../../chunk-7EOSDFS3.js";
23
22
  import "../../chunk-VY3IFGE3.js";
23
+ import "../../chunk-S7QRHUWO.js";
24
+ import "../../chunk-L45X7DKX.js";
24
25
  import "../../chunk-DJOGPSRU.js";
25
26
  import "../../chunk-4WQ36ZP7.js";
26
27
  import "../../chunk-GNF6KFQ7.js";
27
- import "../../chunk-S7QRHUWO.js";
28
28
  import "../../chunk-5GFACGSN.js";
29
29
  import "../../chunk-DMCGN5AS.js";
30
30
  import "../../chunk-67P34WNW.js";
@@ -1,11 +1,17 @@
1
1
  import {
2
- computeReorderTarget
3
- } from "../chunk-DIMDRBFK.js";
2
+ DeckMediaProvider,
3
+ DeckSlideView,
4
+ DeckStage,
5
+ DeckTextEditProvider
6
+ } from "../chunk-TEOAKGZA.js";
4
7
  import {
5
8
  Popover,
6
9
  PopoverItem,
7
10
  Tooltip
8
11
  } from "../chunk-JCDZAFX2.js";
12
+ import {
13
+ computeReorderTarget
14
+ } from "../chunk-DIMDRBFK.js";
9
15
  import {
10
16
  Button
11
17
  } from "../chunk-GGYY3JQJ.js";
@@ -22,12 +28,6 @@ import {
22
28
  putDeckDraft,
23
29
  recordDeckPublish
24
30
  } from "../chunk-FV7JQRCN.js";
25
- import {
26
- DeckMediaProvider,
27
- DeckSlideView,
28
- DeckStage,
29
- DeckTextEditProvider
30
- } from "../chunk-TEOAKGZA.js";
31
31
  import {
32
32
  formatTimestamp
33
33
  } from "../chunk-MM7KZS5C.js";
package/dist/index.js CHANGED
@@ -84,32 +84,33 @@ import {
84
84
  import {
85
85
  formatTimestamp
86
86
  } from "./chunk-MM7KZS5C.js";
87
- import {
88
- generateNavLinks,
89
- resolveReference,
90
- toSectionId
91
- } from "./chunk-WYOFQHKI.js";
92
- import {
93
- ensureSanitizer,
94
- sanitizeHtml
95
- } from "./chunk-QQ3S3P5P.js";
96
87
  import {
97
88
  curatedIcons,
98
89
  getIcon
99
90
  } from "./chunk-WDSVHKAH.js";
100
- import "./chunk-L45X7DKX.js";
101
91
  import {
102
92
  createEvent,
103
93
  darkModeEvent,
104
94
  editModeEvent
105
95
  } from "./chunk-XDEPXTBY.js";
106
- import "./chunk-FRVO75DK.js";
96
+ import {
97
+ generateNavLinks,
98
+ resolveReference,
99
+ toSectionId
100
+ } from "./chunk-W72BPGR3.js";
101
+ import {
102
+ ensureSanitizer,
103
+ sanitizeHtml
104
+ } from "./chunk-QQ3S3P5P.js";
107
105
  import {
108
106
  cn
109
107
  } from "./chunk-7EOSDFS3.js";
110
108
  import {
111
109
  audiencePasses
112
110
  } from "./chunk-VY3IFGE3.js";
111
+ import "./chunk-S7QRHUWO.js";
112
+ import "./chunk-FRVO75DK.js";
113
+ import "./chunk-L45X7DKX.js";
113
114
  import {
114
115
  NAV,
115
116
  SIDECARS,
@@ -132,7 +133,6 @@ import {
132
133
  tagDisplayLabel
133
134
  } from "./chunk-4WQ36ZP7.js";
134
135
  import "./chunk-GNF6KFQ7.js";
135
- import "./chunk-S7QRHUWO.js";
136
136
  import {
137
137
  REFERENCE_TYPE
138
138
  } from "./chunk-5GFACGSN.js";
@@ -19,4 +19,12 @@ export declare function clearDocumentRefs(section: Section, ids: Set<string>): {
19
19
  changed: boolean;
20
20
  section: Section;
21
21
  };
22
+ /**
23
+ * The non-empty `documentId`s referenced by unvalidated section JSON, including
24
+ * ones nested in a container's children — `tallyDocumentIds` for a body that
25
+ * has not been through a schema, so every step is shape-checked. Walks by node
26
+ * type like the rest of this module, so an unrelated field called `doc` is
27
+ * never mistaken for a reference.
28
+ */
29
+ export declare function collectDocumentIds(value: unknown, out?: Set<string>): Set<string>;
22
30
  //# sourceMappingURL=document-refs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-refs.d.ts","sourceRoot":"","sources":["../../src/lib/document-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA4BnD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,EACnC,MAAM,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,GACtC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAUrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GACf;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAqBxC"}
1
+ {"version":3,"file":"document-refs.d.ts","sourceRoot":"","sources":["../../src/lib/document-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA4BnD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,EACnC,MAAM,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,GACtC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAUrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GACf;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAqBxC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAqB5F"}
@@ -0,0 +1,14 @@
1
+ import {
2
+ clearDocumentRefs,
3
+ collectDocumentIds,
4
+ tallyDocumentIds
5
+ } from "../chunk-DKZCHCV3.js";
6
+ import "../chunk-L45X7DKX.js";
7
+ import "../chunk-5GFACGSN.js";
8
+ import "../chunk-FTPETWXE.js";
9
+ import "../chunk-JSBRDJBE.js";
10
+ export {
11
+ clearDocumentRefs,
12
+ collectDocumentIds,
13
+ tallyDocumentIds
14
+ };