@vchernoy/active-runtime 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 vchernoy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
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:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # Temporary Holding Version
1
+ # @vchernoy/active-runtime
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Makes a document rendered by [`@vchernoy/remark-active`](../remark/README.md) live in the browser. Plain DOM, no framework.
4
+
5
+ ```ts
6
+ import { renderActive } from '@vchernoy/remark-active'; // on the server, or in the browser
7
+ import { mount } from '@vchernoy/active-runtime';
8
+
9
+ container.innerHTML = renderActive(markdown, { locale }).html;
10
+ const live = mount(container, { locale }); // later: live.destroy()
11
+ ```
12
+
13
+ - Reads the calc program from `data-active-calc` on `.active-doc` and starts a session.
14
+ - `input[data-active-input]` controls set inputs; several controls of one input stay in sync (the one being edited is never rewritten); values outside the input's range are rejected (`aria-invalid`, a `title` and the browser's validation message), and nothing changes.
15
+ - `[data-active-value]` views and `[data-active-tex]` formulas are redrawn only when a value they use changes. KaTeX is loaded on the first formula update (`loadKatex` to supply it yourself).
16
+ - Values the browser restored into controls (back/forward, autofill) are adopted on mount.
17
+ - Use the same `locale` (and math `output`) as the renderer so updated text matches the first render.
@@ -0,0 +1,27 @@
1
+ import { type Limits, type Program, type Session } from '@vchernoy/calc';
2
+ import { type MathOutput } from '@vchernoy/remark-active/tex';
3
+ import type katex from 'katex';
4
+ type Katex = Pick<typeof katex, 'renderToString'>;
5
+ export type MountOptions = {
6
+ /** Locale for formatting values; should match the one used to render. */
7
+ locale?: string;
8
+ /** Math output; should match the one used to render. */
9
+ output?: MathOutput;
10
+ limits?: Limits;
11
+ /** How to load KaTeX, which is needed only when a formula's values change. Default: `import('katex')`. */
12
+ loadKatex?: () => Promise<Katex>;
13
+ };
14
+ export type Mounted = {
15
+ session: Session;
16
+ program: Program;
17
+ /** Resolves after formulas re-rendered for the latest change (useful in tests). */
18
+ settled(): Promise<void>;
19
+ /** Remove listeners; the page keeps its current state. */
20
+ destroy(): void;
21
+ };
22
+ /**
23
+ * Make a document rendered by @vchernoy/remark-active live. `root` is the `.active-doc` element or
24
+ * contains it. Controls update the session; only views and formulas whose inputs changed are redrawn.
25
+ */
26
+ export declare function mount(root: HTMLElement, options?: MountOptions): Mounted;
27
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,155 @@
1
+ import { createSession, formatNumber, parse, parseFormat } from '@vchernoy/calc';
2
+ import { katexSettings, placeholders, substitute } from '@vchernoy/remark-active/tex';
3
+ const intersects = (a, b) => [...a].some(x => b.has(x));
4
+ /** Read the calc sources the renderer left on the document root. Anything malformed means "no calc". */
5
+ function readBlocks(doc) {
6
+ try {
7
+ const raw = JSON.parse(doc.dataset.activeCalc ?? '[]');
8
+ if (!Array.isArray(raw))
9
+ return [];
10
+ return raw.filter((t) => typeof t === 'string').map((text, i) => ({ id: `calc-${i + 1}`, text }));
11
+ }
12
+ catch {
13
+ return [];
14
+ }
15
+ }
16
+ /**
17
+ * Make a document rendered by @vchernoy/remark-active live. `root` is the `.active-doc` element or
18
+ * contains it. Controls update the session; only views and formulas whose inputs changed are redrawn.
19
+ */
20
+ export function mount(root, options = {}) {
21
+ const doc = root.matches('.active-doc') ? root : root.querySelector('.active-doc');
22
+ if (!doc)
23
+ throw new Error('active-md: no .active-doc element to mount');
24
+ const program = parse(readBlocks(doc), options.limits);
25
+ const session = createSession(program, options.limits);
26
+ const views = [];
27
+ const cleanups = [];
28
+ let pending = Promise.resolve();
29
+ let destroyed = false;
30
+ let katexPromise;
31
+ const loadKatex = () => (katexPromise ??= (options.loadKatex ?? (async () => (await import('katex')).default))());
32
+ // Views: <output data-active-value="expr" data-active-format="…">
33
+ for (const el of doc.querySelectorAll('[data-active-value]')) {
34
+ const compiled = session.compile(el.dataset.activeValue ?? '', 'value');
35
+ if (compiled.diagnostics.length)
36
+ continue; // the renderer already showed this error
37
+ const format = parseFormat(el.dataset.activeFormat);
38
+ if (typeof format === 'string')
39
+ continue;
40
+ views.push({ el, deps: compiled.deps, update: () => showResult(el, compiled.evaluate(), format, options.locale) });
41
+ }
42
+ // Formulas: <span|div data-active-tex="…{{expr}}…">, only those that use values.
43
+ for (const el of doc.querySelectorAll('[data-active-tex]')) {
44
+ const tex = el.dataset.activeTex ?? '';
45
+ const exprs = placeholders(tex).map(e => session.compile(e, 'math'));
46
+ if (!exprs.length)
47
+ continue;
48
+ const deps = new Set(exprs.flatMap(c => [...c.deps]));
49
+ const display = el.dataset.activeDisplay === 'true';
50
+ views.push({
51
+ el, deps,
52
+ update: () => {
53
+ const source = substitute(tex, exprs.map(c => c.evaluate()));
54
+ pending = pending.then(async () => {
55
+ const k = await loadKatex();
56
+ // A destroyed mount must not touch the page (a newer mount may own these elements now).
57
+ // Detached roots still update: the host may insert the document later.
58
+ if (!destroyed)
59
+ el.innerHTML = k.renderToString(source, katexSettings(display, options.output));
60
+ }).catch(() => { });
61
+ },
62
+ });
63
+ }
64
+ /** Every control of each input: a number box and a slider may edit the same input and stay in sync. */
65
+ const controls = new Map();
66
+ const unsubscribe = session.subscribe(changed => {
67
+ for (const v of views)
68
+ if (intersects(v.deps, changed))
69
+ v.update();
70
+ });
71
+ cleanups.push(unsubscribe);
72
+ /**
73
+ * After any accepted submission (even of the current value), show the input's value in every other control and
74
+ * clear their stale errors. The control the reader is editing is never rewritten under the cursor. A slider
75
+ * whose step can't represent the value shows the nearest position; the model and the readout keep the value.
76
+ */
77
+ const syncPeers = (name, editing) => {
78
+ const r = session.get(name);
79
+ if (r?.kind !== 'value')
80
+ return;
81
+ for (const other of controls.get(name) ?? []) {
82
+ if (other === editing)
83
+ continue;
84
+ if (other.valueAsNumber !== r.value)
85
+ other.value = String(r.value);
86
+ clearProblem(other);
87
+ }
88
+ };
89
+ const restorable = [];
90
+ // Controls: <input data-active-input="name">
91
+ for (const input of doc.querySelectorAll('input[data-active-input]')) {
92
+ const name = input.dataset.activeInput ?? '';
93
+ if (!program.inputs.some(i => i.name === name))
94
+ continue;
95
+ controls.set(name, [...(controls.get(name) ?? []), input]);
96
+ const apply = () => {
97
+ const value = input.valueAsNumber;
98
+ const problem = Number.isNaN(value) ? 'enter a number' : outsideControl(input, value) ?? session.set(name, value);
99
+ if (problem) {
100
+ input.setCustomValidity(problem);
101
+ input.setAttribute('aria-invalid', 'true');
102
+ input.title = problem;
103
+ return;
104
+ }
105
+ clearProblem(input);
106
+ syncPeers(name, input);
107
+ };
108
+ input.addEventListener('input', apply);
109
+ cleanups.push(() => input.removeEventListener('input', apply));
110
+ restorable.push({ name, input, apply });
111
+ }
112
+ // The browser may have restored a value (back/forward cache, autofill): adopt it. A control counts as restored
113
+ // if its value differs from what was rendered, decided before anything is applied, so values written by syncing
114
+ // (a slider rounded to its step, say) are never mistaken for restored ones. One restored control per input wins.
115
+ const restored = restorable.filter(({ input }) => !Number.isNaN(input.valueAsNumber) && input.value !== input.defaultValue);
116
+ const adopted = new Set();
117
+ for (const { name, apply } of restored) {
118
+ if (adopted.has(name))
119
+ continue;
120
+ adopted.add(name);
121
+ apply();
122
+ }
123
+ return {
124
+ session,
125
+ program,
126
+ settled: () => pending,
127
+ destroy: () => {
128
+ destroyed = true;
129
+ for (const c of cleanups.splice(0))
130
+ c();
131
+ },
132
+ };
133
+ }
134
+ function clearProblem(input) {
135
+ input.setCustomValidity('');
136
+ input.removeAttribute('aria-invalid');
137
+ input.removeAttribute('title');
138
+ }
139
+ /** A control may narrow the input's range (min/max attributes); the session only knows the model's range. */
140
+ function outsideControl(input, value) {
141
+ const min = input.min === '' ? -Infinity : Number(input.min);
142
+ const max = input.max === '' ? Infinity : Number(input.max);
143
+ if (value >= min && value <= max)
144
+ return undefined;
145
+ if (Number.isFinite(min) && Number.isFinite(max))
146
+ return `enter a number from ${min} to ${max}`;
147
+ return Number.isFinite(min) ? `enter a number of at least ${min}` : `enter a number of at most ${max}`;
148
+ }
149
+ function showResult(el, result, format, locale) {
150
+ const text = result.kind === 'value' ? formatNumber(result.value, format, locale) : `⚠ ${result.message}`;
151
+ if (el.textContent !== text)
152
+ el.textContent = text;
153
+ el.classList.toggle('active-error', result.kind === 'error');
154
+ }
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAqE,MAAM,gBAAgB,CAAC;AACpJ,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAmB,MAAM,6BAA6B,CAAC;AA0BvG,MAAM,UAAU,GAAG,CAAC,CAAsB,EAAE,CAAsB,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,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AI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;IAC1G,IAAI,EAAE,CAAC,WAAW,KAAK,IAAI;QAAE,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;IACnD,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC/D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@vchernoy/active-runtime",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "The browser runtime for active-md: makes rendered documents live",
5
+ "keywords": [
6
+ "markdown",
7
+ "interactive",
8
+ "calculator",
9
+ "runtime",
10
+ "active-md"
11
+ ],
12
+ "license": "MIT",
13
+ "homepage": "https://github.com/vchernoy/active-md/tree/main/packages/runtime#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/vchernoy/active-md/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/vchernoy/active-md.git",
20
+ "directory": "packages/runtime"
21
+ },
22
+ "type": "module",
23
+ "main": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "sideEffects": false,
35
+ "engines": {
36
+ "node": ">=18"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "provenance": true
41
+ },
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.build.json"
44
+ },
45
+ "dependencies": {
46
+ "@vchernoy/calc": "0.1.0",
47
+ "@vchernoy/remark-active": "0.1.0",
48
+ "katex": "0.19.1"
49
+ }
50
+ }