@mindees/renderer 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas.d.ts +53 -0
- package/dist/canvas.d.ts.map +1 -0
- package/dist/canvas.js +143 -0
- package/dist/canvas.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/canvas.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HostBackend } from "./backend.js";
|
|
2
|
+
|
|
3
|
+
//#region src/canvas.d.ts
|
|
4
|
+
/** The subset of `CanvasRenderingContext2D` the painter uses (so a WebGPU/mock backend can satisfy it). */
|
|
5
|
+
interface Scene2DContext {
|
|
6
|
+
fillStyle: string;
|
|
7
|
+
strokeStyle: string;
|
|
8
|
+
lineWidth: number;
|
|
9
|
+
globalAlpha: number;
|
|
10
|
+
font: string;
|
|
11
|
+
textBaseline: string;
|
|
12
|
+
save(): void;
|
|
13
|
+
restore(): void;
|
|
14
|
+
clearRect(x: number, y: number, w: number, h: number): void;
|
|
15
|
+
fillRect(x: number, y: number, w: number, h: number): void;
|
|
16
|
+
strokeRect(x: number, y: number, w: number, h: number): void;
|
|
17
|
+
beginPath(): void;
|
|
18
|
+
moveTo(x: number, y: number): void;
|
|
19
|
+
lineTo(x: number, y: number): void;
|
|
20
|
+
arc(x: number, y: number, r: number, start: number, end: number): void;
|
|
21
|
+
closePath(): void;
|
|
22
|
+
fill(): void;
|
|
23
|
+
stroke(): void;
|
|
24
|
+
fillText(text: string, x: number, y: number): void;
|
|
25
|
+
}
|
|
26
|
+
/** A node in the canvas scene graph. */
|
|
27
|
+
interface SceneNode {
|
|
28
|
+
type: string;
|
|
29
|
+
readonly props: Record<string, unknown>;
|
|
30
|
+
text: string;
|
|
31
|
+
readonly isTextNode: boolean;
|
|
32
|
+
parent: SceneNode | null;
|
|
33
|
+
readonly children: SceneNode[];
|
|
34
|
+
}
|
|
35
|
+
/** A Canvas2D backend: the reconciler builds the scene; `paint(ctx)` rasterizes it. */
|
|
36
|
+
interface Canvas2DBackend extends HostBackend<SceneNode> {
|
|
37
|
+
/** The scene root (pass to `render(tree, backend, root)`). */
|
|
38
|
+
readonly root: SceneNode;
|
|
39
|
+
/** Rasterize the whole scene to `ctx` (clears `[0,0,width,height]` first). */
|
|
40
|
+
paint(ctx: Scene2DContext, width: number, height: number): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a Canvas2D scene backend. Drive it with the reconciler
|
|
44
|
+
* (`render(scene, backend, backend.root)`), then call `backend.paint(ctx, w, h)` to rasterize — on a
|
|
45
|
+
* frame loop for animations, or once for static art. `onDirty` fires after any mutation so a host can
|
|
46
|
+
* schedule a repaint.
|
|
47
|
+
*/
|
|
48
|
+
declare function createCanvas2DBackend(options?: {
|
|
49
|
+
onDirty?: () => void;
|
|
50
|
+
}): Canvas2DBackend;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Canvas2DBackend, Scene2DContext, SceneNode, createCanvas2DBackend };
|
|
53
|
+
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","names":[],"sources":["../src/canvas.ts"],"mappings":";;;;UAciB,cAAA;EACf,SAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA;EACA,IAAA;EACA,YAAA;EACA,IAAA;EACA,OAAA;EACA,SAAA,CAAU,CAAA,UAAW,CAAA,UAAW,CAAA,UAAW,CAAA;EAC3C,QAAA,CAAS,CAAA,UAAW,CAAA,UAAW,CAAA,UAAW,CAAA;EAC1C,UAAA,CAAW,CAAA,UAAW,CAAA,UAAW,CAAA,UAAW,CAAA;EAC5C,SAAA;EACA,MAAA,CAAO,CAAA,UAAW,CAAA;EAClB,MAAA,CAAO,CAAA,UAAW,CAAA;EAClB,GAAA,CAAI,CAAA,UAAW,CAAA,UAAW,CAAA,UAAW,KAAA,UAAe,GAAA;EACpD,SAAA;EACA,IAAA;EACA,MAAA;EACA,QAAA,CAAS,IAAA,UAAc,CAAA,UAAW,CAAA;AAAA;;UAInB,SAAA;EACf,IAAA;EAAA,SACS,KAAA,EAAO,MAAA;EAChB,IAAA;EAAA,SACS,UAAA;EACT,MAAA,EAAQ,SAAA;EAAA,SACC,QAAA,EAAU,SAAA;AAAA;;UAIJ,eAAA,SAAwB,WAAA,CAAY,SAAA;EAhBnD;EAAA,SAkBS,IAAA,EAAM,SAAA;EAhBf;EAkBA,KAAA,CAAM,GAAA,EAAK,cAAA,EAAgB,KAAA,UAAe,MAAA;AAAA;;;AAlBC;AAI7C;;;iBAkHgB,qBAAA,CAAsB,OAAA;EAAW,OAAA;AAAA,IAA8B,eAAe"}
|
package/dist/canvas.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//#region src/canvas.ts
|
|
2
|
+
const num = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
3
|
+
const str = (v) => typeof v === "string" ? v : void 0;
|
|
4
|
+
function makeNode(type, isTextNode, text = "") {
|
|
5
|
+
return {
|
|
6
|
+
type,
|
|
7
|
+
props: {},
|
|
8
|
+
text,
|
|
9
|
+
isTextNode,
|
|
10
|
+
parent: null,
|
|
11
|
+
children: []
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Concatenate the immediate text-node children of `node` (how a `canvas-text`'s string content arrives). */
|
|
15
|
+
function textOf(node) {
|
|
16
|
+
let out = "";
|
|
17
|
+
for (const c of node.children) if (c.isTextNode) out += c.text;
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
/** Draw one scene node (and recurse). Coordinates are absolute (no transform stack in v1). */
|
|
21
|
+
function drawNode(ctx, node) {
|
|
22
|
+
if (node.isTextNode) return;
|
|
23
|
+
const p = node.props;
|
|
24
|
+
const opacity = p.opacity === void 0 ? 1 : num(p.opacity, 1);
|
|
25
|
+
const needsAlpha = opacity !== 1;
|
|
26
|
+
if (needsAlpha) {
|
|
27
|
+
ctx.save();
|
|
28
|
+
ctx.globalAlpha *= opacity;
|
|
29
|
+
}
|
|
30
|
+
const fill = str(p.fill);
|
|
31
|
+
const stroke = str(p.stroke);
|
|
32
|
+
const strokeWidth = num(p.strokeWidth, 1);
|
|
33
|
+
switch (node.type) {
|
|
34
|
+
case "canvas-rect": {
|
|
35
|
+
const x = num(p.x);
|
|
36
|
+
const y = num(p.y);
|
|
37
|
+
const w = num(p.width);
|
|
38
|
+
const h = num(p.height);
|
|
39
|
+
if (fill) {
|
|
40
|
+
ctx.fillStyle = fill;
|
|
41
|
+
ctx.fillRect(x, y, w, h);
|
|
42
|
+
}
|
|
43
|
+
if (stroke) {
|
|
44
|
+
ctx.strokeStyle = stroke;
|
|
45
|
+
ctx.lineWidth = strokeWidth;
|
|
46
|
+
ctx.strokeRect(x, y, w, h);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case "canvas-circle": {
|
|
51
|
+
const cx = num(p.x);
|
|
52
|
+
const cy = num(p.y);
|
|
53
|
+
const r = num(p.radius);
|
|
54
|
+
ctx.beginPath();
|
|
55
|
+
ctx.arc(cx, cy, r, 0, Math.PI * 2);
|
|
56
|
+
ctx.closePath();
|
|
57
|
+
if (fill) {
|
|
58
|
+
ctx.fillStyle = fill;
|
|
59
|
+
ctx.fill();
|
|
60
|
+
}
|
|
61
|
+
if (stroke) {
|
|
62
|
+
ctx.strokeStyle = stroke;
|
|
63
|
+
ctx.lineWidth = strokeWidth;
|
|
64
|
+
ctx.stroke();
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "canvas-line":
|
|
69
|
+
ctx.beginPath();
|
|
70
|
+
ctx.moveTo(num(p.x1), num(p.y1));
|
|
71
|
+
ctx.lineTo(num(p.x2), num(p.y2));
|
|
72
|
+
ctx.strokeStyle = stroke ?? fill ?? "#000";
|
|
73
|
+
ctx.lineWidth = strokeWidth;
|
|
74
|
+
ctx.stroke();
|
|
75
|
+
break;
|
|
76
|
+
case "canvas-text": {
|
|
77
|
+
const content = textOf(node);
|
|
78
|
+
if (content) {
|
|
79
|
+
ctx.font = str(p.font) ?? "16px sans-serif";
|
|
80
|
+
ctx.textBaseline = str(p.baseline) ?? "top";
|
|
81
|
+
ctx.fillStyle = fill ?? "#000";
|
|
82
|
+
ctx.fillText(content, num(p.x), num(p.y));
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
default: break;
|
|
87
|
+
}
|
|
88
|
+
for (const child of node.children) drawNode(ctx, child);
|
|
89
|
+
if (needsAlpha) ctx.restore();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a Canvas2D scene backend. Drive it with the reconciler
|
|
93
|
+
* (`render(scene, backend, backend.root)`), then call `backend.paint(ctx, w, h)` to rasterize — on a
|
|
94
|
+
* frame loop for animations, or once for static art. `onDirty` fires after any mutation so a host can
|
|
95
|
+
* schedule a repaint.
|
|
96
|
+
*/
|
|
97
|
+
function createCanvas2DBackend(options = {}) {
|
|
98
|
+
const root = makeNode("canvas", false);
|
|
99
|
+
const markDirty = () => options.onDirty?.();
|
|
100
|
+
return {
|
|
101
|
+
root,
|
|
102
|
+
createElement: (type) => makeNode(type, false),
|
|
103
|
+
createText: (value) => makeNode("#text", true, value),
|
|
104
|
+
setText(node, value) {
|
|
105
|
+
node.text = value;
|
|
106
|
+
markDirty();
|
|
107
|
+
},
|
|
108
|
+
setProp(node, key, value) {
|
|
109
|
+
if (value === void 0) delete node.props[key];
|
|
110
|
+
else node.props[key] = value;
|
|
111
|
+
markDirty();
|
|
112
|
+
},
|
|
113
|
+
insert(parent, node, anchor) {
|
|
114
|
+
node.parent = parent;
|
|
115
|
+
const idx = anchor ? parent.children.indexOf(anchor) : -1;
|
|
116
|
+
if (idx >= 0) parent.children.splice(idx, 0, node);
|
|
117
|
+
else parent.children.push(node);
|
|
118
|
+
markDirty();
|
|
119
|
+
},
|
|
120
|
+
remove(parent, node) {
|
|
121
|
+
const idx = parent.children.indexOf(node);
|
|
122
|
+
if (idx >= 0) parent.children.splice(idx, 1);
|
|
123
|
+
node.parent = null;
|
|
124
|
+
markDirty();
|
|
125
|
+
},
|
|
126
|
+
parentOf: (node) => node.parent,
|
|
127
|
+
nextSibling(node) {
|
|
128
|
+
const siblings = node.parent?.children;
|
|
129
|
+
if (!siblings) return null;
|
|
130
|
+
const idx = siblings.indexOf(node);
|
|
131
|
+
return idx >= 0 && idx + 1 < siblings.length ? siblings[idx + 1] : null;
|
|
132
|
+
},
|
|
133
|
+
isText: (node) => node.isTextNode,
|
|
134
|
+
paint(ctx, width, height) {
|
|
135
|
+
ctx.clearRect(0, 0, width, height);
|
|
136
|
+
for (const child of root.children) drawNode(ctx, child);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { createCanvas2DBackend };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","names":[],"sources":["../src/canvas.ts"],"sourcesContent":["/**\n * The **Helix Canvas strand** (spec §6.2) — a retained-mode 2D scene graph driven by the SAME\n * reconciler as the native/DOM strands, painting to a 2D context. You get Flutter-grade pixel control\n * *exactly where you want it*: a `<canvas-rect>`/`<canvas-text>`/… subtree is built + diffed by Helix,\n * and `paint(ctx)` rasterizes it. The 2D context is an interface ({@link Scene2DContext}) — a real\n * `CanvasRenderingContext2D` satisfies it on web today, and a WebGPU rasterizer can drive the same\n * scene graph later without touching app code.\n *\n * @module\n */\n\nimport type { HostBackend } from './backend'\n\n/** The subset of `CanvasRenderingContext2D` the painter uses (so a WebGPU/mock backend can satisfy it). */\nexport interface Scene2DContext {\n fillStyle: string\n strokeStyle: string\n lineWidth: number\n globalAlpha: number\n font: string\n textBaseline: string\n save(): void\n restore(): void\n clearRect(x: number, y: number, w: number, h: number): void\n fillRect(x: number, y: number, w: number, h: number): void\n strokeRect(x: number, y: number, w: number, h: number): void\n beginPath(): void\n moveTo(x: number, y: number): void\n lineTo(x: number, y: number): void\n arc(x: number, y: number, r: number, start: number, end: number): void\n closePath(): void\n fill(): void\n stroke(): void\n fillText(text: string, x: number, y: number): void\n}\n\n/** A node in the canvas scene graph. */\nexport interface SceneNode {\n type: string\n readonly props: Record<string, unknown>\n text: string\n readonly isTextNode: boolean\n parent: SceneNode | null\n readonly children: SceneNode[]\n}\n\n/** A Canvas2D backend: the reconciler builds the scene; `paint(ctx)` rasterizes it. */\nexport interface Canvas2DBackend extends HostBackend<SceneNode> {\n /** The scene root (pass to `render(tree, backend, root)`). */\n readonly root: SceneNode\n /** Rasterize the whole scene to `ctx` (clears `[0,0,width,height]` first). */\n paint(ctx: Scene2DContext, width: number, height: number): void\n}\n\nconst num = (v: unknown, fallback = 0): number =>\n typeof v === 'number' && Number.isFinite(v) ? v : fallback\nconst str = (v: unknown): string | undefined => (typeof v === 'string' ? v : undefined)\n\nfunction makeNode(type: string, isTextNode: boolean, text = ''): SceneNode {\n return { type, props: {}, text, isTextNode, parent: null, children: [] }\n}\n\n/** Concatenate the immediate text-node children of `node` (how a `canvas-text`'s string content arrives). */\nfunction textOf(node: SceneNode): string {\n let out = ''\n for (const c of node.children) if (c.isTextNode) out += c.text\n return out\n}\n\n/** Draw one scene node (and recurse). Coordinates are absolute (no transform stack in v1). */\nfunction drawNode(ctx: Scene2DContext, node: SceneNode): void {\n if (node.isTextNode) return\n const p = node.props\n const opacity = p.opacity === undefined ? 1 : num(p.opacity, 1)\n const needsAlpha = opacity !== 1\n if (needsAlpha) {\n ctx.save()\n ctx.globalAlpha *= opacity\n }\n const fill = str(p.fill)\n const stroke = str(p.stroke)\n const strokeWidth = num(p.strokeWidth, 1)\n\n switch (node.type) {\n case 'canvas-rect': {\n const x = num(p.x)\n const y = num(p.y)\n const w = num(p.width)\n const h = num(p.height)\n if (fill) {\n ctx.fillStyle = fill\n ctx.fillRect(x, y, w, h)\n }\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth\n ctx.strokeRect(x, y, w, h)\n }\n break\n }\n case 'canvas-circle': {\n const cx = num(p.x)\n const cy = num(p.y)\n const r = num(p.radius)\n ctx.beginPath()\n ctx.arc(cx, cy, r, 0, Math.PI * 2)\n ctx.closePath()\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill()\n }\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth\n ctx.stroke()\n }\n break\n }\n case 'canvas-line': {\n ctx.beginPath()\n ctx.moveTo(num(p.x1), num(p.y1))\n ctx.lineTo(num(p.x2), num(p.y2))\n ctx.strokeStyle = stroke ?? fill ?? '#000'\n ctx.lineWidth = strokeWidth\n ctx.stroke()\n break\n }\n case 'canvas-text': {\n const content = textOf(node)\n if (content) {\n ctx.font = str(p.font) ?? '16px sans-serif'\n ctx.textBaseline = str(p.baseline) ?? 'top'\n ctx.fillStyle = fill ?? '#000'\n ctx.fillText(content, num(p.x), num(p.y))\n }\n break\n }\n // 'canvas' (root) and 'canvas-group' just composite their children.\n default:\n break\n }\n for (const child of node.children) drawNode(ctx, child)\n if (needsAlpha) ctx.restore()\n}\n\n/**\n * Create a Canvas2D scene backend. Drive it with the reconciler\n * (`render(scene, backend, backend.root)`), then call `backend.paint(ctx, w, h)` to rasterize — on a\n * frame loop for animations, or once for static art. `onDirty` fires after any mutation so a host can\n * schedule a repaint.\n */\nexport function createCanvas2DBackend(options: { onDirty?: () => void } = {}): Canvas2DBackend {\n const root = makeNode('canvas', false)\n const markDirty = (): void => options.onDirty?.()\n\n return {\n root,\n createElement: (type) => makeNode(type, false),\n createText: (value) => makeNode('#text', true, value),\n setText(node, value) {\n node.text = value\n markDirty()\n },\n setProp(node, key, value) {\n if (value === undefined) delete node.props[key]\n else node.props[key] = value\n markDirty()\n },\n insert(parent, node, anchor) {\n node.parent = parent\n const idx = anchor ? parent.children.indexOf(anchor) : -1\n if (idx >= 0) parent.children.splice(idx, 0, node)\n else parent.children.push(node)\n markDirty()\n },\n remove(parent, node) {\n const idx = parent.children.indexOf(node)\n if (idx >= 0) parent.children.splice(idx, 1)\n node.parent = null\n markDirty()\n },\n parentOf: (node) => node.parent,\n nextSibling(node) {\n const siblings = node.parent?.children\n if (!siblings) return null\n const idx = siblings.indexOf(node)\n return idx >= 0 && idx + 1 < siblings.length ? (siblings[idx + 1] as SceneNode) : null\n },\n isText: (node) => node.isTextNode,\n paint(ctx, width, height) {\n ctx.clearRect(0, 0, width, height)\n for (const child of root.children) drawNode(ctx, child)\n },\n }\n}\n"],"mappings":";AAsDA,MAAM,OAAO,GAAY,WAAW,MAClC,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,IAAI,IAAI;AACpD,MAAM,OAAO,MAAoC,OAAO,MAAM,WAAW,IAAI,KAAA;AAE7E,SAAS,SAAS,MAAc,YAAqB,OAAO,IAAe;CACzE,OAAO;EAAE;EAAM,OAAO,CAAC;EAAG;EAAM;EAAY,QAAQ;EAAM,UAAU,CAAC;CAAE;AACzE;;AAGA,SAAS,OAAO,MAAyB;CACvC,IAAI,MAAM;CACV,KAAK,MAAM,KAAK,KAAK,UAAU,IAAI,EAAE,YAAY,OAAO,EAAE;CAC1D,OAAO;AACT;;AAGA,SAAS,SAAS,KAAqB,MAAuB;CAC5D,IAAI,KAAK,YAAY;CACrB,MAAM,IAAI,KAAK;CACf,MAAM,UAAU,EAAE,YAAY,KAAA,IAAY,IAAI,IAAI,EAAE,SAAS,CAAC;CAC9D,MAAM,aAAa,YAAY;CAC/B,IAAI,YAAY;EACd,IAAI,KAAK;EACT,IAAI,eAAe;CACrB;CACA,MAAM,OAAO,IAAI,EAAE,IAAI;CACvB,MAAM,SAAS,IAAI,EAAE,MAAM;CAC3B,MAAM,cAAc,IAAI,EAAE,aAAa,CAAC;CAExC,QAAQ,KAAK,MAAb;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AK;EACxD;CACF;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HostBackend, SerializableBackend, isSerializable } from "./backend.js";
|
|
2
|
+
import { Canvas2DBackend, Scene2DContext, SceneNode, createCanvas2DBackend } from "./canvas.js";
|
|
2
3
|
import { DomDocument, DomElement, DomNode, DomText, createDomBackend, domTagFor } from "./dom.js";
|
|
3
4
|
import { bindKeyedChild } from "./for.js";
|
|
4
5
|
import { HeadlessNode, createHeadlessBackend, createHeadlessRoot, isEventProp } from "./headless.js";
|
|
@@ -16,7 +17,7 @@ import { Maturity, NotImplementedError, PackageInfo, notImplemented } from "@min
|
|
|
16
17
|
/** The npm package name. */
|
|
17
18
|
declare const name = "@mindees/renderer";
|
|
18
19
|
/** The package version. All `@mindees/*` packages share one locked version line. */
|
|
19
|
-
declare const VERSION = "0.
|
|
20
|
+
declare const VERSION = "0.10.0";
|
|
20
21
|
/**
|
|
21
22
|
* Current maturity. The Helix **web/DOM** renderer (reconciler, DOM backend,
|
|
22
23
|
* headless backend, SSR + hydration) is implemented and tested. Native
|
|
@@ -31,5 +32,5 @@ declare const maturity: Maturity;
|
|
|
31
32
|
*/
|
|
32
33
|
declare const info: PackageInfo;
|
|
33
34
|
//#endregion
|
|
34
|
-
export { type CanvasBackend, type CreateNativeAppOptions, type CreateNodeCommand, type CreateTextCommand, type DisposeNodeCommand, type DomDocument, type DomElement, type DomNode, type DomText, type HeadlessNode, type HostBackend, type InsertChildCommand, type Maturity, type Mounted, type NativeApp, type NativeBackend, type NativeCommand, type NativeCommandBackend, type NativeCommandBackendOptions, type NativeCommandNode, NativeHostError, type NativeNodeId, type NativePropValue, NotImplementedError, type PackageInfo, type ReferenceHost, type ReferenceHostNode, type RegisterEventCommand, type RemoveChildCommand, type RemovePropCommand, type SerializableBackend, type SetPropCommand, type UnregisterEventCommand, type UpdateTextCommand, VERSION, bindKeyedChild, bindPortalChild, createCanvasBackend, createDomBackend, createHeadlessBackend, createHeadlessRoot, createNativeApp, createNativeBackend, createNativeCommandBackend, createNativeNodeIdFactory, createReferenceHost, domTagFor, hydrate, info, isEventProp, isNativeCommand, isNativePropValue, isSerializable, maturity, mountNode, name, normalizeNativeProp, notImplemented, render, renderToString };
|
|
35
|
+
export { type Canvas2DBackend, type CanvasBackend, type CreateNativeAppOptions, type CreateNodeCommand, type CreateTextCommand, type DisposeNodeCommand, type DomDocument, type DomElement, type DomNode, type DomText, type HeadlessNode, type HostBackend, type InsertChildCommand, type Maturity, type Mounted, type NativeApp, type NativeBackend, type NativeCommand, type NativeCommandBackend, type NativeCommandBackendOptions, type NativeCommandNode, NativeHostError, type NativeNodeId, type NativePropValue, NotImplementedError, type PackageInfo, type ReferenceHost, type ReferenceHostNode, type RegisterEventCommand, type RemoveChildCommand, type RemovePropCommand, type Scene2DContext, type SceneNode, type SerializableBackend, type SetPropCommand, type UnregisterEventCommand, type UpdateTextCommand, VERSION, bindKeyedChild, bindPortalChild, createCanvas2DBackend, createCanvasBackend, createDomBackend, createHeadlessBackend, createHeadlessRoot, createNativeApp, createNativeBackend, createNativeCommandBackend, createNativeNodeIdFactory, createReferenceHost, domTagFor, hydrate, info, isEventProp, isNativeCommand, isNativePropValue, isSerializable, maturity, mountNode, name, normalizeNativeProp, notImplemented, render, renderToString };
|
|
35
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;cA6Fa,IAAA;AAkBuE;AAAA,cAfvE,OAAA;;;;;;;cAQA,QAAA,EAAU,QAAyB;;;;;;cAOnC,IAAA,EAAM,WAAiE"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isSerializable } from "./backend.js";
|
|
2
|
+
import { createCanvas2DBackend } from "./canvas.js";
|
|
2
3
|
import { createDomBackend, domTagFor } from "./dom.js";
|
|
3
4
|
import { bindPortalChild } from "./portal.js";
|
|
4
5
|
import { mountNode, render } from "./render.js";
|
|
@@ -15,7 +16,7 @@ import { NotImplementedError, notImplemented } from "@mindees/core";
|
|
|
15
16
|
/** The npm package name. */
|
|
16
17
|
const name = "@mindees/renderer";
|
|
17
18
|
/** The package version. All `@mindees/*` packages share one locked version line. */
|
|
18
|
-
const VERSION = "0.
|
|
19
|
+
const VERSION = "0.10.0";
|
|
19
20
|
/**
|
|
20
21
|
* Current maturity. The Helix **web/DOM** renderer (reconciler, DOM backend,
|
|
21
22
|
* headless backend, SSR + hydration) is implemented and tested. Native
|
|
@@ -34,6 +35,6 @@ const info = Object.freeze({
|
|
|
34
35
|
maturity
|
|
35
36
|
});
|
|
36
37
|
//#endregion
|
|
37
|
-
export { NativeHostError, NotImplementedError, VERSION, bindKeyedChild, bindPortalChild, createCanvasBackend, createDomBackend, createHeadlessBackend, createHeadlessRoot, createNativeApp, createNativeBackend, createNativeCommandBackend, createNativeNodeIdFactory, createReferenceHost, domTagFor, hydrate, info, isEventProp, isNativeCommand, isNativePropValue, isSerializable, maturity, mountNode, name, normalizeNativeProp, notImplemented, render, renderToString };
|
|
38
|
+
export { NativeHostError, NotImplementedError, VERSION, bindKeyedChild, bindPortalChild, createCanvas2DBackend, createCanvasBackend, createDomBackend, createHeadlessBackend, createHeadlessRoot, createNativeApp, createNativeBackend, createNativeCommandBackend, createNativeNodeIdFactory, createReferenceHost, domTagFor, hydrate, info, isEventProp, isNativeCommand, isNativePropValue, isSerializable, maturity, mountNode, name, normalizeNativeProp, notImplemented, render, renderToString };
|
|
38
39
|
|
|
39
40
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** Host-backend contract + capability detection. */\nexport {\n type HostBackend,\n isSerializable,\n type SerializableBackend,\n} from './backend'\n/** DOM (web) backend. */\nexport {\n createDomBackend,\n type DomDocument,\n type DomElement,\n type DomNode,\n type DomText,\n domTagFor,\n} from './dom'\n/** Keyed list reconciliation (the renderer side of core's KeyedRegion). */\nexport { bindKeyedChild } from './for'\n/** Headless (in-memory) backend — the reference/test target. */\nexport {\n createHeadlessBackend,\n createHeadlessRoot,\n type HeadlessNode,\n isEventProp,\n} from './headless'\n/**\n * Native backends. `createNativeCommandBackend` is implemented (emits a native\n * command stream); `createNativeBackend`/`createCanvasBackend` are research\n * tracks that throw `NotImplementedError`.\n */\nexport {\n type CanvasBackend,\n createCanvasBackend,\n createNativeBackend,\n createNativeCommandBackend,\n type NativeBackend,\n type NativeCommandBackend,\n type NativeCommandBackendOptions,\n type NativeCommandNode,\n} from './native'\n/** One-call native app entry — wires the command backend + host contract. */\nexport {\n type CreateNativeAppOptions,\n createNativeApp,\n type NativeApp,\n} from './native-app'\n/**\n * The strict reference native host — applies a command stream to a model tree and\n * validates it (the executable conformance contract real native hosts implement).\n */\nexport {\n createReferenceHost,\n NativeHostError,\n type ReferenceHost,\n type ReferenceHostNode,\n} from './native-host'\n/** The native command protocol: command types + serialization-safe helpers. */\nexport {\n type CreateNodeCommand,\n type CreateTextCommand,\n createNativeNodeIdFactory,\n type DisposeNodeCommand,\n type InsertChildCommand,\n isNativeCommand,\n isNativePropValue,\n type NativeCommand,\n type NativeNodeId,\n type NativePropValue,\n normalizeNativeProp,\n type RegisterEventCommand,\n type RemoveChildCommand,\n type RemovePropCommand,\n type SetPropCommand,\n type UnregisterEventCommand,\n type UpdateTextCommand,\n} from './native-protocol'\n/** Portal reconciliation (the renderer side of core's PortalRegion). */\nexport { bindPortalChild } from './portal'\n/** The fine-grained reactive reconciler. */\nexport { type Mounted, mountNode, render } from './render'\n/** Server-side rendering + hydration (web). */\nexport { hydrate, renderToString } from './ssr'\n\n/** The npm package name. */\nexport const name = '@mindees/renderer'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** Host-backend contract + capability detection. */\nexport {\n type HostBackend,\n isSerializable,\n type SerializableBackend,\n} from './backend'\n/** Helix Canvas strand — a 2D scene graph driven by the reconciler, painted to a 2D context (§6.2). */\nexport {\n type Canvas2DBackend,\n createCanvas2DBackend,\n type Scene2DContext,\n type SceneNode,\n} from './canvas'\n/** DOM (web) backend. */\nexport {\n createDomBackend,\n type DomDocument,\n type DomElement,\n type DomNode,\n type DomText,\n domTagFor,\n} from './dom'\n/** Keyed list reconciliation (the renderer side of core's KeyedRegion). */\nexport { bindKeyedChild } from './for'\n/** Headless (in-memory) backend — the reference/test target. */\nexport {\n createHeadlessBackend,\n createHeadlessRoot,\n type HeadlessNode,\n isEventProp,\n} from './headless'\n/**\n * Native backends. `createNativeCommandBackend` is implemented (emits a native\n * command stream); `createNativeBackend`/`createCanvasBackend` are research\n * tracks that throw `NotImplementedError`.\n */\nexport {\n type CanvasBackend,\n createCanvasBackend,\n createNativeBackend,\n createNativeCommandBackend,\n type NativeBackend,\n type NativeCommandBackend,\n type NativeCommandBackendOptions,\n type NativeCommandNode,\n} from './native'\n/** One-call native app entry — wires the command backend + host contract. */\nexport {\n type CreateNativeAppOptions,\n createNativeApp,\n type NativeApp,\n} from './native-app'\n/**\n * The strict reference native host — applies a command stream to a model tree and\n * validates it (the executable conformance contract real native hosts implement).\n */\nexport {\n createReferenceHost,\n NativeHostError,\n type ReferenceHost,\n type ReferenceHostNode,\n} from './native-host'\n/** The native command protocol: command types + serialization-safe helpers. */\nexport {\n type CreateNodeCommand,\n type CreateTextCommand,\n createNativeNodeIdFactory,\n type DisposeNodeCommand,\n type InsertChildCommand,\n isNativeCommand,\n isNativePropValue,\n type NativeCommand,\n type NativeNodeId,\n type NativePropValue,\n normalizeNativeProp,\n type RegisterEventCommand,\n type RemoveChildCommand,\n type RemovePropCommand,\n type SetPropCommand,\n type UnregisterEventCommand,\n type UpdateTextCommand,\n} from './native-protocol'\n/** Portal reconciliation (the renderer side of core's PortalRegion). */\nexport { bindPortalChild } from './portal'\n/** The fine-grained reactive reconciler. */\nexport { type Mounted, mountNode, render } from './render'\n/** Server-side rendering + hydration (web). */\nexport { hydrate, renderToString } from './ssr'\n\n/** The npm package name. */\nexport const name = '@mindees/renderer'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.10.0'\n\n/**\n * Current maturity. The Helix **web/DOM** renderer (reconciler, DOM backend,\n * headless backend, SSR + hydration) is implemented and tested. Native\n * (iOS/Android) and the GPU canvas are research tracks (throw\n * `NotImplementedError`). See the repository `STATUS.md`.\n */\nexport const maturity: Maturity = 'experimental'\n\n/**\n * Static identity + maturity metadata for this package. Frozen so the\n * self-reported identity tooling introspects cannot be mutated at runtime,\n * matching the `readonly` fields of {@link PackageInfo}.\n */\nexport const info: PackageInfo = Object.freeze({ name, version: VERSION, maturity })\n\nexport type { Maturity, PackageInfo }\nexport { NotImplementedError, notImplemented }\n"],"mappings":";;;;;;;;;;;;;;;;AA6FA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;;;;;;AAQvB,MAAa,WAAqB;;;;;;AAOlC,MAAa,OAAoB,OAAO,OAAO;CAAE;CAAM,SAAS;CAAS;AAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindees/renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "MindeesNative Helix — fine-grained reactive renderer with a web/DOM backend, SSR + hydration, and a headless test backend. Native and GPU-canvas backends are research tracks.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"directory": "packages/renderer"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@mindees/core": "0.
|
|
26
|
+
"@mindees/core": "0.10.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"happy-dom": "20.9.0"
|