@canvas-harness/core 0.1.16 → 0.1.18
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.cjs +23 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +23 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
@@ -2294,7 +2294,7 @@ var createDefaultTextareaEditor = ({
|
|
|
2294
2294
|
ta.style.whiteSpace = "pre-wrap";
|
|
2295
2295
|
ta.style.wordBreak = "break-word";
|
|
2296
2296
|
const autosize = () => {
|
|
2297
|
-
ta.style.height = "
|
|
2297
|
+
ta.style.height = "0px";
|
|
2298
2298
|
ta.style.height = `${ta.scrollHeight}px`;
|
|
2299
2299
|
};
|
|
2300
2300
|
const commitNow = () => {
|
|
@@ -3456,14 +3456,18 @@ var fromSerialized = (raw) => {
|
|
|
3456
3456
|
...ser.frameOrder ? { frameOrder: ser.frameOrder } : {}
|
|
3457
3457
|
};
|
|
3458
3458
|
};
|
|
3459
|
-
var storeToJSON = (store) =>
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
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;
|
|
@@ -5197,7 +5201,7 @@ var createRenderer = (opts) => {
|
|
|
5197
5201
|
ctx.fillStyle = "#94a3b8";
|
|
5198
5202
|
ctx.textBaseline = "middle";
|
|
5199
5203
|
ctx.textAlign = "center";
|
|
5200
|
-
ctx.font = `italic ${fontPx}px ${node.style?.fontFamily ?? "
|
|
5204
|
+
ctx.font = `italic ${fontPx}px ${FONT_FAMILY_MAP[node.style?.fontFamily ?? "handwriting"]}`;
|
|
5201
5205
|
ctx.fillText("Type to edit\u2026", node.w / 2, node.h / 2);
|
|
5202
5206
|
ctx.restore();
|
|
5203
5207
|
};
|
|
@@ -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
|
|
5892
|
+
const selectedEdgeIds = /* @__PURE__ */ new Set();
|
|
5889
5893
|
for (const id of selectedIds) {
|
|
5890
|
-
|
|
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 (
|
|
5895
|
-
if (
|
|
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;
|