@mindees/renderer 0.21.0 → 0.22.1

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.js CHANGED
@@ -111,6 +111,11 @@ function createCanvas2DBackend(options = {}) {
111
111
  markDirty();
112
112
  },
113
113
  insert(parent, node, anchor) {
114
+ if (node.parent) {
115
+ const prev = node.parent.children;
116
+ const at = prev.indexOf(node);
117
+ if (at >= 0) prev.splice(at, 1);
118
+ }
114
119
  node.parent = parent;
115
120
  const idx = anchor ? parent.children.indexOf(anchor) : -1;
116
121
  if (idx >= 0) parent.children.splice(idx, 0, node);
@@ -1 +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;EACE,KAAK,eAAe;GAClB,MAAM,IAAI,IAAI,EAAE,CAAC;GACjB,MAAM,IAAI,IAAI,EAAE,CAAC;GACjB,MAAM,IAAI,IAAI,EAAE,KAAK;GACrB,MAAM,IAAI,IAAI,EAAE,MAAM;GACtB,IAAI,MAAM;IACR,IAAI,YAAY;IAChB,IAAI,SAAS,GAAG,GAAG,GAAG,CAAC;GACzB;GACA,IAAI,QAAQ;IACV,IAAI,cAAc;IAClB,IAAI,YAAY;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,SAAS,MAAM,KAAK;EACpD,QAAQ,MAAM,OAAO;GACnB,KAAK,OAAO;GACZ,UAAU;EACZ;EACA,QAAQ,MAAM,KAAK,OAAO;GACxB,IAAI,UAAU,KAAA,GAAW,OAAO,KAAK,MAAM;QACtC,KAAK,MAAM,OAAO;GACvB,UAAU;EACZ;EACA,OAAO,QAAQ,MAAM,QAAQ;GAC3B,KAAK,SAAS;GACd,MAAM,MAAM,SAAS,OAAO,SAAS,QAAQ,MAAM,IAAI;GACvD,IAAI,OAAO,GAAG,OAAO,SAAS,OAAO,KAAK,GAAG,IAAI;QAC5C,OAAO,SAAS,KAAK,IAAI;GAC9B,UAAU;EACZ;EACA,OAAO,QAAQ,MAAM;GACnB,MAAM,MAAM,OAAO,SAAS,QAAQ,IAAI;GACxC,IAAI,OAAO,GAAG,OAAO,SAAS,OAAO,KAAK,CAAC;GAC3C,KAAK,SAAS;GACd,UAAU;EACZ;EACA,WAAW,SAAS,KAAK;EACzB,YAAY,MAAM;GAChB,MAAM,WAAW,KAAK,QAAQ;GAC9B,IAAI,CAAC,UAAU,OAAO;GACtB,MAAM,MAAM,SAAS,QAAQ,IAAI;GACjC,OAAO,OAAO,KAAK,MAAM,IAAI,SAAS,SAAU,SAAS,MAAM,KAAmB;EACpF;EACA,SAAS,SAAS,KAAK;EACvB,MAAM,KAAK,OAAO,QAAQ;GACxB,IAAI,UAAU,GAAG,GAAG,OAAO,MAAM;GACjC,KAAK,MAAM,SAAS,KAAK,UAAU,SAAS,KAAK,KAAK;EACxD;CACF;AACF"}
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 // Move-semantics (matches the headless/native/DOM backends): if the node is already mounted,\n // detach it from its old parent FIRST so a keyed-list reorder MOVES it rather than duplicating\n // it in the scene graph. The anchor index is read AFTER the detach (it can shift on removal).\n if (node.parent) {\n const prev = node.parent.children\n const at = prev.indexOf(node)\n if (at >= 0) prev.splice(at, 1)\n }\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,KA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KAAK,GAAG,IAAI;QAC5C,OAAO,SAAS,KAAK,IAAI;GAC9B,UAAU;EACZ;EACA,OAAO,QAAQ,MAAM;GACnB,MAAM,MAAM,OAAO,SAAS,QAAQ,IAAI;GACxC,IAAI,OAAO,GAAG,OAAO,SAAS,OAAO,KAAK,CAAC;GAC3C,KAAK,SAAS;GACd,UAAU;EACZ;EACA,WAAW,SAAS,KAAK;EACzB,YAAY,MAAM;GAChB,MAAM,WAAW,KAAK,QAAQ;GAC9B,IAAI,CAAC,UAAU,OAAO;GACtB,MAAM,MAAM,SAAS,QAAQ,IAAI;GACjC,OAAO,OAAO,KAAK,MAAM,IAAI,SAAS,SAAU,SAAS,MAAM,KAAmB;EACpF;EACA,SAAS,SAAS,KAAK;EACvB,MAAM,KAAK,OAAO,QAAQ;GACxB,IAAI,UAAU,GAAG,GAAG,OAAO,MAAM;GACjC,KAAK,MAAM,SAAS,KAAK,UAAU,SAAS,KAAK,KAAK;EACxD;CACF;AACF"}
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ import { Maturity, NotImplementedError, PackageInfo, notImplemented } from "@min
17
17
  /** The npm package name. */
18
18
  declare const name = "@mindees/renderer";
19
19
  /** The package version. All `@mindees/*` packages share one locked version line. */
20
- declare const VERSION = "0.21.0";
20
+ declare const VERSION = "0.22.1";
21
21
  /**
22
22
  * Current maturity. The Helix **web/DOM** renderer (reconciler, DOM backend,
23
23
  * headless backend, SSR + hydration) is implemented and tested. Native
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import { NotImplementedError, notImplemented } from "@mindees/core";
16
16
  /** The npm package name. */
17
17
  const name = "@mindees/renderer";
18
18
  /** The package version. All `@mindees/*` packages share one locked version line. */
19
- const VERSION = "0.21.0";
19
+ const VERSION = "0.22.1";
20
20
  /**
21
21
  * Current maturity. The Helix **web/DOM** renderer (reconciler, DOM backend,
22
22
  * headless backend, SSR + hydration) is implemented and tested. Native
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/** 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.21.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"}
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.22.1'\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.21.0",
3
+ "version": "0.22.1",
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.21.0"
26
+ "@mindees/core": "0.22.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "happy-dom": "20.9.0"