vizcraft 1.3.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # vizcraft
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`086ef9e`](https://github.com/ChipiKaf/vizcraft/commit/086ef9e7b5d505cbb03f955e8d24297fb60a6b3e) Thanks [@ChipiKaf](https://github.com/ChipiKaf)! - The fix prevents commit() from using a stale cached runtimePatchCtx (which could reference detached DOM elements) by always recreating it after \_renderSceneToDOM, and removes the redundant strokeDasharray write from patchRuntime so that base style is owned by a single write path.
8
+
3
9
  ## 1.3.0
4
10
 
5
11
  ### Minor Changes
package/dist/builder.js CHANGED
@@ -654,14 +654,13 @@ class VizBuilderImpl {
654
654
  // The reconciliation correctly re-uses existing SVG elements, inserts new ones, and deletes missing ones.
655
655
  const scene = this.build();
656
656
  this._renderSceneToDOM(scene, container);
657
- // Apply runtime overrides (if any)
658
- let ctx = runtimePatchCtxBySvg.get(svg);
659
- if (!ctx) {
660
- ctx = createRuntimePatchCtx(svg, {
661
- edgePathResolver: this._edgePathResolver,
662
- });
663
- runtimePatchCtxBySvg.set(svg, ctx);
664
- }
657
+ // Apply runtime overrides (if any).
658
+ // Always recreate the context after _renderSceneToDOM so patchRuntime
659
+ // never references stale / detached elements (fixes #81).
660
+ const ctx = createRuntimePatchCtx(svg, {
661
+ edgePathResolver: this._edgePathResolver,
662
+ });
663
+ runtimePatchCtxBySvg.set(svg, ctx);
665
664
  patchRuntime(scene, ctx);
666
665
  }
667
666
  /**
@@ -511,19 +511,9 @@ export function patchRuntime(scene, ctx) {
511
511
  shape.removeAttribute('opacity');
512
512
  }
513
513
  }
514
- // Stroke-dasharray: apply resolved value to shape.
515
- if (node.style?.strokeDasharray !== undefined) {
516
- const resolved = resolveDasharray(node.style.strokeDasharray);
517
- if (resolved) {
518
- shape.setAttribute('stroke-dasharray', resolved);
519
- }
520
- else {
521
- shape.removeAttribute('stroke-dasharray');
522
- }
523
- }
524
- else {
525
- shape.removeAttribute('stroke-dasharray');
526
- }
514
+ // NOTE: strokeDasharray is a static base style — written exclusively by
515
+ // _renderSceneToDOM via setSvgAttributes. patchRuntime must NOT duplicate
516
+ // that write to avoid the stale-context overwrite described in #81.
527
517
  if (node.style?.shadow) {
528
518
  const fid = ensureShadowFilter(ctx.svg, node.style.shadow);
529
519
  shape.setAttribute('filter', `url(#${fid})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vizcraft",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A fluent, type-safe SVG scene builder for composing nodes, edges, animations, and overlays with incremental DOM updates and no framework dependency.",
5
5
  "keywords": [
6
6
  "visualization",