@fuzdev/mdz 0.4.0 → 0.6.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/LICENSE +10 -17
- package/README.md +2 -3
- package/dist/MdzNodeView.svelte +59 -23
- package/dist/MdzNodeView.svelte.d.ts.map +1 -1
- package/dist/MdzStreamNodeView.svelte +63 -23
- package/dist/MdzStreamNodeView.svelte.d.ts.map +1 -1
- package/dist/mdz.d.ts +12 -1
- package/dist/mdz.d.ts.map +1 -1
- package/dist/mdz.js +1 -1
- package/dist/mdz_contexts.d.ts +33 -6
- package/dist/mdz_contexts.d.ts.map +1 -1
- package/dist/mdz_helpers.d.ts +31 -3
- package/dist/mdz_helpers.d.ts.map +1 -1
- package/dist/mdz_helpers.js +102 -10
- package/dist/mdz_lexer.d.ts +3 -1
- package/dist/mdz_lexer.d.ts.map +1 -1
- package/dist/mdz_lexer.js +89 -15
- package/dist/mdz_opcodes.d.ts +3 -1
- package/dist/mdz_opcodes.d.ts.map +1 -1
- package/dist/mdz_opcodes_to_nodes.d.ts.map +1 -1
- package/dist/mdz_opcodes_to_nodes.js +3 -0
- package/dist/mdz_stream_parser_link.d.ts.map +1 -1
- package/dist/mdz_stream_parser_link.js +81 -9
- package/dist/mdz_stream_parser_table.js +8 -1
- package/dist/mdz_stream_state.svelte.d.ts +3 -1
- package/dist/mdz_stream_state.svelte.d.ts.map +1 -1
- package/dist/mdz_stream_state.svelte.js +4 -0
- package/dist/mdz_to_svelte.d.ts +17 -4
- package/dist/mdz_to_svelte.d.ts.map +1 -1
- package/dist/mdz_to_svelte.js +22 -9
- package/dist/mdz_token_parser.d.ts.map +1 -1
- package/dist/mdz_token_parser.js +16 -2
- package/dist/svelte_preprocess_mdz.d.ts +5 -2
- package/dist/svelte_preprocess_mdz.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/lib/mdz.ts +13 -1
- package/src/lib/mdz_contexts.ts +36 -6
- package/src/lib/mdz_helpers.ts +129 -14
- package/src/lib/mdz_lexer.ts +98 -15
- package/src/lib/mdz_opcodes.ts +3 -1
- package/src/lib/mdz_opcodes_to_nodes.ts +5 -0
- package/src/lib/mdz_stream_parser_link.ts +77 -7
- package/src/lib/mdz_stream_parser_table.ts +8 -1
- package/src/lib/mdz_stream_state.svelte.ts +4 -1
- package/src/lib/mdz_to_svelte.ts +57 -13
- package/src/lib/mdz_token_parser.ts +16 -2
- package/src/lib/svelte_preprocess_mdz.ts +6 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
BSD Zero Clause License
|
|
2
2
|
|
|
3
3
|
Copyright (c) fuz.dev
|
|
4
4
|
|
|
5
|
-
Permission
|
|
6
|
-
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for
|
|
6
|
+
any purpose with or without fee is hereby granted.
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
|
|
9
|
+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
10
|
+
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
11
|
+
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
|
|
12
|
+
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
|
13
|
+
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
14
|
+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -27,8 +27,7 @@ For more see the [docs](https://mdz.fuz.dev/docs).
|
|
|
27
27
|
AI disclosure: almost everything here was generated by machine agents except
|
|
28
28
|
for the designs and intros. mdz is the result of 5+ years of prototyping ideas.
|
|
29
29
|
|
|
30
|
-
> ⚠️ This project is pre-stable: breaking changes are expected
|
|
31
|
-
> some features (like attributes) are not yet implemented.
|
|
30
|
+
> ⚠️ This project is pre-stable: breaking changes are expected.
|
|
32
31
|
> Feedback is welcome!
|
|
33
32
|
|
|
34
33
|
## Contributing
|
|
@@ -37,4 +36,4 @@ for the designs and intros. mdz is the result of 5+ years of prototyping ideas.
|
|
|
37
36
|
|
|
38
37
|
## License
|
|
39
38
|
|
|
40
|
-
[
|
|
39
|
+
[0BSD](LICENSE)
|
package/dist/MdzNodeView.svelte
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { DEV } from 'esm-env';
|
|
2
3
|
import { resolve } from '$app/paths';
|
|
3
4
|
|
|
4
|
-
import type { MdzNode, MdzNodeTableRow, MdzTableAlign } from './mdz.js';
|
|
5
|
-
import {
|
|
5
|
+
import type { MdzAttribute, MdzNode, MdzNodeTableRow, MdzTableAlign } from './mdz.js';
|
|
6
|
+
import {
|
|
7
|
+
mdz_classify_link,
|
|
8
|
+
mdz_is_void_element,
|
|
9
|
+
mdz_filter_element_attributes,
|
|
10
|
+
mdz_filter_component_attributes,
|
|
11
|
+
mdz_component_config,
|
|
12
|
+
mdz_format_unregistered_attributes,
|
|
13
|
+
ALLOWED_ELEMENT_ATTRIBUTES
|
|
14
|
+
} from './mdz_helpers.js';
|
|
6
15
|
import {
|
|
7
16
|
mdz_components_context,
|
|
8
17
|
mdz_elements_context,
|
|
@@ -24,6 +33,16 @@
|
|
|
24
33
|
const get_mdz_base = mdz_base_context.get_maybe();
|
|
25
34
|
const get_code = mdz_code_context.get_maybe();
|
|
26
35
|
const get_codeblock = mdz_codeblock_context.get_maybe();
|
|
36
|
+
|
|
37
|
+
// `resolve()`'s pathname branch, widened to runtime strings: the app's `Path` union
|
|
38
|
+
// only types known routes, and mdz references are authored content. Sound because
|
|
39
|
+
// `mdz_classify_link` strips the leading slash, so the call never takes the route-id branch.
|
|
40
|
+
const resolve_pathname = resolve as (pathname: string) => string;
|
|
41
|
+
|
|
42
|
+
// the boundary renders the placeholder silently, so surface the cause in DEV
|
|
43
|
+
const on_component_error = DEV
|
|
44
|
+
? (error: unknown) => console.error('mdz: component failed to render', error)
|
|
45
|
+
: undefined;
|
|
27
46
|
</script>
|
|
28
47
|
|
|
29
48
|
<!-- The tree renders through recursive snippets rather than recursive
|
|
@@ -38,30 +57,44 @@ tree instead of per node. -->
|
|
|
38
57
|
{#snippet render_node(node: MdzNode)}
|
|
39
58
|
{#if node.type === 'Element'}
|
|
40
59
|
{@const element_config = get_elements?.()?.get(node.name)}
|
|
41
|
-
{#if element_config
|
|
60
|
+
{#if element_config === true}
|
|
61
|
+
{@const attrs = mdz_filter_element_attributes(
|
|
62
|
+
node.name,
|
|
63
|
+
node.attributes,
|
|
64
|
+
ALLOWED_ELEMENT_ATTRIBUTES
|
|
65
|
+
)}
|
|
42
66
|
{#if mdz_is_void_element(node.name)}
|
|
43
67
|
<!-- void elements cannot have content — any parsed children are dropped -->
|
|
44
|
-
<svelte:element this={node.name} />
|
|
68
|
+
<svelte:element this={node.name} {...attrs} />
|
|
45
69
|
{:else}
|
|
46
|
-
<svelte:element this={node.name}>
|
|
70
|
+
<svelte:element this={node.name} {...attrs}>
|
|
47
71
|
{#if node.children.length > 0}
|
|
48
72
|
{@render render_children(node.children)}
|
|
49
73
|
{/if}
|
|
50
74
|
</svelte:element>
|
|
51
75
|
{/if}
|
|
52
76
|
{:else}
|
|
53
|
-
{@render render_unregistered_tag(node.name, node.children)}
|
|
77
|
+
{@render render_unregistered_tag(node.name, node.attributes, node.children)}
|
|
54
78
|
{/if}
|
|
55
79
|
{:else if node.type === 'Component'}
|
|
56
|
-
{@const
|
|
57
|
-
{#if
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
{@const entry = get_components?.()?.get(node.name)}
|
|
81
|
+
{#if entry}
|
|
82
|
+
{@const config = mdz_component_config(entry)}
|
|
83
|
+
{@const props = mdz_filter_component_attributes(node.name, node.attributes, config.props)}
|
|
84
|
+
<!-- a per-node boundary: a component that throws (say on an unexpected prop
|
|
85
|
+
value) degrades to its literal placeholder instead of taking down the tree -->
|
|
86
|
+
<svelte:boundary onerror={on_component_error}>
|
|
87
|
+
<config.component {...props}>
|
|
88
|
+
{#if node.children.length > 0}
|
|
89
|
+
{@render render_children(node.children)}
|
|
90
|
+
{/if}
|
|
91
|
+
</config.component>
|
|
92
|
+
{#snippet failed()}
|
|
93
|
+
{@render render_unregistered_tag(node.name, node.attributes, node.children)}
|
|
94
|
+
{/snippet}
|
|
95
|
+
</svelte:boundary>
|
|
63
96
|
{:else}
|
|
64
|
-
{@render render_unregistered_tag(node.name, node.children)}
|
|
97
|
+
{@render render_unregistered_tag(node.name, node.attributes, node.children)}
|
|
65
98
|
{/if}
|
|
66
99
|
{:else if node.type === 'Text'}
|
|
67
100
|
{node.content}
|
|
@@ -83,14 +116,14 @@ tree instead of per node. -->
|
|
|
83
116
|
{#if link.kind === 'unsafe'}
|
|
84
117
|
{@render render_children(node.children)}
|
|
85
118
|
{:else if link.kind === 'resolve'}
|
|
86
|
-
<a href={
|
|
119
|
+
<a href={resolve_pathname(link.path)}>{@render render_children(node.children)}</a>
|
|
87
120
|
{:else if link.kind === 'external'}
|
|
88
121
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
|
89
122
|
<a href={link.href} target="_blank" rel="noopener">
|
|
90
123
|
{@render render_children(node.children)}
|
|
91
124
|
</a>
|
|
92
125
|
{:else}
|
|
93
|
-
<!-- fragment/query/relative/bare references
|
|
126
|
+
<!-- fragment/query/relative/bare references aren't under the base, so they skip resolve() -->
|
|
94
127
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
|
95
128
|
<a href={link.href}>{@render render_children(node.children)}</a>
|
|
96
129
|
{/if}
|
|
@@ -170,14 +203,17 @@ tree instead of per node. -->
|
|
|
170
203
|
{/each}
|
|
171
204
|
{/snippet}
|
|
172
205
|
|
|
173
|
-
{#snippet render_unregistered_tag(
|
|
206
|
+
{#snippet render_unregistered_tag(
|
|
207
|
+
name: string,
|
|
208
|
+
attributes: Array<MdzAttribute>,
|
|
209
|
+
children: Array<MdzNode>
|
|
210
|
+
)}
|
|
211
|
+
{@const formatted = mdz_format_unregistered_attributes(attributes)}
|
|
174
212
|
{#if children.length > 0}
|
|
175
|
-
<code class="color_c_50"><{name}></code>{@render render_children(
|
|
176
|
-
|
|
177
|
-
>
|
|
178
|
-
</{name}>
|
|
179
|
-
</code>
|
|
213
|
+
<code class="color_c_50"><{name}{formatted}></code>{@render render_children(
|
|
214
|
+
children
|
|
215
|
+
)}<code class="color_c_50"></{name}></code>
|
|
180
216
|
{:else}
|
|
181
|
-
<code class="color_c_50"><{name} /></code>
|
|
217
|
+
<code class="color_c_50"><{name}{formatted} /></code>
|
|
182
218
|
{/if}
|
|
183
219
|
{/snippet}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MdzNodeView.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/MdzNodeView.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MdzNodeView.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/MdzNodeView.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,OAAO,EAAkC,MAAM,UAAU,CAAC;AAkBrF,KAAK,gBAAgB,GAGpB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAkMrF,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { DEV } from 'esm-env';
|
|
2
3
|
import { resolve } from '$app/paths';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
mdz_classify_link,
|
|
7
|
+
mdz_is_void_element,
|
|
8
|
+
mdz_filter_element_attributes,
|
|
9
|
+
mdz_filter_component_attributes,
|
|
10
|
+
mdz_component_config,
|
|
11
|
+
mdz_format_unregistered_attributes,
|
|
12
|
+
ALLOWED_ELEMENT_ATTRIBUTES
|
|
13
|
+
} from './mdz_helpers.js';
|
|
5
14
|
import {
|
|
6
15
|
mdz_components_context,
|
|
7
16
|
mdz_elements_context,
|
|
@@ -10,7 +19,7 @@
|
|
|
10
19
|
mdz_codeblock_context
|
|
11
20
|
} from './mdz_contexts.js';
|
|
12
21
|
import type { MdzStreamNode } from './mdz_stream_state.svelte.js';
|
|
13
|
-
import type { MdzTableAlign } from './mdz.js';
|
|
22
|
+
import type { MdzAttribute, MdzTableAlign } from './mdz.js';
|
|
14
23
|
|
|
15
24
|
const {
|
|
16
25
|
node,
|
|
@@ -27,6 +36,11 @@
|
|
|
27
36
|
const get_code = mdz_code_context.get_maybe();
|
|
28
37
|
const get_codeblock = mdz_codeblock_context.get_maybe();
|
|
29
38
|
|
|
39
|
+
// `resolve()`'s pathname branch, widened to runtime strings: the app's `Path` union
|
|
40
|
+
// only types known routes, and mdz references are authored content. Sound because
|
|
41
|
+
// `mdz_classify_link` strips the leading slash, so the call never takes the route-id branch.
|
|
42
|
+
const resolve_pathname = resolve as (pathname: string) => string;
|
|
43
|
+
|
|
30
44
|
// While a Code/Codeblock container is open, streamed text accumulates in
|
|
31
45
|
// `children`; `MdzStreamState` collapses it into `content` at close. Joining
|
|
32
46
|
// the children makes the content visible as it streams instead of popping in
|
|
@@ -34,6 +48,11 @@
|
|
|
34
48
|
// it's identical, the children are just retained in the render tree).
|
|
35
49
|
const streaming_content = (n: MdzStreamNode): string =>
|
|
36
50
|
n.content || n.children.map((c) => c.content).join('');
|
|
51
|
+
|
|
52
|
+
// the boundary renders the placeholder silently, so surface the cause in DEV
|
|
53
|
+
const on_component_error = DEV
|
|
54
|
+
? (error: unknown) => console.error('mdz: component failed to render', error)
|
|
55
|
+
: undefined;
|
|
37
56
|
</script>
|
|
38
57
|
|
|
39
58
|
<!-- The tree renders through recursive snippets rather than recursive
|
|
@@ -48,30 +67,48 @@ tree instead of per node. -->
|
|
|
48
67
|
{#snippet render_node(node: MdzStreamNode)}
|
|
49
68
|
{#if node.type === 'Element'}
|
|
50
69
|
{@const element_config = get_elements?.()?.get(node.name ?? '')}
|
|
51
|
-
{#if element_config
|
|
70
|
+
{#if element_config === true}
|
|
71
|
+
{@const attrs = mdz_filter_element_attributes(
|
|
72
|
+
node.name ?? '',
|
|
73
|
+
node.attributes ?? [],
|
|
74
|
+
ALLOWED_ELEMENT_ATTRIBUTES
|
|
75
|
+
)}
|
|
52
76
|
{#if mdz_is_void_element(node.name ?? '')}
|
|
53
77
|
<!-- void elements cannot have content — any parsed children are dropped -->
|
|
54
|
-
<svelte:element this={node.name} />
|
|
78
|
+
<svelte:element this={node.name} {...attrs} />
|
|
55
79
|
{:else}
|
|
56
|
-
<svelte:element this={node.name}>
|
|
80
|
+
<svelte:element this={node.name} {...attrs}>
|
|
57
81
|
{#if node.children.length > 0}
|
|
58
82
|
{@render render_children(node.children)}
|
|
59
83
|
{/if}
|
|
60
84
|
</svelte:element>
|
|
61
85
|
{/if}
|
|
62
86
|
{:else}
|
|
63
|
-
{@render render_unregistered_tag(node.name ?? '', node.children)}
|
|
87
|
+
{@render render_unregistered_tag(node.name ?? '', node.attributes ?? [], node.children)}
|
|
64
88
|
{/if}
|
|
65
89
|
{:else if node.type === 'Component'}
|
|
66
|
-
{@const
|
|
67
|
-
{#if
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
90
|
+
{@const entry = get_components?.()?.get(node.name ?? '')}
|
|
91
|
+
{#if entry}
|
|
92
|
+
{@const config = mdz_component_config(entry)}
|
|
93
|
+
{@const props = mdz_filter_component_attributes(
|
|
94
|
+
node.name ?? '',
|
|
95
|
+
node.attributes ?? [],
|
|
96
|
+
config.props
|
|
97
|
+
)}
|
|
98
|
+
<!-- a per-node boundary: a component that throws (say on an unexpected prop
|
|
99
|
+
value) degrades to its literal placeholder instead of taking down the tree -->
|
|
100
|
+
<svelte:boundary onerror={on_component_error}>
|
|
101
|
+
<config.component {...props}>
|
|
102
|
+
{#if node.children.length > 0}
|
|
103
|
+
{@render render_children(node.children)}
|
|
104
|
+
{/if}
|
|
105
|
+
</config.component>
|
|
106
|
+
{#snippet failed()}
|
|
107
|
+
{@render render_unregistered_tag(node.name ?? '', node.attributes ?? [], node.children)}
|
|
108
|
+
{/snippet}
|
|
109
|
+
</svelte:boundary>
|
|
73
110
|
{:else}
|
|
74
|
-
{@render render_unregistered_tag(node.name ?? '', node.children)}
|
|
111
|
+
{@render render_unregistered_tag(node.name ?? '', node.attributes ?? [], node.children)}
|
|
75
112
|
{/if}
|
|
76
113
|
{:else if node.type === 'Text'}
|
|
77
114
|
{node.content}
|
|
@@ -94,14 +131,14 @@ tree instead of per node. -->
|
|
|
94
131
|
{#if link.kind === 'unsafe'}
|
|
95
132
|
{@render render_children(node.children)}
|
|
96
133
|
{:else if link.kind === 'resolve'}
|
|
97
|
-
<a href={
|
|
134
|
+
<a href={resolve_pathname(link.path)}>{@render render_children(node.children)}</a>
|
|
98
135
|
{:else if link.kind === 'external'}
|
|
99
136
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
|
100
137
|
<a href={link.href} target="_blank" rel="noopener">
|
|
101
138
|
{@render render_children(node.children)}
|
|
102
139
|
</a>
|
|
103
140
|
{:else}
|
|
104
|
-
<!-- fragment/query/relative/bare references
|
|
141
|
+
<!-- fragment/query/relative/bare references aren't under the base, so they skip resolve() -->
|
|
105
142
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
|
106
143
|
<a href={link.href}>{@render render_children(node.children)}</a>
|
|
107
144
|
{/if}
|
|
@@ -179,14 +216,17 @@ tree instead of per node. -->
|
|
|
179
216
|
{/each}
|
|
180
217
|
{/snippet}
|
|
181
218
|
|
|
182
|
-
{#snippet render_unregistered_tag(
|
|
219
|
+
{#snippet render_unregistered_tag(
|
|
220
|
+
name: string,
|
|
221
|
+
attributes: Array<MdzAttribute>,
|
|
222
|
+
children: Array<MdzStreamNode>
|
|
223
|
+
)}
|
|
224
|
+
{@const formatted = mdz_format_unregistered_attributes(attributes)}
|
|
183
225
|
{#if children.length > 0}
|
|
184
|
-
<code class="color_c_50"><{name}></code>{@render render_children(
|
|
185
|
-
|
|
186
|
-
>
|
|
187
|
-
</{name}>
|
|
188
|
-
</code>
|
|
226
|
+
<code class="color_c_50"><{name}{formatted}></code>{@render render_children(
|
|
227
|
+
children
|
|
228
|
+
)}<code class="color_c_50"></{name}></code>
|
|
189
229
|
{:else}
|
|
190
|
-
<code class="color_c_50"><{name} /></code>
|
|
230
|
+
<code class="color_c_50"><{name}{formatted} /></code>
|
|
191
231
|
{/if}
|
|
192
232
|
{/snippet}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MdzStreamNodeView.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/MdzStreamNodeView.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MdzStreamNodeView.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/MdzStreamNodeView.svelte"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGjE,KAAK,gBAAgB,GAGpB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;CAAE,CAAC;AAkNjG,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
package/dist/mdz.d.ts
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* ## Status
|
|
46
46
|
*
|
|
47
47
|
* Pre-stable — breaking changes are expected as the dialect matures.
|
|
48
|
-
* Next:
|
|
48
|
+
* Next: editing.
|
|
49
49
|
*
|
|
50
50
|
* @module
|
|
51
51
|
*/
|
|
@@ -194,16 +194,27 @@ export interface MdzNodeTableCell extends MdzNodeBase {
|
|
|
194
194
|
/** Inline content only (text, bold, italic, strikethrough, code, links). */
|
|
195
195
|
children: Array<MdzNode>;
|
|
196
196
|
}
|
|
197
|
+
export interface MdzAttribute {
|
|
198
|
+
name: string;
|
|
199
|
+
/** `true` for bare boolean shorthand (`disabled` ≡ `disabled={true}`). */
|
|
200
|
+
value: string | true;
|
|
201
|
+
start: number;
|
|
202
|
+
end: number;
|
|
203
|
+
}
|
|
197
204
|
export interface MdzNodeElement extends MdzNodeBase {
|
|
198
205
|
type: 'Element';
|
|
199
206
|
/** HTML element name (e.g. `div`, `span`, `aside`). */
|
|
200
207
|
name: string;
|
|
208
|
+
/** Parsed tag attributes; always present, possibly empty. */
|
|
209
|
+
attributes: Array<MdzAttribute>;
|
|
201
210
|
children: Array<MdzNode>;
|
|
202
211
|
}
|
|
203
212
|
export interface MdzNodeComponent extends MdzNodeBase {
|
|
204
213
|
type: 'Component';
|
|
205
214
|
/** Svelte component name (e.g. `Alert`, `Card`). */
|
|
206
215
|
name: string;
|
|
216
|
+
/** Parsed tag attributes; always present, possibly empty. */
|
|
217
|
+
attributes: Array<MdzAttribute>;
|
|
207
218
|
children: Array<MdzNode>;
|
|
208
219
|
}
|
|
209
220
|
//# sourceMappingURL=mdz.d.ts.map
|
package/dist/mdz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAOH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,KAAK,CAAC,OAAO,CACI,CAAC;AAE3D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,kBAAkB;;IAI9B,gFAAgF;gBACpE,IAAI,EAAE,MAAM;IAIxB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;CAI3D;AAED,MAAM,MAAM,OAAO,GAChB,WAAW,GACX,WAAW,GACX,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,oBAAoB,GACpB,WAAW,GACX,gBAAgB,GAChB,SAAS,GACT,cAAc,GACd,WAAW,GACX,eAAe,GACf,iBAAiB,GACjB,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,gBAAgB,CAAC;AAEpB,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;C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AI,EAAE,UAAU,CAAC;IACjB,8FAA8F;IAC9F,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACpD,IAAI,EAAE,WAAW,CAAC;IAClB,4EAA4E;IAC5E,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IAClD,IAAI,EAAE,SAAS,CAAC;IAChB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACpD,IAAI,EAAE,WAAW,CAAC;IAClB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;CACzB"}
|
package/dist/mdz.js
CHANGED
package/dist/mdz_contexts.d.ts
CHANGED
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import type { Component } from 'svelte';
|
|
2
|
+
/**
|
|
3
|
+
* The attributes a registered component receives as props: a list of allowed
|
|
4
|
+
* names, or `'all'` to pass every attribute through. Attributes outside the
|
|
5
|
+
* list are dropped (DEV-warned).
|
|
6
|
+
*/
|
|
7
|
+
export type MdzComponentProps = ReadonlyArray<string> | 'all';
|
|
8
|
+
/**
|
|
9
|
+
* A component registry entry that allows attributes through as props.
|
|
10
|
+
*/
|
|
11
|
+
export interface MdzComponentConfig {
|
|
12
|
+
component: Component<any, any>;
|
|
13
|
+
/** Attribute names passed as props, or `'all'`; omitted passes none. */
|
|
14
|
+
props?: MdzComponentProps;
|
|
15
|
+
}
|
|
2
16
|
/**
|
|
3
17
|
* Component registry for custom Svelte components that can be used in mdz content.
|
|
4
18
|
*
|
|
5
|
-
*
|
|
19
|
+
* A bare component entry renders the tag with no props — its attributes are
|
|
20
|
+
* dropped. A `MdzComponentConfig` entry names the attributes that pass through
|
|
21
|
+
* as props, so a component only receives what it's prepared for:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* new Map([
|
|
25
|
+
* ['Alert', {component: Alert, props: ['status']}], // `<Alert status="error">`
|
|
26
|
+
* ['Note', Note], // `<Note>`, attributes dropped
|
|
27
|
+
* ]);
|
|
28
|
+
* ```
|
|
6
29
|
*
|
|
7
|
-
*
|
|
30
|
+
* Attribute values are author-controlled strings (or `true` for bare names),
|
|
31
|
+
* so with untrusted content, allow only props the component treats safely.
|
|
32
|
+
* `props: 'all'` passes everything — a component that spreads rest props onto
|
|
33
|
+
* an element then forwards `style`, `href`, and the like.
|
|
8
34
|
*/
|
|
9
|
-
export type MdzComponents = Map<string, Component<any, any
|
|
35
|
+
export type MdzComponents = Map<string, Component<any, any> | MdzComponentConfig>;
|
|
10
36
|
/**
|
|
11
37
|
* Element registry for HTML elements that can be used in mdz content.
|
|
12
38
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
39
|
+
* Register an element by mapping its name to `true` (e.g. `['aside', true]`),
|
|
40
|
+
* which allows `<aside>...</aside>` in mdz content. Only `true` enables an
|
|
41
|
+
* element — the renderers treat any other value (including `false`) as
|
|
42
|
+
* unregistered, so the tag falls back to literal text.
|
|
16
43
|
*/
|
|
17
44
|
export type MdzElements = Map<string, boolean>;
|
|
18
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_contexts.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_contexts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIxC
|
|
1
|
+
{"version":3,"file":"mdz_contexts.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_contexts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIxC;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,wEAAwE;IACxE,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC;AAEnG;;;GAGG;AACH,eAAO,MAAM,sBAAsB;2CAAwB,aAAa,GAAG,SAAS;4BAAzB,aAAa,GAAG,SAAS;uBAAzB,aAAa,GAAG,SAAS,WAAzB,aAAa,GAAG,SAAS;CAAG,CAAC;AAExF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;2CAAwB,WAAW,GAAG,SAAS;4BAAvB,WAAW,GAAG,SAAS;uBAAvB,WAAW,GAAG,SAAS,WAAvB,WAAW,GAAG,SAAS;CA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
import type { Component } from 'svelte';
|
|
10
|
+
import type { MdzAttribute, MdzNode, MdzNodeComponent, MdzNodeElement, MdzTableAlign } from './mdz.js';
|
|
11
|
+
import type { MdzComponentConfig, MdzComponentProps } from './mdz_contexts.js';
|
|
10
12
|
/** @nodocs */
|
|
11
13
|
export declare const BACKTICK = 96;
|
|
12
14
|
/** @nodocs */
|
|
@@ -66,6 +68,8 @@ export declare const AMPERSAND = 38;
|
|
|
66
68
|
/** @nodocs */
|
|
67
69
|
export declare const APOSTROPHE = 39;
|
|
68
70
|
/** @nodocs */
|
|
71
|
+
export declare const DOUBLE_QUOTE = 34;
|
|
72
|
+
/** @nodocs */
|
|
69
73
|
export declare const PLUS = 43;
|
|
70
74
|
/** @nodocs */
|
|
71
75
|
export declare const EQUALS = 61;
|
|
@@ -349,6 +353,18 @@ export declare const mdz_is_safe_reference: (reference: string) => boolean;
|
|
|
349
353
|
* Void elements render self-closing; any parsed children are dropped.
|
|
350
354
|
*/
|
|
351
355
|
export declare const mdz_is_void_element: (name: string) => boolean;
|
|
356
|
+
/**
|
|
357
|
+
* The closed, global set of attribute names allowed on rendered HTML elements.
|
|
358
|
+
* Every name is inert on any element (no URL, no script, no focus or DOM
|
|
359
|
+
* clobbering), so element safety is independent of which element names a
|
|
360
|
+
* consumer registers. Anything outside this set is dropped by
|
|
361
|
+
* `mdz_filter_element_attributes`.
|
|
362
|
+
*/
|
|
363
|
+
export declare const ALLOWED_ELEMENT_ATTRIBUTES: ReadonlySet<string>;
|
|
364
|
+
export declare const mdz_filter_element_attributes: (element_name: string, attributes: Array<MdzAttribute>, allowlist: ReadonlySet<string>) => Record<string, string | true>;
|
|
365
|
+
export declare const mdz_filter_component_attributes: (component_name: string, attributes: Array<MdzAttribute>, props: MdzComponentProps | undefined) => Record<string, string | true>;
|
|
366
|
+
export declare const mdz_component_config: (entry: Component<any, any> | MdzComponentConfig) => MdzComponentConfig;
|
|
367
|
+
export declare const mdz_format_unregistered_attributes: (attributes: Array<MdzAttribute>) => string;
|
|
352
368
|
/**
|
|
353
369
|
* Resolves a relative path (`./` or `../`) against a base path.
|
|
354
370
|
* The base is treated as a directory regardless of trailing slash
|
|
@@ -373,10 +389,15 @@ export type MdzLinkRender =
|
|
|
373
389
|
{
|
|
374
390
|
kind: 'unsafe';
|
|
375
391
|
}
|
|
376
|
-
/**
|
|
392
|
+
/**
|
|
393
|
+
* Absolute path — render `resolve(path)` (needs `$app/paths`). `path` is the
|
|
394
|
+
* reference minus its leading slash, SvelteKit's pathname form, which only
|
|
395
|
+
* prepends the base path (or `#` under hash routing; a relative `./`/`../`
|
|
396
|
+
* prefix under `paths.relative` SSR) and keeps the rest verbatim.
|
|
397
|
+
*/
|
|
377
398
|
| {
|
|
378
399
|
kind: 'resolve';
|
|
379
|
-
|
|
400
|
+
path: string;
|
|
380
401
|
}
|
|
381
402
|
/** Internal fragment/query/relative/bare ref — raw `href`, no `resolve()`. */
|
|
382
403
|
| {
|
|
@@ -391,6 +412,13 @@ export type MdzLinkRender =
|
|
|
391
412
|
/**
|
|
392
413
|
* Classify a `Link` reference into how it should render. Pure — no rendering,
|
|
393
414
|
* no context; `base` is the resolved base path (or `undefined`).
|
|
415
|
+
*
|
|
416
|
+
* Absolute references are authored URLs, not SvelteKit route ids: they classify
|
|
417
|
+
* as `resolve` with the base-relative pathname, never a leading-slash route id,
|
|
418
|
+
* whose resolution would drop `(group)` and empty segments, decode `[x+nn]`
|
|
419
|
+
* escapes, and throw on `[param]` segments. A leading `/` followed by any `/`
|
|
420
|
+
* or `\` run collapses to one `/`, so `//host` and `/\host` stay under the base
|
|
421
|
+
* rather than becoming protocol-relative.
|
|
394
422
|
* @nodocs
|
|
395
423
|
*/
|
|
396
424
|
export declare const mdz_classify_link: (reference: string, link_type: "internal" | "external" | undefined, base: string | undefined) => MdzLinkRender;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_helpers.ts"],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