stickyflow 0.2.0 → 0.4.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.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/dist/{chunk-KFJIFHXG.js → chunk-65IVT4GK.js} +475 -199
- package/dist/chunk-65IVT4GK.js.map +1 -0
- package/dist/{chunk-6JKNT2YC.js → chunk-BYMIYXP5.js} +17 -7
- package/dist/chunk-BYMIYXP5.js.map +1 -0
- package/dist/{chunk-N6WVHOUQ.js → chunk-CSXQD3ON.js} +28 -15
- package/dist/chunk-CSXQD3ON.js.map +1 -0
- package/dist/{chunk-YM3XFBI4.cjs → chunk-CXL254BT.cjs} +17 -6
- package/dist/chunk-CXL254BT.cjs.map +1 -0
- package/dist/{chunk-S5BVAAEF.cjs → chunk-DDCTNLLD.cjs} +989 -713
- package/dist/chunk-DDCTNLLD.cjs.map +1 -0
- package/dist/{chunk-34PK7HEU.cjs → chunk-HFOGKSNU.cjs} +18 -18
- package/dist/{chunk-34PK7HEU.cjs.map → chunk-HFOGKSNU.cjs.map} +1 -1
- package/dist/{chunk-IIOJFR73.cjs → chunk-UXDWH2JC.cjs} +56 -43
- package/dist/chunk-UXDWH2JC.cjs.map +1 -0
- package/dist/{chunk-6LQJUAD4.js → chunk-XEN5QIIJ.js} +6 -6
- package/dist/{chunk-6LQJUAD4.js.map → chunk-XEN5QIIJ.js.map} +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/interaction/index.cjs +780 -382
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.d.cts +12 -3
- package/dist/interaction/index.d.ts +12 -3
- package/dist/interaction/index.js +562 -165
- package/dist/interaction/index.js.map +1 -1
- package/dist/{render-r1GYvjNm.d.cts → render-C5X74hds.d.cts} +75 -4
- package/dist/{render-r1GYvjNm.d.ts → render-C5X74hds.d.ts} +75 -4
- package/dist/{runtimeTypes-ByiafBwg.d.ts → runtimeTypes-D8hPZ62T.d.ts} +1 -1
- package/dist/{runtimeTypes-DwLeD-em.d.cts → runtimeTypes-yTSAvtCn.d.cts} +1 -1
- package/dist/stickyflow-diagram.global.js +37 -35
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/{types-T7W2yTQF.d.cts → types-BDKDf4zr.d.cts} +1 -1
- package/dist/{types-ndGA1kbl.d.ts → types-CdgGdtoD.d.ts} +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +4 -4
- package/dist/viewer/index.d.ts +4 -4
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.d.cts +2 -2
- package/dist/web-component/index.d.ts +2 -2
- package/dist/web-component/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-6JKNT2YC.js.map +0 -1
- package/dist/chunk-IIOJFR73.cjs.map +0 -1
- package/dist/chunk-KFJIFHXG.js.map +0 -1
- package/dist/chunk-N6WVHOUQ.js.map +0 -1
- package/dist/chunk-S5BVAAEF.cjs.map +0 -1
- package/dist/chunk-YM3XFBI4.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkDDCTNLLD_cjs = require('./chunk-DDCTNLLD.cjs');
|
|
4
|
+
var chunkHFOGKSNU_cjs = require('./chunk-HFOGKSNU.cjs');
|
|
5
5
|
|
|
6
6
|
// src/runtime/viewer/display/rootAttributesPatch.ts
|
|
7
7
|
var CAMERA_OWNED_ATTRIBUTES = /* @__PURE__ */ new Set(["viewbox", "width", "height"]);
|
|
@@ -234,6 +234,14 @@ var ViewportController = class {
|
|
|
234
234
|
setNatural(natural) {
|
|
235
235
|
this.#natural = natural;
|
|
236
236
|
}
|
|
237
|
+
#userPoint(clientX, clientY) {
|
|
238
|
+
const matrix = this.#svg.getScreenCTM();
|
|
239
|
+
if (!matrix) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
const point = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
|
|
243
|
+
return { x: point.x, y: point.y };
|
|
244
|
+
}
|
|
237
245
|
zoomBy(factor, clientX, clientY) {
|
|
238
246
|
const rect = this.#svg.getBoundingClientRect();
|
|
239
247
|
if (rect.width <= 0 || rect.height <= 0) {
|
|
@@ -241,16 +249,19 @@ var ViewportController = class {
|
|
|
241
249
|
}
|
|
242
250
|
const centerX = clientX ?? rect.left + rect.width / 2;
|
|
243
251
|
const centerY = clientY ?? rect.top + rect.height / 2;
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
this
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
const anchor = this.#userPoint(centerX, centerY);
|
|
253
|
+
this.#view = { ...this.#view, w: this.#view.w / factor, h: this.#view.h / factor };
|
|
254
|
+
this.apply();
|
|
255
|
+
const moved = anchor ? this.#userPoint(centerX, centerY) : null;
|
|
256
|
+
if (anchor && moved) {
|
|
257
|
+
this.#view.x += anchor.x - moved.x;
|
|
258
|
+
this.#view.y += anchor.y - moved.y;
|
|
259
|
+
}
|
|
249
260
|
this.apply();
|
|
250
261
|
}
|
|
251
262
|
panBy(dxPixels, dyPixels) {
|
|
252
|
-
const
|
|
253
|
-
const pixelsPerUnit =
|
|
263
|
+
const scale = this.#svg.getScreenCTM()?.a;
|
|
264
|
+
const pixelsPerUnit = scale && scale > 0 ? scale : 1;
|
|
254
265
|
this.#view.x -= dxPixels / pixelsPerUnit;
|
|
255
266
|
this.#view.y -= dyPixels / pixelsPerUnit;
|
|
256
267
|
this.apply();
|
|
@@ -286,7 +297,7 @@ function mountDisplay(container, svgString) {
|
|
|
286
297
|
}
|
|
287
298
|
|
|
288
299
|
// src/runtime/viewer/events.ts
|
|
289
|
-
var Emitter2 = class extends
|
|
300
|
+
var Emitter2 = class extends chunkHFOGKSNU_cjs.Emitter {
|
|
290
301
|
};
|
|
291
302
|
|
|
292
303
|
// src/runtime/viewer/export/raster.ts
|
|
@@ -376,15 +387,15 @@ function svgElement(document, name, attributes) {
|
|
|
376
387
|
function readWidgetStyle(surface) {
|
|
377
388
|
try {
|
|
378
389
|
return {
|
|
379
|
-
...
|
|
390
|
+
...chunkDDCTNLLD_cjs.DEFAULT_ROLLING_NUMBER_STYLE,
|
|
380
391
|
...JSON.parse(surface.getAttribute("data-sf-widget-style") ?? "{}")
|
|
381
392
|
};
|
|
382
393
|
} catch {
|
|
383
|
-
return
|
|
394
|
+
return chunkDDCTNLLD_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
|
|
384
395
|
}
|
|
385
396
|
}
|
|
386
|
-
function cellsOf(box, plain) {
|
|
387
|
-
const size = Math.max(1, Math.min(box.width, box.height) * 0.28);
|
|
397
|
+
function cellsOf(box, plain, fontSize = 0) {
|
|
398
|
+
const size = fontSize > 0 ? fontSize : Math.max(1, Math.min(box.width, box.height) * 0.28);
|
|
388
399
|
return {
|
|
389
400
|
size,
|
|
390
401
|
plain,
|
|
@@ -470,7 +481,7 @@ function flattenRollingNumbers(svg) {
|
|
|
470
481
|
const value = surface.getAttribute("data-sf-widget-value") ?? "";
|
|
471
482
|
const style = readWidgetStyle(surface);
|
|
472
483
|
const label = surface.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent ?? "";
|
|
473
|
-
const cells = cellsOf(box, style.variant === "plain");
|
|
484
|
+
const cells = cellsOf(box, style.variant === "plain", style.fontSize);
|
|
474
485
|
const labelBlock = label ? cells.size * 0.3 : 0;
|
|
475
486
|
const rowWidth = value.length * cells.cellWidth + Math.max(0, value.length - 1) * cells.gap;
|
|
476
487
|
const left = box.x + (box.width - rowWidth) / 2;
|
|
@@ -520,7 +531,7 @@ function serializeSvgSnapshot(svg, captures) {
|
|
|
520
531
|
// src/runtime/viewer/interaction/changeFlash.ts
|
|
521
532
|
function createChangeFlash(svg) {
|
|
522
533
|
const timers = /* @__PURE__ */ new Map();
|
|
523
|
-
const flash = (ownerIds, color2 =
|
|
534
|
+
const flash = (ownerIds, color2 = chunkHFOGKSNU_cjs.CHANGE_COLOR) => {
|
|
524
535
|
const ids = [...new Set(ownerIds)];
|
|
525
536
|
if (ids.length === 0) {
|
|
526
537
|
return;
|
|
@@ -528,7 +539,7 @@ function createChangeFlash(svg) {
|
|
|
528
539
|
const doc = svg.ownerDocument;
|
|
529
540
|
const reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
530
541
|
for (const id of ids) {
|
|
531
|
-
const primary =
|
|
542
|
+
const primary = chunkHFOGKSNU_cjs.findOwnerNode(svg, id, chunkHFOGKSNU_cjs.isPrimary);
|
|
532
543
|
if (!primary) {
|
|
533
544
|
continue;
|
|
534
545
|
}
|
|
@@ -539,10 +550,10 @@ function createChangeFlash(svg) {
|
|
|
539
550
|
for (const stale of svg.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(id)}"]`)) {
|
|
540
551
|
stale.remove();
|
|
541
552
|
}
|
|
542
|
-
const overlay = primary.getAttribute("data-sf-role") === "link" ?
|
|
553
|
+
const overlay = primary.getAttribute("data-sf-role") === "link" ? chunkHFOGKSNU_cjs.linkChangeOverlay(doc, primary, id, color2) : chunkHFOGKSNU_cjs.shapeChangeOverlay(doc, primary, id, color2);
|
|
543
554
|
svg.appendChild(overlay);
|
|
544
|
-
|
|
545
|
-
const duration = reducedMotion ?
|
|
555
|
+
chunkHFOGKSNU_cjs.startChangeFade(overlay, reducedMotion);
|
|
556
|
+
const duration = reducedMotion ? chunkHFOGKSNU_cjs.REDUCED_MOTION_DURATION_MS : chunkHFOGKSNU_cjs.FLASH_DURATION_MS;
|
|
546
557
|
timers.set(
|
|
547
558
|
id,
|
|
548
559
|
setTimeout(() => {
|
|
@@ -629,7 +640,7 @@ var OwnerPointerController = class {
|
|
|
629
640
|
this.#selection = selection;
|
|
630
641
|
}
|
|
631
642
|
hover(event) {
|
|
632
|
-
const owner =
|
|
643
|
+
const owner = chunkHFOGKSNU_cjs.resolveOwner(event.target);
|
|
633
644
|
this.#emitter.emit(
|
|
634
645
|
"ownerHover",
|
|
635
646
|
owner ? { diagramId: this.#diagramId, owner, modifiers: modifiersOf(event) } : { diagramId: this.#diagramId, owner: null }
|
|
@@ -637,7 +648,7 @@ var OwnerPointerController = class {
|
|
|
637
648
|
}
|
|
638
649
|
select(event) {
|
|
639
650
|
const target = event.target;
|
|
640
|
-
const owner =
|
|
651
|
+
const owner = chunkHFOGKSNU_cjs.resolveOwner(target);
|
|
641
652
|
if (!owner) {
|
|
642
653
|
this.#clearWhenOutsideOverlay(target);
|
|
643
654
|
return;
|
|
@@ -658,7 +669,7 @@ var OwnerPointerController = class {
|
|
|
658
669
|
owner,
|
|
659
670
|
modifiers
|
|
660
671
|
});
|
|
661
|
-
const node =
|
|
672
|
+
const node = chunkHFOGKSNU_cjs.findOwnerNode(this.#svg, owner.id, chunkHFOGKSNU_cjs.isPrimary);
|
|
662
673
|
if (node && !node.hasAttribute("tabindex")) {
|
|
663
674
|
node.setAttribute("tabindex", "-1");
|
|
664
675
|
}
|
|
@@ -686,12 +697,12 @@ var PointerInteractionSession = class {
|
|
|
686
697
|
}
|
|
687
698
|
#onPointerDown = (event) => {
|
|
688
699
|
const target = event.target;
|
|
689
|
-
const overContent = Boolean(
|
|
700
|
+
const overContent = Boolean(chunkHFOGKSNU_cjs.resolveOwner(target)) || isSelectionOverlayControl(target);
|
|
690
701
|
this.#down = {
|
|
691
702
|
x: event.clientX,
|
|
692
703
|
y: event.clientY,
|
|
693
704
|
moved: false,
|
|
694
|
-
panable:
|
|
705
|
+
panable: chunkHFOGKSNU_cjs.isCameraGesture(event) || !overContent
|
|
695
706
|
};
|
|
696
707
|
};
|
|
697
708
|
#onPointerMove = (event) => {
|
|
@@ -719,7 +730,7 @@ var PointerInteractionSession = class {
|
|
|
719
730
|
if (!this.#down.moved) {
|
|
720
731
|
return false;
|
|
721
732
|
}
|
|
722
|
-
if (this.#down.panable &&
|
|
733
|
+
if (this.#down.panable && chunkHFOGKSNU_cjs.isCameraGesture(event)) {
|
|
723
734
|
this.#display.panBy(event.movementX, event.movementY);
|
|
724
735
|
}
|
|
725
736
|
return true;
|
|
@@ -743,15 +754,15 @@ function paintSelectionOverlays(svg, selectedIds, owners) {
|
|
|
743
754
|
}
|
|
744
755
|
const document = svg.ownerDocument;
|
|
745
756
|
for (const id of selectedIds) {
|
|
746
|
-
const primary =
|
|
757
|
+
const primary = chunkHFOGKSNU_cjs.findOwnerNode(svg, id, chunkHFOGKSNU_cjs.isPrimary);
|
|
747
758
|
if (!primary) {
|
|
748
759
|
continue;
|
|
749
760
|
}
|
|
750
761
|
const owner = owners.get(id);
|
|
751
|
-
const overlay = owner?.role === "link" ?
|
|
762
|
+
const overlay = owner?.role === "link" ? chunkHFOGKSNU_cjs.linkSelectionOverlay(document, primary, id, svg) : owner?.role === "path" ? chunkHFOGKSNU_cjs.pathSelectionOverlay(document, primary, id, svg) : owner?.role === "isometric" ? chunkHFOGKSNU_cjs.isometricSelectionOverlay(document, primary, id, svg) : chunkHFOGKSNU_cjs.shapeSelectionOverlay(document, primary, id, svg, owner ? chunkHFOGKSNU_cjs.DERIVED_HEIGHT_ROLES.has(owner.role) : false);
|
|
752
763
|
svg.appendChild(overlay);
|
|
753
764
|
if (owner?.role === "shape" && selectedIds.size === 1) {
|
|
754
|
-
svg.appendChild(
|
|
765
|
+
svg.appendChild(chunkHFOGKSNU_cjs.quickDuplicateBubbles(document, primary, id, svg));
|
|
755
766
|
}
|
|
756
767
|
}
|
|
757
768
|
}
|
|
@@ -790,7 +801,7 @@ var SelectionController = class {
|
|
|
790
801
|
selectIds(ids) {
|
|
791
802
|
for (const id of ids) {
|
|
792
803
|
const element = this.#svg.querySelector(`[data-sf-id="${CSS.escape(id)}"]`);
|
|
793
|
-
const owner =
|
|
804
|
+
const owner = chunkHFOGKSNU_cjs.resolveOwner(element);
|
|
794
805
|
if (owner) {
|
|
795
806
|
this.remember(owner);
|
|
796
807
|
}
|
|
@@ -802,7 +813,7 @@ var SelectionController = class {
|
|
|
802
813
|
// src/runtime/viewer/interaction/wheel.ts
|
|
803
814
|
function bindWheelZoom(display, selection) {
|
|
804
815
|
const onWheel = (event) => {
|
|
805
|
-
if (!
|
|
816
|
+
if (!chunkHFOGKSNU_cjs.isCameraGesture(event)) {
|
|
806
817
|
return;
|
|
807
818
|
}
|
|
808
819
|
event.preventDefault();
|
|
@@ -2026,6 +2037,7 @@ uniform vec3 uColor;
|
|
|
2026
2037
|
uniform vec3 uAccent;
|
|
2027
2038
|
uniform vec3 uGlow;
|
|
2028
2039
|
uniform vec3 uCore;
|
|
2040
|
+
uniform vec3 uPeak;
|
|
2029
2041
|
varying vec2 vUv;
|
|
2030
2042
|
|
|
2031
2043
|
float wireAt(float at, float lineAt, float depth, float radius, float knob, float spread) {
|
|
@@ -2098,7 +2110,8 @@ void main() {
|
|
|
2098
2110
|
vec2 q = abs(vec2(across - (tickEnd - tickLength * 0.5), tickAlong)) - vec2(tickLength * 0.5, halfTick) + corner;
|
|
2099
2111
|
float edge = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - corner;
|
|
2100
2112
|
float tick = (1.0 - smoothstep(-0.75, 0.75, edge)) * inRange * mix(0.4, 1.0, tickBump);
|
|
2101
|
-
vec3
|
|
2113
|
+
vec3 peakColor = dot(uPeak, uPeak) > 0.0 ? uPeak : vec3(1.0);
|
|
2114
|
+
vec3 tickColor = mix(uColor, peakColor, tickBump);
|
|
2102
2115
|
|
|
2103
2116
|
float alpha = clamp(tick + line * 0.95 + glow + core, 0.0, 1.0);
|
|
2104
2117
|
vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
|
|
@@ -2975,21 +2988,21 @@ function mountShaderSurfaces(svg) {
|
|
|
2975
2988
|
|
|
2976
2989
|
// src/runtime/viewer/source.ts
|
|
2977
2990
|
function renderViewerSource(next, defaultRenderOptions) {
|
|
2978
|
-
const svg = next.svg ?? (next.source != null ?
|
|
2991
|
+
const svg = next.svg ?? (next.source != null ? chunkDDCTNLLD_cjs.render(next.source, { ...next.renderOptions ?? defaultRenderOptions, linkHitAreas: true }).svg : null);
|
|
2979
2992
|
if (svg == null) {
|
|
2980
2993
|
throw new Error("createViewer: provide either `source` (SFL) or `svg`.");
|
|
2981
2994
|
}
|
|
2982
2995
|
return svg;
|
|
2983
2996
|
}
|
|
2984
2997
|
function assertCreateViewerContract(svg) {
|
|
2985
|
-
const version =
|
|
2986
|
-
if (!
|
|
2998
|
+
const version = chunkHFOGKSNU_cjs.parseContractVersion(svg);
|
|
2999
|
+
if (!chunkHFOGKSNU_cjs.isContractCompatible(version)) {
|
|
2987
3000
|
throw new Error(`createViewer: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
|
|
2988
3001
|
}
|
|
2989
3002
|
}
|
|
2990
3003
|
function assertViewerUpdateContract(svg) {
|
|
2991
|
-
const version =
|
|
2992
|
-
if (!
|
|
3004
|
+
const version = chunkHFOGKSNU_cjs.parseContractVersion(svg);
|
|
3005
|
+
if (!chunkHFOGKSNU_cjs.isContractCompatible(version)) {
|
|
2993
3006
|
throw new Error(`viewer.update: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
|
|
2994
3007
|
}
|
|
2995
3008
|
}
|
|
@@ -3152,12 +3165,12 @@ function widgetDigits(surface) {
|
|
|
3152
3165
|
function widgetStyle(surface) {
|
|
3153
3166
|
const encoded = surface.getAttribute("data-sf-widget-style");
|
|
3154
3167
|
if (!encoded) {
|
|
3155
|
-
return
|
|
3168
|
+
return chunkDDCTNLLD_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
|
|
3156
3169
|
}
|
|
3157
3170
|
try {
|
|
3158
|
-
return { ...
|
|
3171
|
+
return { ...chunkDDCTNLLD_cjs.DEFAULT_ROLLING_NUMBER_STYLE, ...JSON.parse(encoded) };
|
|
3159
3172
|
} catch {
|
|
3160
|
-
return
|
|
3173
|
+
return chunkDDCTNLLD_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
|
|
3161
3174
|
}
|
|
3162
3175
|
}
|
|
3163
3176
|
function positiveInteger(value) {
|
|
@@ -3181,7 +3194,7 @@ function setRollingNumber(surface, value, animate) {
|
|
|
3181
3194
|
return false;
|
|
3182
3195
|
}
|
|
3183
3196
|
const previousValue = surface.getAttribute("data-sf-widget-value") ?? "";
|
|
3184
|
-
const nextValue =
|
|
3197
|
+
const nextValue = chunkDDCTNLLD_cjs.formatRollingNumber(value, positiveInteger(surface.getAttribute("data-sf-widget-digits")));
|
|
3185
3198
|
if (previousValue === nextValue) {
|
|
3186
3199
|
return true;
|
|
3187
3200
|
}
|
|
@@ -3667,5 +3680,5 @@ exports.connectInteraction = connectInteraction;
|
|
|
3667
3680
|
exports.createViewer = createViewer;
|
|
3668
3681
|
exports.registerShaderProgram = registerShaderProgram;
|
|
3669
3682
|
exports.shaderProgram = shaderProgram;
|
|
3670
|
-
//# sourceMappingURL=chunk-
|
|
3671
|
-
//# sourceMappingURL=chunk-
|
|
3683
|
+
//# sourceMappingURL=chunk-UXDWH2JC.cjs.map
|
|
3684
|
+
//# sourceMappingURL=chunk-UXDWH2JC.cjs.map
|