@stego-labs/engine 1.0.1 → 1.0.3

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 (117) hide show
  1. package/README.md +75 -63
  2. package/dist/stego-engine/src/collections/index.d.ts +2 -2
  3. package/dist/stego-engine/src/collections/index.d.ts.map +1 -1
  4. package/dist/stego-engine/src/collections/index.js +1 -1
  5. package/dist/stego-engine/src/collections/index.js.map +1 -1
  6. package/dist/stego-engine/src/collections/internal/grouping.d.ts.map +1 -1
  7. package/dist/stego-engine/src/collections/internal/grouping.js +1 -17
  8. package/dist/stego-engine/src/collections/internal/grouping.js.map +1 -1
  9. package/dist/stego-engine/src/collections/internal/sorting.d.ts +2 -1
  10. package/dist/stego-engine/src/collections/internal/sorting.d.ts.map +1 -1
  11. package/dist/stego-engine/src/collections/public/types.d.ts +1 -10
  12. package/dist/stego-engine/src/collections/public/types.d.ts.map +1 -1
  13. package/dist/stego-engine/src/compile/internal/load-content.d.ts +7 -0
  14. package/dist/stego-engine/src/compile/internal/load-content.d.ts.map +1 -0
  15. package/dist/stego-engine/src/compile/internal/load-content.js +151 -0
  16. package/dist/stego-engine/src/compile/internal/load-content.js.map +1 -0
  17. package/dist/stego-engine/src/compile/public/buildTemplateContext.d.ts.map +1 -1
  18. package/dist/stego-engine/src/compile/public/buildTemplateContext.js +5 -12
  19. package/dist/stego-engine/src/compile/public/buildTemplateContext.js.map +1 -1
  20. package/dist/stego-engine/src/compile/public/compileProject.js +2 -2
  21. package/dist/stego-engine/src/compile/public/compileProject.js.map +1 -1
  22. package/dist/stego-engine/src/compile/public/types.d.ts +4 -4
  23. package/dist/stego-engine/src/compile/public/types.d.ts.map +1 -1
  24. package/dist/stego-engine/src/index.d.ts +5 -3
  25. package/dist/stego-engine/src/index.d.ts.map +1 -1
  26. package/dist/stego-engine/src/index.js +2 -1
  27. package/dist/stego-engine/src/index.js.map +1 -1
  28. package/dist/stego-engine/src/ir/index.d.ts +3 -0
  29. package/dist/stego-engine/src/ir/index.d.ts.map +1 -1
  30. package/dist/stego-engine/src/ir/index.js +3 -0
  31. package/dist/stego-engine/src/ir/index.js.map +1 -1
  32. package/dist/stego-engine/src/ir/nodes/heading.d.ts +2 -2
  33. package/dist/stego-engine/src/ir/nodes/heading.d.ts.map +1 -1
  34. package/dist/stego-engine/src/ir/nodes/heading.js.map +1 -1
  35. package/dist/stego-engine/src/ir/nodes/keep-together.d.ts +3 -0
  36. package/dist/stego-engine/src/ir/nodes/keep-together.d.ts.map +1 -0
  37. package/dist/stego-engine/src/ir/nodes/keep-together.js +7 -0
  38. package/dist/stego-engine/src/ir/nodes/keep-together.js.map +1 -0
  39. package/dist/stego-engine/src/ir/nodes/link.d.ts +6 -0
  40. package/dist/stego-engine/src/ir/nodes/link.d.ts.map +1 -0
  41. package/dist/stego-engine/src/ir/nodes/link.js +10 -0
  42. package/dist/stego-engine/src/ir/nodes/link.js.map +1 -0
  43. package/dist/stego-engine/src/ir/nodes/markdown.d.ts +7 -1
  44. package/dist/stego-engine/src/ir/nodes/markdown.d.ts.map +1 -1
  45. package/dist/stego-engine/src/ir/nodes/markdown.js +3 -2
  46. package/dist/stego-engine/src/ir/nodes/markdown.js.map +1 -1
  47. package/dist/stego-engine/src/ir/nodes/paragraph.d.ts +2 -2
  48. package/dist/stego-engine/src/ir/nodes/paragraph.d.ts.map +1 -1
  49. package/dist/stego-engine/src/ir/nodes/paragraph.js.map +1 -1
  50. package/dist/stego-engine/src/ir/nodes/plain-text.d.ts +9 -0
  51. package/dist/stego-engine/src/ir/nodes/plain-text.d.ts.map +1 -0
  52. package/dist/stego-engine/src/ir/nodes/plain-text.js +8 -0
  53. package/dist/stego-engine/src/ir/nodes/plain-text.js.map +1 -0
  54. package/dist/stego-engine/src/ir/types.d.ts +28 -4
  55. package/dist/stego-engine/src/ir/types.d.ts.map +1 -1
  56. package/dist/stego-engine/src/render/internal/backends/pandoc/lower-to-render-plan.d.ts +2 -1
  57. package/dist/stego-engine/src/render/internal/backends/pandoc/lower-to-render-plan.d.ts.map +1 -1
  58. package/dist/stego-engine/src/render/internal/backends/pandoc/lower-to-render-plan.js +9 -3
  59. package/dist/stego-engine/src/render/internal/backends/pandoc/lower-to-render-plan.js.map +1 -1
  60. package/dist/stego-engine/src/render/internal/backends/pandoc/markdown-writer.d.ts +6 -1
  61. package/dist/stego-engine/src/render/internal/backends/pandoc/markdown-writer.d.ts.map +1 -1
  62. package/dist/stego-engine/src/render/internal/backends/pandoc/markdown-writer.js +198 -19
  63. package/dist/stego-engine/src/render/internal/backends/pandoc/markdown-writer.js.map +1 -1
  64. package/dist/stego-engine/src/render/public/renderDocument.js +1 -1
  65. package/dist/stego-engine/src/render/public/renderDocument.js.map +1 -1
  66. package/dist/stego-engine/src/render/public/types.d.ts +8 -0
  67. package/dist/stego-engine/src/render/public/types.d.ts.map +1 -1
  68. package/dist/stego-engine/src/template/index.d.ts +4 -2
  69. package/dist/stego-engine/src/template/index.d.ts.map +1 -1
  70. package/dist/stego-engine/src/template/index.js +1 -1
  71. package/dist/stego-engine/src/template/index.js.map +1 -1
  72. package/dist/stego-engine/src/template/internal/evaluate-template.d.ts +8 -1
  73. package/dist/stego-engine/src/template/internal/evaluate-template.d.ts.map +1 -1
  74. package/dist/stego-engine/src/template/internal/evaluate-template.js +158 -2
  75. package/dist/stego-engine/src/template/internal/evaluate-template.js.map +1 -1
  76. package/dist/stego-engine/src/template/internal/jsx-runtime.d.ts +2 -2
  77. package/dist/stego-engine/src/template/internal/jsx-runtime.d.ts.map +1 -1
  78. package/dist/stego-engine/src/template/internal/jsx-runtime.js.map +1 -1
  79. package/dist/stego-engine/src/template/internal/normalizeChildren.d.ts +2 -1
  80. package/dist/stego-engine/src/template/internal/normalizeChildren.d.ts.map +1 -1
  81. package/dist/stego-engine/src/template/internal/normalizeChildren.js +9 -0
  82. package/dist/stego-engine/src/template/internal/normalizeChildren.js.map +1 -1
  83. package/dist/stego-engine/src/template/public/authoring.d.ts +3 -1
  84. package/dist/stego-engine/src/template/public/authoring.d.ts.map +1 -1
  85. package/dist/stego-engine/src/template/public/components.d.ts +136 -17
  86. package/dist/stego-engine/src/template/public/components.d.ts.map +1 -1
  87. package/dist/stego-engine/src/template/public/components.js +46 -6
  88. package/dist/stego-engine/src/template/public/components.js.map +1 -1
  89. package/dist/stego-engine/src/template/public/context.d.ts +1 -1
  90. package/dist/stego-engine/src/template/public/context.d.ts.map +1 -1
  91. package/dist/stego-engine/src/template/public/defineTemplate.d.ts +6 -3
  92. package/dist/stego-engine/src/template/public/defineTemplate.d.ts.map +1 -1
  93. package/dist/stego-engine/src/template/public/defineTemplate.js +27 -2
  94. package/dist/stego-engine/src/template/public/defineTemplate.js.map +1 -1
  95. package/dist/stego-engine/src/template/public/types.d.ts +38 -29
  96. package/dist/stego-engine/src/template/public/types.d.ts.map +1 -1
  97. package/dist/stego-engine/src/test/index.d.ts +2 -0
  98. package/dist/stego-engine/src/test/index.d.ts.map +1 -0
  99. package/dist/stego-engine/src/test/index.js +2 -0
  100. package/dist/stego-engine/src/test/index.js.map +1 -0
  101. package/dist/stego-engine/src/test/template-generic-types.test.d.ts +2 -0
  102. package/dist/stego-engine/src/test/template-generic-types.test.d.ts.map +1 -0
  103. package/dist/stego-engine/src/test/template-generic-types.test.js +77 -0
  104. package/dist/stego-engine/src/test/template-generic-types.test.js.map +1 -0
  105. package/package.json +6 -2
  106. package/dist/stego-engine/src/collections/public/createCollection.d.ts +0 -3
  107. package/dist/stego-engine/src/collections/public/createCollection.d.ts.map +0 -1
  108. package/dist/stego-engine/src/collections/public/createCollection.js +0 -31
  109. package/dist/stego-engine/src/collections/public/createCollection.js.map +0 -1
  110. package/dist/stego-engine/src/compile/internal/load-manuscripts.d.ts +0 -3
  111. package/dist/stego-engine/src/compile/internal/load-manuscripts.d.ts.map +0 -1
  112. package/dist/stego-engine/src/compile/internal/load-manuscripts.js +0 -70
  113. package/dist/stego-engine/src/compile/internal/load-manuscripts.js.map +0 -1
  114. package/dist/stego-engine/src/compile/internal/load-spine.d.ts +0 -7
  115. package/dist/stego-engine/src/compile/internal/load-spine.d.ts.map +0 -1
  116. package/dist/stego-engine/src/compile/internal/load-spine.js +0 -92
  117. package/dist/stego-engine/src/compile/internal/load-spine.js.map +0 -1
package/README.md CHANGED
@@ -5,108 +5,120 @@
5
5
  It provides four public areas:
6
6
 
7
7
  - `ir`: the intermediate representation for Stego documents
8
- - `collections`: generic query/grouping helpers for template data
9
- - `template`: TSX-facing authoring API and template loading
8
+ - `template`: TSX-facing authoring API
10
9
  - `compile` and `render`: project loading, template evaluation, and Pandoc-oriented render planning
11
10
 
12
- Templates are plain TSX with normal JavaScript. They compose built-in `Stego.*` components and compile into Stego IR, which the render layer lowers into a Pandoc-oriented render plan.
11
+ Templates are plain TSX with normal JavaScript. They compile ordered leaves from `content/` into a manuscript.
13
12
 
14
- V1 intentionally does not expose backend-specific escape hatches, arbitrary CSS, or a plugin API.
13
+ Stego can emit compiled markdown, but that markdown should be treated as a debug and interchange artifact rather than a full-fidelity presentation target. Richer layout primitives are intended primarily for the DOCX/PDF/EPUB pipeline.
15
14
 
16
15
  ## Template basics
17
16
 
18
- Templates default-export `defineTemplate(...)` from a `.tsx` file:
19
-
20
17
  ```tsx
21
18
  import { defineTemplate, Stego } from "@stego-labs/engine";
22
19
 
23
20
  export default defineTemplate((ctx) => (
24
21
  <Stego.Document page={{ size: "6x9", margin: "0.75in" }}>
25
22
  <Stego.PageTemplate footer={{ right: <Stego.PageNumber /> }} />
26
- <Stego.Heading level={1}>
27
- {String(ctx.project.metadata.title ?? ctx.project.id)}
28
- </Stego.Heading>
29
- {ctx.collections.manuscripts.map((doc) => (
30
- <Stego.Markdown source={doc.body} />
23
+ <Stego.Heading level={1}>{String(ctx.project.metadata.title ?? ctx.project.id)}</Stego.Heading>
24
+ {ctx.content.map((leaf) => (
25
+ <Stego.Markdown leaf={leaf} />
31
26
  ))}
32
27
  </Stego.Document>
33
28
  ));
34
29
  ```
35
30
 
36
- Templates use normal JavaScript control flow inside TSX. There is no Stego-specific control-flow DSL in V1.
37
-
38
- For VS Code and TypeScript language-server support, put template files in a TS project with:
39
-
40
- ```json
41
- {
42
- "compilerOptions": {
43
- "target": "ES2022",
44
- "module": "NodeNext",
45
- "moduleResolution": "NodeNext",
46
- "strict": true,
47
- "noEmit": true,
48
- "types": ["node"],
49
- "jsx": "react-jsx",
50
- "jsxImportSource": "@stego-labs/engine"
51
- },
52
- "include": ["templates/**/*.tsx"]
53
- }
54
- ```
31
+ That default form keeps the full low-friction Stego API and works well for single-template projects.
55
32
 
56
- The TypeScript server also needs to be able to resolve `@stego-labs/engine`, either from `node_modules` or a local link during development.
33
+ ## Target-aware templates
57
34
 
58
- For block spacing, use `spaceBefore` / `spaceAfter`. For horizontally inset blocks such as custom pull quotes or blockquote-style wrappers, use `insetLeft` / `insetRight`. For fiction-style paragraph indentation, use `firstLineIndent` at the section or paragraph level.
35
+ Advanced template mode narrows the Stego API to the strict intersection of the presentation targets you declare:
59
36
 
60
37
  ```tsx
61
- function PullQuote(props: { children?: unknown }) {
62
- return (
63
- <Stego.Section insetLeft="24pt" insetRight="24pt" spaceBefore={18} spaceAfter={18}>
64
- <Stego.Paragraph align="center">{props.children}</Stego.Paragraph>
65
- </Stego.Section>
66
- );
67
- }
68
-
69
- function ChapterBody(props: { children?: unknown }) {
70
- return (
71
- <Stego.Section firstLineIndent="1.5em">
72
- {props.children}
73
- </Stego.Section>
74
- );
75
- }
38
+ import { defineTemplate, type TemplateContext } from "@stego-labs/engine";
39
+
40
+ type ProjectMeta = { title: string };
41
+ type LeafMeta = { id: string; chapter?: string };
42
+ type BranchMeta = { label?: string };
43
+
44
+ export default defineTemplate(
45
+ { targets: ["docx", "pdf"] as const },
46
+ (ctx: TemplateContext<ProjectMeta, LeafMeta, BranchMeta>, Stego) => (
47
+ <Stego.Document page={{ size: "6x9", margin: "0.75in" }}>
48
+ <Stego.PageTemplate footer={{ right: <Stego.PageNumber /> }} />
49
+ <Stego.Heading level={1}>{ctx.project.metadata.title}</Stego.Heading>
50
+ {ctx.content.map((leaf) => (
51
+ <Stego.Markdown leaf={leaf} />
52
+ ))}
53
+ </Stego.Document>
54
+ )
55
+ );
76
56
  ```
77
57
 
78
- ## Collections: `groupBy()` vs `splitBy()`
58
+ Target-aware templates are meant for advanced template mode and multiple templates per project. They are opt-in. The global `Stego` import stays broad for the default lane.
79
59
 
80
- `ctx.collections.*` exposes immutable collection helpers for ordered project content.
60
+ Markdown is a special-case export artifact. It is still useful for debug, diff, and interchange output, but it does not participate in the strict target-aware type contract the way `docx`, `pdf`, and `epub` do.
81
61
 
82
- Use `groupBy()` when you want bucketed groups by key, regardless of where matching items appear:
62
+ `ctx.content` is the full ordered array of leaves loaded from `content/`.
83
63
 
84
- ```ts
85
- const groups = ctx.collections.spineEntries.groupBy("category");
64
+ `ctx.branches` exposes the discovered branch tree for directories under `content/`. Every directory is a branch, and `_branch.md` enriches it with `label` and branch notes.
65
+
66
+ Built-in leaf renderers:
67
+
68
+ ```tsx
69
+ <Stego.Markdown source="# Inline markdown" />
70
+ <Stego.Markdown leaf={leaf} />
71
+ <Stego.PlainText source="Plain text body" />
72
+ <Stego.PlainText leaf={leaf} />
86
73
  ```
87
74
 
88
- Use `splitBy()` when you want contiguous groups in the current order:
75
+ Internal links target leaf ids by default:
89
76
 
90
- ```ts
91
- const chapters = ctx.collections.manuscripts.splitBy("chapter");
77
+ ```tsx
78
+ <Stego.Link leaf="CFG-TEMPLATES" />
79
+ <Stego.Link leaf="CFG-TEMPLATES" heading="Template Collections" />
80
+ <Stego.Link leaf="CFG-TEMPLATES">Custom label</Stego.Link>
92
81
  ```
93
82
 
94
- `splitBy()` preserves order and starts a new group each time the selected value changes. Repeated values later in the stream create a new group.
83
+ Default link text falls back through:
95
84
 
96
- Missing values inherit the current open group instead of breaking it, so only files that start a new boundary need to specify the boundary metadata.
85
+ 1. explicit children
86
+ 2. `leaf.metadata.label`
87
+ 3. `leaf.metadata.title`
88
+ 4. `leaf.titleFromFilename`
89
+ 5. `leaf.id`
97
90
 
98
- Example:
91
+ ## Helpers: `Stego.groupBy()` vs `Stego.splitBy()`
92
+
93
+ Use `groupBy()` when you want bucketed groups by key regardless of where items appear:
99
94
 
100
95
  ```ts
101
- ["1", "1", null, "2", "2", null, "1"]
96
+ const references = Stego.groupBy(
97
+ ctx.content.filter((leaf) => leaf.metadata.kind === "reference"),
98
+ (leaf) => typeof leaf.metadata.kind === "string" ? leaf.metadata.kind : undefined
99
+ );
102
100
  ```
103
101
 
104
- becomes:
102
+ Use `splitBy()` when you want contiguous groups in the current order:
105
103
 
106
104
  ```ts
107
- [["1", "1", null], ["2", "2", null], ["1"]]
105
+ const chapters = Stego.splitBy(
106
+ ctx.content,
107
+ (leaf) => typeof leaf.metadata.chapter === "string" ? leaf.metadata.chapter : undefined
108
+ );
108
109
  ```
109
110
 
110
- If the sequence starts with `undefined`, `null`, or blank values, those leading items form a leading ungrouped segment with `group.value === undefined`.
111
+ `Stego.splitBy()` preserves order and starts a new group each time the selected value changes. Missing values inherit the current open group, so only boundary leaves need the grouping metadata.
112
+
113
+ ## Layout primitives
114
+
115
+ Stego currently exposes portable layout controls such as:
116
+
117
+ - `spaceBefore` / `spaceAfter`
118
+ - `insetLeft` / `insetRight`
119
+ - `firstLineIndent`
120
+ - `align`
121
+ - `Stego.KeepTogether`
122
+ - `Stego.PageBreak`
111
123
 
112
- This makes `splitBy()` the right primitive for ordered document structure such as chapters, parts, or appendix sections.
124
+ These lower into the render plan and are supported across the main Stego targets, including DOCX.
@@ -1,3 +1,3 @@
1
- export { createCollection } from "./public/createCollection.ts";
2
- export type { Collection, Group, GroupSelector, SortSelector, SplitGroup } from "./public/types.ts";
1
+ export { groupItems as groupCollectionItems, splitItems as splitCollectionItems } from "./internal/grouping.ts";
2
+ export type { Group, GroupSelector, SplitGroup } from "./public/types.ts";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAChH,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,2 +1,2 @@
1
- export { createCollection } from "./public/createCollection.js";
1
+ export { groupItems as groupCollectionItems, splitItems as splitCollectionItems } from "./internal/grouping.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.d.ts","sourceRoot":"","sources":["../../../../../src/collections/internal/grouping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3E,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAkBhF;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CA4BrF;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,SAAS,CAW5F"}
1
+ {"version":3,"file":"grouping.d.ts","sourceRoot":"","sources":["../../../../../src/collections/internal/grouping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3E,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAkBhF;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CA4BrF;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,SAAS,CAS5F"}
@@ -43,27 +43,11 @@ export function splitItems(items, selector) {
43
43
  return groups;
44
44
  }
45
45
  export function resolveGroupValue(item, selector) {
46
- const raw = typeof selector === "function"
47
- ? selector(item)
48
- : resolveNamedValue(item, selector);
46
+ const raw = selector(item);
49
47
  if (raw == null) {
50
48
  return undefined;
51
49
  }
52
50
  const normalized = String(raw).trim();
53
51
  return normalized.length > 0 ? normalized : undefined;
54
52
  }
55
- function resolveNamedValue(item, key) {
56
- const ownValue = Reflect.get(item, key);
57
- if (typeof ownValue === "string" || typeof ownValue === "number") {
58
- return ownValue;
59
- }
60
- const metadata = Reflect.get(item, "metadata");
61
- if (metadata && typeof metadata === "object" && !Array.isArray(metadata)) {
62
- const metadataValue = Reflect.get(metadata, key);
63
- if (typeof metadataValue === "string" || typeof metadataValue === "number") {
64
- return metadataValue;
65
- }
66
- }
67
- return undefined;
68
- }
69
53
  //# sourceMappingURL=grouping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grouping.js","sourceRoot":"","sources":["../../../../../src/collections/internal/grouping.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAI,KAAU,EAAE,QAA0B;IAClE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5D,GAAG,EAAE,KAAK;QACV,KAAK;QACL,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;KACvB,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAI,KAAU,EAAE,QAA0B;IAClE,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,IAAI,WAA+B,CAAC;IAEpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ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,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC"}
@@ -1,3 +1,4 @@
1
- import type { SortSelector } from "../public/types.ts";
1
+ type SortSelector<T> = keyof T | ((item: T) => string | number | undefined);
2
2
  export declare function sortItems<T>(items: T[], selector: SortSelector<T>): T[];
3
+ export {};
3
4
  //# sourceMappingURL=sorting.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../../../../src/collections/internal/sorting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAIvE"}
1
+ {"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../../../../src/collections/internal/sorting.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAE5E,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAIvE"}
@@ -10,14 +10,5 @@ export type SplitGroup<T> = {
10
10
  items: T[];
11
11
  first: T;
12
12
  };
13
- export type GroupSelector<T> = string | ((item: T) => string | undefined);
14
- export type SortSelector<T> = keyof T | ((item: T) => string | number | undefined);
15
- export type Collection<T> = {
16
- all(): T[];
17
- where(predicate: (item: T) => boolean): Collection<T>;
18
- sortBy(selector: SortSelector<T>): Collection<T>;
19
- groupBy(selector: GroupSelector<T>): Group<T>[];
20
- splitBy(selector: GroupSelector<T>): SplitGroup<T>[];
21
- map<U>(mapper: (item: T) => U): U[];
22
- };
13
+ export type GroupSelector<T> = (item: T) => string | undefined;
23
14
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/collections/public/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;AAC1E,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAEnF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,GAAG,IAAI,CAAC,EAAE,CAAC;IACX,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;CACrC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/collections/public/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { BranchRecord, LeafRecord } from "../../template/index.ts";
2
+ export type ContentGraph = {
3
+ leaves: LeafRecord[];
4
+ branches: BranchRecord[];
5
+ };
6
+ export declare function loadContentGraph(projectRoot: string, contentDir: string, projectMeta: Record<string, unknown>): ContentGraph;
7
+ //# sourceMappingURL=load-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-content.d.ts","sourceRoot":"","sources":["../../../../../src/compile/internal/load-content.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAExE,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,YAAY,CAiBd"}
@@ -0,0 +1,151 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { BRANCH_FILENAME, buildBranchKey, buildBranchLabel, buildBranchName, buildBranchParentKey, collectLeafHeadingTargets, inferLeafFormat, isBranchFile, isSupportedLeafContentFile, isValidLeafId, parseBranchDocument } from "@stego-labs/shared/domain/content";
4
+ import { parseMarkdownDocument } from "@stego-labs/shared/domain/frontmatter";
5
+ import { parseCommentAppendix } from "@stego-labs/shared/domain/comments";
6
+ import { rewriteMarkdownImagesForChapter } from "@stego-labs/shared/domain/images";
7
+ export function loadContentGraph(projectRoot, contentDir, projectMeta) {
8
+ if (!fs.existsSync(contentDir)) {
9
+ return {
10
+ leaves: [],
11
+ branches: [createImplicitBranch(projectRoot, contentDir, contentDir)]
12
+ };
13
+ }
14
+ const leaves = [];
15
+ const branches = [];
16
+ collectDirectory(contentDir, projectRoot, contentDir, projectMeta, leaves, branches);
17
+ validateLeafIds(leaves);
18
+ return {
19
+ leaves: leaves.sort((a, b) => compareOrders(a.order, b.order) || a.relativePath.localeCompare(b.relativePath)),
20
+ branches: branches.sort((a, b) => a.depth - b.depth || a.key.localeCompare(b.key))
21
+ };
22
+ }
23
+ function collectDirectory(dirPath, projectRoot, contentRoot, projectMeta, leaves, branches) {
24
+ const branch = loadBranch(projectRoot, contentRoot, dirPath);
25
+ branches.push(branch);
26
+ const entries = fs.readdirSync(dirPath, { withFileTypes: true })
27
+ .sort((a, b) => a.name.localeCompare(b.name));
28
+ for (const entry of entries) {
29
+ const fullPath = path.join(dirPath, entry.name);
30
+ if (entry.isDirectory()) {
31
+ collectDirectory(fullPath, projectRoot, contentRoot, projectMeta, leaves, branches);
32
+ continue;
33
+ }
34
+ if (!entry.isFile() || isBranchFile(fullPath) || !isSupportedLeafContentFile(fullPath)) {
35
+ continue;
36
+ }
37
+ leaves.push(loadLeaf(projectRoot, fullPath, projectMeta));
38
+ }
39
+ }
40
+ function loadBranch(projectRoot, contentRoot, dirPath) {
41
+ const branchFilePath = path.join(dirPath, BRANCH_FILENAME);
42
+ const relativeDir = path.relative(projectRoot, dirPath).split(path.sep).join("/");
43
+ const key = buildBranchKey(contentRoot, dirPath);
44
+ const parentKey = buildBranchParentKey(key);
45
+ const depth = key ? key.split("/").length : 0;
46
+ const name = key ? buildBranchName(dirPath) : "content";
47
+ if (!fs.existsSync(branchFilePath)) {
48
+ return createImplicitBranch(projectRoot, contentRoot, dirPath);
49
+ }
50
+ const raw = fs.readFileSync(branchFilePath, "utf8");
51
+ const parsed = parseBranchDocument(raw, path.relative(projectRoot, branchFilePath));
52
+ return {
53
+ kind: "branch",
54
+ key,
55
+ name,
56
+ label: buildBranchLabel(name, parsed.metadata.label),
57
+ parentKey,
58
+ depth,
59
+ relativeDir,
60
+ path: branchFilePath,
61
+ relativePath: path.relative(projectRoot, branchFilePath).split(path.sep).join("/"),
62
+ metadata: parsed.metadata,
63
+ body: parsed.body || undefined
64
+ };
65
+ }
66
+ function createImplicitBranch(projectRoot, contentRoot, dirPath) {
67
+ const key = buildBranchKey(contentRoot, dirPath);
68
+ const name = key ? buildBranchName(dirPath) : "content";
69
+ return {
70
+ kind: "branch",
71
+ key,
72
+ name,
73
+ label: key ? buildBranchLabel(name) : "Content",
74
+ parentKey: buildBranchParentKey(key),
75
+ depth: key ? key.split("/").length : 0,
76
+ relativeDir: path.relative(projectRoot, dirPath).split(path.sep).join("/"),
77
+ metadata: {}
78
+ };
79
+ }
80
+ function validateLeafIds(leaves) {
81
+ const seenIds = new Set();
82
+ for (const leaf of leaves) {
83
+ if (!leaf.id) {
84
+ throw new Error(`Leaf '${leaf.relativePath}' is missing required frontmatter id.`);
85
+ }
86
+ if (!isValidLeafId(leaf.id)) {
87
+ throw new Error(`Leaf '${leaf.relativePath}' has invalid id '${leaf.id}'. Use token-style ids like CFG-TEMPLATES.`);
88
+ }
89
+ if (seenIds.has(leaf.id)) {
90
+ throw new Error(`Duplicate leaf id '${leaf.id}' found at '${leaf.relativePath}'.`);
91
+ }
92
+ seenIds.add(leaf.id);
93
+ }
94
+ }
95
+ function loadLeaf(projectRoot, filePath, projectMeta) {
96
+ const raw = fs.readFileSync(filePath, "utf8");
97
+ const parsed = parseMarkdownDocument(raw);
98
+ const withoutComments = parseCommentAppendix(parsed.body).contentWithoutComments;
99
+ const relativePath = path.relative(projectRoot, filePath).split(path.sep).join("/");
100
+ const basename = path.basename(filePath).replace(/\.(md|markdown|txt|text)$/i, "");
101
+ const format = inferLeafFormat(filePath);
102
+ const body = format === "markdown"
103
+ ? rewriteMarkdownImagesForChapter({
104
+ body: withoutComments.trim(),
105
+ chapterPath: filePath,
106
+ projectRoot,
107
+ projectMeta,
108
+ frontmatter: parsed.frontmatter
109
+ })
110
+ : withoutComments.trim();
111
+ const id = typeof parsed.frontmatter.id === "string" ? parsed.frontmatter.id.trim() : "";
112
+ return {
113
+ kind: "leaf",
114
+ id,
115
+ format,
116
+ path: filePath,
117
+ relativePath,
118
+ titleFromFilename: toTitleFromFilename(basename),
119
+ metadata: {
120
+ ...parsed.frontmatter,
121
+ id
122
+ },
123
+ body,
124
+ order: parseOrder(path.basename(filePath)),
125
+ headings: format === "markdown" ? collectLeafHeadingTargets(body, id) : []
126
+ };
127
+ }
128
+ function parseOrder(basename) {
129
+ const match = basename.match(/^(\d+)[-_]/);
130
+ return match ? Number(match[1]) : null;
131
+ }
132
+ function compareOrders(a, b) {
133
+ if (a == null && b == null) {
134
+ return 0;
135
+ }
136
+ if (a == null) {
137
+ return 1;
138
+ }
139
+ if (b == null) {
140
+ return -1;
141
+ }
142
+ return a - b;
143
+ }
144
+ function toTitleFromFilename(value) {
145
+ const normalized = value.replace(/^\d+[-_]?/, "").replace(/[-_]+/g, " ").trim();
146
+ if (!normalized) {
147
+ return value;
148
+ }
149
+ return normalized.replace(/\b\w/g, (letter) => letter.toUpperCase());
150
+ }
151
+ //# sourceMappingURL=load-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-content.js","sourceRoot":"","sources":["../../../../../src/compile/internal/load-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,YAAY,EACZ,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAQnF,MAAM,UAAU,gBAAgB,CAC9B,WAAmB,EACnB,UAAkB,EAClB,WAAoC;IAEpC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO;YACL,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,CAAC,oBAAoB,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;SACtE,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,gBAAgB,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrF,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,E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C;IACX,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAChF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildTemplateContext.d.ts","sourceRoot":"","sources":["../../../../../src/compile/public/buildTemplateContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAK5D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,eAAe,CAetF"}
1
+ {"version":3,"file":"buildTemplateContext.d.ts","sourceRoot":"","sources":["../../../../../src/compile/public/buildTemplateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAI5D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,eAAe,CAUtF"}
@@ -1,21 +1,14 @@
1
1
  import path from "node:path";
2
- import { createCollection } from "../../collections/index.js";
3
- import { loadManuscripts } from "../internal/load-manuscripts.js";
2
+ import { loadContentGraph } from "../internal/load-content.js";
4
3
  import { loadProject } from "../internal/load-project.js";
5
- import { loadSpine } from "../internal/load-spine.js";
6
4
  export function buildTemplateContext(input) {
7
- const manuscriptDir = input.manuscriptDir ?? path.join(input.projectRoot, "manuscript");
8
- const spineDir = input.spineDir ?? path.join(input.projectRoot, "spine");
5
+ const contentDir = input.contentDir ?? path.join(input.projectRoot, "content");
9
6
  const project = loadProject(input.projectRoot);
10
- const manuscripts = loadManuscripts(input.projectRoot, manuscriptDir, project.metadata);
11
- const spine = loadSpine(input.projectRoot, spineDir);
7
+ const graph = loadContentGraph(input.projectRoot, contentDir, project.metadata);
12
8
  return {
13
9
  project,
14
- collections: {
15
- manuscripts: createCollection(manuscripts),
16
- spineEntries: createCollection(spine.entries),
17
- spineCategories: createCollection(spine.categories)
18
- }
10
+ content: graph.leaves,
11
+ branches: graph.branches
19
12
  };
20
13
  }
21
14
  //# sourceMappingURL=buildTemplateContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildTemplateContext.js","sourceRoot":"","sources":["../../../../../src/compile/public/buildTemplateContext.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IACnE,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACxF,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAErD,OAAO;QACL,OAAO;QACP,WAAW,EAAE;YACX,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC;YAC1C,YAAY,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;YAC7C,eAAe,EAAE,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;SACpD;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"buildTemplateContext.js","sourceRoot":"","sources":["../../../../../src/compile/public/buildTemplateContext.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IACnE,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/E,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEhF,OAAO;QACL,OAAO;QACP,OAAO,EAAE,KAAK,CAAC,MAAM;QACrB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;AACJ,CAAC"}
@@ -7,8 +7,7 @@ export async function compileProject(input) {
7
7
  const templatePath = resolveTemplatePath(projectRoot, input.templatePath);
8
8
  const context = buildTemplateContext({
9
9
  projectRoot,
10
- manuscriptDir: input.manuscriptDir,
11
- spineDir: input.spineDir
10
+ contentDir: input.contentDir
12
11
  });
13
12
  const loaded = await loadTemplateFromFile(templatePath);
14
13
  try {
@@ -16,6 +15,7 @@ export async function compileProject(input) {
16
15
  return {
17
16
  projectRoot,
18
17
  templatePath,
18
+ declaredTargets: loaded.template.targets,
19
19
  context,
20
20
  document
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"compileProject.js","sourceRoot":"","sources":["../../../../../src/compile/public/compileProject.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA0B;IAC7D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,mBAAmB,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,oBAAoB,CAAC;QACnC,WAAW;QACX,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACxD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5D,OAAO;YACL,WAAW;YACX,YAAY;YACZ,OAAO;YACP,QAAQ;SACT,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"compileProject.js","sourceRoot":"","sources":["../../../../../src/compile/public/compileProject.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA0B;IAC7D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,mBAAmB,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,oBAAoB,CAAC;QACnC,WAAW;QACX,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACxD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5D,OAAO;YACL,WAAW;YACX,YAAY;YACZ,eAAe,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO;YACxC,OAAO;YACP,QAAQ;SACT,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -1,20 +1,20 @@
1
1
  import type { StegoDocumentNode } from "../../ir/index.ts";
2
2
  import type { TemplateContext } from "../../template/index.ts";
3
+ import type { PresentationTarget } from "@stego-labs/shared/domain/templates";
3
4
  export type CompileProjectInput = {
4
5
  projectRoot: string;
5
- manuscriptDir?: string;
6
- spineDir?: string;
6
+ contentDir?: string;
7
7
  templatePath?: string;
8
8
  };
9
9
  export type CompileProjectResult = {
10
10
  projectRoot: string;
11
11
  templatePath: string;
12
+ declaredTargets: readonly PresentationTarget[] | null;
12
13
  document: StegoDocumentNode;
13
14
  context: TemplateContext;
14
15
  };
15
16
  export type BuildTemplateContextInput = {
16
17
  projectRoot: string;
17
- manuscriptDir?: string;
18
- spineDir?: string;
18
+ contentDir?: string;
19
19
  };
20
20
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/compile/public/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/compile/public/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACtD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -1,10 +1,12 @@
1
1
  export * from "./ir/index.ts";
2
- export { createCollection } from "./collections/index.ts";
3
- export type { Collection, Group, GroupSelector, SortSelector, SplitGroup } from "./collections/index.ts";
2
+ export type { Group, GroupSelector, SplitGroup } from "./collections/index.ts";
4
3
  export { defineTemplate, Stego } from "./template/index.ts";
5
- export type { ManuscriptRecord, SpineEntryRecord, SpineCategoryRecord, TemplateContext, StegoTemplate } from "./template/index.ts";
4
+ export { TemplateContractError } from "./template/index.ts";
5
+ export { evaluateTemplate, loadTemplateFromFile } from "./template/index.ts";
6
+ export type { ProjectMetadata, LeafMetadata, BranchMetadata, ProjectRecord, LeafRecord, BranchRecord, TemplateContext, StegoTemplate, TemplateDefinitionOptions, StegoApi } from "./template/index.ts";
6
7
  export { compileProject, buildTemplateContext } from "./compile/index.ts";
7
8
  export type { CompileProjectInput, CompileProjectResult, BuildTemplateContextInput } from "./compile/index.ts";
8
9
  export { renderDocument } from "./render/index.ts";
9
10
  export type { RenderDocumentInput, RenderDocumentResult } from "./render/index.ts";
11
+ export type { ExportTarget, PresentationTarget } from "@stego-labs/shared/domain/templates";
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"A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AE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACnF,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export * from "./ir/index.js";
2
- export { createCollection } from "./collections/index.js";
3
2
  export { defineTemplate, Stego } from "./template/index.js";
3
+ export { TemplateContractError } from "./template/index.js";
4
+ export { evaluateTemplate, loadTemplateFromFile } from "./template/index.js";
4
5
  export { compileProject, buildTemplateContext } from "./compile/index.js";
5
6
  export { renderDocument } from "./render/index.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAQ5D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAa7E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}