@refrakt-md/runes 0.14.4 → 0.16.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.
- package/dist/aggregate-resolve.d.ts +4 -0
- package/dist/aggregate-resolve.d.ts.map +1 -0
- package/dist/aggregate-resolve.js +209 -0
- package/dist/aggregate-resolve.js.map +1 -0
- package/dist/collection-helpers.d.ts +101 -0
- package/dist/collection-helpers.d.ts.map +1 -0
- package/dist/collection-helpers.js +206 -0
- package/dist/collection-helpers.js.map +1 -0
- package/dist/collection-resolve.d.ts +5 -0
- package/dist/collection-resolve.d.ts.map +1 -0
- package/dist/collection-resolve.js +209 -0
- package/dist/collection-resolve.js.map +1 -0
- package/dist/config.d.ts +46 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +208 -88
- package/dist/config.js.map +1 -1
- package/dist/deferred-body.d.ts +19 -0
- package/dist/deferred-body.d.ts.map +1 -0
- package/dist/deferred-body.js +70 -0
- package/dist/deferred-body.js.map +1 -0
- package/dist/drawer-pipeline.d.ts +33 -0
- package/dist/drawer-pipeline.d.ts.map +1 -0
- package/dist/drawer-pipeline.js +206 -0
- package/dist/drawer-pipeline.js.map +1 -0
- package/dist/expand-pipeline.d.ts +51 -0
- package/dist/expand-pipeline.d.ts.map +1 -0
- package/dist/expand-pipeline.js +314 -0
- package/dist/expand-pipeline.js.map +1 -0
- package/dist/field-match.d.ts +43 -0
- package/dist/field-match.d.ts.map +1 -0
- package/dist/field-match.js +121 -0
- package/dist/field-match.js.map +1 -0
- package/dist/functions.d.ts +36 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/functions.js +74 -0
- package/dist/functions.js.map +1 -0
- package/dist/index.d.ts +34 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -4
- package/dist/index.js.map +1 -1
- package/dist/lang-map.d.ts +32 -0
- package/dist/lang-map.d.ts.map +1 -0
- package/dist/lang-map.js +76 -0
- package/dist/lang-map.js.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +9 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/read-file.d.ts +78 -0
- package/dist/lib/read-file.d.ts.map +1 -0
- package/dist/lib/read-file.js +166 -0
- package/dist/lib/read-file.js.map +1 -0
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +18 -2
- package/dist/nodes.js.map +1 -1
- package/dist/outline-scope.d.ts +46 -0
- package/dist/outline-scope.d.ts.map +1 -0
- package/dist/outline-scope.js +208 -0
- package/dist/outline-scope.js.map +1 -0
- package/dist/plugins.d.ts +13 -0
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +65 -1
- package/dist/plugins.js.map +1 -1
- package/dist/relationships-resolve.d.ts +4 -0
- package/dist/relationships-resolve.d.ts.map +1 -0
- package/dist/relationships-resolve.js +180 -0
- package/dist/relationships-resolve.js.map +1 -0
- package/dist/snippet-pipeline.d.ts +42 -0
- package/dist/snippet-pipeline.d.ts.map +1 -0
- package/dist/snippet-pipeline.js +219 -0
- package/dist/snippet-pipeline.js.map +1 -0
- package/dist/tags/aggregate.d.ts +19 -0
- package/dist/tags/aggregate.d.ts.map +1 -0
- package/dist/tags/aggregate.js +59 -0
- package/dist/tags/aggregate.js.map +1 -0
- package/dist/tags/card.d.ts +25 -0
- package/dist/tags/card.d.ts.map +1 -0
- package/dist/tags/card.js +138 -0
- package/dist/tags/card.js.map +1 -0
- package/dist/tags/collection.d.ts +10 -0
- package/dist/tags/collection.d.ts.map +1 -0
- package/dist/tags/collection.js +54 -0
- package/dist/tags/collection.js.map +1 -0
- package/dist/tags/conversation.d.ts.map +1 -1
- package/dist/tags/conversation.js +26 -6
- package/dist/tags/conversation.js.map +1 -1
- package/dist/tags/drawer.d.ts +26 -0
- package/dist/tags/drawer.d.ts.map +1 -0
- package/dist/tags/drawer.js +134 -0
- package/dist/tags/drawer.js.map +1 -0
- package/dist/tags/expand.d.ts +22 -0
- package/dist/tags/expand.d.ts.map +1 -0
- package/dist/tags/expand.js +76 -0
- package/dist/tags/expand.js.map +1 -0
- package/dist/tags/progress.d.ts +9 -0
- package/dist/tags/progress.d.ts.map +1 -0
- package/dist/tags/progress.js +96 -0
- package/dist/tags/progress.js.map +1 -0
- package/dist/tags/relationships.d.ts +12 -0
- package/dist/tags/relationships.d.ts.map +1 -0
- package/dist/tags/relationships.js +62 -0
- package/dist/tags/relationships.js.map +1 -0
- package/dist/tags/snippet.d.ts +19 -0
- package/dist/tags/snippet.d.ts.map +1 -0
- package/dist/tags/snippet.js +49 -0
- package/dist/tags/snippet.js.map +1 -0
- package/dist/util.d.ts +11 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +35 -0
- package/dist/util.js.map +1 -1
- package/dist/xref-patterns.d.ts +57 -0
- package/dist/xref-patterns.d.ts.map +1 -0
- package/dist/xref-patterns.js +140 -0
- package/dist/xref-patterns.js.map +1 -0
- package/dist/xref-resolve.d.ts +22 -5
- package/dist/xref-resolve.d.ts.map +1 -1
- package/dist/xref-resolve.js +203 -79
- package/dist/xref-resolve.js.map +1 -1
- package/package.json +3 -3
|
@@ -40,12 +40,21 @@ function convertConversationChildren(nodes, attrs) {
|
|
|
40
40
|
if (node.type === 'blockquote') {
|
|
41
41
|
let speaker = '';
|
|
42
42
|
const children = [...node.children];
|
|
43
|
+
// Markdoc wraps a paragraph's inline content in an `inline` node, so
|
|
44
|
+
// the first paragraph's *content* is `firstPara.children[0].children`
|
|
45
|
+
// (when an inline wrapper is present) rather than `firstPara.children`
|
|
46
|
+
// directly. Both forms are handled.
|
|
47
|
+
const firstPara = children.length > 0 && children[0].type === 'paragraph'
|
|
48
|
+
? children[0]
|
|
49
|
+
: null;
|
|
50
|
+
const inlineHost = firstPara && firstPara.children[0]?.type === 'inline'
|
|
51
|
+
? firstPara.children[0]
|
|
52
|
+
: firstPara;
|
|
43
53
|
// Try to extract speaker from first paragraph's bold text: **Name:** ...
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const nameText = Array.from(firstChild.walk())
|
|
54
|
+
if (inlineHost) {
|
|
55
|
+
const firstInline = inlineHost.children[0];
|
|
56
|
+
if (firstInline && firstInline.type === 'strong') {
|
|
57
|
+
const nameText = Array.from(firstInline.walk())
|
|
49
58
|
.filter(n => n.type === 'text')
|
|
50
59
|
.map(n => n.attributes.content)
|
|
51
60
|
.join('')
|
|
@@ -53,9 +62,20 @@ function convertConversationChildren(nodes, attrs) {
|
|
|
53
62
|
speaker = nameText;
|
|
54
63
|
}
|
|
55
64
|
}
|
|
56
|
-
// Fall back to alternating from speakers list
|
|
65
|
+
// Fall back to alternating from speakers list. Inject a bold
|
|
66
|
+
// `**Name:**` prefix at the start of the first paragraph so the
|
|
67
|
+
// rendering matches the explicit `> **Name**:` form — name reads as
|
|
68
|
+
// bold-inline inside the bubble rather than as a separate label
|
|
69
|
+
// above it.
|
|
57
70
|
if (!speaker && speakerList.length > 0) {
|
|
58
71
|
speaker = speakerList[messageIndex % speakerList.length];
|
|
72
|
+
if (inlineHost) {
|
|
73
|
+
const strongTag = new Ast.Node('strong', {}, [
|
|
74
|
+
new Ast.Node('text', { content: `${speaker}:` }, []),
|
|
75
|
+
]);
|
|
76
|
+
const spaceText = new Ast.Node('text', { content: ' ' }, []);
|
|
77
|
+
inlineHost.children = [strongTag, spaceText, ...inlineHost.children];
|
|
78
|
+
}
|
|
59
79
|
}
|
|
60
80
|
const align = messageIndex % 2 === 0 ? 'left' : 'right';
|
|
61
81
|
converted.push(new Ast.Node('tag', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/tags/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,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;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC;IACpD,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,wDAAwD,EAAE;KAClH;IACD,YAAY,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,2BAA2B,CAAC,KAAe,EAAE,KAAK,CAAC;QACtF,WAAW,EAAE,uFAAuF;cACjG,uFAAuF;KAC1F;IACD,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM;QAChC,MAAM,IAAI,GAAG,IAAI,oBAAoB,CACpC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAoD,CACxG,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC/D,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE/C,OAAO,yBAAyB,CAAC,EAAE,IAAI,EAAE,cAAc;YACtD,GAAG,EAAE,KAAK;YACV,UAAU,EAAE;gBACX,OAAO,EAAE,QAAQ;aACjB;YACD,IAAI,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE;YACrC,QAAQ,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;SACpC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawer rune (SPEC-060).
|
|
3
|
+
*
|
|
4
|
+
* Body-only modal panel: declares an addressable region by id and renders
|
|
5
|
+
* its body as a visible in-flow `<section>` at the authored position. With
|
|
6
|
+
* JS (WORK-258 behaviors), the section is enhanced into a `<dialog>` and
|
|
7
|
+
* xref clicks open it via `showModal()`. Without JS, the body is visible
|
|
8
|
+
* inline and xref clicks scroll to it via fragment navigation.
|
|
9
|
+
*
|
|
10
|
+
* Triggers are not part of this rune — any `{% ref "drawer-id" /%}` on
|
|
11
|
+
* the same page resolves to `<a href="#drawer-{id}" data-target-type="drawer">`
|
|
12
|
+
* (via SPEC-065's `data-target-type` propagation, WORK-253). The
|
|
13
|
+
* progressive-enhancement layer queries that marker.
|
|
14
|
+
*
|
|
15
|
+
* Title heading level: `headingLevel="3"` etc. sets the level explicitly.
|
|
16
|
+
* Without an explicit level, the schema emits a sentinel `data-drawer-title-auto`
|
|
17
|
+
* marker; the corePipelineHooks.postProcess walk replaces it with an
|
|
18
|
+
* `h{n}` element one level deeper than the nearest preceding heading on
|
|
19
|
+
* the page (clamped to 1-6, default h2 when no preceding heading exists).
|
|
20
|
+
*/
|
|
21
|
+
import Markdoc from '@markdoc/markdoc';
|
|
22
|
+
/** Marker attribute placed on the title heading when `headingLevel` is omitted.
|
|
23
|
+
* The core postProcess walk replaces the tag with `h{n}` based on outline depth. */
|
|
24
|
+
export declare const DRAWER_TITLE_AUTO_MARKER = "data-drawer-title-auto";
|
|
25
|
+
export declare const drawer: Markdoc.Schema;
|
|
26
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/tags/drawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAMvC;qFACqF;AACrF,eAAO,MAAM,wBAAwB,2BAA2B,CAAC;AAKjE,eAAO,MAAM,MAAM,gBAgHjB,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drawer rune (SPEC-060).
|
|
3
|
+
*
|
|
4
|
+
* Body-only modal panel: declares an addressable region by id and renders
|
|
5
|
+
* its body as a visible in-flow `<section>` at the authored position. With
|
|
6
|
+
* JS (WORK-258 behaviors), the section is enhanced into a `<dialog>` and
|
|
7
|
+
* xref clicks open it via `showModal()`. Without JS, the body is visible
|
|
8
|
+
* inline and xref clicks scroll to it via fragment navigation.
|
|
9
|
+
*
|
|
10
|
+
* Triggers are not part of this rune — any `{% ref "drawer-id" /%}` on
|
|
11
|
+
* the same page resolves to `<a href="#drawer-{id}" data-target-type="drawer">`
|
|
12
|
+
* (via SPEC-065's `data-target-type` propagation, WORK-253). The
|
|
13
|
+
* progressive-enhancement layer queries that marker.
|
|
14
|
+
*
|
|
15
|
+
* Title heading level: `headingLevel="3"` etc. sets the level explicitly.
|
|
16
|
+
* Without an explicit level, the schema emits a sentinel `data-drawer-title-auto`
|
|
17
|
+
* marker; the corePipelineHooks.postProcess walk replaces it with an
|
|
18
|
+
* `h{n}` element one level deeper than the nearest preceding heading on
|
|
19
|
+
* the page (clamped to 1-6, default h2 when no preceding heading exists).
|
|
20
|
+
*/
|
|
21
|
+
import Markdoc from '@markdoc/markdoc';
|
|
22
|
+
const { Tag } = Markdoc;
|
|
23
|
+
import { createContentModelSchema, createComponentRenderable, asNodes } from '../lib/index.js';
|
|
24
|
+
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
25
|
+
/** Marker attribute placed on the title heading when `headingLevel` is omitted.
|
|
26
|
+
* The core postProcess walk replaces the tag with `h{n}` based on outline depth. */
|
|
27
|
+
export const DRAWER_TITLE_AUTO_MARKER = 'data-drawer-title-auto';
|
|
28
|
+
const drawerSides = ['right', 'left', 'top', 'bottom'];
|
|
29
|
+
const drawerSizes = ['sm', 'md', 'lg'];
|
|
30
|
+
export const drawer = createContentModelSchema({
|
|
31
|
+
attributes: {
|
|
32
|
+
id: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
description: 'Stable id for the drawer. Used in entity registration and as the `id="drawer-{value}"` on the rendered element so xref triggers can target it via fragment.',
|
|
36
|
+
},
|
|
37
|
+
title: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
description: 'Panel heading text. Rendered in the drawer header (or as a heading in the no-JS in-flow rendering).',
|
|
41
|
+
},
|
|
42
|
+
headingLevel: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: false,
|
|
45
|
+
description: 'Heading level (1-6) for the title. When omitted, the level is auto-detected from outline position (one deeper than the nearest preceding heading). Out-of-range values are clamped to the 1-6 range.',
|
|
46
|
+
},
|
|
47
|
+
shortcut: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: false,
|
|
50
|
+
description: 'Keyboard shortcut that opens the drawer when behaviors are loaded (e.g. ".", "cmd+k"). Surfaces as `data-shortcut`; the progressive-enhancement layer wires the listener.',
|
|
51
|
+
},
|
|
52
|
+
side: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: false,
|
|
55
|
+
matches: drawerSides.slice(),
|
|
56
|
+
description: 'Edge the panel slides from when enhanced. Defaults to "right".',
|
|
57
|
+
},
|
|
58
|
+
size: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: false,
|
|
61
|
+
matches: drawerSizes.slice(),
|
|
62
|
+
description: 'Panel size. "sm" / "md" (default) / "lg" — width for left/right sides, height for top/bottom.',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
contentModel: {
|
|
66
|
+
type: 'sequence',
|
|
67
|
+
fields: [
|
|
68
|
+
{ name: 'body', match: 'any', optional: true, greedy: true },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
transform(resolved, attrs, config) {
|
|
72
|
+
const drawerId = attrs.id;
|
|
73
|
+
const titleText = attrs.title;
|
|
74
|
+
const side = attrs.side ?? 'right';
|
|
75
|
+
const size = attrs.size ?? 'md';
|
|
76
|
+
// Title heading: explicit level → `h{n}`, otherwise emit a sentinel
|
|
77
|
+
// `h3` placeholder marked with `data-drawer-title-auto`. The core
|
|
78
|
+
// postProcess walk inspects outline depth and rewrites the tag name.
|
|
79
|
+
// We pick `h3` as the sentinel because it's the no-postProcess
|
|
80
|
+
// fallback (most drawers live under an h2 page section).
|
|
81
|
+
const clampedLevel = typeof attrs.headingLevel === 'number'
|
|
82
|
+
? Math.min(6, Math.max(1, Math.trunc(attrs.headingLevel)))
|
|
83
|
+
: undefined;
|
|
84
|
+
const titleTag = titleText
|
|
85
|
+
? (clampedLevel
|
|
86
|
+
? new Tag(`h${clampedLevel}`, {}, [titleText])
|
|
87
|
+
: new Tag('h3', { [DRAWER_TITLE_AUTO_MARKER]: 'true' }, [titleText]))
|
|
88
|
+
: undefined;
|
|
89
|
+
const closeButton = new Tag('button', {
|
|
90
|
+
type: 'button',
|
|
91
|
+
'aria-label': 'Close',
|
|
92
|
+
hidden: true,
|
|
93
|
+
}, ['×']);
|
|
94
|
+
const headerChildren = [];
|
|
95
|
+
if (titleTag)
|
|
96
|
+
headerChildren.push(titleTag);
|
|
97
|
+
headerChildren.push(closeButton);
|
|
98
|
+
const header = new Tag('header', {}, headerChildren);
|
|
99
|
+
const body = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config)).wrap('div');
|
|
100
|
+
// Property meta tags drive engine modifier-from-meta + data-attribute
|
|
101
|
+
// derivation. We always emit `side` and `size` so the engine applies
|
|
102
|
+
// the BEM modifier even when the author didn't specify them (the
|
|
103
|
+
// default "right"/"md" still need their data-attribute on the wrapper).
|
|
104
|
+
// `shortcut` is only emitted when set — its absence shouldn't appear
|
|
105
|
+
// as `data-shortcut=""` on the wrapper.
|
|
106
|
+
const properties = {
|
|
107
|
+
side: new Tag('meta', { content: side }),
|
|
108
|
+
size: new Tag('meta', { content: size }),
|
|
109
|
+
};
|
|
110
|
+
if (attrs.shortcut) {
|
|
111
|
+
properties.shortcut = new Tag('meta', { content: attrs.shortcut });
|
|
112
|
+
}
|
|
113
|
+
const renderable = createComponentRenderable({
|
|
114
|
+
rune: 'drawer',
|
|
115
|
+
tag: 'section',
|
|
116
|
+
id: `drawer-${drawerId}`,
|
|
117
|
+
properties,
|
|
118
|
+
refs: {
|
|
119
|
+
header,
|
|
120
|
+
...(titleTag ? { title: titleTag } : {}),
|
|
121
|
+
close: closeButton,
|
|
122
|
+
body: body.tag('div'),
|
|
123
|
+
},
|
|
124
|
+
children: [...Object.values(properties), header, body.next()],
|
|
125
|
+
});
|
|
126
|
+
// `data-drawer-id` carries the author-supplied id (before the
|
|
127
|
+
// `drawer-` prefix) for register-hook consumption. The register
|
|
128
|
+
// scan reads this to know what id the entity should have without
|
|
129
|
+
// re-parsing the html id.
|
|
130
|
+
renderable.attributes['data-drawer-id'] = drawerId;
|
|
131
|
+
return renderable;
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/tags/drawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D;qFACqF;AACrF,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAEjE,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AAChE,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,MAAM,GAAG,wBAAwB,CAAC;IAC9C,UAAU,EAAE;QACX,EAAE,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,6JAA6J;SAC1K;QACD,KAAK,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,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E,CAAC;SACxC,CAAC;QACF,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,UAAU,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,UAAU,GAAG,yBAAyB,CAAC;YAC5C,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,SAAS;YACd,EAAE,EAAE,UAAU,QAAQ,EAAE;YACxB,UAAU;YACV,IAAI,EAAE;gBACL,MAAM;gBACN,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxC,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;aACrB;YACD,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;SAC7D,CAAC,CAAC;QAEH,8DAA8D;QAC9D,gEAAgE;QAChE,iEAAiE;QACjE,0BAA0B;QACzB,UAAU,CAAC,UAAsC,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC;QAEhF,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expand rune (SPEC-066, WORK-260).
|
|
3
|
+
*
|
|
4
|
+
* Inline-substitution counterpart to `{% ref %}`: same registry lookup
|
|
5
|
+
* chain, different output mode (inline content instead of an anchor).
|
|
6
|
+
* Schema is self-closing and emits a placeholder; the postProcess hook
|
|
7
|
+
* (`expand-pipeline.ts`) walks for placeholders, resolves the entity
|
|
8
|
+
* from the registry, reads its `sourceFile`, calls the plugin's
|
|
9
|
+
* `extract()` to get the embeddable subtree, processes headings, and
|
|
10
|
+
* substitutes the content inline. The wrapper is a `<section
|
|
11
|
+
* data-rune="expand">` with `data-outline-scope` set so the WORK-259
|
|
12
|
+
* walkers automatically TOC-isolate the embed and namespace its
|
|
13
|
+
* heading IDs.
|
|
14
|
+
*/
|
|
15
|
+
import type { Schema } from '@markdoc/markdoc';
|
|
16
|
+
/** Sentinel attribute value used to identify expand placeholders in the
|
|
17
|
+
* renderable tree. PostProcess queries for `data-rune="expand-pending"`
|
|
18
|
+
* to find tags awaiting resolution. After substitution the wrapper
|
|
19
|
+
* carries `data-rune="expand"`. */
|
|
20
|
+
export declare const EXPAND_PLACEHOLDER_MARKER = "expand-pending";
|
|
21
|
+
export declare const expand: Schema;
|
|
22
|
+
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../src/tags/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAgB,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG7D;;;oCAGoC;AACpC,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,eAAO,MAAM,MAAM,EAAE,MAmDpB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expand rune (SPEC-066, WORK-260).
|
|
3
|
+
*
|
|
4
|
+
* Inline-substitution counterpart to `{% ref %}`: same registry lookup
|
|
5
|
+
* chain, different output mode (inline content instead of an anchor).
|
|
6
|
+
* Schema is self-closing and emits a placeholder; the postProcess hook
|
|
7
|
+
* (`expand-pipeline.ts`) walks for placeholders, resolves the entity
|
|
8
|
+
* from the registry, reads its `sourceFile`, calls the plugin's
|
|
9
|
+
* `extract()` to get the embeddable subtree, processes headings, and
|
|
10
|
+
* substitutes the content inline. The wrapper is a `<section
|
|
11
|
+
* data-rune="expand">` with `data-outline-scope` set so the WORK-259
|
|
12
|
+
* walkers automatically TOC-isolate the embed and namespace its
|
|
13
|
+
* heading IDs.
|
|
14
|
+
*/
|
|
15
|
+
import Markdoc from '@markdoc/markdoc';
|
|
16
|
+
const { Tag } = Markdoc;
|
|
17
|
+
/** Sentinel attribute value used to identify expand placeholders in the
|
|
18
|
+
* renderable tree. PostProcess queries for `data-rune="expand-pending"`
|
|
19
|
+
* to find tags awaiting resolution. After substitution the wrapper
|
|
20
|
+
* carries `data-rune="expand"`. */
|
|
21
|
+
export const EXPAND_PLACEHOLDER_MARKER = 'expand-pending';
|
|
22
|
+
export const expand = {
|
|
23
|
+
selfClosing: true,
|
|
24
|
+
attributes: {
|
|
25
|
+
primary: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
description: 'Entity ID or name to substitute inline. Same lookup chain as xref.',
|
|
29
|
+
},
|
|
30
|
+
level: {
|
|
31
|
+
type: Number,
|
|
32
|
+
required: false,
|
|
33
|
+
description: 'Optional heading-demotion opt-in. When set, embedded headings shift by `N - 1` and the embed joins the host outline instead of staying TOC-isolated.',
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
description: 'Entity type hint for disambiguation when the same ID/name lives in multiple registries.',
|
|
39
|
+
},
|
|
40
|
+
canonical: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
required: false,
|
|
43
|
+
description: 'When true, append a visible "View canonical" link pointing at the entity\'s canonical URL.',
|
|
44
|
+
},
|
|
45
|
+
label: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false,
|
|
48
|
+
description: 'Custom label for the canonical link (only meaningful when `canonical=true`).',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
transform(node, _config) {
|
|
52
|
+
const id = node.attributes.primary;
|
|
53
|
+
const level = node.attributes.level;
|
|
54
|
+
const typeHint = node.attributes.type;
|
|
55
|
+
const canonical = node.attributes.canonical === true;
|
|
56
|
+
const label = node.attributes.label;
|
|
57
|
+
const attrs = {
|
|
58
|
+
'data-rune': EXPAND_PLACEHOLDER_MARKER,
|
|
59
|
+
'data-expand-id': id,
|
|
60
|
+
};
|
|
61
|
+
if (typeof level === 'number')
|
|
62
|
+
attrs['data-expand-level'] = String(level);
|
|
63
|
+
if (typeHint)
|
|
64
|
+
attrs['data-expand-type'] = typeHint;
|
|
65
|
+
if (canonical)
|
|
66
|
+
attrs['data-expand-canonical'] = 'true';
|
|
67
|
+
if (label)
|
|
68
|
+
attrs['data-expand-label'] = label;
|
|
69
|
+
// The placeholder is a `<div>` rather than a `<span>` because the
|
|
70
|
+
// substituted content is block-level (the embedded rune's `<section>`).
|
|
71
|
+
// A `<span>` parent would produce invalid block-in-inline HTML once
|
|
72
|
+
// the postProcess substitutes content.
|
|
73
|
+
return new Tag('div', attrs, []);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../src/tags/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAExB;;;oCAGoC;AACpC,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,MAAM,GAAW;IAC7B,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE;QACX,OAAO,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,oEAAoE;SACjF;QACD,KAAK,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,sJAAsJ;SACnK;QACD,IAAI,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,yFAAyF;SACtG;QACD,SAAS,EAAE;YACV,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,4FAA4F;SACzG;QACD,KAAK,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,8EAA8E;SAC3F;KACD;IACD,SAAS,CAAC,IAAU,EAAE,OAAe;QACpC,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,OAAiB,CAAC;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAA2B,CAAC;QAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAA0B,CAAC;QAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,KAAK,IAAI,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAA2B,CAAC;QAE1D,MAAM,KAAK,GAA4B;YACtC,WAAW,EAAE,yBAAyB;YACtC,gBAAgB,EAAE,EAAE;SACpB,CAAC;QACF,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,KAAK,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1E,IAAI,QAAQ;YAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,QAAQ,CAAC;QACnD,IAAI,SAAS;YAAE,KAAK,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAAC;QACvD,IAAI,KAAK;YAAE,KAAK,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC;QAE9C,kEAAkE;QAClE,wEAAwE;QACxE,oEAAoE;QACpE,uCAAuC;QACvC,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
2
|
+
/**
|
|
3
|
+
* `progress` — a generic, presentational completion bar (SPEC-072 / WORK-285).
|
|
4
|
+
* Renders a ratio from supplied numbers; computes nothing from the registry.
|
|
5
|
+
* `value`+`max` (primary) or `percent` (alternative, when there's no count);
|
|
6
|
+
* an optional body is the label. Identity-transform only, no resolver.
|
|
7
|
+
*/
|
|
8
|
+
export declare const progress: Markdoc.Schema;
|
|
9
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/tags/progress.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAiBvC;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,gBA6EnB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
2
|
+
const { Tag } = Markdoc;
|
|
3
|
+
import { createContentModelSchema, createComponentRenderable, asNodes } from '../lib/index.js';
|
|
4
|
+
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
5
|
+
const displayValues = ['fraction', 'percent', 'none'];
|
|
6
|
+
const sentimentValues = ['positive', 'caution', 'negative'];
|
|
7
|
+
/** Best-effort plain-text of a rendered subtree, for the accessible name. */
|
|
8
|
+
function textContent(node) {
|
|
9
|
+
if (typeof node === 'string')
|
|
10
|
+
return node;
|
|
11
|
+
if (Array.isArray(node))
|
|
12
|
+
return node.map(textContent).join('');
|
|
13
|
+
if (Markdoc.Tag.isTag(node))
|
|
14
|
+
return textContent(node.children ?? []);
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* `progress` — a generic, presentational completion bar (SPEC-072 / WORK-285).
|
|
19
|
+
* Renders a ratio from supplied numbers; computes nothing from the registry.
|
|
20
|
+
* `value`+`max` (primary) or `percent` (alternative, when there's no count);
|
|
21
|
+
* an optional body is the label. Identity-transform only, no resolver.
|
|
22
|
+
*/
|
|
23
|
+
export const progress = createContentModelSchema({
|
|
24
|
+
attributes: {
|
|
25
|
+
value: { type: Number, required: false, description: 'Completed amount (paired with `max`).' },
|
|
26
|
+
max: { type: Number, required: false, description: 'Total amount (paired with `value`).' },
|
|
27
|
+
percent: { type: Number, required: false, description: 'Direct percentage 0–100, when there is no count.' },
|
|
28
|
+
display: { type: String, required: false, matches: displayValues.slice(), description: 'Readout: fraction (default with value/max), percent, or none.' },
|
|
29
|
+
sentiment: { type: String, required: false, matches: sentimentValues.slice(), description: 'Tone cue: positive / caution / negative. Absent → the neutral primary fill.' },
|
|
30
|
+
},
|
|
31
|
+
contentModel: {
|
|
32
|
+
type: 'sequence',
|
|
33
|
+
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
34
|
+
},
|
|
35
|
+
transform(resolved, attrs, config) {
|
|
36
|
+
const value = attrs.value != null ? Number(attrs.value) : undefined;
|
|
37
|
+
const max = attrs.max != null ? Number(attrs.max) : undefined;
|
|
38
|
+
const percentAttr = attrs.percent != null ? Number(attrs.percent) : undefined;
|
|
39
|
+
const clamp = (n) => Math.max(0, Math.min(100, n));
|
|
40
|
+
const hasRatio = value != null && max != null && Number.isFinite(value) && Number.isFinite(max) && max > 0;
|
|
41
|
+
const pct = hasRatio
|
|
42
|
+
? clamp(Math.round((value / max) * 100))
|
|
43
|
+
: (percentAttr != null && Number.isFinite(percentAttr) ? clamp(percentAttr) : 0);
|
|
44
|
+
const display = attrs.display || (hasRatio ? 'fraction' : 'percent');
|
|
45
|
+
let readout = '';
|
|
46
|
+
if (display === 'fraction' && hasRatio)
|
|
47
|
+
readout = `${value}/${max}`;
|
|
48
|
+
else if (display === 'percent')
|
|
49
|
+
readout = `${pct}%`;
|
|
50
|
+
const labelNodes = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config));
|
|
51
|
+
const labelArr = labelNodes.toArray();
|
|
52
|
+
const labelText = textContent(labelArr).trim();
|
|
53
|
+
// Optional tone cue — omit the meta entirely when absent so no modifier
|
|
54
|
+
// class is applied (the bar then uses the neutral primary fill).
|
|
55
|
+
const sentiment = attrs.sentiment;
|
|
56
|
+
const sentimentMeta = sentiment ? new Tag('meta', { content: sentiment }) : undefined;
|
|
57
|
+
const fillTag = new Tag('span', {}, []);
|
|
58
|
+
const trackTag = new Tag('span', {}, [fillTag]);
|
|
59
|
+
const refs = { track: trackTag, fill: fillTag };
|
|
60
|
+
const children = sentimentMeta ? [sentimentMeta] : [];
|
|
61
|
+
if (labelArr.length > 0) {
|
|
62
|
+
const labelTag = new Tag('span', {}, labelArr);
|
|
63
|
+
refs.label = labelTag;
|
|
64
|
+
children.push(labelTag);
|
|
65
|
+
}
|
|
66
|
+
if (readout) {
|
|
67
|
+
const valueTag = new Tag('span', {}, [readout]);
|
|
68
|
+
refs.value = valueTag;
|
|
69
|
+
children.push(valueTag);
|
|
70
|
+
}
|
|
71
|
+
children.push(trackTag);
|
|
72
|
+
const out = createComponentRenderable({
|
|
73
|
+
rune: 'progress',
|
|
74
|
+
tag: 'div',
|
|
75
|
+
properties: sentimentMeta ? { sentiment: sentimentMeta } : {},
|
|
76
|
+
refs,
|
|
77
|
+
children,
|
|
78
|
+
});
|
|
79
|
+
// Per-instance computed root attributes: accessible progressbar + fill width.
|
|
80
|
+
out.attributes.role = 'progressbar';
|
|
81
|
+
out.attributes['aria-valuemin'] = '0';
|
|
82
|
+
if (hasRatio) {
|
|
83
|
+
out.attributes['aria-valuenow'] = String(value);
|
|
84
|
+
out.attributes['aria-valuemax'] = String(max);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
out.attributes['aria-valuenow'] = String(pct);
|
|
88
|
+
out.attributes['aria-valuemax'] = '100';
|
|
89
|
+
}
|
|
90
|
+
if (labelText)
|
|
91
|
+
out.attributes['aria-label'] = labelText;
|
|
92
|
+
out.attributes.style = `--rf-progress: ${pct}%`;
|
|
93
|
+
return out;
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/tags/progress.ts"],"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CAAC;YAChD,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC9C,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC;QACzC,CAAC;QACD,IAAI,SAAS;YAAE,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;QACxD,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,kBAAkB,GAAG,GAAG,CAAC;QAChD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
2
|
+
export declare const RELATIONSHIPS_SENTINEL = "__relationships-sentinel";
|
|
3
|
+
/**
|
|
4
|
+
* `relationships` (SPEC-072) — render an entity's relationship edges, grouped
|
|
5
|
+
* by kind. The plural-graph counterpart to `collection`: its source set is
|
|
6
|
+
* `registry.getRelated(of)` rather than a type-query. Emits a sentinel filled
|
|
7
|
+
* by the postProcess resolver (`resolveRelationships`). A body, when present,
|
|
8
|
+
* is the per-edge template (deferBody) with `$item` (the related entity) and
|
|
9
|
+
* `$kind` (the edge kind) bound.
|
|
10
|
+
*/
|
|
11
|
+
export declare const relationships: Markdoc.Schema;
|
|
12
|
+
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/tags/relationships.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAKvC,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,gBAkDxB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
2
|
+
const { Tag } = Markdoc;
|
|
3
|
+
import { createContentModelSchema, createComponentRenderable } from '../lib/index.js';
|
|
4
|
+
import { readDeferredBody } from '../deferred-body.js';
|
|
5
|
+
export const RELATIONSHIPS_SENTINEL = '__relationships-sentinel';
|
|
6
|
+
/**
|
|
7
|
+
* `relationships` (SPEC-072) — render an entity's relationship edges, grouped
|
|
8
|
+
* by kind. The plural-graph counterpart to `collection`: its source set is
|
|
9
|
+
* `registry.getRelated(of)` rather than a type-query. Emits a sentinel filled
|
|
10
|
+
* by the postProcess resolver (`resolveRelationships`). A body, when present,
|
|
11
|
+
* is the per-edge template (deferBody) with `$item` (the related entity) and
|
|
12
|
+
* `$kind` (the edge kind) bound.
|
|
13
|
+
*/
|
|
14
|
+
export const relationships = createContentModelSchema({
|
|
15
|
+
attributes: {
|
|
16
|
+
of: { type: String, required: false, default: '', description: 'Entity to describe — an id (e.g. `of=$item.id`) or a bound entity.' },
|
|
17
|
+
kind: { type: String, required: false, default: '', description: 'Edge kinds to include, comma-separated (e.g. "blocks,blocked-by").' },
|
|
18
|
+
type: { type: String, required: false, default: '', description: 'Restrict related entity types, comma-separated.' },
|
|
19
|
+
group: { type: String, required: false, default: 'kind', description: 'Group-by: kind (default) | type | none.' },
|
|
20
|
+
'group-display': { type: String, required: false, default: 'headings', matches: ['headings', 'accordion'], description: 'How groups are presented: headings (default) or accordion (collapsible native <details> panels, styled like the accordion rune, with a per-group count).' },
|
|
21
|
+
sort: { type: String, required: false, default: '', description: 'Sort related entities by a field (prefix - for descending).' },
|
|
22
|
+
limit: { type: String, required: false, default: '', description: 'Max edges.' },
|
|
23
|
+
fields: { type: String, required: false, default: '', description: 'Comma-separated data fields to project in the no-body built-in.' },
|
|
24
|
+
layout: { type: String, required: false, default: 'list', description: 'Arrangement: list (stacked) | grid (multi-column). Item chrome comes from the item — the no-body built-in, or a rune like {% card %} in the body template.' },
|
|
25
|
+
empty: { type: String, required: false, default: '', description: 'Fallback text shown when there are no edges (no-body form; body form uses a fallback zone). Absent → render nothing.' },
|
|
26
|
+
},
|
|
27
|
+
deferBody: true,
|
|
28
|
+
contentModel: { type: 'sequence', fields: [] },
|
|
29
|
+
transform(_resolved, attrs) {
|
|
30
|
+
const meta = (field, content) => new Tag('meta', { 'data-field': field, content });
|
|
31
|
+
const bodySource = readDeferredBody(attrs) ?? '';
|
|
32
|
+
// `of` accepts an id string or a bound entity object ({ id, … }).
|
|
33
|
+
const ofRaw = attrs.of;
|
|
34
|
+
const of = ofRaw && typeof ofRaw === 'object'
|
|
35
|
+
? String(ofRaw.id ?? '')
|
|
36
|
+
: String(ofRaw ?? '');
|
|
37
|
+
const metas = [
|
|
38
|
+
meta('relationships-of', of),
|
|
39
|
+
meta('relationships-kind', String(attrs.kind ?? '')),
|
|
40
|
+
meta('relationships-type', String(attrs.type ?? '')),
|
|
41
|
+
meta('relationships-group', String(attrs.group ?? 'kind')),
|
|
42
|
+
meta('relationships-group-display', String(attrs['group-display'] ?? 'headings')),
|
|
43
|
+
meta('relationships-sort', String(attrs.sort ?? '')),
|
|
44
|
+
meta('relationships-limit', String(attrs.limit ?? '')),
|
|
45
|
+
meta('relationships-fields', String(attrs.fields ?? '')),
|
|
46
|
+
meta('relationships-layout', String(attrs.layout ?? 'list')),
|
|
47
|
+
meta('relationships-empty', String(attrs.empty ?? '')),
|
|
48
|
+
meta(RELATIONSHIPS_SENTINEL, 'true'),
|
|
49
|
+
];
|
|
50
|
+
if (bodySource)
|
|
51
|
+
metas.push(meta('relationships-body', bodySource));
|
|
52
|
+
const placeholder = new Tag('div', { 'data-name': 'items' }, []);
|
|
53
|
+
return createComponentRenderable({
|
|
54
|
+
rune: 'relationships',
|
|
55
|
+
tag: 'section',
|
|
56
|
+
properties: {},
|
|
57
|
+
refs: { items: placeholder },
|
|
58
|
+
children: [...metas, placeholder],
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=rel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;IACJ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `snippet` rune — embed a file's contents as a syntax-highlighted code
|
|
3
|
+
* block (SPEC-062).
|
|
4
|
+
*
|
|
5
|
+
* Implementation note: snippet is implemented as an **AST preprocessor**
|
|
6
|
+
* rather than a transform-time rune. Every `{% snippet %}` tag is replaced
|
|
7
|
+
* by a Markdoc `fence` node before the schema-driven transform runs (see
|
|
8
|
+
* `corePipelineHooks.preprocess` in `../config.ts`). By the time the transform
|
|
9
|
+
* reaches the AST, no snippet tags exist — only fences. So this schema's
|
|
10
|
+
* `transform` function is **unreachable in normal operation**.
|
|
11
|
+
*
|
|
12
|
+
* The schema still exists for tooling: `refrakt inspect snippet`, the
|
|
13
|
+
* contracts generator, attribute validation, and the rune-catalog docs all
|
|
14
|
+
* read from it. If the transform ever does execute (e.g., the core preprocess
|
|
15
|
+
* hook isn't registered for some reason), it throws a clear error pointing
|
|
16
|
+
* the user at the registration site.
|
|
17
|
+
*/
|
|
18
|
+
export declare const snippet: import("@markdoc/markdoc").Schema;
|
|
19
|
+
//# sourceMappingURL=snippet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/tags/snippet.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,OAAO,mCA+BlB,CAAC"}
|