stickyflow 0.11.0 → 0.11.2

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 (32) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/binding/index.cjs +8 -8
  3. package/dist/binding/index.js +2 -2
  4. package/dist/{chunk-FXGXUWSI.cjs → chunk-4KBU4CFU.cjs} +7 -7
  5. package/dist/{chunk-FXGXUWSI.cjs.map → chunk-4KBU4CFU.cjs.map} +1 -1
  6. package/dist/{chunk-RQYZNW2I.js → chunk-DGAVCN4D.js} +3 -3
  7. package/dist/{chunk-RQYZNW2I.js.map → chunk-DGAVCN4D.js.map} +1 -1
  8. package/dist/{chunk-5G3BEXQU.cjs → chunk-EHH6ZDK6.cjs} +9 -2
  9. package/dist/chunk-EHH6ZDK6.cjs.map +1 -0
  10. package/dist/{chunk-Q6QLU6YQ.js → chunk-TQIYK5OA.js} +9 -2
  11. package/dist/chunk-TQIYK5OA.js.map +1 -0
  12. package/dist/{chunk-UB2ANTWF.js → chunk-UD6IG2PG.js} +3 -3
  13. package/dist/{chunk-UB2ANTWF.js.map → chunk-UD6IG2PG.js.map} +1 -1
  14. package/dist/{chunk-F24JURN2.cjs → chunk-VYQ6N5SI.cjs} +4 -4
  15. package/dist/{chunk-F24JURN2.cjs.map → chunk-VYQ6N5SI.cjs.map} +1 -1
  16. package/dist/index.cjs +14 -14
  17. package/dist/index.js +3 -3
  18. package/dist/interaction/index.cjs +83 -19
  19. package/dist/interaction/index.cjs.map +1 -1
  20. package/dist/interaction/index.d.cts +2 -1
  21. package/dist/interaction/index.d.ts +2 -1
  22. package/dist/interaction/index.js +83 -20
  23. package/dist/interaction/index.js.map +1 -1
  24. package/dist/stickyflow-diagram.global.js +1 -1
  25. package/dist/stickyflow-diagram.global.js.map +1 -1
  26. package/dist/viewer/index.cjs +7 -7
  27. package/dist/viewer/index.js +2 -2
  28. package/dist/web-component/index.cjs +4 -4
  29. package/dist/web-component/index.js +2 -2
  30. package/package.json +1 -1
  31. package/dist/chunk-5G3BEXQU.cjs.map +0 -1
  32. package/dist/chunk-Q6QLU6YQ.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkFXGXUWSI_cjs = require('./chunk-FXGXUWSI.cjs');
4
- var chunk5G3BEXQU_cjs = require('./chunk-5G3BEXQU.cjs');
3
+ var chunk4KBU4CFU_cjs = require('./chunk-4KBU4CFU.cjs');
4
+ var chunkEHH6ZDK6_cjs = require('./chunk-EHH6ZDK6.cjs');
5
5
  var chunkUHKFJBY5_cjs = require('./chunk-UHKFJBY5.cjs');
6
6
 
7
7
  // src/model/shape/supportedTypes.ts
@@ -76,7 +76,7 @@ function flattenGroups(groups, buckets) {
76
76
  // src/adapters/importJson/assembly.ts
77
77
  function sflToImportJson(sfl) {
78
78
  const state = chunkUHKFJBY5_cjs.sflToCanvasState(sfl);
79
- const collected = chunk5G3BEXQU_cjs.collectCanvasObjects(state);
79
+ const collected = chunkEHH6ZDK6_cjs.collectCanvasObjects(state);
80
80
  const canvas = emptyBuckets();
81
81
  const { groupBuckets, bucketFor } = createBucketResolver(indexGroupMembership(state.groups), canvas);
82
82
  for (const shape of collected.shapes) {
@@ -107,47 +107,47 @@ function sflToImportJson(sfl) {
107
107
 
108
108
  Object.defineProperty(exports, "buildBindingGraph", {
109
109
  enumerable: true,
110
- get: function () { return chunkFXGXUWSI_cjs.buildBindingGraph; }
110
+ get: function () { return chunk4KBU4CFU_cjs.buildBindingGraph; }
111
111
  });
112
112
  Object.defineProperty(exports, "createBindingRuntime", {
113
113
  enumerable: true,
114
- get: function () { return chunkFXGXUWSI_cjs.createBindingRuntime; }
114
+ get: function () { return chunk4KBU4CFU_cjs.createBindingRuntime; }
115
115
  });
116
116
  Object.defineProperty(exports, "createDataSource", {
117
117
  enumerable: true,
118
- get: function () { return chunkFXGXUWSI_cjs.createDataSource; }
118
+ get: function () { return chunk4KBU4CFU_cjs.createDataSource; }
119
119
  });
120
120
  Object.defineProperty(exports, "interactiveElements", {
121
121
  enumerable: true,
122
- get: function () { return chunkFXGXUWSI_cjs.interactiveElements; }
122
+ get: function () { return chunk4KBU4CFU_cjs.interactiveElements; }
123
123
  });
124
124
  Object.defineProperty(exports, "renderBound", {
125
125
  enumerable: true,
126
- get: function () { return chunkFXGXUWSI_cjs.renderBound; }
126
+ get: function () { return chunk4KBU4CFU_cjs.renderBound; }
127
127
  });
128
128
  Object.defineProperty(exports, "decodeColor", {
129
129
  enumerable: true,
130
- get: function () { return chunk5G3BEXQU_cjs.decodeColor; }
130
+ get: function () { return chunkEHH6ZDK6_cjs.decodeColor; }
131
131
  });
132
132
  Object.defineProperty(exports, "decodeShadow", {
133
133
  enumerable: true,
134
- get: function () { return chunk5G3BEXQU_cjs.decodeShadow; }
134
+ get: function () { return chunkEHH6ZDK6_cjs.decodeShadow; }
135
135
  });
136
136
  Object.defineProperty(exports, "defineComponent", {
137
137
  enumerable: true,
138
- get: function () { return chunk5G3BEXQU_cjs.defineComponent; }
138
+ get: function () { return chunkEHH6ZDK6_cjs.defineComponent; }
139
139
  });
140
140
  Object.defineProperty(exports, "render", {
141
141
  enumerable: true,
142
- get: function () { return chunk5G3BEXQU_cjs.render; }
142
+ get: function () { return chunkEHH6ZDK6_cjs.render; }
143
143
  });
144
144
  Object.defineProperty(exports, "renderCanvas", {
145
145
  enumerable: true,
146
- get: function () { return chunk5G3BEXQU_cjs.renderCanvas; }
146
+ get: function () { return chunkEHH6ZDK6_cjs.renderCanvas; }
147
147
  });
148
148
  Object.defineProperty(exports, "sflToRenderInput", {
149
149
  enumerable: true,
150
- get: function () { return chunk5G3BEXQU_cjs.sflToRenderInput; }
150
+ get: function () { return chunkEHH6ZDK6_cjs.sflToRenderInput; }
151
151
  });
152
152
  Object.defineProperty(exports, "AXIS_COS", {
153
153
  enumerable: true,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { buildBindingGraph, createBindingRuntime, createDataSource, interactiveElements, renderBound } from './chunk-UB2ANTWF.js';
2
- import { collectCanvasObjects } from './chunk-Q6QLU6YQ.js';
3
- export { decodeColor, decodeShadow, defineComponent, render, renderCanvas, sflToRenderInput } from './chunk-Q6QLU6YQ.js';
1
+ export { buildBindingGraph, createBindingRuntime, createDataSource, interactiveElements, renderBound } from './chunk-UD6IG2PG.js';
2
+ import { collectCanvasObjects } from './chunk-TQIYK5OA.js';
3
+ export { decodeColor, decodeShadow, defineComponent, render, renderCanvas, sflToRenderInput } from './chunk-TQIYK5OA.js';
4
4
  import { sflToCanvasState } from './chunk-G6IW2IX3.js';
5
5
  export { AXIS_COS, AXIS_SIN, CHART_TYPES, COMPONENT_CATEGORIES, DOM_CONTRACT_VERSION, canonicalizeSource as canonicalize, componentTypes, flattenPath, getComponentDescriptor, isChartObject, isDimensionObject, isGenericComponent, isIsometricObject, isPathObject, isSwimlaneObject, parseSource as parse, pathBounds, pathToSymbol, sflToCanvasState, symbolToPath } from './chunk-G6IW2IX3.js';
6
6
 
@@ -836,6 +836,14 @@ function trackDrag(node, onMove, onEnd) {
836
836
  var CHANNELS = ["r", "g", "b"];
837
837
  var GAP_BELOW_ANCHOR = 6;
838
838
  var VIEWPORT_MARGIN = 8;
839
+ function buildEyedropper(parent) {
840
+ const button = el("button", "sf-cp-eyedropper", parent);
841
+ button.type = "button";
842
+ button.title = "Pick a color from the screen";
843
+ button.setAttribute("aria-label", "Pick a color from the screen");
844
+ button.innerHTML = '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 22l1-1h3l9-9"/><path d="M3 21v-3l9-9"/><path d="M15 6l3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4z"/></svg>';
845
+ return button;
846
+ }
839
847
  function buildSolidControls(root) {
840
848
  const area = el("div", "sf-cp-area", root);
841
849
  const matrix = el("div", "sf-cp-matrix", area);
@@ -859,6 +867,7 @@ function buildSolidControls(root) {
859
867
  const hexInput = el("input", "sf-cp-text", hexRow);
860
868
  hexInput.type = "text";
861
869
  hexInput.spellcheck = false;
870
+ const eyedropper = "EyeDropper" in window ? buildEyedropper(hexRow) : void 0;
862
871
  return {
863
872
  matrix,
864
873
  matrixCursor,
@@ -869,7 +878,8 @@ function buildSolidControls(root) {
869
878
  alphaRow,
870
879
  alphaRange,
871
880
  alphaNumber,
872
- hexInput
881
+ hexInput,
882
+ eyedropper
873
883
  };
874
884
  }
875
885
  function buildGradientControls(root, lockStops) {
@@ -1006,6 +1016,20 @@ function bindAngle(picker) {
1006
1016
  angleNumber.addEventListener("input", (event) => applyAngle(picker, read(event)));
1007
1017
  angleNumber.addEventListener("change", () => commit(picker));
1008
1018
  }
1019
+ function bindEyedropper(picker) {
1020
+ const { eyedropper } = picker.view;
1021
+ eyedropper?.addEventListener("click", async () => {
1022
+ const Dropper = window.EyeDropper;
1023
+ try {
1024
+ const hex = normalizeHex((await new Dropper().open()).sRGBHex);
1025
+ if (hex) {
1026
+ applyHex(picker, hex);
1027
+ commit(picker);
1028
+ }
1029
+ } catch {
1030
+ }
1031
+ });
1032
+ }
1009
1033
  function bindPickerEvents(picker) {
1010
1034
  const { view } = picker;
1011
1035
  const disposers = bindAreas(picker);
@@ -1017,6 +1041,7 @@ function bindPickerEvents(picker) {
1017
1041
  }
1018
1042
  bindAlpha(picker);
1019
1043
  bindHex(picker);
1044
+ bindEyedropper(picker);
1020
1045
  bindAngle(picker);
1021
1046
  return disposers;
1022
1047
  }
@@ -1314,6 +1339,25 @@ var FIELDS_CSS = `
1314
1339
  }
1315
1340
 
1316
1341
  .sf-cp-number,
1342
+ .sf-cp-eyedropper {
1343
+ flex: none;
1344
+ display: grid;
1345
+ place-items: center;
1346
+ width: 24px;
1347
+ height: 24px;
1348
+ margin-left: auto;
1349
+ padding: 0;
1350
+ border: 1px solid var(--sf-cp-field-border);
1351
+ border-radius: 6px;
1352
+ background: var(--sf-cp-field-bg);
1353
+ color: var(--sf-cp-fg);
1354
+ cursor: pointer;
1355
+ }
1356
+
1357
+ .sf-cp-eyedropper:hover {
1358
+ background: var(--sf-cp-hover);
1359
+ }
1360
+
1317
1361
  .sf-cp-text {
1318
1362
  flex: none;
1319
1363
  width: 52px;
@@ -5611,6 +5655,10 @@ function applyGeometryPreview(drag, bounds) {
5611
5655
  return;
5612
5656
  }
5613
5657
  drag.geometryNodes.forEach((node, index) => {
5658
+ if (node.tagName.toLowerCase() === "image") {
5659
+ applyCompositeScale([node], drag.startBounds, bounds, [drag.baseTransforms[index]]);
5660
+ return;
5661
+ }
5614
5662
  applySingleNodeBounds(node, drag.kind, applyInset(bounds, drag.insets[index] ?? NO_INSET));
5615
5663
  });
5616
5664
  }
@@ -7195,29 +7243,44 @@ function movePathPoints(lines, range, dx, dy) {
7195
7243
  );
7196
7244
  replacePropertyValue(lines, span, shifted);
7197
7245
  }
7198
- function applyMoveChange(sfl, event) {
7246
+ function applyMoveChanges(sfl, events) {
7199
7247
  const state = chunkUHKFJBY5_cjs.sflToCanvasState(sfl);
7200
- const canvasObject = state.canvasObjects.find((candidate) => candidate.id === event.owner.id);
7201
- if (!canvasObject) {
7202
- return sfl;
7203
- }
7204
- const parent = canvasObject.parentFrameId ? state.canvasObjects.find((candidate) => candidate.id === canvasObject.parentFrameId) : void 0;
7205
- const originX = parent?.x ?? 0;
7206
- const originY = parent?.y ?? 0;
7207
7248
  const lines = sfl.split("\n");
7208
- const range = findOwnerBlock(lines, event.owner.id);
7209
- if (!range) {
7210
- return sfl;
7211
- }
7212
- if (event.owner.role === "path") {
7213
- movePathPoints(lines, range, event.dx, event.dy);
7214
- return lines.join("\n");
7249
+ const parents = new Map(state.canvasObjects.map((candidate) => [candidate.id, candidate.parentFrameId]));
7250
+ const moving = new Set(events.map((event) => event.owner.id));
7251
+ const hasMovingAncestor = (id) => {
7252
+ const seen = /* @__PURE__ */ new Set();
7253
+ for (let parent = parents.get(id); parent && !seen.has(parent); parent = parents.get(parent)) {
7254
+ if (moving.has(parent)) {
7255
+ return true;
7256
+ }
7257
+ seen.add(parent);
7258
+ }
7259
+ return false;
7260
+ };
7261
+ for (const event of events) {
7262
+ if (hasMovingAncestor(event.owner.id)) {
7263
+ continue;
7264
+ }
7265
+ const canvasObject = state.canvasObjects.find((candidate) => candidate.id === event.owner.id);
7266
+ const range = canvasObject ? findOwnerBlock(lines, event.owner.id) : null;
7267
+ if (!canvasObject || !range) {
7268
+ continue;
7269
+ }
7270
+ if (event.owner.role === "path") {
7271
+ movePathPoints(lines, range, event.dx, event.dy);
7272
+ continue;
7273
+ }
7274
+ const parent = canvasObject.parentFrameId ? state.canvasObjects.find((candidate) => candidate.id === canvasObject.parentFrameId) : void 0;
7275
+ setOrInsertLayoutTuples(lines, range, [
7276
+ ["position", canvasObject.x - (parent?.x ?? 0) + event.dx, canvasObject.y - (parent?.y ?? 0) + event.dy]
7277
+ ]);
7215
7278
  }
7216
- setOrInsertLayoutTuples(lines, range, [
7217
- ["position", canvasObject.x - originX + event.dx, canvasObject.y - originY + event.dy]
7218
- ]);
7219
7279
  return lines.join("\n");
7220
7280
  }
7281
+ function applyMoveChange(sfl, event) {
7282
+ return applyMoveChanges(sfl, [event]);
7283
+ }
7221
7284
 
7222
7285
  // src/runtime/interaction/sflPatch/changes/pathPointChange.ts
7223
7286
  function applyPathPointChange(sfl, event) {
@@ -7798,6 +7861,7 @@ exports.applyChartValueChange = applyChartValueChange;
7798
7861
  exports.applyLinkReconnectChange = applyLinkReconnectChange;
7799
7862
  exports.applyLinkSegmentChange = applyLinkSegmentChange;
7800
7863
  exports.applyMoveChange = applyMoveChange;
7864
+ exports.applyMoveChanges = applyMoveChanges;
7801
7865
  exports.applyPathPointChange = applyPathPointChange;
7802
7866
  exports.applyPropertyChange = applyPropertyChange;
7803
7867
  exports.applyQuickDuplicateChange = applyQuickDuplicateChange;