@pixerate/editor 0.140.4 → 0.141.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.
Files changed (77) hide show
  1. package/dist/agent/canvasPlayback.d.cts +15 -0
  2. package/dist/agent/canvasPlayback.d.ts +15 -0
  3. package/dist/agent/index.cjs +144 -23
  4. package/dist/agent/index.d.cts +1 -0
  5. package/dist/agent/index.d.ts +1 -0
  6. package/dist/agent/index.js +125 -4
  7. package/dist/agent/providers.d.cts +8 -0
  8. package/dist/agent/providers.d.ts +8 -0
  9. package/dist/agent/types.d.cts +3 -0
  10. package/dist/agent/types.d.ts +3 -0
  11. package/dist/animation/index.cjs +2 -2
  12. package/dist/animation/index.js +1 -1
  13. package/dist/animation/presence.d.cts +1 -75
  14. package/dist/animation/presence.d.ts +1 -75
  15. package/dist/bridge/cli.cjs +3 -3
  16. package/dist/bridge/cli.js +2 -2
  17. package/dist/bridge/index.cjs +3 -3
  18. package/dist/bridge/index.js +2 -2
  19. package/dist/canvas/index.cjs +336 -646
  20. package/dist/canvas/index.d.cts +1 -0
  21. package/dist/canvas/index.d.ts +1 -0
  22. package/dist/canvas/index.js +44 -354
  23. package/dist/canvas/playback.d.cts +14 -0
  24. package/dist/canvas/playback.d.ts +14 -0
  25. package/dist/chart/index.cjs +7 -7
  26. package/dist/chart/index.js +1 -1
  27. package/dist/chunk-6SFREX6H.cjs +406 -0
  28. package/dist/chunk-DW4CV5H4.js +591 -0
  29. package/dist/{chunk-UMS6YFA6.js → chunk-EAQ4BGNS.js} +1 -1
  30. package/dist/{chunk-AGCD3EHB.cjs → chunk-ENIZYNEF.cjs} +7 -7
  31. package/dist/chunk-MFFE55CS.js +406 -0
  32. package/dist/{chunk-BSGPXPTW.js → chunk-PEEP2YR7.js} +1 -1
  33. package/dist/{chunk-RB62U6MS.js → chunk-RFBFTLVN.js} +27 -5
  34. package/dist/chunk-UBRYHNRU.cjs +591 -0
  35. package/dist/{chunk-GEY73RUW.cjs → chunk-UJGAA6AK.cjs} +1 -1
  36. package/dist/{chunk-HDK3T2QS.cjs → chunk-Y4BWZB6J.cjs} +29 -7
  37. package/dist/commands/index.cjs +37 -1
  38. package/dist/commands/index.js +36 -0
  39. package/dist/commands/registry.d.cts +11 -0
  40. package/dist/commands/registry.d.ts +11 -0
  41. package/dist/diagram/index.cjs +7 -7
  42. package/dist/diagram/index.js +1 -1
  43. package/dist/image-editor/index.cjs +108 -16
  44. package/dist/image-editor/index.d.cts +1 -0
  45. package/dist/image-editor/index.d.ts +1 -0
  46. package/dist/image-editor/index.js +107 -15
  47. package/dist/image-editor/playback.d.cts +22 -0
  48. package/dist/image-editor/playback.d.ts +22 -0
  49. package/dist/paint-editor/index.cjs +6 -6
  50. package/dist/paint-editor/index.js +1 -1
  51. package/dist/tools/index.cjs +33 -3
  52. package/dist/tools/index.d.cts +2 -0
  53. package/dist/tools/index.d.ts +2 -0
  54. package/dist/tools/index.js +32 -2
  55. package/dist/tools/playback.d.cts +205 -0
  56. package/dist/tools/playback.d.ts +205 -0
  57. package/dist/tools/presence.d.cts +82 -0
  58. package/dist/tools/presence.d.ts +82 -0
  59. package/dist/tools/registry.d.cts +45 -6
  60. package/dist/tools/registry.d.ts +45 -6
  61. package/dist/tools/view.d.cts +2 -4
  62. package/dist/tools/view.d.ts +2 -4
  63. package/dist/vector/index.cjs +217 -100
  64. package/dist/vector/index.d.cts +1 -0
  65. package/dist/vector/index.d.ts +1 -0
  66. package/dist/vector/index.js +140 -23
  67. package/dist/vector/playback.d.cts +13 -0
  68. package/dist/vector/playback.d.ts +13 -0
  69. package/package.json +1 -1
  70. package/skills/pixerate-agent-tools/SKILL.md +13 -0
  71. package/skills/pixerate-canvas/SKILL.md +3 -0
  72. package/skills/pixerate-image-editor/SKILL.md +2 -2
  73. package/skills/pixerate-vector/SKILL.md +5 -0
  74. package/dist/chunk-BTZS3KZY.js +0 -221
  75. package/dist/chunk-MRD3NXKR.cjs +0 -221
  76. /package/dist/{chunk-K73HMKQP.js → chunk-PLKIYNJZ.js} +0 -0
  77. /package/dist/{chunk-LACYURUW.cjs → chunk-TNCWKC5M.cjs} +0 -0
@@ -31,6 +31,7 @@ export * from './brushstroke.cjs';
31
31
  export * from './gradient.cjs';
32
32
  export * from './mermaid/index.cjs';
33
33
  export * from './agent-presence.cjs';
34
+ export * from './playback.cjs';
34
35
  export * from './capture.cjs';
35
36
  export * from './effects.cjs';
36
37
  export * from './effect-player.cjs';
@@ -31,6 +31,7 @@ export * from './brushstroke.js';
31
31
  export * from './gradient.js';
32
32
  export * from './mermaid/index.js';
33
33
  export * from './agent-presence.js';
34
+ export * from './playback.js';
34
35
  export * from './capture.js';
35
36
  export * from './effects.js';
36
37
  export * from './effect-player.js';
@@ -65,17 +65,35 @@ import {
65
65
  DEFAULT_NODE_HEIGHT,
66
66
  DEFAULT_NODE_WIDTH,
67
67
  DEFAULT_PLACEMENT_GAP,
68
+ LOCKED_DATA_KEY,
69
+ LOCKED_PREVIOUS_FLAGS_KEY,
70
+ alignNodes,
71
+ applyNodeUpdates,
68
72
  boundsOf,
69
73
  centerNodes,
70
74
  centre,
75
+ createNodeLookup,
76
+ distributeNodes,
71
77
  ensureLayout,
72
78
  estimateNodeSize,
73
79
  flowSide,
80
+ getAbsolutePosition,
74
81
  getCenteredNodePosition,
75
82
  getLayoutedNodes,
83
+ getNodeRect,
84
+ getNodeSize,
85
+ invertNodeUpdates,
86
+ isLocked,
87
+ lockNodes,
88
+ matchSize,
76
89
  overlaps,
77
- placeBeside
78
- } from "../chunk-BTZS3KZY.js";
90
+ placeBeside,
91
+ readStyleSize,
92
+ reorderNodes,
93
+ toggleLockNodes,
94
+ unlockNodes,
95
+ withStyleSize
96
+ } from "../chunk-DW4CV5H4.js";
79
97
  import {
80
98
  DEFAULT_ARRANGE_SHORTCUTS,
81
99
  matchArrangeShortcut
@@ -869,358 +887,6 @@ var StreamingLayoutManager = class {
869
887
  }
870
888
  };
871
889
 
872
- // src/canvas/arrange.ts
873
- var LOCKED_DATA_KEY = "locked";
874
- var LOCKED_PREVIOUS_FLAGS_KEY = "lockedPrevious";
875
- function parsePx(value) {
876
- if (typeof value === "number" && Number.isFinite(value)) return value;
877
- if (typeof value === "string") {
878
- const match = /^\s*(-?\d+(?:\.\d+)?)(px)?\s*$/i.exec(value);
879
- if (match) return Number(match[1]);
880
- }
881
- return void 0;
882
- }
883
- function readStyleSize(style) {
884
- if (!style) return {};
885
- if (typeof style === "object") {
886
- return { width: parsePx(style.width), height: parsePx(style.height) };
887
- }
888
- const read = (prop) => {
889
- const match = new RegExp(`(?:^|;)\\s*${prop}\\s*:\\s*([^;]+)`, "i").exec(style);
890
- return match ? parsePx(match[1]) : void 0;
891
- };
892
- return { width: read("width"), height: read("height") };
893
- }
894
- function withStyleSize(style, size2) {
895
- if (!style) return style ?? void 0;
896
- if (typeof style === "object") {
897
- const next2 = { ...style };
898
- if (size2.width !== void 0 && "width" in next2) next2.width = size2.width;
899
- if (size2.height !== void 0 && "height" in next2) next2.height = size2.height;
900
- return next2;
901
- }
902
- let next = style;
903
- for (const prop of ["width", "height"]) {
904
- const value = size2[prop];
905
- if (value === void 0) continue;
906
- next = next.replace(
907
- new RegExp(`((?:^|;)\\s*${prop}\\s*:\\s*)[^;]+`, "i"),
908
- `$1${value}px`
909
- );
910
- }
911
- return next;
912
- }
913
- function getNodeSize(node, options = {}) {
914
- const styleSize = readStyleSize(node.style);
915
- let width = node.measured?.width ?? node.width ?? styleSize.width;
916
- let height = node.measured?.height ?? node.height ?? styleSize.height;
917
- if (width === void 0 || height === void 0) {
918
- const fallback = options.estimate === false ? { width: options.defaultWidth ?? 200, height: options.defaultHeight ?? 60 } : estimateNodeSize(node, options.defaultWidth, options.defaultHeight);
919
- width ??= fallback.width;
920
- height ??= fallback.height;
921
- }
922
- return { width, height };
923
- }
924
- function getAbsolutePosition(node, lookup) {
925
- let x = node.position.x;
926
- let y = node.position.y;
927
- const seen = /* @__PURE__ */ new Set([node.id]);
928
- let parentId = node.parentId;
929
- while (parentId && !seen.has(parentId)) {
930
- const parent = lookup.get(parentId);
931
- if (!parent) break;
932
- seen.add(parentId);
933
- x += parent.position.x;
934
- y += parent.position.y;
935
- parentId = parent.parentId;
936
- }
937
- return { x, y };
938
- }
939
- function createNodeLookup(nodes) {
940
- return new Map(nodes.map((n3) => [n3.id, n3]));
941
- }
942
- function getNodeRect(node, lookup, options) {
943
- const { x, y } = node.parentId && lookup ? getAbsolutePosition(node, lookup) : node.position;
944
- return { x, y, ...getNodeSize(node, options) };
945
- }
946
- function isLocked(node) {
947
- return node?.data?.[LOCKED_DATA_KEY] === true;
948
- }
949
- function lockNodes(nodes, ids) {
950
- const idSet = new Set(ids);
951
- return nodes.map((node) => {
952
- if (!idSet.has(node.id) || isLocked(node)) return node;
953
- const previous = {};
954
- if (node.draggable !== void 0) previous.draggable = node.draggable;
955
- if (node.deletable !== void 0) previous.deletable = node.deletable;
956
- return {
957
- ...node,
958
- draggable: false,
959
- deletable: false,
960
- data: { ...node.data, [LOCKED_DATA_KEY]: true, [LOCKED_PREVIOUS_FLAGS_KEY]: previous }
961
- };
962
- });
963
- }
964
- function unlockNodes(nodes, ids) {
965
- const idSet = new Set(ids);
966
- return nodes.map((node) => {
967
- if (!idSet.has(node.id) || !isLocked(node)) return node;
968
- const {
969
- [LOCKED_DATA_KEY]: _locked,
970
- [LOCKED_PREVIOUS_FLAGS_KEY]: previous = {},
971
- ...data
972
- } = node.data;
973
- const next = { ...node, data };
974
- delete next.draggable;
975
- delete next.deletable;
976
- if (previous.draggable !== void 0) next.draggable = previous.draggable;
977
- if (previous.deletable !== void 0) next.deletable = previous.deletable;
978
- return next;
979
- });
980
- }
981
- function toggleLockNodes(nodes, ids) {
982
- const idSet = new Set(ids);
983
- const anyUnlocked = nodes.some((n3) => idSet.has(n3.id) && !isLocked(n3));
984
- return anyUnlocked ? lockNodes(nodes, idSet) : unlockNodes(nodes, idSet);
985
- }
986
- function collect(nodes, ids, options) {
987
- const lookup = createNodeLookup(nodes);
988
- const items = [];
989
- const seen = /* @__PURE__ */ new Set();
990
- for (const id of ids) {
991
- const node = lookup.get(id);
992
- if (!node || seen.has(id)) continue;
993
- seen.add(id);
994
- items.push({ node, rect: getNodeRect(node, lookup, options), locked: isLocked(node) });
995
- }
996
- return { lookup, items };
997
- }
998
- function toPositionUpdates(lookup, targets) {
999
- const updates = [];
1000
- for (const [id, abs] of targets) {
1001
- const node = lookup.get(id);
1002
- let position = abs;
1003
- if (node.parentId && lookup.has(node.parentId)) {
1004
- const parent = lookup.get(node.parentId);
1005
- const parentAbs = targets.get(parent.id) ?? getAbsolutePosition(parent, lookup);
1006
- position = { x: abs.x - parentAbs.x, y: abs.y - parentAbs.y };
1007
- }
1008
- if (position.x !== node.position.x || position.y !== node.position.y) {
1009
- updates.push({ id, position });
1010
- }
1011
- }
1012
- return updates;
1013
- }
1014
- function alignNodes(nodes, ids, edge, options = {}) {
1015
- const { lookup, items } = collect(nodes, ids, options);
1016
- const fixed = typeof options.to === "object" ? options.to : null;
1017
- if (items.length === 0 || !fixed && items.length < 2) return [];
1018
- const bounds = fixed ?? boundsOf(items.map((i) => i.rect));
1019
- const targets = /* @__PURE__ */ new Map();
1020
- for (const { node, rect: rect2, locked } of items) {
1021
- if (locked) continue;
1022
- let { x, y } = rect2;
1023
- switch (edge) {
1024
- case "left":
1025
- x = bounds.x;
1026
- break;
1027
- case "center":
1028
- x = bounds.x + bounds.width / 2 - rect2.width / 2;
1029
- break;
1030
- case "right":
1031
- x = bounds.x + bounds.width - rect2.width;
1032
- break;
1033
- case "top":
1034
- y = bounds.y;
1035
- break;
1036
- case "middle":
1037
- y = bounds.y + bounds.height / 2 - rect2.height / 2;
1038
- break;
1039
- case "bottom":
1040
- y = bounds.y + bounds.height - rect2.height;
1041
- break;
1042
- }
1043
- targets.set(node.id, { x, y });
1044
- }
1045
- return toPositionUpdates(lookup, targets);
1046
- }
1047
- function distributeAxis(items, horizontal, mode, gapOverride, targets) {
1048
- const start = (r) => horizontal ? r.x : r.y;
1049
- const size2 = (r) => horizontal ? r.width : r.height;
1050
- const sorted = [...items].sort(
1051
- (a, b) => start(a.rect) + size2(a.rect) / 2 - (start(b.rect) + size2(b.rect) / 2)
1052
- );
1053
- const first = sorted[0].rect;
1054
- const last = sorted[sorted.length - 1].rect;
1055
- const n3 = sorted.length;
1056
- const set = (item, value) => {
1057
- if (item.locked) return;
1058
- const current = targets.get(item.node.id) ?? { x: item.rect.x, y: item.rect.y };
1059
- targets.set(item.node.id, horizontal ? { ...current, x: value } : { ...current, y: value });
1060
- };
1061
- if (mode === "centres") {
1062
- const c0 = start(first) + size2(first) / 2;
1063
- const c1 = start(last) + size2(last) / 2;
1064
- const step = (c1 - c0) / (n3 - 1);
1065
- sorted.forEach((item, i) => set(item, c0 + step * i - size2(item.rect) / 2));
1066
- return;
1067
- }
1068
- const span = start(last) + size2(last) - start(first);
1069
- const total = sorted.reduce((sum, item) => sum + size2(item.rect), 0);
1070
- const gap = gapOverride ?? (span - total) / (n3 - 1);
1071
- let cursor = start(first);
1072
- for (const item of sorted) {
1073
- set(item, cursor);
1074
- cursor += size2(item.rect) + gap;
1075
- }
1076
- }
1077
- function distributeNodes(nodes, ids, axis, mode = "gaps", options = {}) {
1078
- const { lookup, items } = collect(nodes, ids, options);
1079
- const minimum = options.gap !== void 0 && mode === "gaps" ? 2 : 3;
1080
- if (items.length < minimum) return [];
1081
- const targets = /* @__PURE__ */ new Map();
1082
- if (axis !== "vertical") distributeAxis(items, true, mode, options.gap, targets);
1083
- if (axis !== "horizontal") distributeAxis(items, false, mode, options.gap, targets);
1084
- return toPositionUpdates(lookup, targets);
1085
- }
1086
- function matchSize(nodes, ids, dimension, options = {}) {
1087
- const { items } = collect(nodes, ids, options);
1088
- if (items.length < 2) return [];
1089
- const reference = options.reference ?? "largest";
1090
- const pick = (dim) => {
1091
- if (typeof reference === "object") {
1092
- const item = items.find((i) => i.node.id === reference.id);
1093
- if (item) return item.rect[dim];
1094
- }
1095
- if (reference === "first") return items[0].rect[dim];
1096
- const values = items.map((i) => i.rect[dim]);
1097
- return reference === "smallest" ? Math.min(...values) : Math.max(...values);
1098
- };
1099
- const width = dimension !== "height" ? pick("width") : void 0;
1100
- const height = dimension !== "width" ? pick("height") : void 0;
1101
- const updates = [];
1102
- for (const { node, rect: rect2, locked } of items) {
1103
- if (locked) continue;
1104
- const update = { id: node.id };
1105
- if (width !== void 0 && width !== rect2.width) update.width = width;
1106
- if (height !== void 0 && height !== rect2.height) update.height = height;
1107
- if (update.width === void 0 && update.height === void 0) continue;
1108
- if (options.keepCentre) {
1109
- update.position = {
1110
- x: node.position.x - ((update.width ?? rect2.width) - rect2.width) / 2,
1111
- y: node.position.y - ((update.height ?? rect2.height) - rect2.height) / 2
1112
- };
1113
- }
1114
- updates.push(update);
1115
- }
1116
- return updates;
1117
- }
1118
- function reorderNodes(nodes, ids, operation, options = {}) {
1119
- const lookup = createNodeLookup(nodes);
1120
- const targetIds = new Set(
1121
- [...ids].filter((id) => lookup.has(id) && !isLocked(lookup.get(id)))
1122
- );
1123
- if (targetIds.size === 0) return [];
1124
- const groups = /* @__PURE__ */ new Map();
1125
- for (const node of nodes) {
1126
- const key = node.parentId ?? "";
1127
- if (!groups.has(key)) groups.set(key, []);
1128
- groups.get(key).push(node);
1129
- }
1130
- const updates = [];
1131
- for (const siblings of groups.values()) {
1132
- if (!siblings.some((n3) => targetIds.has(n3.id))) continue;
1133
- const order = siblings.map((node, index) => ({ node, index, z: typeof node.zIndex === "number" ? node.zIndex : 0 })).sort((a, b) => a.z - b.z || a.index - b.index).map((entry) => entry.node);
1134
- const isTarget = (n3) => targetIds.has(n3.id);
1135
- let next;
1136
- if (operation === "bringToFront") {
1137
- next = [...order.filter((n3) => !isTarget(n3)), ...order.filter(isTarget)];
1138
- } else if (operation === "sendToBack") {
1139
- next = [...order.filter(isTarget), ...order.filter((n3) => !isTarget(n3))];
1140
- } else {
1141
- next = [...order];
1142
- const forward = operation === "bringForward";
1143
- const rects = new Map(next.map((n3) => [n3.id, getNodeRect(n3, lookup, options)]));
1144
- const intersects = (a, b) => a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
1145
- const indices = next.map((_, i) => i);
1146
- if (forward) indices.reverse();
1147
- for (const i of indices) {
1148
- const node = next[i];
1149
- if (!isTarget(node)) continue;
1150
- const step = forward ? 1 : -1;
1151
- let j = i + step;
1152
- let swapWith = -1;
1153
- let firstNonTarget = -1;
1154
- while (j >= 0 && j < next.length) {
1155
- if (!isTarget(next[j])) {
1156
- if (firstNonTarget === -1) firstNonTarget = j;
1157
- if (intersects(rects.get(node.id), rects.get(next[j].id))) {
1158
- swapWith = j;
1159
- break;
1160
- }
1161
- }
1162
- j += step;
1163
- }
1164
- if (swapWith === -1) swapWith = firstNonTarget;
1165
- if (swapWith === -1) continue;
1166
- next.splice(i, 1);
1167
- next.splice(swapWith, 0, node);
1168
- }
1169
- }
1170
- if (next.every((node, i) => node === order[i])) continue;
1171
- next.forEach((node, rank) => {
1172
- const current = typeof node.zIndex === "number" ? node.zIndex : 0;
1173
- if (current !== rank) updates.push({ id: node.id, zIndex: rank });
1174
- });
1175
- }
1176
- return updates;
1177
- }
1178
- function applyNodeUpdates(nodes, updates) {
1179
- if (updates.length === 0) return nodes;
1180
- const byId = /* @__PURE__ */ new Map();
1181
- for (const update of updates) {
1182
- byId.set(update.id, { ...byId.get(update.id), ...update });
1183
- }
1184
- return nodes.map((node) => {
1185
- const update = byId.get(node.id);
1186
- if (!update) return node;
1187
- const next = { ...node };
1188
- if (update.position) next.position = { ...update.position };
1189
- if (update.zIndex !== void 0) next.zIndex = update.zIndex;
1190
- if (update.width !== void 0 || update.height !== void 0) {
1191
- if (update.width !== void 0) next.width = update.width;
1192
- if (update.height !== void 0) next.height = update.height;
1193
- if (node.style) next.style = withStyleSize(node.style, update);
1194
- if (node.measured) {
1195
- next.measured = {
1196
- ...node.measured,
1197
- ...update.width !== void 0 ? { width: update.width } : {},
1198
- ...update.height !== void 0 ? { height: update.height } : {}
1199
- };
1200
- }
1201
- }
1202
- return next;
1203
- });
1204
- }
1205
- function invertNodeUpdates(nodes, updates) {
1206
- const lookup = createNodeLookup(nodes);
1207
- const inverse = [];
1208
- for (const update of updates) {
1209
- const node = lookup.get(update.id);
1210
- if (!node) continue;
1211
- const back = { id: node.id };
1212
- if (update.position) back.position = { ...node.position };
1213
- if (update.zIndex !== void 0) back.zIndex = typeof node.zIndex === "number" ? node.zIndex : 0;
1214
- if (update.width !== void 0 || update.height !== void 0) {
1215
- const size2 = getNodeSize(node);
1216
- if (update.width !== void 0) back.width = size2.width;
1217
- if (update.height !== void 0) back.height = size2.height;
1218
- }
1219
- inverse.push(back);
1220
- }
1221
- return inverse;
1222
- }
1223
-
1224
890
  // src/canvas/guides.ts
1225
891
  function snapToGrid(value, spacing, origin = 0) {
1226
892
  if (!(spacing > 0) || !Number.isFinite(spacing)) return value;
@@ -11513,6 +11179,29 @@ function isAgentCursor(cursor) {
11513
11179
  return false;
11514
11180
  }
11515
11181
 
11182
+ // src/canvas/playback.ts
11183
+ function createCanvasPlaybackLocator(options) {
11184
+ return (ref) => {
11185
+ const nodes = options.getNodes();
11186
+ const lookup = createNodeLookup(nodes);
11187
+ const rectOf = (id) => {
11188
+ const node = lookup.get(id);
11189
+ return node ? getNodeRect(node, lookup, options.rectOptions) : null;
11190
+ };
11191
+ if (ref.kind === "node" || ref.kind === "item") return rectOf(ref.id);
11192
+ if (ref.kind === "edge") {
11193
+ const edge = options.getEdges?.().find((e) => e.id === ref.id);
11194
+ const a = edge && rectOf(edge.source);
11195
+ const b = edge && rectOf(edge.target);
11196
+ if (!a || !b) return null;
11197
+ const x = (a.x + a.width / 2 + b.x + b.width / 2) / 2;
11198
+ const y = (a.y + a.height / 2 + b.y + b.height / 2) / 2;
11199
+ return { x: x - 12, y: y - 12, width: 24, height: 24 };
11200
+ }
11201
+ return null;
11202
+ };
11203
+ }
11204
+
11516
11205
  // src/canvas/capture.ts
11517
11206
  var CANVAS_CAPTURE_VIEWPORT_SELECTOR = ".xyflow__viewport, .react-flow__viewport, .svelte-flow__viewport";
11518
11207
  var CANVAS_CAPTURE_CHROME_SELECTORS = [
@@ -12133,6 +11822,7 @@ export {
12133
11822
  createCanvasEffectsController,
12134
11823
  createCanvasEffectsToolProvider,
12135
11824
  createCanvasInstance,
11825
+ createCanvasPlaybackLocator,
12136
11826
  createCanvasScenesStore,
12137
11827
  createDefaultStrokeStyle,
12138
11828
  createFanOutTrajectory,
@@ -0,0 +1,14 @@
1
+ import type { PlaybackRect, PlaybackRef } from '../tools/playback.cjs';
2
+ import { type NodeRectOptions } from './arrange.cjs';
3
+ import type { CanvasEdge, CanvasNode } from './types.cjs';
4
+ export interface CanvasPlaybackLocatorOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
5
+ getNodes: () => readonly TNode[];
6
+ getEdges?: () => readonly TEdge[];
7
+ /** Size resolution for unmeasured nodes. */
8
+ rectOptions?: NodeRectOptions;
9
+ }
10
+ /**
11
+ * Finds `{ kind: 'node', id }` (the node's absolute rectangle) and `{ kind: 'edge', id }` (a small
12
+ * box at the middle of the line between its nodes' centres) in flow coordinates.
13
+ */
14
+ export declare function createCanvasPlaybackLocator<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(options: CanvasPlaybackLocatorOptions<TNode, TEdge>): (ref: PlaybackRef) => PlaybackRect | null;
@@ -0,0 +1,14 @@
1
+ import type { PlaybackRect, PlaybackRef } from '../tools/playback.js';
2
+ import { type NodeRectOptions } from './arrange.js';
3
+ import type { CanvasEdge, CanvasNode } from './types.js';
4
+ export interface CanvasPlaybackLocatorOptions<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge> {
5
+ getNodes: () => readonly TNode[];
6
+ getEdges?: () => readonly TEdge[];
7
+ /** Size resolution for unmeasured nodes. */
8
+ rectOptions?: NodeRectOptions;
9
+ }
10
+ /**
11
+ * Finds `{ kind: 'node', id }` (the node's absolute rectangle) and `{ kind: 'edge', id }` (a small
12
+ * box at the middle of the line between its nodes' centres) in flow coordinates.
13
+ */
14
+ export declare function createCanvasPlaybackLocator<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdge = CanvasEdge>(options: CanvasPlaybackLocatorOptions<TNode, TEdge>): (ref: PlaybackRef) => PlaybackRect | null;
@@ -149,7 +149,7 @@ var _chunkN3KJFGXTcjs = require('../chunk-N3KJFGXT.cjs');
149
149
 
150
150
 
151
151
 
152
- var _chunkGEY73RUWcjs = require('../chunk-GEY73RUW.cjs');
152
+ var _chunkUJGAA6AKcjs = require('../chunk-UJGAA6AK.cjs');
153
153
 
154
154
 
155
155
  var _chunkALNIFK5Gcjs = require('../chunk-ALNIFK5G.cjs');
@@ -1644,11 +1644,11 @@ function blendChartScenes(from, to, t) {
1644
1644
  var easeChartTween = (t) => 1 - Math.pow(1 - Math.max(0, Math.min(1, t)), 3);
1645
1645
 
1646
1646
  // src/chart/presence.ts
1647
- var ChartPresence = class extends _chunkGEY73RUWcjs.PresenceStore {
1647
+ var ChartPresence = class extends _chunkUJGAA6AKcjs.PresenceStore {
1648
1648
  };
1649
- var CHART_PRESENCE_COLORS = _chunkGEY73RUWcjs.PRESENCE_COLORS;
1650
- var realChartClock = _chunkGEY73RUWcjs.realPresenceClock;
1651
- var createInstantChartClock = _chunkGEY73RUWcjs.createInstantPresenceClock;
1649
+ var CHART_PRESENCE_COLORS = _chunkUJGAA6AKcjs.PRESENCE_COLORS;
1650
+ var realChartClock = _chunkUJGAA6AKcjs.realPresenceClock;
1651
+ var createInstantChartClock = _chunkUJGAA6AKcjs.createInstantPresenceClock;
1652
1652
  function chartPointAnchor(scene, seriesId, index) {
1653
1653
  const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _91 => _91.target, 'optionalAccess', _92 => _92.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
1654
1654
  if (!mark) return null;
@@ -1715,7 +1715,7 @@ var ChartDirector = class {
1715
1715
  this.presence = presence;
1716
1716
  this.options = options;
1717
1717
  this.clock = _nullishCoalesce(options.clock, () => ( realChartClock));
1718
- this.queue = new (0, _chunkGEY73RUWcjs.PerformanceQueue)(presence, {
1718
+ this.queue = new (0, _chunkUJGAA6AKcjs.PerformanceQueue)(presence, {
1719
1719
  clock: this.clock,
1720
1720
  linger: options.linger,
1721
1721
  beginGesture: (key) => controller.beginGesture(key),
@@ -1746,7 +1746,7 @@ var ChartDirector = class {
1746
1746
  return null;
1747
1747
  }
1748
1748
  move(id, from, to, ms, each) {
1749
- return _chunkGEY73RUWcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, from, to, ms, each);
1749
+ return _chunkUJGAA6AKcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, from, to, ms, each);
1750
1750
  }
1751
1751
  async performOne(id, command) {
1752
1752
  const stale = this.stale(command);
@@ -149,7 +149,7 @@ import {
149
149
  createInstantPresenceClock,
150
150
  realPresenceClock,
151
151
  tweenPresenceCursor
152
- } from "../chunk-BSGPXPTW.js";
152
+ } from "../chunk-PEEP2YR7.js";
153
153
  import {
154
154
  readZip
155
155
  } from "../chunk-CIQIM2IP.js";