stickyflow 0.9.1 → 0.9.3

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 (40) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/binding/index.cjs +9 -9
  3. package/dist/binding/index.js +3 -3
  4. package/dist/{chunk-BL5NCXS4.cjs → chunk-2GKXPZRL.cjs} +23 -23
  5. package/dist/{chunk-BL5NCXS4.cjs.map → chunk-2GKXPZRL.cjs.map} +1 -1
  6. package/dist/{chunk-RUSNRDLI.cjs → chunk-3EOG34QN.cjs} +48 -44
  7. package/dist/chunk-3EOG34QN.cjs.map +1 -0
  8. package/dist/{chunk-CM35H45Z.js → chunk-AAP24GBG.js} +3 -3
  9. package/dist/{chunk-CM35H45Z.js.map → chunk-AAP24GBG.js.map} +1 -1
  10. package/dist/{chunk-QL7MNEMT.cjs → chunk-C25NWWIH.cjs} +48 -3
  11. package/dist/chunk-C25NWWIH.cjs.map +1 -0
  12. package/dist/{chunk-7ZEC7AB4.js → chunk-C3LVKPWQ.js} +19 -15
  13. package/dist/chunk-C3LVKPWQ.js.map +1 -0
  14. package/dist/{chunk-5EY7EK5V.cjs → chunk-EURX7QT3.cjs} +653 -653
  15. package/dist/{chunk-5EY7EK5V.cjs.map → chunk-EURX7QT3.cjs.map} +1 -1
  16. package/dist/{chunk-TH2HFMEL.js → chunk-G2N3KJYJ.js} +3 -3
  17. package/dist/{chunk-TH2HFMEL.js.map → chunk-G2N3KJYJ.js.map} +1 -1
  18. package/dist/{chunk-OUWGWDJ2.cjs → chunk-MR32IJQO.cjs} +15 -15
  19. package/dist/{chunk-OUWGWDJ2.cjs.map → chunk-MR32IJQO.cjs.map} +1 -1
  20. package/dist/{chunk-D2266VBZ.js → chunk-Q6FBISNP.js} +48 -3
  21. package/dist/chunk-Q6FBISNP.js.map +1 -0
  22. package/dist/{chunk-IKTSCLIK.js → chunk-XNNNIOJU.js} +4 -4
  23. package/dist/{chunk-IKTSCLIK.js.map → chunk-XNNNIOJU.js.map} +1 -1
  24. package/dist/index.cjs +36 -36
  25. package/dist/index.js +5 -5
  26. package/dist/interaction/index.cjs +288 -231
  27. package/dist/interaction/index.cjs.map +1 -1
  28. package/dist/interaction/index.js +60 -3
  29. package/dist/interaction/index.js.map +1 -1
  30. package/dist/stickyflow-diagram.global.js +37 -37
  31. package/dist/stickyflow-diagram.global.js.map +1 -1
  32. package/dist/viewer/index.cjs +9 -9
  33. package/dist/viewer/index.js +4 -4
  34. package/dist/web-component/index.cjs +6 -6
  35. package/dist/web-component/index.js +4 -4
  36. package/package.json +1 -1
  37. package/dist/chunk-7ZEC7AB4.js.map +0 -1
  38. package/dist/chunk-D2266VBZ.js.map +0 -1
  39. package/dist/chunk-QL7MNEMT.cjs.map +0 -1
  40. package/dist/chunk-RUSNRDLI.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk5EY7EK5V_cjs = require('./chunk-5EY7EK5V.cjs');
4
- var chunkOUWGWDJ2_cjs = require('./chunk-OUWGWDJ2.cjs');
5
- var chunkQL7MNEMT_cjs = require('./chunk-QL7MNEMT.cjs');
3
+ var chunkEURX7QT3_cjs = require('./chunk-EURX7QT3.cjs');
4
+ var chunkMR32IJQO_cjs = require('./chunk-MR32IJQO.cjs');
5
+ var chunkC25NWWIH_cjs = require('./chunk-C25NWWIH.cjs');
6
6
 
7
7
  // src/runtime/viewer/components/rollingNumberDom.ts
8
8
  var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
@@ -162,12 +162,12 @@ function componentDigits(surface) {
162
162
  function componentStyle(surface) {
163
163
  const encoded = surface.getAttribute("data-sf-widget-style");
164
164
  if (!encoded) {
165
- return chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
165
+ return chunkC25NWWIH_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
166
166
  }
167
167
  try {
168
- return { ...chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE, ...JSON.parse(encoded) };
168
+ return { ...chunkC25NWWIH_cjs.DEFAULT_ROLLING_NUMBER_STYLE, ...JSON.parse(encoded) };
169
169
  } catch {
170
- return chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
170
+ return chunkC25NWWIH_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
171
171
  }
172
172
  }
173
173
  function positiveInteger(value) {
@@ -191,7 +191,7 @@ function setRollingNumber(surface, value, animate) {
191
191
  return false;
192
192
  }
193
193
  const previousValue = surface.getAttribute("data-sf-widget-value") ?? "";
194
- const nextValue = chunkQL7MNEMT_cjs.formatRollingNumber(value, positiveInteger(surface.getAttribute("data-sf-widget-digits")));
194
+ const nextValue = chunkC25NWWIH_cjs.formatRollingNumber(value, positiveInteger(surface.getAttribute("data-sf-widget-digits")));
195
195
  if (previousValue === nextValue) {
196
196
  return true;
197
197
  }
@@ -507,12 +507,16 @@ function patchSceneElement(current, next) {
507
507
  function ownerIdOf(element) {
508
508
  return element.getAttribute("data-sf-id") ?? element.id;
509
509
  }
510
+ function keyedElements(svg) {
511
+ const seen = /* @__PURE__ */ new Map();
512
+ return Array.from(svg.querySelectorAll(":scope > [id]"), (element) => {
513
+ const count = seen.get(element.id) ?? 0;
514
+ seen.set(element.id, count + 1);
515
+ return [`${element.id}#${count}`, element];
516
+ });
517
+ }
510
518
  function currentElementsById(svg) {
511
- const elements = /* @__PURE__ */ new Map();
512
- for (const element of svg.querySelectorAll(":scope > [id]")) {
513
- elements.set(element.id, element);
514
- }
515
- return elements;
519
+ return new Map(keyedElements(svg));
516
520
  }
517
521
  function reusableElement(current, next, markTouched) {
518
522
  if (current && current.tagName === next.tagName) {
@@ -545,15 +549,15 @@ function patchSceneNodes(svg, next) {
545
549
  touchedOwnerIds.add(ownerId);
546
550
  };
547
551
  let previousSibling = definitions;
548
- for (const nextElement of next.querySelectorAll(":scope > [id]")) {
549
- retainedIds.add(nextElement.id);
552
+ for (const [key, nextElement] of keyedElements(next)) {
553
+ retainedIds.add(key);
550
554
  newOwnerIds.add(ownerIdOf(nextElement));
551
- const liveElement = reusableElement(currentById.get(nextElement.id), nextElement, markTouched);
555
+ const liveElement = reusableElement(currentById.get(key), nextElement, markTouched);
552
556
  placeAfter(svg, liveElement, previousSibling);
553
557
  previousSibling = liveElement;
554
558
  }
555
- for (const [id, element] of currentById) {
556
- if (!retainedIds.has(id)) {
559
+ for (const [key, element] of currentById) {
560
+ if (!retainedIds.has(key)) {
557
561
  touchedOwnerIds.add(ownerIdOf(element));
558
562
  element.remove();
559
563
  }
@@ -667,7 +671,7 @@ function mountDisplay(container, svgString) {
667
671
  }
668
672
 
669
673
  // src/runtime/viewer/events.ts
670
- var Emitter2 = class extends chunkOUWGWDJ2_cjs.Emitter {
674
+ var Emitter2 = class extends chunkMR32IJQO_cjs.Emitter {
671
675
  };
672
676
 
673
677
  // src/runtime/viewer/export/raster.ts
@@ -757,11 +761,11 @@ function svgElement(document, name, attributes) {
757
761
  function readComponentStyle(surface) {
758
762
  try {
759
763
  return {
760
- ...chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE,
764
+ ...chunkC25NWWIH_cjs.DEFAULT_ROLLING_NUMBER_STYLE,
761
765
  ...JSON.parse(surface.getAttribute("data-sf-widget-style") ?? "{}")
762
766
  };
763
767
  } catch {
764
- return chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
768
+ return chunkC25NWWIH_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
765
769
  }
766
770
  }
767
771
  function cellsOf(box, plain, fontSize = 0) {
@@ -901,7 +905,7 @@ function serializeSvgSnapshot(svg, captures) {
901
905
  // src/runtime/viewer/interaction/changeFlash.ts
902
906
  function createChangeFlash(svg) {
903
907
  const timers = /* @__PURE__ */ new Map();
904
- const flash = (ownerIds, color2 = chunkOUWGWDJ2_cjs.CHANGE_COLOR) => {
908
+ const flash = (ownerIds, color2 = chunkMR32IJQO_cjs.CHANGE_COLOR) => {
905
909
  const ids = [...new Set(ownerIds)];
906
910
  if (ids.length === 0) {
907
911
  return;
@@ -909,7 +913,7 @@ function createChangeFlash(svg) {
909
913
  const doc = svg.ownerDocument;
910
914
  const reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
911
915
  for (const id of ids) {
912
- const primary = chunkOUWGWDJ2_cjs.findOwnerNode(svg, id, chunkOUWGWDJ2_cjs.isPrimary);
916
+ const primary = chunkMR32IJQO_cjs.findOwnerNode(svg, id, chunkMR32IJQO_cjs.isPrimary);
913
917
  if (!primary) {
914
918
  continue;
915
919
  }
@@ -920,10 +924,10 @@ function createChangeFlash(svg) {
920
924
  for (const stale of svg.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(id)}"]`)) {
921
925
  stale.remove();
922
926
  }
923
- const overlay = primary.getAttribute("data-sf-role") === "link" ? chunkOUWGWDJ2_cjs.linkChangeOverlay(doc, primary, id, color2) : chunkOUWGWDJ2_cjs.shapeChangeOverlay(doc, primary, id, color2);
927
+ const overlay = primary.getAttribute("data-sf-role") === "link" ? chunkMR32IJQO_cjs.linkChangeOverlay(doc, primary, id, color2) : chunkMR32IJQO_cjs.shapeChangeOverlay(doc, primary, id, color2);
924
928
  svg.appendChild(overlay);
925
- chunkOUWGWDJ2_cjs.startChangeFade(overlay, reducedMotion);
926
- const duration = reducedMotion ? chunkOUWGWDJ2_cjs.REDUCED_MOTION_DURATION_MS : chunkOUWGWDJ2_cjs.FLASH_DURATION_MS;
929
+ chunkMR32IJQO_cjs.startChangeFade(overlay, reducedMotion);
930
+ const duration = reducedMotion ? chunkMR32IJQO_cjs.REDUCED_MOTION_DURATION_MS : chunkMR32IJQO_cjs.FLASH_DURATION_MS;
927
931
  timers.set(
928
932
  id,
929
933
  setTimeout(() => {
@@ -1010,7 +1014,7 @@ var OwnerPointerController = class {
1010
1014
  this.#selection = selection;
1011
1015
  }
1012
1016
  hover(event) {
1013
- const owner = chunkOUWGWDJ2_cjs.resolveOwner(event.target);
1017
+ const owner = chunkMR32IJQO_cjs.resolveOwner(event.target);
1014
1018
  this.#emitter.emit(
1015
1019
  "ownerHover",
1016
1020
  owner ? { diagramId: this.#diagramId, owner, modifiers: modifiersOf(event) } : { diagramId: this.#diagramId, owner: null }
@@ -1018,7 +1022,7 @@ var OwnerPointerController = class {
1018
1022
  }
1019
1023
  select(event) {
1020
1024
  const target = event.target;
1021
- const owner = chunkOUWGWDJ2_cjs.resolveOwner(target);
1025
+ const owner = chunkMR32IJQO_cjs.resolveOwner(target);
1022
1026
  if (!owner) {
1023
1027
  this.#clearWhenOutsideOverlay(target);
1024
1028
  return;
@@ -1039,7 +1043,7 @@ var OwnerPointerController = class {
1039
1043
  owner,
1040
1044
  modifiers
1041
1045
  });
1042
- const node = chunkOUWGWDJ2_cjs.findOwnerNode(this.#svg, owner.id, chunkOUWGWDJ2_cjs.isPrimary);
1046
+ const node = chunkMR32IJQO_cjs.findOwnerNode(this.#svg, owner.id, chunkMR32IJQO_cjs.isPrimary);
1043
1047
  if (node && !node.hasAttribute("tabindex")) {
1044
1048
  node.setAttribute("tabindex", "-1");
1045
1049
  }
@@ -1067,12 +1071,12 @@ var PointerInteractionSession = class {
1067
1071
  }
1068
1072
  #onPointerDown = (event) => {
1069
1073
  const target = event.target;
1070
- const overContent = Boolean(chunkOUWGWDJ2_cjs.resolveOwner(target)) || isSelectionOverlayControl(target);
1074
+ const overContent = Boolean(chunkMR32IJQO_cjs.resolveOwner(target)) || isSelectionOverlayControl(target);
1071
1075
  this.#down = {
1072
1076
  x: event.clientX,
1073
1077
  y: event.clientY,
1074
1078
  moved: false,
1075
- panable: chunkOUWGWDJ2_cjs.isCameraGesture(event) || !overContent
1079
+ panable: chunkMR32IJQO_cjs.isCameraGesture(event) || !overContent
1076
1080
  };
1077
1081
  };
1078
1082
  #onPointerMove = (event) => {
@@ -1100,7 +1104,7 @@ var PointerInteractionSession = class {
1100
1104
  if (!this.#down.moved) {
1101
1105
  return false;
1102
1106
  }
1103
- if (this.#down.panable && chunkOUWGWDJ2_cjs.isCameraGesture(event)) {
1107
+ if (this.#down.panable && chunkMR32IJQO_cjs.isCameraGesture(event)) {
1104
1108
  this.#display.panBy(event.movementX, event.movementY);
1105
1109
  }
1106
1110
  return true;
@@ -1124,15 +1128,15 @@ function paintSelectionOverlays(svg, selectedIds, owners) {
1124
1128
  }
1125
1129
  const document = svg.ownerDocument;
1126
1130
  for (const id of selectedIds) {
1127
- const primary = chunkOUWGWDJ2_cjs.findOwnerNode(svg, id, chunkOUWGWDJ2_cjs.isPrimary);
1131
+ const primary = chunkMR32IJQO_cjs.findOwnerNode(svg, id, chunkMR32IJQO_cjs.isPrimary);
1128
1132
  if (!primary) {
1129
1133
  continue;
1130
1134
  }
1131
1135
  const owner = owners.get(id);
1132
- const overlay = owner?.role === "link" ? chunkOUWGWDJ2_cjs.linkSelectionOverlay(document, primary, id, svg) : owner?.role === "path" ? chunkOUWGWDJ2_cjs.pathSelectionOverlay(document, primary, id, svg) : owner?.role === "isometric" ? chunkOUWGWDJ2_cjs.isometricSelectionOverlay(document, primary, id, svg) : chunkOUWGWDJ2_cjs.shapeSelectionOverlay(document, primary, id, svg, owner ? chunkOUWGWDJ2_cjs.DERIVED_HEIGHT_ROLES.has(owner.role) : false);
1136
+ const overlay = owner?.role === "link" ? chunkMR32IJQO_cjs.linkSelectionOverlay(document, primary, id, svg) : owner?.role === "path" ? chunkMR32IJQO_cjs.pathSelectionOverlay(document, primary, id, svg) : owner?.role === "isometric" ? chunkMR32IJQO_cjs.isometricSelectionOverlay(document, primary, id, svg) : chunkMR32IJQO_cjs.shapeSelectionOverlay(document, primary, id, svg, owner ? chunkMR32IJQO_cjs.DERIVED_HEIGHT_ROLES.has(owner.role) : false);
1133
1137
  svg.appendChild(overlay);
1134
1138
  if (owner?.role === "shape" && selectedIds.size === 1) {
1135
- svg.appendChild(chunkOUWGWDJ2_cjs.quickDuplicateBubbles(document, primary, id, svg));
1139
+ svg.appendChild(chunkMR32IJQO_cjs.quickDuplicateBubbles(document, primary, id, svg));
1136
1140
  }
1137
1141
  }
1138
1142
  }
@@ -1171,7 +1175,7 @@ var SelectionController = class {
1171
1175
  selectIds(ids) {
1172
1176
  for (const id of ids) {
1173
1177
  const element = this.#svg.querySelector(`[data-sf-id="${CSS.escape(id)}"]`);
1174
- const owner = chunkOUWGWDJ2_cjs.resolveOwner(element);
1178
+ const owner = chunkMR32IJQO_cjs.resolveOwner(element);
1175
1179
  if (owner) {
1176
1180
  this.remember(owner);
1177
1181
  }
@@ -1183,7 +1187,7 @@ var SelectionController = class {
1183
1187
  // src/runtime/viewer/interaction/wheel.ts
1184
1188
  function bindWheelZoom(display, selection) {
1185
1189
  const onWheel = (event) => {
1186
- if (!chunkOUWGWDJ2_cjs.isCameraGesture(event)) {
1190
+ if (!chunkMR32IJQO_cjs.isCameraGesture(event)) {
1187
1191
  return;
1188
1192
  }
1189
1193
  event.preventDefault();
@@ -4332,21 +4336,21 @@ function mountShaderSurfaces(svg) {
4332
4336
 
4333
4337
  // src/runtime/viewer/source.ts
4334
4338
  function renderViewerSource(next, defaultRenderOptions) {
4335
- const svg = next.svg ?? (next.source != null ? chunk5EY7EK5V_cjs.render(next.source, { ...next.renderOptions ?? defaultRenderOptions, linkHitAreas: true }).svg : null);
4339
+ const svg = next.svg ?? (next.source != null ? chunkEURX7QT3_cjs.render(next.source, { ...next.renderOptions ?? defaultRenderOptions, linkHitAreas: true }).svg : null);
4336
4340
  if (svg == null) {
4337
4341
  throw new Error("createViewer: provide either `source` (SFL) or `svg`.");
4338
4342
  }
4339
4343
  return svg;
4340
4344
  }
4341
4345
  function assertCreateViewerContract(svg) {
4342
- const version = chunkOUWGWDJ2_cjs.parseContractVersion(svg);
4343
- if (!chunkOUWGWDJ2_cjs.isContractCompatible(version)) {
4346
+ const version = chunkMR32IJQO_cjs.parseContractVersion(svg);
4347
+ if (!chunkMR32IJQO_cjs.isContractCompatible(version)) {
4344
4348
  throw new Error(`createViewer: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
4345
4349
  }
4346
4350
  }
4347
4351
  function assertViewerUpdateContract(svg) {
4348
- const version = chunkOUWGWDJ2_cjs.parseContractVersion(svg);
4349
- if (!chunkOUWGWDJ2_cjs.isContractCompatible(version)) {
4352
+ const version = chunkMR32IJQO_cjs.parseContractVersion(svg);
4353
+ if (!chunkMR32IJQO_cjs.isContractCompatible(version)) {
4350
4354
  throw new Error(`viewer.update: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
4351
4355
  }
4352
4356
  }
@@ -4580,7 +4584,7 @@ function trackScales(wiring, event) {
4580
4584
  }
4581
4585
  function driveValue(wiring, id, event) {
4582
4586
  const { runtime, svg } = wiring;
4583
- const kind = chunkQL7MNEMT_cjs.getComponentDescriptor(runtime.graph.elements.get(id)?.componentType)?.interaction;
4587
+ const kind = chunkC25NWWIH_cjs.getComponentDescriptor(runtime.graph.elements.get(id)?.componentType)?.interaction;
4584
4588
  if (kind !== "slide" && kind !== "pick" && kind !== "turn" && kind !== "range") {
4585
4589
  return;
4586
4590
  }
@@ -4719,5 +4723,5 @@ exports.connectInteraction = connectInteraction;
4719
4723
  exports.createViewer = createViewer;
4720
4724
  exports.registerShaderProgram = registerShaderProgram;
4721
4725
  exports.shaderProgram = shaderProgram;
4722
- //# sourceMappingURL=chunk-RUSNRDLI.cjs.map
4723
- //# sourceMappingURL=chunk-RUSNRDLI.cjs.map
4726
+ //# sourceMappingURL=chunk-3EOG34QN.cjs.map
4727
+ //# sourceMappingURL=chunk-3EOG34QN.cjs.map