@canvas-harness/core 0.1.16 → 0.1.17

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/index.d.cts CHANGED
@@ -2132,6 +2132,11 @@ declare const toSerialized: (scene: Scene) => SerializedScene;
2132
2132
  declare const fromSerialized: (raw: SerializedScene | unknown) => Scene;
2133
2133
  /**
2134
2134
  * Convenience: dump a store's current state to wire form.
2135
+ *
2136
+ * `getFrames()` already returns frame nodes in presentation order, so the
2137
+ * id list it yields is the same value `setFrameOrder` maintains — including
2138
+ * it here is what lets a saved scene round-trip slide order. Omitted when
2139
+ * empty to keep the wire form clean (and match `toSerialized`).
2135
2140
  */
2136
2141
  declare const storeToJSON: (store: CanvasStore) => SerializedScene;
2137
2142
 
package/dist/index.d.ts CHANGED
@@ -2132,6 +2132,11 @@ declare const toSerialized: (scene: Scene) => SerializedScene;
2132
2132
  declare const fromSerialized: (raw: SerializedScene | unknown) => Scene;
2133
2133
  /**
2134
2134
  * Convenience: dump a store's current state to wire form.
2135
+ *
2136
+ * `getFrames()` already returns frame nodes in presentation order, so the
2137
+ * id list it yields is the same value `setFrameOrder` maintains — including
2138
+ * it here is what lets a saved scene round-trip slide order. Omitted when
2139
+ * empty to keep the wire form clean (and match `toSerialized`).
2135
2140
  */
2136
2141
  declare const storeToJSON: (store: CanvasStore) => SerializedScene;
2137
2142
 
package/dist/index.js CHANGED
@@ -3456,14 +3456,18 @@ var fromSerialized = (raw) => {
3456
3456
  ...ser.frameOrder ? { frameOrder: ser.frameOrder } : {}
3457
3457
  };
3458
3458
  };
3459
- var storeToJSON = (store) => ({
3460
- schemaVersion: SCHEMA_VERSION,
3461
- nodes: store.getAllNodes(),
3462
- edges: store.getAllEdges(),
3463
- groups: store.getAllGroups(),
3464
- camera: store.getCamera(),
3465
- selection: store.getSelection()
3466
- });
3459
+ var storeToJSON = (store) => {
3460
+ const frameOrder = store.getFrames().map((f) => f.id);
3461
+ return {
3462
+ schemaVersion: SCHEMA_VERSION,
3463
+ nodes: store.getAllNodes(),
3464
+ edges: store.getAllEdges(),
3465
+ groups: store.getAllGroups(),
3466
+ camera: store.getCamera(),
3467
+ selection: store.getSelection(),
3468
+ ...frameOrder.length > 0 ? { frameOrder } : {}
3469
+ };
3470
+ };
3467
3471
 
3468
3472
  // src/render/canvas-setup.ts
3469
3473
  var HARD_MAX_DPR = 3;
@@ -4425,8 +4429,8 @@ var darkenedStyle = (style) => {
4425
4429
  const stroke = style.strokeColor;
4426
4430
  const next = {
4427
4431
  ...style,
4428
- ...fill ? { backgroundColor: darkenHex(fill) } : {},
4429
- ...stroke ? { strokeColor: darkenHex(stroke) } : {}
4432
+ ...fill && !isFullyTransparent(fill) ? { backgroundColor: darkenHex(fill) } : {},
4433
+ ...stroke && !isFullyTransparent(stroke) ? { strokeColor: darkenHex(stroke) } : {}
4430
4434
  };
4431
4435
  darkenedStyleCache.set(style, next);
4432
4436
  return next;
@@ -5885,14 +5889,15 @@ var serializeSelection = (store) => {
5885
5889
  const n = store.getNode(id);
5886
5890
  if (n) nodes.push(n);
5887
5891
  }
5888
- const edges = [];
5892
+ const selectedEdgeIds = /* @__PURE__ */ new Set();
5889
5893
  for (const id of selectedIds) {
5890
- const e = store.getEdge(id);
5891
- if (e && bothEndsInsideSelection(e, selectedNodeIds)) edges.push(e);
5894
+ if (store.getEdge(id)) selectedEdgeIds.add(id);
5892
5895
  }
5896
+ const edges = [];
5893
5897
  for (const e of store.getAllEdges()) {
5894
- if (edges.includes(e)) continue;
5895
- if (bothEndsInsideSelection(e, selectedNodeIds)) edges.push(e);
5898
+ if (!bothEndsInsideSelection(e, selectedNodeIds)) continue;
5899
+ if (hasFreeFloatingEnd(e) && !selectedEdgeIds.has(e.id)) continue;
5900
+ edges.push(e);
5896
5901
  }
5897
5902
  return {
5898
5903
  v: SCHEMA_VERSION,
@@ -5909,6 +5914,7 @@ var endInside = (end, ids) => {
5909
5914
  if (!isAttached(end)) return true;
5910
5915
  return ids.has(end.nodeId);
5911
5916
  };
5917
+ var hasFreeFloatingEnd = (edge) => !isAttached(edge.source) || !isAttached(edge.target);
5912
5918
  var clipBboxCenter = (nodes) => {
5913
5919
  if (nodes.length === 0) return { x: 0, y: 0 };
5914
5920
  let minX = Number.POSITIVE_INFINITY;