@mobile-reality/mdma-renderer-vanilla 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +127 -0
  3. package/dist/components/ApprovalGateRenderer.d.ts +2 -0
  4. package/dist/components/ApprovalGateRenderer.d.ts.map +1 -0
  5. package/dist/components/ApprovalGateRenderer.js +43 -0
  6. package/dist/components/ApprovalGateRenderer.js.map +1 -0
  7. package/dist/components/ButtonRenderer.d.ts +2 -0
  8. package/dist/components/ButtonRenderer.d.ts.map +1 -0
  9. package/dist/components/ButtonRenderer.js +23 -0
  10. package/dist/components/ButtonRenderer.js.map +1 -0
  11. package/dist/components/CalloutRenderer.d.ts +2 -0
  12. package/dist/components/CalloutRenderer.d.ts.map +1 -0
  13. package/dist/components/CalloutRenderer.js +33 -0
  14. package/dist/components/CalloutRenderer.js.map +1 -0
  15. package/dist/components/ChartRenderer.d.ts +3 -0
  16. package/dist/components/ChartRenderer.d.ts.map +1 -0
  17. package/dist/components/ChartRenderer.js +52 -0
  18. package/dist/components/ChartRenderer.js.map +1 -0
  19. package/dist/components/CustomRenderer.d.ts +8 -0
  20. package/dist/components/CustomRenderer.d.ts.map +1 -0
  21. package/dist/components/CustomRenderer.js +51 -0
  22. package/dist/components/CustomRenderer.js.map +1 -0
  23. package/dist/components/FormRenderer.d.ts +8 -0
  24. package/dist/components/FormRenderer.d.ts.map +1 -0
  25. package/dist/components/FormRenderer.js +149 -0
  26. package/dist/components/FormRenderer.js.map +1 -0
  27. package/dist/components/MdmaBlockLoading.d.ts +11 -0
  28. package/dist/components/MdmaBlockLoading.d.ts.map +1 -0
  29. package/dist/components/MdmaBlockLoading.js +26 -0
  30. package/dist/components/MdmaBlockLoading.js.map +1 -0
  31. package/dist/components/TableRenderer.d.ts +2 -0
  32. package/dist/components/TableRenderer.d.ts.map +1 -0
  33. package/dist/components/TableRenderer.js +66 -0
  34. package/dist/components/TableRenderer.js.map +1 -0
  35. package/dist/components/TasklistRenderer.d.ts +7 -0
  36. package/dist/components/TasklistRenderer.d.ts.map +1 -0
  37. package/dist/components/TasklistRenderer.js +80 -0
  38. package/dist/components/TasklistRenderer.js.map +1 -0
  39. package/dist/components/ThinkingRenderer.d.ts +3 -0
  40. package/dist/components/ThinkingRenderer.d.ts.map +1 -0
  41. package/dist/components/ThinkingRenderer.js +36 -0
  42. package/dist/components/ThinkingRenderer.js.map +1 -0
  43. package/dist/components/WebhookRenderer.d.ts +2 -0
  44. package/dist/components/WebhookRenderer.d.ts.map +1 -0
  45. package/dist/components/WebhookRenderer.js +33 -0
  46. package/dist/components/WebhookRenderer.js.map +1 -0
  47. package/dist/components/form/default-elements.d.ts +10 -0
  48. package/dist/components/form/default-elements.d.ts.map +1 -0
  49. package/dist/components/form/default-elements.js +198 -0
  50. package/dist/components/form/default-elements.js.map +1 -0
  51. package/dist/components/form/element-props.d.ts +58 -0
  52. package/dist/components/form/element-props.d.ts.map +1 -0
  53. package/dist/components/form/element-props.js +2 -0
  54. package/dist/components/form/element-props.js.map +1 -0
  55. package/dist/context/render-context.d.ts +40 -0
  56. package/dist/context/render-context.d.ts.map +1 -0
  57. package/dist/context/render-context.js +7 -0
  58. package/dist/context/render-context.js.map +1 -0
  59. package/dist/document/mount-block.d.ts +19 -0
  60. package/dist/document/mount-block.d.ts.map +1 -0
  61. package/dist/document/mount-block.js +31 -0
  62. package/dist/document/mount-block.js.map +1 -0
  63. package/dist/document/mount-document.d.ts +33 -0
  64. package/dist/document/mount-document.d.ts.map +1 -0
  65. package/dist/document/mount-document.js +177 -0
  66. package/dist/document/mount-document.js.map +1 -0
  67. package/dist/document/partial-yaml.d.ts +10 -0
  68. package/dist/document/partial-yaml.d.ts.map +1 -0
  69. package/dist/document/partial-yaml.js +48 -0
  70. package/dist/document/partial-yaml.js.map +1 -0
  71. package/dist/dom/el.d.ts +26 -0
  72. package/dist/dom/el.d.ts.map +1 -0
  73. package/dist/dom/el.js +59 -0
  74. package/dist/dom/el.js.map +1 -0
  75. package/dist/index.d.ts +23 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +22 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/markdown/render-mdast.d.ts +21 -0
  80. package/dist/markdown/render-mdast.d.ts.map +1 -0
  81. package/dist/markdown/render-mdast.js +89 -0
  82. package/dist/markdown/render-mdast.js.map +1 -0
  83. package/dist/renderers/renderer-props.d.ts +41 -0
  84. package/dist/renderers/renderer-props.d.ts.map +1 -0
  85. package/dist/renderers/renderer-props.js +31 -0
  86. package/dist/renderers/renderer-props.js.map +1 -0
  87. package/dist/renderers/renderer-registry.d.ts +14 -0
  88. package/dist/renderers/renderer-registry.d.ts.map +1 -0
  89. package/dist/renderers/renderer-registry.js +48 -0
  90. package/dist/renderers/renderer-registry.js.map +1 -0
  91. package/dist/theme/theme.d.ts +68 -0
  92. package/dist/theme/theme.d.ts.map +1 -0
  93. package/dist/theme/theme.js +120 -0
  94. package/dist/theme/theme.js.map +1 -0
  95. package/package.json +56 -0
  96. package/styles.css +1045 -0
@@ -0,0 +1,89 @@
1
+ import { append, el } from '../dom/el.js';
2
+ function renderChildren(nodes) {
3
+ if (!nodes)
4
+ return [];
5
+ return nodes.map((child) => renderNode(child));
6
+ }
7
+ function alignStyle(align, index) {
8
+ const value = align?.[index];
9
+ return value ? { 'text-align': value } : undefined;
10
+ }
11
+ function renderTable(node) {
12
+ const rows = node.children ?? [];
13
+ const [headerRow, ...bodyRows] = rows;
14
+ const sections = [];
15
+ if (headerRow) {
16
+ sections.push(el('thead', {}, [
17
+ el('tr', {}, (headerRow.children ?? []).map((cell, index) => el('th', { style: alignStyle(node.align, index) }, renderChildren(cell.children)))),
18
+ ]));
19
+ }
20
+ if (bodyRows.length > 0) {
21
+ sections.push(el('tbody', {}, bodyRows.map((row) => el('tr', {}, (row.children ?? []).map((cell, index) => el('td', { style: alignStyle(node.align, index) }, renderChildren(cell.children)))))));
22
+ }
23
+ return el('table', { class: 'mdast-table' }, sections);
24
+ }
25
+ function renderNode(node) {
26
+ switch (node.type) {
27
+ case 'heading':
28
+ return el(`h${node.depth ?? 1}`, {}, renderChildren(node.children));
29
+ case 'paragraph':
30
+ return el('p', {}, renderChildren(node.children));
31
+ case 'blockquote':
32
+ return el('blockquote', {}, renderChildren(node.children));
33
+ case 'list':
34
+ return el(node.ordered ? 'ol' : 'ul', { start: node.ordered ? (node.start ?? 1) : undefined }, renderChildren(node.children));
35
+ case 'listItem': {
36
+ if (node.checked == null)
37
+ return el('li', {}, renderChildren(node.children));
38
+ const box = el('input', { type: 'checkbox', readonly: true });
39
+ box.checked = node.checked;
40
+ return el('li', { class: 'mdast-task-item' }, [box, ...renderChildren(node.children)]);
41
+ }
42
+ case 'code':
43
+ return el('pre', { class: 'mdast-code-block' }, [
44
+ el('code', { class: node.lang ? `language-${node.lang}` : undefined }, [node.value]),
45
+ ]);
46
+ case 'thematicBreak':
47
+ return el('hr');
48
+ case 'html':
49
+ // Rendered as text, never parsed — untrusted model output must not become live markup.
50
+ return el('div', { class: 'mdast-raw-html' }, [node.value]);
51
+ case 'table':
52
+ return renderTable(node);
53
+ case 'text':
54
+ return node.value;
55
+ case 'emphasis':
56
+ return el('em', {}, renderChildren(node.children));
57
+ case 'strong':
58
+ return el('strong', {}, renderChildren(node.children));
59
+ case 'delete':
60
+ return el('del', {}, renderChildren(node.children));
61
+ case 'inlineCode':
62
+ return el('code', { class: 'mdast-inline-code' }, [node.value]);
63
+ case 'link':
64
+ return el('a', {
65
+ href: node.url,
66
+ title: node.title,
67
+ target: '_blank',
68
+ rel: 'noopener noreferrer',
69
+ }, renderChildren(node.children));
70
+ case 'image':
71
+ return el('img', { src: node.url, alt: node.alt ?? '', title: node.title });
72
+ case 'break':
73
+ return el('br');
74
+ default: {
75
+ if (node.children) {
76
+ const fragment = el('span', {}, renderChildren(node.children));
77
+ return fragment;
78
+ }
79
+ return node.value ?? null;
80
+ }
81
+ }
82
+ }
83
+ /** Render one standard Markdown node into its `.mdma-markdown-content` wrapper. */
84
+ export function renderMdast(node) {
85
+ const root = el('div', { class: 'mdma-markdown-content' });
86
+ append(root, [renderNode(node)]);
87
+ return root;
88
+ }
89
+ //# sourceMappingURL=render-mdast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-mdast.js","sourceRoot":"","sources":["../../src/markdown/render-mdast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAuBtD,SAAS,cAAc,CAAC,KAAmB;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,UAAU,CAAC,KAAoC,EAAE,KAAa;IACrE,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC;AAED,SAAS,WAAW,CAAC,IAAe;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IACjC,MAAM,CAAC,SAAS,EAAE,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,QAAQ,GAAY,EAAE,CAAC;IAE7B,IAAI,SAAS,EAAE,CAAC;QACd,QAAQ,CAAC,IAAI,CACX,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE;YACd,EAAE,CACA,IAAI,EACJ,EAAE,EACF,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC7C,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAA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M,EAAE,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC/D,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;AACH,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ComponentState } from '@mobile-reality/mdma-runtime';
2
+ import type { MdmaComponent, StoreAction } from '@mobile-reality/mdma-spec';
3
+ import type { RenderContext } from '../context/render-context.js';
4
+ /** What every block renderer receives. Mirrors the React and Vue renderers' props. */
5
+ export interface MdmaBlockRendererProps {
6
+ component: MdmaComponent;
7
+ componentState: ComponentState | undefined;
8
+ dispatch: (action: StoreAction) => void;
9
+ resolveBinding: (expr: string) => unknown;
10
+ /** Host customizations — data sources, element overrides, custom variants. */
11
+ context: RenderContext;
12
+ }
13
+ /**
14
+ * A mounted renderer. There is no virtual DOM here: a renderer owns its element
15
+ * and is handed new props whenever the store or the AST changes, so it can
16
+ * decide what to touch. That is what keeps a focused input intact while a
17
+ * streamed document re-parses on every chunk.
18
+ */
19
+ export interface RendererInstance {
20
+ /** The element currently in the document. Re-read after `update` — it may be replaced. */
21
+ el: HTMLElement;
22
+ update(props: MdmaBlockRendererProps): void;
23
+ destroy?(): void;
24
+ }
25
+ export type MdmaBlockRenderer = (props: MdmaBlockRendererProps) => RendererInstance;
26
+ /**
27
+ * Build a renderer from a plain render function, for components with nothing
28
+ * worth preserving between renders — no focusable control whose value the user
29
+ * is editing. Each update rebuilds the element and swaps it in place.
30
+ *
31
+ * A component that owns editable state (`form`, `tasklist`) implements
32
+ * {@link RendererInstance} directly and updates in place instead.
33
+ */
34
+ export declare function stateless(render: (props: MdmaBlockRendererProps) => HTMLElement): MdmaBlockRenderer;
35
+ /**
36
+ * Like {@link stateless}, but with view state that outlives a rebuild — a
37
+ * revealed PII cell, a fired webhook. This is presentation state only; anything
38
+ * the document should remember belongs in the store.
39
+ */
40
+ export declare function withState<TState>(createState: () => TState, render: (props: MdmaBlockRendererProps, state: TState) => HTMLElement): MdmaBlockRenderer;
41
+ //# sourceMappingURL=renderer-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-props.d.ts","sourceRoot":"","sources":["../../src/renderers/renderer-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,sFAAsF;AACtF,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,cAAc,GAAG,SAAS,CAAC;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,8EAA8E;IAC9E,OAAO,EAAE,aAAa,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0FAA0F;IAC1F,EAAE,EAAE,WAAW,CAAC;IAChB,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC5C,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,gBAAgB,CAAC;AAEpF;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,WAAW,GACrD,iBAAiB,CAKnB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAC9B,WAAW,EAAE,MAAM,MAAM,EACzB,MAAM,EAAE,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,KAAK,WAAW,GACpE,iBAAiB,CAanB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Build a renderer from a plain render function, for components with nothing
3
+ * worth preserving between renders — no focusable control whose value the user
4
+ * is editing. Each update rebuilds the element and swaps it in place.
5
+ *
6
+ * A component that owns editable state (`form`, `tasklist`) implements
7
+ * {@link RendererInstance} directly and updates in place instead.
8
+ */
9
+ export function stateless(render) {
10
+ return withState(() => undefined, (props) => render(props));
11
+ }
12
+ /**
13
+ * Like {@link stateless}, but with view state that outlives a rebuild — a
14
+ * revealed PII cell, a fired webhook. This is presentation state only; anything
15
+ * the document should remember belongs in the store.
16
+ */
17
+ export function withState(createState, render) {
18
+ return (initial) => {
19
+ const state = createState();
20
+ const instance = {
21
+ el: render(initial, state),
22
+ update(next) {
23
+ const replacement = render(next, state);
24
+ instance.el.replaceWith(replacement);
25
+ instance.el = replacement;
26
+ },
27
+ };
28
+ return instance;
29
+ };
30
+ }
31
+ //# sourceMappingURL=renderer-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-props.js","sourceRoot":"","sources":["../../src/renderers/renderer-props.ts"],"names":[],"mappings":"AA6BA;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,MAAsD;IAEtD,OAAO,SAAS,CACd,GAAG,EAAE,CAAC,SAAS,EACf,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,WAAyB,EACzB,MAAqE;IAErE,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAqB;YACjC,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;YAC1B,MAAM,CAAC,IAAI;gBACT,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACxC,QAAQ,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACrC,QAAQ,CAAC,EAAE,GAAG,WAAW,CAAC;YAC5B,CAAC;SACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { MdmaBlockRenderer } from './renderer-props.js';
2
+ export declare class RendererRegistry {
3
+ private renderers;
4
+ register(type: string, renderer: MdmaBlockRenderer): void;
5
+ get(type: string): MdmaBlockRenderer | undefined;
6
+ has(type: string): boolean;
7
+ /** Convert to a plain record for passing as the `renderers` option. */
8
+ toRecord(): Record<string, MdmaBlockRenderer>;
9
+ }
10
+ /** Built-in renderers for all core MDMA component types. */
11
+ export declare const defaultRenderers: Record<string, MdmaBlockRenderer>;
12
+ /** A registry pre-populated with the built-ins; register more to extend or override. */
13
+ export declare function createRendererRegistry(): RendererRegistry;
14
+ //# sourceMappingURL=renderer-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-registry.d.ts","sourceRoot":"","sources":["../../src/renderers/renderer-registry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAwC;IAEzD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAIzD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIhD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,uEAAuE;IACvE,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;CAG9C;AAED,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAW9D,CAAC;AAEF,wFAAwF;AACxF,wBAAgB,sBAAsB,IAAI,gBAAgB,CAMzD"}
@@ -0,0 +1,48 @@
1
+ import { ApprovalGateRenderer } from '../components/ApprovalGateRenderer.js';
2
+ import { ButtonRenderer } from '../components/ButtonRenderer.js';
3
+ import { CalloutRenderer } from '../components/CalloutRenderer.js';
4
+ import { ChartRenderer } from '../components/ChartRenderer.js';
5
+ import { CustomRenderer } from '../components/CustomRenderer.js';
6
+ import { FormRenderer } from '../components/FormRenderer.js';
7
+ import { TableRenderer } from '../components/TableRenderer.js';
8
+ import { TasklistRenderer } from '../components/TasklistRenderer.js';
9
+ import { ThinkingRenderer } from '../components/ThinkingRenderer.js';
10
+ import { WebhookRenderer } from '../components/WebhookRenderer.js';
11
+ export class RendererRegistry {
12
+ renderers = new Map();
13
+ register(type, renderer) {
14
+ this.renderers.set(type, renderer);
15
+ }
16
+ get(type) {
17
+ return this.renderers.get(type);
18
+ }
19
+ has(type) {
20
+ return this.renderers.has(type);
21
+ }
22
+ /** Convert to a plain record for passing as the `renderers` option. */
23
+ toRecord() {
24
+ return Object.fromEntries(this.renderers);
25
+ }
26
+ }
27
+ /** Built-in renderers for all core MDMA component types. */
28
+ export const defaultRenderers = {
29
+ form: FormRenderer,
30
+ button: ButtonRenderer,
31
+ tasklist: TasklistRenderer,
32
+ table: TableRenderer,
33
+ callout: CalloutRenderer,
34
+ 'approval-gate': ApprovalGateRenderer,
35
+ webhook: WebhookRenderer,
36
+ chart: ChartRenderer,
37
+ thinking: ThinkingRenderer,
38
+ custom: CustomRenderer,
39
+ };
40
+ /** A registry pre-populated with the built-ins; register more to extend or override. */
41
+ export function createRendererRegistry() {
42
+ const registry = new RendererRegistry();
43
+ for (const [type, renderer] of Object.entries(defaultRenderers)) {
44
+ registry.register(type, renderer);
45
+ }
46
+ return registry;
47
+ }
48
+ //# sourceMappingURL=renderer-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-registry.js","sourceRoot":"","sources":["../../src/renderers/renderer-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,MAAM,OAAO,gBAAgB;IACnB,SAAS,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEzD,QAAQ,CAAC,IAAY,EAAE,QAA2B;QAChD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,uEAAuE;IACvE,QAAQ;QACN,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAsC;IACjE,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,gBAAgB;IAC1B,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,eAAe;IACxB,eAAe,EAAE,oBAAoB;IACrC,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF,wFAAwF;AACxF,MAAM,UAAU,sBAAsB;IACpC,MAAM,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAChE,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Design tokens for the web renderers — the typed mirror of the `--mdma-*` CSS
3
+ * custom properties in `styles.css`, and the same shape the React, Vue, and
4
+ * React Native renderers expose, so a theme object is portable between them.
5
+ */
6
+ export interface MdmaTheme {
7
+ colors: {
8
+ background: string;
9
+ surface: string;
10
+ text: string;
11
+ textMuted: string;
12
+ border: string;
13
+ primary: string;
14
+ onPrimary: string;
15
+ secondary: string;
16
+ onSecondary: string;
17
+ danger: string;
18
+ onDanger: string;
19
+ info: string;
20
+ infoBg: string;
21
+ warning: string;
22
+ warningBg: string;
23
+ error: string;
24
+ errorBg: string;
25
+ success: string;
26
+ successBg: string;
27
+ };
28
+ spacing: {
29
+ xs: number;
30
+ sm: number;
31
+ md: number;
32
+ lg: number;
33
+ };
34
+ radius: {
35
+ sm: number;
36
+ md: number;
37
+ };
38
+ fontSize: {
39
+ small: number;
40
+ body: number;
41
+ label: number;
42
+ title: number;
43
+ };
44
+ }
45
+ /** Built-in light palette — matches the default `--mdma-*` values in `styles.css`. */
46
+ export declare const lightTheme: MdmaTheme;
47
+ /** Built-in dark palette — matches the `[data-theme='dark']` block in `styles.css`. */
48
+ export declare const darkTheme: MdmaTheme;
49
+ /**
50
+ * What can be passed as a `theme`:
51
+ * - `'light'` / `'dark'` — the built-in palettes (applied via `data-theme`).
52
+ * - `'auto'` — follows the OS `prefers-color-scheme`.
53
+ * - a full {@link MdmaTheme} — custom tokens, written inline as CSS variables.
54
+ * - `undefined` — no theme; the stylesheet's default (light) tokens apply.
55
+ */
56
+ export type MdmaThemeInput = MdmaTheme | 'light' | 'dark' | 'auto';
57
+ export interface ResolvedThemeProps {
58
+ dataTheme?: 'light' | 'dark' | 'auto';
59
+ /** Inline CSS variables, when a custom theme object is provided. */
60
+ style?: Record<string, string>;
61
+ theme: MdmaTheme;
62
+ }
63
+ /** Convert tokens into the inline CSS variables the `.mdma-*` classes read. */
64
+ export declare function themeToCssVars(theme: MdmaTheme): Record<string, string>;
65
+ export declare function resolveThemeProps(theme: MdmaThemeInput | undefined): ResolvedThemeProps;
66
+ /** Apply a resolved theme to an element: `data-theme` plus any inline variables. */
67
+ export declare function applyTheme(element: HTMLElement, resolved: ResolvedThemeProps): void;
68
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAA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B,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAgBvF;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAUnF"}
@@ -0,0 +1,120 @@
1
+ /** Built-in light palette — matches the default `--mdma-*` values in `styles.css`. */
2
+ export const lightTheme = {
3
+ colors: {
4
+ background: '#ffffff',
5
+ surface: '#f8f9fa',
6
+ text: '#333333',
7
+ textMuted: '#666666',
8
+ border: '#e0e0e0',
9
+ primary: '#6c5ce7',
10
+ onPrimary: '#ffffff',
11
+ secondary: '#dfe6e9',
12
+ onSecondary: '#2d3436',
13
+ danger: '#e74c3c',
14
+ onDanger: '#ffffff',
15
+ info: '#3498db',
16
+ infoBg: '#ebf5fb',
17
+ warning: '#f39c12',
18
+ warningBg: '#fef9e7',
19
+ error: '#e74c3c',
20
+ errorBg: '#fdedec',
21
+ success: '#27ae60',
22
+ successBg: '#eafaf1',
23
+ },
24
+ spacing: { xs: 4, sm: 8, md: 12, lg: 16 },
25
+ radius: { sm: 6, md: 10 },
26
+ fontSize: { small: 13, body: 14, label: 15, title: 18 },
27
+ };
28
+ /** Built-in dark palette — matches the `[data-theme='dark']` block in `styles.css`. */
29
+ export const darkTheme = {
30
+ colors: {
31
+ background: '#151a26',
32
+ surface: '#1c2333',
33
+ text: '#e5e7eb',
34
+ textMuted: '#9ca3af',
35
+ border: '#2a3140',
36
+ primary: '#8b7ff0',
37
+ onPrimary: '#ffffff',
38
+ secondary: '#2a3140',
39
+ onSecondary: '#e5e7eb',
40
+ danger: '#ef4444',
41
+ onDanger: '#ffffff',
42
+ info: '#5dade2',
43
+ infoBg: '#16283a',
44
+ warning: '#f5b041',
45
+ warningBg: '#2a2412',
46
+ error: '#ef4444',
47
+ errorBg: '#2a1717',
48
+ success: '#2ecc71',
49
+ successBg: '#12251a',
50
+ },
51
+ spacing: { xs: 4, sm: 8, md: 12, lg: 16 },
52
+ radius: { sm: 6, md: 10 },
53
+ fontSize: { small: 13, body: 14, label: 15, title: 18 },
54
+ };
55
+ function camelToKebab(key) {
56
+ return key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
57
+ }
58
+ /** Convert tokens into the inline CSS variables the `.mdma-*` classes read. */
59
+ export function themeToCssVars(theme) {
60
+ const vars = {};
61
+ for (const [key, value] of Object.entries(theme.colors)) {
62
+ vars[`--mdma-color-${camelToKebab(key)}`] = value;
63
+ }
64
+ for (const [key, value] of Object.entries(theme.spacing))
65
+ vars[`--mdma-spacing-${key}`] = `${value}px`;
66
+ for (const [key, value] of Object.entries(theme.radius))
67
+ vars[`--mdma-radius-${key}`] = `${value}px`;
68
+ for (const [key, value] of Object.entries(theme.fontSize)) {
69
+ vars[`--mdma-font-size-${camelToKebab(key)}`] = `${value}px`;
70
+ }
71
+ return vars;
72
+ }
73
+ /** Heuristic: is this theme's background dark? (relative luminance < 50%). */
74
+ function isDarkTheme(theme) {
75
+ const hex = theme.colors.background.replace('#', '');
76
+ if (hex.length < 6)
77
+ return false;
78
+ const r = Number.parseInt(hex.slice(0, 2), 16);
79
+ const g = Number.parseInt(hex.slice(2, 4), 16);
80
+ const b = Number.parseInt(hex.slice(4, 6), 16);
81
+ if (Number.isNaN(r + g + b))
82
+ return false;
83
+ return 0.299 * r + 0.587 * g + 0.114 * b < 128;
84
+ }
85
+ export function resolveThemeProps(theme) {
86
+ if (theme === undefined)
87
+ return { theme: lightTheme };
88
+ if (theme === 'light')
89
+ return { dataTheme: 'light', theme: lightTheme };
90
+ if (theme === 'dark')
91
+ return { dataTheme: 'dark', theme: darkTheme };
92
+ // `auto` follows the OS preference at the CSS layer; the resolved token object
93
+ // is a best-effort light default for any JS consumer.
94
+ if (theme === 'auto')
95
+ return { dataTheme: 'auto', theme: lightTheme };
96
+ // A custom theme sets the public tokens inline, but the stylesheet also has
97
+ // internal derived vars (heading text, code backgrounds, …) that aren't on the
98
+ // public type. Pick the light/dark base by the theme's own background so those
99
+ // derived vars match.
100
+ return {
101
+ dataTheme: isDarkTheme(theme) ? 'dark' : 'light',
102
+ style: themeToCssVars(theme),
103
+ theme,
104
+ };
105
+ }
106
+ /** Apply a resolved theme to an element: `data-theme` plus any inline variables. */
107
+ export function applyTheme(element, resolved) {
108
+ if (resolved.dataTheme)
109
+ element.setAttribute('data-theme', resolved.dataTheme);
110
+ else
111
+ element.removeAttribute('data-theme');
112
+ for (const name of Array.from(element.style)) {
113
+ if (name.startsWith('--mdma-'))
114
+ element.style.removeProperty(name);
115
+ }
116
+ for (const [name, value] of Object.entries(resolved.style ?? {})) {
117
+ element.style.setProperty(name, value);
118
+ }
119
+ }
120
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAgCA,sFAAsF;AACtF,MAAM,CAAC,MAAM,UAAU,GAAc;IACnC,MAAM,EAAE;QACN,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,SAAS;QACtB,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,SAAS;KACrB;IACD,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IACzC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,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AAC,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;;QAC1E,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAE3C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QACjE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@mobile-reality/mdma-renderer-vanilla",
3
+ "version": "0.2.0",
4
+ "keywords": [
5
+ "mdma",
6
+ "markdown",
7
+ "ai",
8
+ "llm",
9
+ "interactive-document",
10
+ "vanilla",
11
+ "dom",
12
+ "no-framework",
13
+ "forms",
14
+ "ui"
15
+ ],
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.js",
20
+ "types": "./dist/index.d.ts"
21
+ },
22
+ "./styles.css": "./styles.css"
23
+ },
24
+ "dependencies": {
25
+ "@mobile-reality/mdma-spec": "0.4.0",
26
+ "@mobile-reality/mdma-runtime": "0.4.0"
27
+ },
28
+ "devDependencies": {
29
+ "happy-dom": "^20.0.0",
30
+ "remark-gfm": "^4.0.0",
31
+ "remark-parse": "^11.0.0",
32
+ "typescript": "^5.7.0",
33
+ "unified": "^11.0.0",
34
+ "vitest": "^3.2.0",
35
+ "@mobile-reality/mdma-parser": "0.3.0",
36
+ "@mobile-reality/mdma-attachables-core": "0.2.6"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "styles.css"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/MobileReality/mdma.git",
48
+ "directory": "packages/renderer-vanilla"
49
+ },
50
+ "scripts": {
51
+ "build": "tsc -p tsconfig.json",
52
+ "test": "vitest run",
53
+ "lint": "biome lint src/",
54
+ "typecheck": "tsc --noEmit"
55
+ }
56
+ }