@refrakt-md/runes 0.38.0 → 0.40.0

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 (106) hide show
  1. package/dist/attribute-presets.d.ts +3 -2
  2. package/dist/attribute-presets.d.ts.map +1 -1
  3. package/dist/attribute-presets.js +2 -1
  4. package/dist/attribute-presets.js.map +1 -1
  5. package/dist/collection-helpers.d.ts +21 -2
  6. package/dist/collection-helpers.d.ts.map +1 -1
  7. package/dist/collection-helpers.js +72 -15
  8. package/dist/collection-helpers.js.map +1 -1
  9. package/dist/composed-rune.d.ts +59 -0
  10. package/dist/composed-rune.d.ts.map +1 -0
  11. package/dist/composed-rune.js +129 -0
  12. package/dist/composed-rune.js.map +1 -0
  13. package/dist/config.d.ts.map +1 -1
  14. package/dist/config.js +73 -40
  15. package/dist/config.js.map +1 -1
  16. package/dist/data-pipeline.d.ts +24 -10
  17. package/dist/data-pipeline.d.ts.map +1 -1
  18. package/dist/data-pipeline.js +34 -56
  19. package/dist/data-pipeline.js.map +1 -1
  20. package/dist/file-ref-resolve.js +9 -13
  21. package/dist/file-ref-resolve.js.map +1 -1
  22. package/dist/index.d.ts +14 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +19 -5
  25. package/dist/index.js.map +1 -1
  26. package/dist/lib/composition.d.ts +152 -0
  27. package/dist/lib/composition.d.ts.map +1 -0
  28. package/dist/lib/composition.js +1120 -0
  29. package/dist/lib/composition.js.map +1 -0
  30. package/dist/lib/index.d.ts +63 -4
  31. package/dist/lib/index.d.ts.map +1 -1
  32. package/dist/lib/index.js +137 -8
  33. package/dist/lib/index.js.map +1 -1
  34. package/dist/lib/preprocess.d.ts +64 -0
  35. package/dist/lib/preprocess.d.ts.map +1 -0
  36. package/dist/lib/preprocess.js +72 -0
  37. package/dist/lib/preprocess.js.map +1 -0
  38. package/dist/lib/registers.d.ts +132 -0
  39. package/dist/lib/registers.d.ts.map +1 -0
  40. package/dist/lib/registers.js +329 -0
  41. package/dist/lib/registers.js.map +1 -0
  42. package/dist/lib/resolver.d.ts +21 -1
  43. package/dist/lib/resolver.d.ts.map +1 -1
  44. package/dist/lib/resolver.js +41 -18
  45. package/dist/lib/resolver.js.map +1 -1
  46. package/dist/lib/schema-side-table.d.ts +26 -0
  47. package/dist/lib/schema-side-table.d.ts.map +1 -0
  48. package/dist/lib/schema-side-table.js +34 -0
  49. package/dist/lib/schema-side-table.js.map +1 -0
  50. package/dist/lib/schema-table.d.ts +59 -9
  51. package/dist/lib/schema-table.d.ts.map +1 -1
  52. package/dist/lib/schema-table.js +158 -22
  53. package/dist/lib/schema-table.js.map +1 -1
  54. package/dist/lib/slot-markers.d.ts +38 -0
  55. package/dist/lib/slot-markers.d.ts.map +1 -0
  56. package/dist/lib/slot-markers.js +105 -0
  57. package/dist/lib/slot-markers.js.map +1 -0
  58. package/dist/lib/slots.d.ts +99 -0
  59. package/dist/lib/slots.d.ts.map +1 -0
  60. package/dist/lib/slots.js +448 -0
  61. package/dist/lib/slots.js.map +1 -0
  62. package/dist/plugins.d.ts +3 -0
  63. package/dist/plugins.d.ts.map +1 -1
  64. package/dist/plugins.js +53 -4
  65. package/dist/plugins.js.map +1 -1
  66. package/dist/reference.d.ts +18 -0
  67. package/dist/reference.d.ts.map +1 -1
  68. package/dist/reference.js +34 -1
  69. package/dist/reference.js.map +1 -1
  70. package/dist/registers-pipeline.d.ts +51 -0
  71. package/dist/registers-pipeline.d.ts.map +1 -0
  72. package/dist/registers-pipeline.js +224 -0
  73. package/dist/registers-pipeline.js.map +1 -0
  74. package/dist/schema-row.d.ts +5 -0
  75. package/dist/schema-row.d.ts.map +1 -1
  76. package/dist/schema-row.js +1 -0
  77. package/dist/schema-row.js.map +1 -1
  78. package/dist/tags/data.d.ts +2 -2
  79. package/dist/tags/data.d.ts.map +1 -1
  80. package/dist/tags/data.js +6 -4
  81. package/dist/tags/data.js.map +1 -1
  82. package/dist/tags/figure.d.ts +10 -4
  83. package/dist/tags/figure.d.ts.map +1 -1
  84. package/dist/tags/figure.js +65 -20
  85. package/dist/tags/figure.js.map +1 -1
  86. package/dist/tags/include.d.ts +51 -7
  87. package/dist/tags/include.d.ts.map +1 -1
  88. package/dist/tags/include.js +216 -7
  89. package/dist/tags/include.js.map +1 -1
  90. package/dist/tags/sandbox.d.ts.map +1 -1
  91. package/dist/tags/sandbox.js +13 -3
  92. package/dist/tags/sandbox.js.map +1 -1
  93. package/dist/tags/snippet.d.ts +9 -10
  94. package/dist/tags/snippet.d.ts.map +1 -1
  95. package/dist/tags/snippet.js +213 -10
  96. package/dist/tags/snippet.js.map +1 -1
  97. package/dist/universal-attributes.d.ts +1 -1
  98. package/package.json +3 -3
  99. package/dist/include-pipeline.d.ts +0 -52
  100. package/dist/include-pipeline.d.ts.map +0 -1
  101. package/dist/include-pipeline.js +0 -206
  102. package/dist/include-pipeline.js.map +0 -1
  103. package/dist/snippet-pipeline.d.ts +0 -44
  104. package/dist/snippet-pipeline.d.ts.map +0 -1
  105. package/dist/snippet-pipeline.js +0 -307
  106. package/dist/snippet-pipeline.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registers-pipeline.js","sourceRoot":"","sources":["../src/registers-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAQvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,GAIZ,MAAM,oBAAoB,CAAC;AA0B5B;8EAC8E;AAC9E,MAAM,UAAU,oBAAoB,CACnC,KAAoF;IAEpF,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,oEAAoE;QACpE,8DAA8D;QAC9D,MAAM,MAAM,GACX,OAAO,KAAK,CAAC,QAAQ,K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QAAQ,EAAE,GAAG,CAAC,CAAC;YACtC,CAAC;YACF,CAAC,CAAC,OAAO,CAAC,SAAS;KACpB,CAAC;AACH,CAAC"}
@@ -42,6 +42,11 @@ export interface ResolvedSchemaRow {
42
42
  type?: string;
43
43
  /** The attribute a multi-row table selects on, if any. */
44
44
  by?: string;
45
+ /**
46
+ * The field-bag entry a content-dependent table selects on, if any. The row
47
+ * described is the fallback; the content can select another.
48
+ */
49
+ byField?: string;
45
50
  /** The attribute value this row was selected for, if any. */
46
51
  selectedFor?: string;
47
52
  /** Every property mapping, parent and nested. */
@@ -1 +1 @@
1
- {"version":3,"file":"schema-row.d.ts","sourceRoot":"","sources":["../src/schema-row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAE/E;;;;;;;;;;;;;GAaG;AAEH,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IACjC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IACxC,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IACjC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,gEAAgE;IAChE,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAA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K,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAOnC"}
@@ -42,6 +42,7 @@ export function describeSchemaRow(table, attrs = {}) {
42
42
  return {
43
43
  type: row.type,
44
44
  by: table.by,
45
+ ...(table.byField !== undefined ? { byField: table.byField } : {}),
45
46
  selectedFor: selected,
46
47
  properties,
47
48
  entities,
@@ -1 +1 @@
1
- {"version":3,"file":"schema-row.js","sourceRoot":"","sources":["../src/schema-row.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA2DlD,qDAAqD;AACrD,MAAM,UAAU,QAAQ,CAAC,IAAyB;IACjD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC;AAED,SAAS,aAAa,CACrB,IAAY,EACZ,MAAiB,EACjB,IAAyB,EACzB,KAAe;IAEf,KAAK,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,KAAK,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE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IACtD,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
@@ -6,8 +6,8 @@
6
6
  * Like `snippet`, `data` is implemented as an **AST preprocessor**: every
7
7
  * `{% data %}` tag is resolved (read through the SPEC-113 `ProjectFiles` seam,
8
8
  * adapted, projected, typed) and replaced with a `table` AST node before the
9
- * schema-driven transform runs (see `corePipelineHooks.preprocess` in
10
- * `../config.ts`). By the time the transform reaches the AST, no `data` tags
9
+ * schema-driven transform runs — its `preprocess` hook, `preprocessDataTag` in
10
+ * `../data-pipeline.ts`, dispatched by the tree-order walk (SPEC-141). By the time the transform reaches the AST, no `data` tags
11
11
  * remain — so this schema's `transform` is **unreachable in normal operation**.
12
12
  *
13
13
  * The schema still exists for tooling: `refrakt inspect data`, the contracts
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/tags/data.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,mCA+Gf,CAAC"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/tags/data.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,mCAgHf,CAAC"}
package/dist/tags/data.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createContentModelSchema } from '../lib/index.js';
2
+ import { preprocessDataTag } from '../data-pipeline.js';
2
3
  /**
3
4
  * The `data` rune — ingest an external tabular source (CSV/TSV/JSON/NDJSON) and
4
5
  * emit a Markdoc `table` node that `chart` and `datatable` consume unchanged
@@ -7,8 +8,8 @@ import { createContentModelSchema } from '../lib/index.js';
7
8
  * Like `snippet`, `data` is implemented as an **AST preprocessor**: every
8
9
  * `{% data %}` tag is resolved (read through the SPEC-113 `ProjectFiles` seam,
9
10
  * adapted, projected, typed) and replaced with a `table` AST node before the
10
- * schema-driven transform runs (see `corePipelineHooks.preprocess` in
11
- * `../config.ts`). By the time the transform reaches the AST, no `data` tags
11
+ * schema-driven transform runs — its `preprocess` hook, `preprocessDataTag` in
12
+ * `../data-pipeline.ts`, dispatched by the tree-order walk (SPEC-141). By the time the transform reaches the AST, no `data` tags
12
13
  * remain — so this schema's `transform` is **unreachable in normal operation**.
13
14
  *
14
15
  * The schema still exists for tooling: `refrakt inspect data`, the contracts
@@ -98,11 +99,12 @@ export const data = createContentModelSchema({
98
99
  // row with `$row` bound, in place of the `<table>` the bodyless form emits.
99
100
  // With `headers` set it is instead one `---`-delimited table *row* (WORK-550).
100
101
  // The content model stays empty because the body never reaches the transform
101
- // — `preprocessData` binds and splices it at parse time — but it must be
102
+ // — the `preprocess` hook binds and splices it at parse time — but it must be
102
103
  // *allowed* here or Markdoc rejects the tag before the preprocessor sees it.
103
104
  contentModel: { type: 'sequence', fields: [] },
105
+ preprocess: preprocessDataTag,
104
106
  transform(_resolved, _attrs) {
105
- // Unreachable in normal operation — corePipelineHooks.preprocess replaces
107
+ // Unreachable in normal operation — the `preprocess` hook replaces
106
108
  // `data` tags with `table` nodes before the transform runs.
107
109
  //
108
110
  // For a *content* author there is exactly one way to get here, and it is
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/tags/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,wBAAwB,CAAC;IAC5C,UAAU,EAAE;QACX,QAAQ;QACR,GAAG,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,oEAAoE;SACjF;QACD,MAAM,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;YACzC,WAAW,EAAE,0EAA0E;SACvF;QACD,aAAa;QACb,SAAS,EAA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,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,wEAAwE;SACrF;QACD,IAAI,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,kDAAkD;SAC/D;KACD;IACD,4EAA4E;IAC5E,4EAA4E;IAC5E,+EAA+E;IAC/E,6EAA6E;IAC7E,8EAA8E;IAC9E,6EAA6E;IAC7E,YAAY,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;IAC9C,UAAU,EAAE,iBAAiB;IAC7B,SAAS,CAAC,SAAS,EAAE,MAAM;QAC1B,mEAAmE;QACnE,4DAA4D;QAC5D,EAAE;QACF,yEAAyE;QACzE,qEAAqE;QACrE,qEAAqE;QACrE,wEAAwE;QACxE,yEAAyE;QACzE,uEAAuE;QACvE,MAAM,IAAI,KAAK,CACd,wDAAwD;YACvD,2EAA2E;YAC3E,+EAA+E;YAC/E,iFAAiF;YACjF,6EAA6E;YAC7E,+EAA+E;YAC/E,oDAAoD;YACpD,gFAAgF;YAChF,2EAA2E;YAC3E,+BAA+B,CAChC,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -4,10 +4,16 @@ export declare const figureSections: {
4
4
  };
5
5
  export declare const figureFrameTarget: "self";
6
6
  export declare const figureSchema: {
7
- readonly type: "ImageObject";
8
- readonly properties: {
9
- readonly image: "contentUrl";
10
- readonly caption: "caption";
7
+ readonly byField: "body";
8
+ readonly rows: {
9
+ readonly mixed: {};
10
+ };
11
+ readonly fallback: {
12
+ readonly type: "ImageObject";
13
+ readonly properties: {
14
+ readonly image: "contentUrl";
15
+ readonly caption: "caption";
16
+ };
11
17
  };
12
18
  };
13
19
  export declare const figure: Markdoc.Schema;
@@ -1 +1 @@
1
- {"version":3,"file":"figure.d.ts","sourceRoot":"","sources":["../../src/tags/figure.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAgBvC,eAAO,MAAM,cAAc;;CAAsC,CAAC;AAClE,eAAO,MAAM,iBAAiB,EAAG,MAAe,CAAC;AAOjD,eAAO,MAAM,YAAY;;;;;;CAGf,CAAC;AAEX,eAAO,MAAM,MAAM,gBAwEjB,CAAC"}
1
+ {"version":3,"file":"figure.d.ts","sourceRoot":"","sources":["../../src/tags/figure.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAgBvC,eAAO,MAAM,cAAc;;CAAsC,CAAC;AAClE,eAAO,MAAM,iBAAiB,EAAG,MAAe,CAAC;AAiBjD,eAAO,MAAM,YAAY;;;;;;;;;;;;CAOf,CAAC;AAEX,eAAO,MAAM,MAAM,gBAsGjB,CAAC"}
@@ -14,9 +14,23 @@ export const figureFrameTarget = 'self';
14
14
  // `<figcaption>` its text. The image is the node WORK-561 gave a name to —
15
15
  // before that, the schema reached it only as an anonymous `imgs[0]`, and a
16
16
  // reordering of the transform would have silently repointed `contentUrl`.
17
+ //
18
+ // BUG-028 — a figure is a general captioned container, so `ImageObject` holds
19
+ // only while the media slot is the figure's whole body. The transform records
20
+ // `body: 'mixed'` when anything else is there; that row asserts nothing. No
21
+ // type at all, rather than a more general one: the figure's caption describes
22
+ // the image *and* the code beside it, and `ImageObject` with that caption is a
23
+ // wrong claim, while the alternatives (`CreativeWork`, `SoftwareSourceCode`)
24
+ // would describe a code block nobody marked up as a work. The properties go with
25
+ // the type: stamping `caption` with no `typeof` here would hand it to whatever
26
+ // typed ancestor the page has.
17
27
  export const figureSchema = {
18
- type: 'ImageObject',
19
- properties: { image: 'contentUrl', caption: 'caption' },
28
+ byField: 'body',
29
+ rows: { mixed: {} },
30
+ fallback: {
31
+ type: 'ImageObject',
32
+ properties: { image: 'contentUrl', caption: 'caption' },
33
+ },
20
34
  };
21
35
  export const figure = createContentModelSchema({
22
36
  schema: figureSchema,
@@ -43,30 +57,60 @@ export const figure = createContentModelSchema({
43
57
  },
44
58
  contentModel: bodyOnly(),
45
59
  transform(resolved, attrs, config) {
46
- const children = renderNodes(resolved.body, config);
47
- // Media is an <img> or a scheme-resolved <svg> (placeholder:/icon:) — both
48
- // count as the figure's image (SPEC-106).
49
- const imgs = children
50
- .flatten()
51
- .toArray()
52
- .filter((n) => isMediaNode(n));
53
- // For caption fallback, skip paragraphs that only contain a media node
54
- const textParagraphs = children
55
- .tag('p')
56
- .toArray()
57
- .filter((p) => {
58
- const kids = (p.children || []).filter((c) => Markdoc.Tag.isTag(c));
59
- return !(kids.length === 1 && isMediaNode(kids[0]));
60
- });
60
+ const children = renderNodes(resolved.body, config).toArray();
61
+ // BUG-028 — every body child is kept, in body order. Media — an <img>, a
62
+ // <video>, or a scheme-resolved <svg> (SPEC-106) — standing on its own,
63
+ // or in a paragraph holding nothing else, is the figure's media slot and
64
+ // is emitted unwrapped, as it always was. Anything else is emitted as
65
+ // written: before this, all of it was resolved and then dropped.
66
+ const mediaOnly = (p) => {
67
+ if (!Markdoc.Tag.isTag(p) || p.name !== 'p')
68
+ return undefined;
69
+ const kids = p.children ?? [];
70
+ const media = kids.filter((c) => isMediaNode(c));
71
+ const rest = kids.filter((c) => !isMediaNode(c) && !(typeof c === 'string' && c.trim() === ''));
72
+ return media.length > 0 && rest.length === 0 ? media : undefined;
73
+ };
74
+ const holdsMedia = (n) => isMediaNode(n) || (Markdoc.Tag.isTag(n) && (n.children ?? []).some(holdsMedia));
75
+ // Caption fallback: the first paragraph with no media in it.
61
76
  const captionContent = attrs.caption || undefined;
77
+ const captionParagraph = captionContent
78
+ ? undefined
79
+ : children.find((n) => Markdoc.Tag.isTag(n) && n.name === 'p' && !holdsMedia(n));
62
80
  const captionTag = captionContent
63
81
  ? new Tag('figcaption', {}, [captionContent])
64
- : textParagraphs.length > 0
65
- ? new Tag('figcaption', {}, [textParagraphs[0]])
82
+ : captionParagraph
83
+ ? new Tag('figcaption', {}, [captionParagraph])
66
84
  : undefined;
85
+ const imgs = [];
86
+ const body = [];
87
+ let mixed = false;
88
+ for (const node of children) {
89
+ if (node === captionParagraph)
90
+ continue;
91
+ if (isMediaNode(node)) {
92
+ imgs.push(node);
93
+ body.push(node);
94
+ continue;
95
+ }
96
+ const media = mediaOnly(node);
97
+ if (media) {
98
+ imgs.push(...media);
99
+ body.push(...media);
100
+ continue;
101
+ }
102
+ if (typeof node === 'string' && node.trim() === '')
103
+ continue;
104
+ body.push(node);
105
+ mixed = true;
106
+ }
67
107
  const sizeMeta = attrs.size ? new Tag('meta', { content: attrs.size }) : undefined;
68
108
  const alignMeta = attrs.align ? new Tag('meta', { content: attrs.align }) : undefined;
69
- const childNodes = [...imgs];
109
+ // A content fact, not a type: the schema table decides what it means.
110
+ const bodyMeta = mixed ? new Tag('meta', { content: 'mixed' }) : undefined;
111
+ const childNodes = [...body];
112
+ if (bodyMeta)
113
+ childNodes.push(bodyMeta);
70
114
  if (captionTag)
71
115
  childNodes.push(captionTag);
72
116
  return createComponentRenderable({
@@ -75,6 +119,7 @@ export const figure = createContentModelSchema({
75
119
  properties: {
76
120
  size: sizeMeta,
77
121
  align: alignMeta,
122
+ body: bodyMeta,
78
123
  },
79
124
  refs: {
80
125
  caption: captionTag,
@@ -1 +1 @@
1
- {"version":3,"file":"figure.js","sourceRoot":"","sources":["../../src/tags/figure.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EACN,wBAAwB,EACxB,QAAQ,EACR,yBAAyB,EACzB,WAAW,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAEzD,4EAA4E;AAC5E,0EAA0E;AAC1E,iCAAiC;AACjC,MAAM,CA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EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtF,sEAAsE;QACtE,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3E,MAAM,UAAU,GAAU,CAAC,GAAG,IAAI,CAAC,CAAC;QACpC,IAAI,QAAQ;YAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,UAAU;YAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE5C,OAAO,yBAAyB,CAAC;YAChC,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,QAAQ;YACb,UAAU,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;aACd;YACD,IAAI,EAAE;gBACL,OAAO,EAAE,UAAU;gBACnB,qEAAqE;gBACrE,sEAAsE;gBACtE,wDAAwD;gBACxD,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9C;YACD,QAAQ,EAAE,UAAU;SACpB,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
@@ -1,24 +1,68 @@
1
+ /**
2
+ * Include's preprocess hook (SPEC-129).
3
+ *
4
+ * Replaces an `{% include %}` tag with the referenced partial's AST, cloned and
5
+ * with the tag's `variables` substituted. The preprocess walk then descends
6
+ * into the pasted nodes (SPEC-141), so a `data` or `snippet` inside the file is
7
+ * resolved exactly as if it had been typed there — the case `{% partial %}`
8
+ * cannot serve, because Markdoc expands partials during the transform.
9
+ *
10
+ * Three properties are load-bearing:
11
+ *
12
+ * - **Splice, never wrap.** One include produces N nodes and they land as
13
+ * direct siblings. A container to keep the replacement 1:1 breaks
14
+ * composition invisibly: measured in SPEC-127, `{% section %}` and
15
+ * `{% grid %}` consume their children, so wrapped content vanishes with no
16
+ * error. Same constraint, same reason, as the `data` per-row body.
17
+ *
18
+ * - **Always clone.** The partial ASTs are parsed once per build and shared by
19
+ * every page that references them. The other preprocessors mutate the tree in
20
+ * place, so pasting the shared nodes would let one page's `data` resolution
21
+ * leak into the next page's copy.
22
+ *
23
+ * - **Substitute, don't scope.** `partial` binds variables into a
24
+ * transform-time scope, which is precisely what a preprocessor attribute
25
+ * cannot read. `include` rewrites `Variable` nodes in the cloned AST at paste
26
+ * time — the same thing `bindRow` does for `$row` — so a binding reaches
27
+ * `{% data where=$q %}`. Variables the include does not bind are left alone
28
+ * and resolve at transform against the page's own variables.
29
+ *
30
+ * Failures render a visible error callout and record a build error rather than
31
+ * throwing, matching `data`: one bad include does not take out the build, and
32
+ * the failure is on the page where the author will see it.
33
+ */
34
+ import Markdoc from '@markdoc/markdoc';
35
+ /**
36
+ * How deep includes may nest.
37
+ *
38
+ * A cycle is caught by name before this ever fires — the stack check below is
39
+ * the real guard. This bounds the other shape: a chain of distinct files deep
40
+ * enough that it is a mistake rather than a structure anyone meant to author.
41
+ */
42
+ export declare const MAX_INCLUDE_DEPTH = 16;
1
43
  /**
2
44
  * The `include` rune — paste a file's AST into the page during **preprocess**
3
45
  * (SPEC-129).
4
46
  *
5
47
  * `{% partial %}` is Markdoc's, and Markdoc expands it during
6
48
  * `Markdoc.transform`. refrakt's preprocessors — `data` (SPEC-103) and
7
- * `snippet` (SPEC-062) — walk the *page's* AST before that, so a preprocessor
8
- * rune inside a partial is never in the tree when they run and survives to its
9
- * own throwing transform. `include` closes that gap: it splices the file's
10
- * parsed AST into the page ahead of every other preprocess step, so the pasted
11
- * content is preprocessed exactly as if it had been typed there.
49
+ * `snippet` (SPEC-062) — resolve the *page's* AST before that, so a
50
+ * preprocessor rune inside a partial is never in the tree when they run and
51
+ * survives to its own throwing transform. `include` closes that gap: it splices
52
+ * the file's parsed AST into the page during preprocess, and the walk descends
53
+ * into it, so the pasted content is preprocessed exactly as if it had been
54
+ * typed there.
12
55
  *
13
56
  * Both runes read the same `_partials/` directory and the same `namespace:file`
14
57
  * roots — a file's *location* should not depend on its *contents*, so only the
15
58
  * call site differs. `partial` stays the documented default; reach for
16
59
  * `include` when the file contains `data` or `snippet`.
17
60
  *
18
- * Like `snippet` and `data`, this is an **AST preprocessor**, so the schema's
61
+ * Like `snippet` and `data`, this is an **AST preprocessor** — its `preprocess`
62
+ * hook is the code above — so the schema's
19
63
  * `transform` is unreachable in normal operation. It exists for tooling
20
64
  * (`refrakt inspect include`, contracts, attribute validation, the rune
21
65
  * catalog) and throws a message pointing at the wiring if it ever runs.
22
66
  */
23
- export declare const include: import("@markdoc/markdoc").Schema;
67
+ export declare const include: Markdoc.Schema;
24
68
  //# sourceMappingURL=include.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../../src/tags/include.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,OAAO,mCAyBlB,CAAC"}
1
+ {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../../src/tags/include.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAQvC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAiMpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,gBA0BlB,CAAC"}
@@ -1,22 +1,230 @@
1
+ /**
2
+ * Include's preprocess hook (SPEC-129).
3
+ *
4
+ * Replaces an `{% include %}` tag with the referenced partial's AST, cloned and
5
+ * with the tag's `variables` substituted. The preprocess walk then descends
6
+ * into the pasted nodes (SPEC-141), so a `data` or `snippet` inside the file is
7
+ * resolved exactly as if it had been typed there — the case `{% partial %}`
8
+ * cannot serve, because Markdoc expands partials during the transform.
9
+ *
10
+ * Three properties are load-bearing:
11
+ *
12
+ * - **Splice, never wrap.** One include produces N nodes and they land as
13
+ * direct siblings. A container to keep the replacement 1:1 breaks
14
+ * composition invisibly: measured in SPEC-127, `{% section %}` and
15
+ * `{% grid %}` consume their children, so wrapped content vanishes with no
16
+ * error. Same constraint, same reason, as the `data` per-row body.
17
+ *
18
+ * - **Always clone.** The partial ASTs are parsed once per build and shared by
19
+ * every page that references them. The other preprocessors mutate the tree in
20
+ * place, so pasting the shared nodes would let one page's `data` resolution
21
+ * leak into the next page's copy.
22
+ *
23
+ * - **Substitute, don't scope.** `partial` binds variables into a
24
+ * transform-time scope, which is precisely what a preprocessor attribute
25
+ * cannot read. `include` rewrites `Variable` nodes in the cloned AST at paste
26
+ * time — the same thing `bindRow` does for `$row` — so a binding reaches
27
+ * `{% data where=$q %}`. Variables the include does not bind are left alone
28
+ * and resolve at transform against the page's own variables.
29
+ *
30
+ * Failures render a visible error callout and record a build error rather than
31
+ * throwing, matching `data`: one bad include does not take out the build, and
32
+ * the failure is on the page where the author will see it.
33
+ */
34
+ import Markdoc from '@markdoc/markdoc';
1
35
  import { createContentModelSchema } from '../lib/index.js';
36
+ import { emitErrorNode } from '../data-emit.js';
37
+ const { Ast } = Markdoc;
38
+ /**
39
+ * How deep includes may nest.
40
+ *
41
+ * A cycle is caught by name before this ever fires — the stack check below is
42
+ * the real guard. This bounds the other shape: a chain of distinct files deep
43
+ * enough that it is a mistake rather than a structure anyone meant to author.
44
+ */
45
+ export const MAX_INCLUDE_DEPTH = 16;
46
+ /**
47
+ * Preprocess: splice the `{% include %}` tag away. No-op when no partials are
48
+ * available (a tree-mode build with none wired), matching how snippet and data
49
+ * no-op without a sandbox — the tag then falls through to its schema transform,
50
+ * which names the wiring.
51
+ */
52
+ function preprocessInclude(tag, page, ctx) {
53
+ const partials = ctx.partials;
54
+ if (!partials)
55
+ return;
56
+ return resolveInclude(tag, page, ctx, partials, []);
57
+ }
58
+ /**
59
+ * Include's own nested expansion (SPEC-141 D3). The preprocess walk descends
60
+ * into every replacement, but the cycle stack is per-chain state it should not
61
+ * carry, so the includes inside a pasted file are expanded here, under a stack
62
+ * that names the chain. `resolveInclude` therefore leaves no `include` tag
63
+ * behind, and the walk's descent finds none to expand a second time.
64
+ */
65
+ function walkAndReplaceIncludes(node, page, ctx, partials, stack) {
66
+ if (!node.children)
67
+ return;
68
+ for (let i = 0; i < node.children.length; i++) {
69
+ const child = node.children[i];
70
+ if (child.type === 'tag' && child.tag === 'include') {
71
+ const replacement = resolveInclude(child, page, ctx, partials, stack);
72
+ node.children.splice(i, 1, ...replacement);
73
+ // Skip the pasted nodes: nested includes inside them were already
74
+ // expanded by `resolveInclude`, under the cycle stack that names the
75
+ // chain. Re-walking here would expand them a second time with an empty
76
+ // stack, which is exactly how a cycle becomes an infinite paste.
77
+ i += replacement.length - 1;
78
+ continue;
79
+ }
80
+ walkAndReplaceIncludes(child, page, ctx, partials, stack);
81
+ }
82
+ }
83
+ function fail(ctx, page, message) {
84
+ ctx.error(`include: ${message}`, page.url);
85
+ return [emitErrorNode(`include error: ${message}`)];
86
+ }
87
+ function resolveInclude(tag, page, ctx, partials, stack) {
88
+ const file = resolveValue(tag.attributes?.file, ctx.variables);
89
+ if (typeof file !== 'string' || file.length === 0) {
90
+ return fail(ctx, page, 'the `file` attribute is required (an unresolvable variable reference resolves to empty)');
91
+ }
92
+ if (stack.includes(file)) {
93
+ return fail(ctx, page, `cycle — ${[...stack, file].join(' → ')}`);
94
+ }
95
+ if (stack.length >= MAX_INCLUDE_DEPTH) {
96
+ return fail(ctx, page, `nested more than ${MAX_INCLUDE_DEPTH} deep — ${[...stack, file].join(' → ')}`);
97
+ }
98
+ const source = partials[file];
99
+ if (!source || typeof source !== 'object') {
100
+ const known = Object.keys(partials).sort();
101
+ const available = known.length > 0
102
+ ? ` Available: ${known.join(', ')}.`
103
+ : ' No partials are registered for this site.';
104
+ return fail(ctx, page, `"${file}" was not found in \`_partials/\` or any registered file root.${available}`);
105
+ }
106
+ const bindings = resolveVariables(tag.attributes?.variables, ctx.variables);
107
+ const pasted = source.children ?? [];
108
+ const children = pasted.map((child) => cloneWithBindings(child, bindings));
109
+ // Expand nested includes inside what was just pasted, under a stack carrying
110
+ // this file — so a cycle is reported by name instead of overflowing.
111
+ if (children.length > 0) {
112
+ const container = new Ast.Node('document', {}, children);
113
+ walkAndReplaceIncludes(container, page, ctx, partials, [...stack, file]);
114
+ return container.children;
115
+ }
116
+ return children;
117
+ }
118
+ /**
119
+ * Clone a node, substituting bound variables.
120
+ *
121
+ * `$q` reaches the AST as a `Variable` in a node's *attributes* — on a tag
122
+ * (`where=$q`) and equally on a `text` node, where `{% $q %}` becomes
123
+ * `content: Variable(['q'])`. One rule covers both, exactly as `bindRow` does.
124
+ */
125
+ function cloneWithBindings(node, bindings) {
126
+ const attributes = {};
127
+ for (const [key, value] of Object.entries(node.attributes ?? {})) {
128
+ attributes[key] = substitute(value, bindings);
129
+ }
130
+ const children = (node.children ?? []).map((child) => cloneWithBindings(child, bindings));
131
+ const copy = new Ast.Node(node.type, attributes, children, node.tag);
132
+ // The constructor takes four fields; everything else Markdoc's parser sets
133
+ // has to be carried across by hand. `inline` decides whether a node renders
134
+ // inline, and `annotations` carries `{% .class #id %}` shorthand — dropping
135
+ // either changes the output silently.
136
+ if (node.lines)
137
+ copy.lines = node.lines;
138
+ if (node.location)
139
+ copy.location = node.location;
140
+ copy.inline = node.inline;
141
+ if (node.annotations?.length)
142
+ copy.annotations = node.annotations;
143
+ if (node.slots && Object.keys(node.slots).length > 0) {
144
+ copy.slots = Object.fromEntries(Object.entries(node.slots).map(([k, v]) => [k, cloneWithBindings(v, bindings)]));
145
+ }
146
+ return copy;
147
+ }
148
+ /**
149
+ * Replace a `Variable` node whose root segment the include binds.
150
+ *
151
+ * Unbound variables pass through untouched rather than resolving to empty: the
152
+ * pasted AST is page content now, so `$page.slug` and friends still resolve at
153
+ * transform against the page's own variables. That is a capability `partial`
154
+ * does not have — its scope *replaces* the variable surface.
155
+ */
156
+ function substitute(value, bindings) {
157
+ if (!value || typeof value !== 'object')
158
+ return value;
159
+ const node = value;
160
+ if (node.$$mdtype === 'Variable' && Array.isArray(node.path) && node.path.length > 0) {
161
+ const [root, ...rest] = node.path;
162
+ if (!(root in bindings))
163
+ return value;
164
+ let current = bindings[root];
165
+ for (const segment of rest) {
166
+ if (current === null || current === undefined)
167
+ return '';
168
+ current = current[segment];
169
+ }
170
+ return current === null || current === undefined ? '' : current;
171
+ }
172
+ return value;
173
+ }
174
+ /** The include's own `variables={...}`, with any page-variable references in
175
+ * its values resolved before they are substituted into the pasted AST. */
176
+ function resolveVariables(raw, pageVariables) {
177
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
178
+ return {};
179
+ const out = {};
180
+ for (const [key, value] of Object.entries(raw)) {
181
+ out[key] = resolveValue(value, pageVariables);
182
+ }
183
+ return out;
184
+ }
185
+ /** Resolve an attribute value against the page's variables — literals pass
186
+ * through, `Variable` nodes are looked up. Mirrors snippet's and data's
187
+ * resolvers; anything else (a `Function` node) resolves to empty — the same
188
+ * silent-empty behaviour BUG-010 tracks for `data`'s `where`. */
189
+ function resolveValue(value, variables) {
190
+ if (value === undefined || value === null)
191
+ return '';
192
+ if (typeof value !== 'object')
193
+ return value;
194
+ const node = value;
195
+ if (node.$$mdtype === 'Variable' && Array.isArray(node.path)) {
196
+ let current = variables;
197
+ for (const segment of node.path) {
198
+ if (current === null || current === undefined)
199
+ return '';
200
+ current = current[segment];
201
+ }
202
+ return current === null || current === undefined ? '' : current;
203
+ }
204
+ if (node.$$mdtype === undefined)
205
+ return value;
206
+ return '';
207
+ }
2
208
  /**
3
209
  * The `include` rune — paste a file's AST into the page during **preprocess**
4
210
  * (SPEC-129).
5
211
  *
6
212
  * `{% partial %}` is Markdoc's, and Markdoc expands it during
7
213
  * `Markdoc.transform`. refrakt's preprocessors — `data` (SPEC-103) and
8
- * `snippet` (SPEC-062) — walk the *page's* AST before that, so a preprocessor
9
- * rune inside a partial is never in the tree when they run and survives to its
10
- * own throwing transform. `include` closes that gap: it splices the file's
11
- * parsed AST into the page ahead of every other preprocess step, so the pasted
12
- * content is preprocessed exactly as if it had been typed there.
214
+ * `snippet` (SPEC-062) — resolve the *page's* AST before that, so a
215
+ * preprocessor rune inside a partial is never in the tree when they run and
216
+ * survives to its own throwing transform. `include` closes that gap: it splices
217
+ * the file's parsed AST into the page during preprocess, and the walk descends
218
+ * into it, so the pasted content is preprocessed exactly as if it had been
219
+ * typed there.
13
220
  *
14
221
  * Both runes read the same `_partials/` directory and the same `namespace:file`
15
222
  * roots — a file's *location* should not depend on its *contents*, so only the
16
223
  * call site differs. `partial` stays the documented default; reach for
17
224
  * `include` when the file contains `data` or `snippet`.
18
225
  *
19
- * Like `snippet` and `data`, this is an **AST preprocessor**, so the schema's
226
+ * Like `snippet` and `data`, this is an **AST preprocessor** — its `preprocess`
227
+ * hook is the code above — so the schema's
20
228
  * `transform` is unreachable in normal operation. It exists for tooling
21
229
  * (`refrakt inspect include`, contracts, attribute validation, the rune
22
230
  * catalog) and throws a message pointing at the wiring if it ever runs.
@@ -35,8 +243,9 @@ export const include = createContentModelSchema({
35
243
  },
36
244
  },
37
245
  contentModel: { type: 'sequence', fields: [] },
246
+ preprocess: preprocessInclude,
38
247
  transform(_resolved, _attrs) {
39
- // Unreachable in normal operation — corePipelineHooks.preprocess splices
248
+ // Unreachable in normal operation — the `preprocess` hook above splices
40
249
  // `include` tags away before the transform runs.
41
250
  throw new Error('{% include %} reached the transform phase unresolved — its preprocess hook was not ' +
42
251
  'wired through. Ensure the content pipeline runs registered `preprocess` hooks before ' +