@hymarkx/compiler 0.0.2
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-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +23 -0
- package/dist/analyze/index.d.ts +75 -0
- package/dist/analyze/index.d.ts.map +1 -0
- package/dist/analyze/index.js +455 -0
- package/dist/analyze/index.js.map +1 -0
- package/dist/components/authored.d.ts +30 -0
- package/dist/components/authored.d.ts.map +1 -0
- package/dist/components/authored.js +293 -0
- package/dist/components/authored.js.map +1 -0
- package/dist/components/builtins.d.ts +6 -0
- package/dist/components/builtins.d.ts.map +1 -0
- package/dist/components/builtins.js +205 -0
- package/dist/components/builtins.js.map +1 -0
- package/dist/components/styles.d.ts +3 -0
- package/dist/components/styles.d.ts.map +1 -0
- package/dist/components/styles.js +99 -0
- package/dist/components/styles.js.map +1 -0
- package/dist/components/types.d.ts +77 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/components/types.js +2 -0
- package/dist/components/types.js.map +1 -0
- package/dist/components/validate.d.ts +14 -0
- package/dist/components/validate.d.ts.map +1 -0
- package/dist/components/validate.js +347 -0
- package/dist/components/validate.js.map +1 -0
- package/dist/diagnostic-origin.d.ts +11 -0
- package/dist/diagnostic-origin.d.ts.map +1 -0
- package/dist/diagnostic-origin.js +12 -0
- package/dist/diagnostic-origin.js.map +1 -0
- package/dist/diagnostics/render.d.ts +13 -0
- package/dist/diagnostics/render.d.ts.map +1 -0
- package/dist/diagnostics/render.js +92 -0
- package/dist/diagnostics/render.js.map +1 -0
- package/dist/emit/backend.d.ts +13 -0
- package/dist/emit/backend.d.ts.map +1 -0
- package/dist/emit/backend.js +2 -0
- package/dist/emit/backend.js.map +1 -0
- package/dist/emit/escape.d.ts +5 -0
- package/dist/emit/escape.d.ts.map +1 -0
- package/dist/emit/escape.js +52 -0
- package/dist/emit/escape.js.map +1 -0
- package/dist/emit/html.d.ts +16 -0
- package/dist/emit/html.d.ts.map +1 -0
- package/dist/emit/html.js +528 -0
- package/dist/emit/html.js.map +1 -0
- package/dist/emit/sanitize.d.ts +19 -0
- package/dist/emit/sanitize.d.ts.map +1 -0
- package/dist/emit/sanitize.js +383 -0
- package/dist/emit/sanitize.js.map +1 -0
- package/dist/events.d.ts +7 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +16 -0
- package/dist/events.js.map +1 -0
- package/dist/expression.d.ts +133 -0
- package/dist/expression.d.ts.map +1 -0
- package/dist/expression.js +1248 -0
- package/dist/expression.js.map +1 -0
- package/dist/frontmatter.d.ts +15 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +196 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -0
- package/dist/index.js.map +1 -0
- package/dist/islands.d.ts +23 -0
- package/dist/islands.d.ts.map +1 -0
- package/dist/islands.js +76 -0
- package/dist/islands.js.map +1 -0
- package/dist/runtime.d.ts +14 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +487 -0
- package/dist/runtime.js.map +1 -0
- package/dist/styles.d.ts +33 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +370 -0
- package/dist/styles.js.map +1 -0
- package/dist/suggestions.d.ts +3 -0
- package/dist/suggestions.d.ts.map +1 -0
- package/dist/suggestions.js +29 -0
- package/dist/suggestions.js.map +1 -0
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { createDiagnostic, visit } from '@hymarkx/ast';
|
|
2
|
+
import { parse } from '@hymarkx/parser';
|
|
3
|
+
import { setDiagnosticOrigin } from '../diagnostic-origin.js';
|
|
4
|
+
import { compileFrontmatter } from '../frontmatter.js';
|
|
5
|
+
import { componentHtmlDiagnostics, isAllowedDocumentUrl } from '../emit/sanitize.js';
|
|
6
|
+
import { builtinComponents } from './builtins.js';
|
|
7
|
+
const ATTRIBUTE_TYPES = new Set([
|
|
8
|
+
'string',
|
|
9
|
+
'number',
|
|
10
|
+
'boolean',
|
|
11
|
+
'enum',
|
|
12
|
+
'url',
|
|
13
|
+
'identifier',
|
|
14
|
+
]);
|
|
15
|
+
const SCHEMA_KEYS = new Set(['type', 'values', 'required', 'default', 'min', 'max', 'description']);
|
|
16
|
+
const IDENTIFIER = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
17
|
+
const authoredRenderers = new WeakMap();
|
|
18
|
+
function isMapping(value) {
|
|
19
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
function componentPath(component) {
|
|
22
|
+
return component.from ?? `${component.name}.hmx`;
|
|
23
|
+
}
|
|
24
|
+
function componentDiagnostic(component, span, code, severity, message) {
|
|
25
|
+
const diagnostic = createDiagnostic({ code, severity, message, span });
|
|
26
|
+
setDiagnosticOrigin(diagnostic, component.source, component.from);
|
|
27
|
+
return diagnostic;
|
|
28
|
+
}
|
|
29
|
+
function authoredDescription(component, propName) {
|
|
30
|
+
return `Property "${propName}" accepted by authored component "${component.name}".`;
|
|
31
|
+
}
|
|
32
|
+
function scalarDefault(value) {
|
|
33
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'
|
|
34
|
+
? String(value)
|
|
35
|
+
: undefined;
|
|
36
|
+
}
|
|
37
|
+
function validDefault(value, schema, trust) {
|
|
38
|
+
switch (schema.type) {
|
|
39
|
+
case 'string':
|
|
40
|
+
return true;
|
|
41
|
+
case 'number': {
|
|
42
|
+
const parsed = Number(value);
|
|
43
|
+
return (Number.isFinite(parsed) &&
|
|
44
|
+
Number.isInteger(parsed) &&
|
|
45
|
+
(schema.min === undefined || parsed >= schema.min) &&
|
|
46
|
+
(schema.max === undefined || parsed <= schema.max));
|
|
47
|
+
}
|
|
48
|
+
case 'boolean':
|
|
49
|
+
return value === 'true' || value === 'false';
|
|
50
|
+
case 'enum':
|
|
51
|
+
return schema.values?.includes(value) === true;
|
|
52
|
+
case 'identifier':
|
|
53
|
+
return IDENTIFIER.test(value);
|
|
54
|
+
case 'url':
|
|
55
|
+
return trust === 'app' || isAllowedDocumentUrl(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function propSchema(component, propName, value, span, trust, diagnostics) {
|
|
59
|
+
if (!isMapping(value)) {
|
|
60
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: schema for "${propName}" must be a mapping.`));
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
let malformed = false;
|
|
64
|
+
for (const key of Object.keys(value)) {
|
|
65
|
+
if (!SCHEMA_KEYS.has(key)) {
|
|
66
|
+
malformed = true;
|
|
67
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: unknown schema key "${key}" on "${propName}".`));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const typeValue = value.type;
|
|
71
|
+
if (typeof typeValue !== 'string' || !ATTRIBUTE_TYPES.has(typeValue)) {
|
|
72
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: "${propName}" has an invalid type.`));
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const type = typeValue;
|
|
76
|
+
let values;
|
|
77
|
+
if (value.values !== undefined) {
|
|
78
|
+
if (!Array.isArray(value.values) || !value.values.every((item) => typeof item === 'string')) {
|
|
79
|
+
malformed = true;
|
|
80
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: "values" on "${propName}" must contain only strings.`));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
values = value.values;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (type === 'enum' && (values === undefined || values.length === 0)) {
|
|
87
|
+
malformed = true;
|
|
88
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: enum prop "${propName}" requires values.`));
|
|
89
|
+
}
|
|
90
|
+
else if (type !== 'enum' && values !== undefined) {
|
|
91
|
+
malformed = true;
|
|
92
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: "values" is only valid for enum props.`));
|
|
93
|
+
}
|
|
94
|
+
const required = value.required;
|
|
95
|
+
if (required !== undefined && typeof required !== 'boolean') {
|
|
96
|
+
malformed = true;
|
|
97
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: "required" on "${propName}" must be boolean.`));
|
|
98
|
+
}
|
|
99
|
+
const min = value.min;
|
|
100
|
+
const max = value.max;
|
|
101
|
+
if ((min !== undefined && (typeof min !== 'number' || !Number.isFinite(min))) ||
|
|
102
|
+
(max !== undefined && (typeof max !== 'number' || !Number.isFinite(max))) ||
|
|
103
|
+
((min !== undefined || max !== undefined) && type !== 'number') ||
|
|
104
|
+
(typeof min === 'number' && typeof max === 'number' && min > max)) {
|
|
105
|
+
malformed = true;
|
|
106
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: numeric bounds on "${propName}" are invalid.`));
|
|
107
|
+
}
|
|
108
|
+
const description = value.description;
|
|
109
|
+
if (description !== undefined && typeof description !== 'string') {
|
|
110
|
+
malformed = true;
|
|
111
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: "description" on "${propName}" must be a string.`));
|
|
112
|
+
}
|
|
113
|
+
const schemaWithoutDefault = {
|
|
114
|
+
type,
|
|
115
|
+
...(values === undefined ? {} : { values }),
|
|
116
|
+
...(typeof required === 'boolean' ? { required } : {}),
|
|
117
|
+
...(typeof min === 'number' && type === 'number' ? { min } : {}),
|
|
118
|
+
...(typeof max === 'number' && type === 'number' ? { max } : {}),
|
|
119
|
+
description: typeof description === 'string' ? description : authoredDescription(component, propName),
|
|
120
|
+
};
|
|
121
|
+
const defaultValue = value.default === undefined ? undefined : scalarDefault(value.default);
|
|
122
|
+
if (value.default !== undefined &&
|
|
123
|
+
(defaultValue === undefined || !validDefault(defaultValue, schemaWithoutDefault, trust))) {
|
|
124
|
+
malformed = true;
|
|
125
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: default for "${propName}" does not satisfy its schema.`));
|
|
126
|
+
}
|
|
127
|
+
return malformed
|
|
128
|
+
? undefined
|
|
129
|
+
: {
|
|
130
|
+
...schemaWithoutDefault,
|
|
131
|
+
...(defaultValue === undefined ? {} : { default: defaultValue }),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function propsFromFrontmatter(component, value, span, trust, diagnostics) {
|
|
135
|
+
const props = value?.props;
|
|
136
|
+
if (props === undefined) {
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
139
|
+
if (!isMapping(props)) {
|
|
140
|
+
diagnostics.push(componentDiagnostic(component, span, 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: "props" must be a mapping.`));
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
143
|
+
const attributes = Object.create(null);
|
|
144
|
+
for (const [name, schemaValue] of Object.entries(props)) {
|
|
145
|
+
const schema = propSchema(component, name, schemaValue, span, trust, diagnostics);
|
|
146
|
+
if (schema !== undefined) {
|
|
147
|
+
attributes[name] = schema;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return attributes;
|
|
151
|
+
}
|
|
152
|
+
function childrenMarkers(root) {
|
|
153
|
+
const markers = [];
|
|
154
|
+
visit(root, (node) => {
|
|
155
|
+
if (node.type === 'leafDirective' && node.name === 'children') {
|
|
156
|
+
markers.push(node);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return markers;
|
|
160
|
+
}
|
|
161
|
+
function componentRawHtmlDiagnostics(root, component, source) {
|
|
162
|
+
const diagnostics = [];
|
|
163
|
+
visit(root, (node) => {
|
|
164
|
+
if (node.type !== 'html') {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const styleOpening = /^<style[ \t]+scoped[ \t]*>/i.exec(node.value);
|
|
168
|
+
const styleClosing = node.value.toLowerCase().lastIndexOf('</style>');
|
|
169
|
+
if (styleOpening !== null &&
|
|
170
|
+
styleClosing >= styleOpening[0].length &&
|
|
171
|
+
node.value.slice(styleClosing + 8).trim() === '') {
|
|
172
|
+
if (/<\s*script\b/i.test(node.value.slice(styleOpening[0].length, styleClosing))) {
|
|
173
|
+
const diagnostic = createDiagnostic({
|
|
174
|
+
code: 'HMX3001',
|
|
175
|
+
severity: 'error',
|
|
176
|
+
message: 'Authored component styles cannot contain script markup.',
|
|
177
|
+
span: node.position,
|
|
178
|
+
});
|
|
179
|
+
setDiagnosticOrigin(diagnostic, source, component.from);
|
|
180
|
+
diagnostics.push(diagnostic);
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
for (const diagnostic of componentHtmlDiagnostics(node.value, node.position)) {
|
|
185
|
+
setDiagnosticOrigin(diagnostic, source, component.from);
|
|
186
|
+
diagnostics.push(diagnostic);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return diagnostics;
|
|
190
|
+
}
|
|
191
|
+
function frontmatterNode(root) {
|
|
192
|
+
const node = root.children[0];
|
|
193
|
+
return node?.type === 'yaml' ? node : undefined;
|
|
194
|
+
}
|
|
195
|
+
function pointAt(source, offset) {
|
|
196
|
+
let line = 1;
|
|
197
|
+
let lineStart = 0;
|
|
198
|
+
for (let index = 0; index < offset; index += 1) {
|
|
199
|
+
if (source.charCodeAt(index) === 10) {
|
|
200
|
+
line += 1;
|
|
201
|
+
lineStart = index + 1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return { line, column: offset - lineStart + 1, offset };
|
|
205
|
+
}
|
|
206
|
+
function frontmatterValueSpan(node, source) {
|
|
207
|
+
const openingLineEnd = source.indexOf('\n', node.position.start.offset);
|
|
208
|
+
const start = openingLineEnd === -1 ? node.position.start.offset : openingLineEnd + 1;
|
|
209
|
+
const end = Math.min(start + node.value.length, source.length);
|
|
210
|
+
return { start: pointAt(source, start), end: pointAt(source, end) };
|
|
211
|
+
}
|
|
212
|
+
function parsedComponent(component, options, diagnostics) {
|
|
213
|
+
const parseOptions = {
|
|
214
|
+
...(component.from === undefined ? {} : { from: component.from }),
|
|
215
|
+
...(options.gfm === undefined ? {} : { gfm: options.gfm }),
|
|
216
|
+
};
|
|
217
|
+
let parsed = parse(component.source, parseOptions);
|
|
218
|
+
for (const diagnostic of parsed.diagnostics) {
|
|
219
|
+
setDiagnosticOrigin(diagnostic, parsed.source, component.from);
|
|
220
|
+
}
|
|
221
|
+
diagnostics.push(...parsed.diagnostics);
|
|
222
|
+
const frontmatter = compileFrontmatter(parsed.root, parsed.source);
|
|
223
|
+
const yaml = frontmatterNode(parsed.root);
|
|
224
|
+
let value = frontmatter.value;
|
|
225
|
+
if (!frontmatter.recognized && yaml !== undefined && yaml.value.trim() !== '') {
|
|
226
|
+
diagnostics.push(componentDiagnostic({ ...component, source: parsed.source }, frontmatterValueSpan(yaml, parsed.source), 'HMX2051', 'error', `Malformed props in ${componentPath(component)}: component frontmatter must be a mapping.`));
|
|
227
|
+
value = undefined;
|
|
228
|
+
}
|
|
229
|
+
else if (!frontmatter.recognized) {
|
|
230
|
+
parsed = parse(component.source, { ...parseOptions, frontmatter: false });
|
|
231
|
+
for (const diagnostic of parsed.diagnostics) {
|
|
232
|
+
setDiagnosticOrigin(diagnostic, parsed.source, component.from);
|
|
233
|
+
}
|
|
234
|
+
diagnostics.push(...parsed.diagnostics);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
for (const diagnostic of frontmatter.diagnostics) {
|
|
238
|
+
setDiagnosticOrigin(diagnostic, parsed.source, component.from);
|
|
239
|
+
diagnostics.push(diagnostic);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const span = yaml === undefined ? parsed.root.position : frontmatterValueSpan(yaml, parsed.source);
|
|
243
|
+
const normalizedComponent = { ...component, source: parsed.source };
|
|
244
|
+
const attributes = propsFromFrontmatter(normalizedComponent, value, span, options.trust, diagnostics);
|
|
245
|
+
const markers = childrenMarkers(parsed.root);
|
|
246
|
+
diagnostics.push(...componentRawHtmlDiagnostics(parsed.root, component, parsed.source));
|
|
247
|
+
for (const duplicate of markers.slice(1)) {
|
|
248
|
+
diagnostics.push(componentDiagnostic(normalizedComponent, duplicate.position, 'HMX2053', 'error', `Authored component "${component.name}" contains more than one ::children directive.`));
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
definition: {
|
|
252
|
+
name: component.name,
|
|
253
|
+
source: parsed.source,
|
|
254
|
+
root: parsed.root,
|
|
255
|
+
childrenMarkers: markers,
|
|
256
|
+
...(component.from === undefined ? {} : { from: component.from }),
|
|
257
|
+
},
|
|
258
|
+
attributes,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Returns authored template metadata for a renderer created by {@link compileComponents}. */
|
|
262
|
+
export function authoredComponentFor(renderer) {
|
|
263
|
+
return authoredRenderers.get(renderer);
|
|
264
|
+
}
|
|
265
|
+
/** Parses HMX component sources and registers their schemas and compile-time templates. */
|
|
266
|
+
export function compileComponents(sources, options = {}) {
|
|
267
|
+
const schemas = Object.create(null);
|
|
268
|
+
const renderers = Object.create(null);
|
|
269
|
+
const diagnostics = [];
|
|
270
|
+
for (const component of sources) {
|
|
271
|
+
const parsed = parsedComponent(component, options, diagnostics);
|
|
272
|
+
if (Object.hasOwn(schemas, component.name)) {
|
|
273
|
+
diagnostics.push(componentDiagnostic({ ...component, source: parsed.definition.source }, parsed.definition.root.position, 'HMX2057', 'error', `Authored component "${component.name}" is registered more than once.`));
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
if (Object.hasOwn(builtinComponents.schemas, component.name)) {
|
|
277
|
+
diagnostics.push(componentDiagnostic({ ...component, source: parsed.definition.source }, parsed.definition.root.position, 'HMX2050', 'warning', `Authored component "${component.name}" shadows built-in component "${component.name}".`));
|
|
278
|
+
}
|
|
279
|
+
const renderer = () => ({ wrappers: [] });
|
|
280
|
+
authoredRenderers.set(renderer, parsed.definition);
|
|
281
|
+
schemas[component.name] = {
|
|
282
|
+
name: component.name,
|
|
283
|
+
kinds: ['container'],
|
|
284
|
+
attributes: parsed.attributes,
|
|
285
|
+
children: 'block',
|
|
286
|
+
label: 'forbidden',
|
|
287
|
+
description: `HMX-authored component "${component.name}".`,
|
|
288
|
+
};
|
|
289
|
+
renderers[component.name] = renderer;
|
|
290
|
+
}
|
|
291
|
+
return { registry: { schemas, renderers }, diagnostics };
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=authored.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authored.js","sourceRoot":"","sources":["../../src/components/authored.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAiCjD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAgB;IAC7C,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,KAAK;IACL,YAAY;CACb,CAAC,CAAA;AACF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EA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AC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,WAAW,CAAC,IAAI,CACd,mBAAmB,CACjB,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAClD,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAC/B,SAAS,EACT,SAAS,EACT,uBAAuB,SAAS,CAAC,IAAI,iCAAiC,SAAS,CAAC,IAAI,IAAI,CACzF,CACF,CAAA;QACH,CAAC;QAED,MAAM,QAAQ,GAAsB,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAA;QAC5D,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;QAClD,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YACxB,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,2BAA2B,SAAS,CAAC,IAAI,IAAI;SAC3D,CAAA;QACD,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;IACtC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,CAAA;AAC1D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentRegistry } from './types.js';
|
|
2
|
+
/** The built-in component schemas and their separate trusted renderers. */
|
|
3
|
+
export declare const builtinComponents: ComponentRegistry;
|
|
4
|
+
/** Merges caller components over the built-ins in each name-keyed lookup. */
|
|
5
|
+
export declare function mergeComponentRegistries(components: ComponentRegistry | undefined): ComponentRegistry;
|
|
6
|
+
//# sourceMappingURL=builtins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/components/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,YAAY,CAAA;AAiOnB,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,EAAE,iBAA0C,CAAA;AAE1E,6EAA6E;AAC7E,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,iBAAiB,GAAG,SAAS,GACxC,iBAAiB,CAQnB"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
const statusValues = ['info', 'warning', 'danger', 'success'];
|
|
2
|
+
const schemas = {
|
|
3
|
+
note: {
|
|
4
|
+
name: 'note',
|
|
5
|
+
kinds: ['container'],
|
|
6
|
+
attributes: {
|
|
7
|
+
type: {
|
|
8
|
+
type: 'enum',
|
|
9
|
+
values: statusValues,
|
|
10
|
+
default: 'info',
|
|
11
|
+
description: 'Visual status of the note.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
children: 'block',
|
|
15
|
+
label: 'optional',
|
|
16
|
+
description: 'A callout containing related information.',
|
|
17
|
+
},
|
|
18
|
+
card: {
|
|
19
|
+
name: 'card',
|
|
20
|
+
kinds: ['container'],
|
|
21
|
+
attributes: {},
|
|
22
|
+
children: 'block',
|
|
23
|
+
label: 'optional',
|
|
24
|
+
description: 'A grouped card of content.',
|
|
25
|
+
},
|
|
26
|
+
grid: {
|
|
27
|
+
name: 'grid',
|
|
28
|
+
kinds: ['container'],
|
|
29
|
+
attributes: {
|
|
30
|
+
columns: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
default: '3',
|
|
33
|
+
min: 1,
|
|
34
|
+
max: 12,
|
|
35
|
+
description: 'Integer number of grid columns from 1 through 12.',
|
|
36
|
+
},
|
|
37
|
+
gap: {
|
|
38
|
+
type: 'number',
|
|
39
|
+
default: '4',
|
|
40
|
+
min: 0,
|
|
41
|
+
max: 16,
|
|
42
|
+
description: 'Integer grid gap from 0 through 16.',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
children: 'block',
|
|
46
|
+
label: 'optional',
|
|
47
|
+
description: 'A grid layout for block content.',
|
|
48
|
+
},
|
|
49
|
+
metric: {
|
|
50
|
+
name: 'metric',
|
|
51
|
+
kinds: ['container'],
|
|
52
|
+
attributes: {},
|
|
53
|
+
children: 'block',
|
|
54
|
+
label: 'optional',
|
|
55
|
+
description: 'A labelled metric or key figure.',
|
|
56
|
+
},
|
|
57
|
+
badge: {
|
|
58
|
+
name: 'badge',
|
|
59
|
+
kinds: ['text'],
|
|
60
|
+
attributes: {
|
|
61
|
+
kind: {
|
|
62
|
+
type: 'enum',
|
|
63
|
+
values: statusValues,
|
|
64
|
+
default: 'info',
|
|
65
|
+
description: 'Visual status of the badge.',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
children: 'phrasing',
|
|
69
|
+
label: 'optional',
|
|
70
|
+
description: 'An inline status badge.',
|
|
71
|
+
},
|
|
72
|
+
button: {
|
|
73
|
+
name: 'button',
|
|
74
|
+
kinds: ['container'],
|
|
75
|
+
attributes: {
|
|
76
|
+
type: {
|
|
77
|
+
type: 'enum',
|
|
78
|
+
values: ['button', 'submit', 'reset'],
|
|
79
|
+
default: 'button',
|
|
80
|
+
description: 'Native button behavior.',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
children: 'block',
|
|
84
|
+
label: 'optional',
|
|
85
|
+
description: 'A native button used by event handlers.',
|
|
86
|
+
},
|
|
87
|
+
input: {
|
|
88
|
+
name: 'input',
|
|
89
|
+
kinds: ['leaf', 'container'],
|
|
90
|
+
attributes: {
|
|
91
|
+
type: {
|
|
92
|
+
type: 'enum',
|
|
93
|
+
values: ['text'],
|
|
94
|
+
default: 'text',
|
|
95
|
+
description: 'Native text-input type.',
|
|
96
|
+
},
|
|
97
|
+
value: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
default: '',
|
|
100
|
+
description: 'Initial text-input value.',
|
|
101
|
+
},
|
|
102
|
+
name: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
description: 'Native form field name.',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
children: 'none',
|
|
108
|
+
label: 'forbidden',
|
|
109
|
+
description: 'A native text input used by input and change handlers.',
|
|
110
|
+
},
|
|
111
|
+
form: {
|
|
112
|
+
name: 'form',
|
|
113
|
+
kinds: ['container'],
|
|
114
|
+
attributes: {},
|
|
115
|
+
children: 'block',
|
|
116
|
+
label: 'forbidden',
|
|
117
|
+
description: 'A native form used by submit handlers.',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
function classPlan(tag, className, labelTag, labelClass, attributeBindings) {
|
|
121
|
+
return {
|
|
122
|
+
wrappers: [{ tag, attributes: { class: className } }],
|
|
123
|
+
...(labelTag === undefined || labelClass === undefined
|
|
124
|
+
? {}
|
|
125
|
+
: { labelWrapper: { tag: labelTag, attributes: { class: labelClass } } }),
|
|
126
|
+
...(attributeBindings === undefined ? {} : { attributeBindings }),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function classBinding(prefix, attributes, variant) {
|
|
130
|
+
const segments = [prefix];
|
|
131
|
+
if (variant !== undefined)
|
|
132
|
+
segments.push({ attribute: variant });
|
|
133
|
+
if (typeof attributes.class === 'string') {
|
|
134
|
+
segments.push(' ', { attribute: 'class' });
|
|
135
|
+
}
|
|
136
|
+
return { name: 'class', segments };
|
|
137
|
+
}
|
|
138
|
+
const renderers = {
|
|
139
|
+
note: (_node, attributes) => classPlan('aside', typeof attributes.type === 'string' ? `hmx-note hmx-note-${attributes.type}` : 'hmx-note', 'p', 'hmx-note-title', [classBinding('hmx-note hmx-note-', attributes, 'type')]),
|
|
140
|
+
card: (_node, attributes) => classPlan('article', 'hmx-card', 'h3', 'hmx-card-title', [
|
|
141
|
+
classBinding('hmx-card', attributes),
|
|
142
|
+
]),
|
|
143
|
+
grid: (_node, attributes) => {
|
|
144
|
+
const numericStyle = typeof attributes.columns === 'number' && typeof attributes.gap === 'number'
|
|
145
|
+
? { style: `--hmx-grid-columns:${attributes.columns};--hmx-grid-gap:${attributes.gap}` }
|
|
146
|
+
: {};
|
|
147
|
+
return {
|
|
148
|
+
wrappers: [{ tag: 'div', attributes: { class: 'hmx-grid', ...numericStyle } }],
|
|
149
|
+
attributeBindings: [
|
|
150
|
+
classBinding('hmx-grid', attributes),
|
|
151
|
+
{
|
|
152
|
+
name: 'style',
|
|
153
|
+
segments: [
|
|
154
|
+
'--hmx-grid-columns:',
|
|
155
|
+
{ attribute: 'columns' },
|
|
156
|
+
';--hmx-grid-gap:',
|
|
157
|
+
{ attribute: 'gap' },
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
metric: (_node, attributes) => classPlan('div', 'hmx-metric', 'p', 'hmx-metric-label', [
|
|
164
|
+
classBinding('hmx-metric', attributes),
|
|
165
|
+
]),
|
|
166
|
+
badge: (_node, attributes) => classPlan('span', typeof attributes.kind === 'string' ? `hmx-badge hmx-badge-${attributes.kind}` : 'hmx-badge', undefined, undefined, [classBinding('hmx-badge hmx-badge-', attributes, 'kind')]),
|
|
167
|
+
button: (_node, attributes) => ({
|
|
168
|
+
wrappers: [
|
|
169
|
+
{
|
|
170
|
+
tag: 'button',
|
|
171
|
+
attributes: {
|
|
172
|
+
type: typeof attributes.type === 'string' ? attributes.type : 'button',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
flattenSingleParagraph: true,
|
|
177
|
+
}),
|
|
178
|
+
input: (_node, attributes) => ({
|
|
179
|
+
wrappers: [
|
|
180
|
+
{
|
|
181
|
+
tag: 'input',
|
|
182
|
+
attributes: {
|
|
183
|
+
type: typeof attributes.type === 'string' ? attributes.type : 'text',
|
|
184
|
+
value: typeof attributes.value === 'string' ? attributes.value : '',
|
|
185
|
+
...(typeof attributes.name === 'string' ? { name: attributes.name } : {}),
|
|
186
|
+
},
|
|
187
|
+
void: true,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
}),
|
|
191
|
+
form: () => ({ wrappers: [{ tag: 'form', attributes: {} }] }),
|
|
192
|
+
};
|
|
193
|
+
/** The built-in component schemas and their separate trusted renderers. */
|
|
194
|
+
export const builtinComponents = { schemas, renderers };
|
|
195
|
+
/** Merges caller components over the built-ins in each name-keyed lookup. */
|
|
196
|
+
export function mergeComponentRegistries(components) {
|
|
197
|
+
if (components === undefined) {
|
|
198
|
+
return builtinComponents;
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
schemas: { ...builtinComponents.schemas, ...components.schemas },
|
|
202
|
+
renderers: { ...builtinComponents.renderers, ...components.renderers },
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=builtins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/components/builtins.ts"],"names":[],"mappings":"AAOA,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAA;AAEtE,MAAM,OAAO,GAAiC;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,YAAY;gBACpB,OAAO,EAAE,MAAM;gBACf,WAAW,EAAE,4BAA4B;aAC1C;SACF;QACD,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,2CAA2C;KACzD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,4BAA4B;KAC1C;IACD,IAA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":["../../src/components/styles.ts"],"names":[],"mappings":"AAgGA,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAK5E"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const TOKENS = `:where(:root) {
|
|
2
|
+
--hmx-color-surface: #f8fafc;
|
|
3
|
+
--hmx-color-text: #172033;
|
|
4
|
+
--hmx-color-muted: #526176;
|
|
5
|
+
--hmx-color-border: #cbd5e1;
|
|
6
|
+
--hmx-color-info: #2563eb;
|
|
7
|
+
--hmx-color-warning: #b45309;
|
|
8
|
+
--hmx-color-danger: #dc2626;
|
|
9
|
+
--hmx-color-success: #15803d;
|
|
10
|
+
--hmx-space-sm: 0.5rem;
|
|
11
|
+
--hmx-space-md: 1rem;
|
|
12
|
+
--hmx-space-lg: 1.5rem;
|
|
13
|
+
--hmx-radius: 0.5rem;
|
|
14
|
+
--hmx-border: 0.0625rem solid var(--hmx-color-border);
|
|
15
|
+
}
|
|
16
|
+
@media (prefers-color-scheme: dark) {
|
|
17
|
+
:where(:root) {
|
|
18
|
+
--hmx-color-surface: #172033;
|
|
19
|
+
--hmx-color-text: #f8fafc;
|
|
20
|
+
--hmx-color-muted: #cbd5e1;
|
|
21
|
+
--hmx-color-border: #475569;
|
|
22
|
+
--hmx-color-info: #60a5fa;
|
|
23
|
+
--hmx-color-warning: #fbbf24;
|
|
24
|
+
--hmx-color-danger: #f87171;
|
|
25
|
+
--hmx-color-success: #4ade80;
|
|
26
|
+
}
|
|
27
|
+
}`;
|
|
28
|
+
const COMPONENT_STYLES = {
|
|
29
|
+
note: `:where(.hmx-note) {
|
|
30
|
+
--hmx-status-color: var(--hmx-color-info);
|
|
31
|
+
border: var(--hmx-border);
|
|
32
|
+
border-inline-start: 0.25rem solid var(--hmx-status-color);
|
|
33
|
+
border-radius: var(--hmx-radius);
|
|
34
|
+
padding: var(--hmx-space-md);
|
|
35
|
+
background: var(--hmx-color-surface);
|
|
36
|
+
color: var(--hmx-color-text);
|
|
37
|
+
}
|
|
38
|
+
:where(.hmx-note-warning) { --hmx-status-color: var(--hmx-color-warning); }
|
|
39
|
+
:where(.hmx-note-danger) { --hmx-status-color: var(--hmx-color-danger); }
|
|
40
|
+
:where(.hmx-note-success) { --hmx-status-color: var(--hmx-color-success); }
|
|
41
|
+
:where(.hmx-note-title) {
|
|
42
|
+
margin-block: 0 var(--hmx-space-sm);
|
|
43
|
+
font-weight: 650;
|
|
44
|
+
}`,
|
|
45
|
+
card: `:where(.hmx-card) {
|
|
46
|
+
border: var(--hmx-border);
|
|
47
|
+
border-radius: var(--hmx-radius);
|
|
48
|
+
padding: var(--hmx-space-lg);
|
|
49
|
+
background: var(--hmx-color-surface);
|
|
50
|
+
color: var(--hmx-color-text);
|
|
51
|
+
}
|
|
52
|
+
:where(.hmx-card-title) {
|
|
53
|
+
margin-block: 0 var(--hmx-space-md);
|
|
54
|
+
font-size: 1.125rem;
|
|
55
|
+
}`,
|
|
56
|
+
grid: `:where(.hmx-grid) {
|
|
57
|
+
display: grid;
|
|
58
|
+
grid-template-columns: repeat(var(--hmx-grid-columns), minmax(0, 1fr));
|
|
59
|
+
gap: calc(var(--hmx-grid-gap) * 0.25rem);
|
|
60
|
+
}
|
|
61
|
+
@media (max-width: 40rem) {
|
|
62
|
+
:where(.hmx-grid) { grid-template-columns: minmax(0, 1fr); }
|
|
63
|
+
}`,
|
|
64
|
+
metric: `:where(.hmx-metric) {
|
|
65
|
+
border-block-start: 0.1875rem solid var(--hmx-color-info);
|
|
66
|
+
border-radius: var(--hmx-radius);
|
|
67
|
+
padding: var(--hmx-space-md);
|
|
68
|
+
background: var(--hmx-color-surface);
|
|
69
|
+
color: var(--hmx-color-text);
|
|
70
|
+
font-size: 1.75rem;
|
|
71
|
+
font-variant-numeric: tabular-nums;
|
|
72
|
+
}
|
|
73
|
+
:where(.hmx-metric-label) {
|
|
74
|
+
margin-block: 0 var(--hmx-space-sm);
|
|
75
|
+
color: var(--hmx-color-muted);
|
|
76
|
+
font-size: 0.875rem;
|
|
77
|
+
}`,
|
|
78
|
+
badge: `:where(.hmx-badge) {
|
|
79
|
+
--hmx-status-color: var(--hmx-color-info);
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
border: 0.0625rem solid var(--hmx-status-color);
|
|
83
|
+
border-radius: 999rem;
|
|
84
|
+
padding: 0.125rem var(--hmx-space-sm);
|
|
85
|
+
color: var(--hmx-status-color);
|
|
86
|
+
font-size: 0.8125rem;
|
|
87
|
+
line-height: 1.25;
|
|
88
|
+
}
|
|
89
|
+
:where(.hmx-badge-warning) { --hmx-status-color: var(--hmx-color-warning); }
|
|
90
|
+
:where(.hmx-badge-danger) { --hmx-status-color: var(--hmx-color-danger); }
|
|
91
|
+
:where(.hmx-badge-success) { --hmx-status-color: var(--hmx-color-success); }`,
|
|
92
|
+
};
|
|
93
|
+
const COMPONENT_ORDER = ['note', 'card', 'grid', 'metric', 'badge'];
|
|
94
|
+
/** Returns design tokens and only the built-in rules selected by a document. */
|
|
95
|
+
export function builtinStylesFor(usedComponents) {
|
|
96
|
+
const styles = COMPONENT_ORDER.flatMap((name) => usedComponents.has(name) ? [COMPONENT_STYLES[name] ?? ''] : []);
|
|
97
|
+
return styles.length === 0 ? '' : [TOKENS, ...styles].join('\n');
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/components/styles.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;EA0Bb,CAAA;AAEF,MAAM,gBAAgB,GAAqC;IACzD,IAAI,EAAE;;;;;;;;;;;;;;;EAeN;IACA,IAAI,EAAE;;;;;;;;;;EAUN;IACA,IAAI,EAAE;;;;;;;EAON;IACA,MAAM,EAAE;;;;;;;;;;;;;EAaR;IACA,KAAK,EAAE;;;;;;;;;;;;;6EAaoE;CAC5E,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAE5E,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAAC,cAAmC;IAClE,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAC9C,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAC/D,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAClE,CAAC"}
|