stickyflow 0.9.2 → 0.10.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 +16 -0
- package/README.md +1 -1
- package/dist/binding/index.cjs +9 -9
- package/dist/binding/index.d.cts +3 -3
- package/dist/binding/index.d.ts +3 -3
- package/dist/binding/index.js +3 -3
- package/dist/{chunk-EURX7QT3.cjs → chunk-5PJ55GPG.cjs} +883 -830
- package/dist/chunk-5PJ55GPG.cjs.map +1 -0
- package/dist/{chunk-AAP24GBG.js → chunk-EGUPN56K.js} +3 -3
- package/dist/chunk-EGUPN56K.js.map +1 -0
- package/dist/{chunk-Q6FBISNP.js → chunk-HRU6VOEC.js} +545 -331
- package/dist/chunk-HRU6VOEC.js.map +1 -0
- package/dist/{chunk-3EOG34QN.cjs → chunk-KRSX4UZ7.cjs} +308 -252
- package/dist/chunk-KRSX4UZ7.cjs.map +1 -0
- package/dist/{chunk-XNNNIOJU.js → chunk-L7CEX5JV.js} +5 -5
- package/dist/{chunk-XNNNIOJU.js.map → chunk-L7CEX5JV.js.map} +1 -1
- package/dist/{chunk-C25NWWIH.cjs → chunk-LSEMXRB5.cjs} +549 -331
- package/dist/chunk-LSEMXRB5.cjs.map +1 -0
- package/dist/{chunk-MR32IJQO.cjs → chunk-SCD3AHMY.cjs} +15 -15
- package/dist/chunk-SCD3AHMY.cjs.map +1 -0
- package/dist/{chunk-G2N3KJYJ.js → chunk-SDOHUNBW.js} +237 -184
- package/dist/chunk-SDOHUNBW.js.map +1 -0
- package/dist/{chunk-2GKXPZRL.cjs → chunk-TECWZVIM.cjs} +23 -23
- package/dist/chunk-TECWZVIM.cjs.map +1 -0
- package/dist/{chunk-C3LVKPWQ.js → chunk-VPNOVRWP.js} +279 -223
- package/dist/chunk-VPNOVRWP.js.map +1 -0
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +33 -28
- package/dist/index.d.ts +33 -28
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +358 -337
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.js +133 -112
- package/dist/interaction/index.js.map +1 -1
- package/dist/{runtime-DG8X3Fwf.d.cts → runtime-Bkv7QW7H.d.cts} +1 -1
- package/dist/{runtime-kqD1RS17.d.ts → runtime-DJ4K4_HZ.d.ts} +1 -1
- package/dist/{runtimeTypes-CvjlBZds.d.cts → runtimeTypes-BvJBZLkr.d.cts} +1 -1
- package/dist/{runtimeTypes-vRaHOIHi.d.ts → runtimeTypes-C1shzoyr.d.ts} +1 -1
- package/dist/stickyflow-diagram.global.js +41 -41
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +1 -1
- package/dist/viewer/index.d.ts +1 -1
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.cjs.map +1 -1
- package/dist/web-component/index.js +4 -4
- package/dist/web-component/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2GKXPZRL.cjs.map +0 -1
- package/dist/chunk-3EOG34QN.cjs.map +0 -1
- package/dist/chunk-AAP24GBG.js.map +0 -1
- package/dist/chunk-C25NWWIH.cjs.map +0 -1
- package/dist/chunk-C3LVKPWQ.js.map +0 -1
- package/dist/chunk-EURX7QT3.cjs.map +0 -1
- package/dist/chunk-G2N3KJYJ.js.map +0 -1
- package/dist/chunk-MR32IJQO.cjs.map +0 -1
- package/dist/chunk-Q6FBISNP.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk5PJ55GPG_cjs = require('./chunk-5PJ55GPG.cjs');
|
|
4
|
+
var chunkSCD3AHMY_cjs = require('./chunk-SCD3AHMY.cjs');
|
|
5
|
+
var chunkLSEMXRB5_cjs = require('./chunk-LSEMXRB5.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
|
|
165
|
+
return chunkLSEMXRB5_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
|
|
166
166
|
}
|
|
167
167
|
try {
|
|
168
|
-
return { ...
|
|
168
|
+
return { ...chunkLSEMXRB5_cjs.DEFAULT_ROLLING_NUMBER_STYLE, ...JSON.parse(encoded) };
|
|
169
169
|
} catch {
|
|
170
|
-
return
|
|
170
|
+
return chunkLSEMXRB5_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 =
|
|
194
|
+
const nextValue = chunkLSEMXRB5_cjs.formatRollingNumber(value, positiveInteger(surface.getAttribute("data-sf-widget-digits")));
|
|
195
195
|
if (previousValue === nextValue) {
|
|
196
196
|
return true;
|
|
197
197
|
}
|
|
@@ -277,10 +277,14 @@ function parameters(surface) {
|
|
|
277
277
|
function positive(value, fallback) {
|
|
278
278
|
return Number(value) > 0 ? Number(value) : fallback;
|
|
279
279
|
}
|
|
280
|
+
function rangeOf(params) {
|
|
281
|
+
return {
|
|
282
|
+
min: Number(params.min) || 0,
|
|
283
|
+
max: Number.isFinite(Number(params.max)) && params.max !== void 0 ? Number(params.max) : 100
|
|
284
|
+
};
|
|
285
|
+
}
|
|
280
286
|
function rulerProgress(surface, value) {
|
|
281
|
-
const
|
|
282
|
-
const min = Number(params.min) || 0;
|
|
283
|
-
const max = Number.isFinite(Number(params.max)) && params.max !== void 0 ? Number(params.max) : 100;
|
|
287
|
+
const { min, max } = rangeOf(parameters(surface));
|
|
284
288
|
return clamp01(max === min ? 0 : (value - min) / (max - min));
|
|
285
289
|
}
|
|
286
290
|
function move(node, dx, dy) {
|
|
@@ -291,19 +295,11 @@ function move(node, dx, dy) {
|
|
|
291
295
|
written.set(node, next);
|
|
292
296
|
node.setAttribute("transform", next);
|
|
293
297
|
}
|
|
294
|
-
function hexToRgb(value) {
|
|
295
|
-
const match = /^#([0-9a-f]{6})$/i.exec(value.trim());
|
|
296
|
-
if (!match) {
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
const number2 = parseInt(match[1], 16);
|
|
300
|
-
return [number2 >> 16 & 255, number2 >> 8 & 255, number2 & 255];
|
|
301
|
-
}
|
|
302
298
|
var WHITE = [255, 255, 255];
|
|
303
299
|
function shade(node, bump, target) {
|
|
304
300
|
const base = fills.get(node) ?? node.getAttribute("fill") ?? "";
|
|
305
301
|
fills.set(node, base);
|
|
306
|
-
const rgb =
|
|
302
|
+
const rgb = chunkLSEMXRB5_cjs.parseHexRgb(base);
|
|
307
303
|
if (!rgb) {
|
|
308
304
|
return;
|
|
309
305
|
}
|
|
@@ -314,61 +310,84 @@ function shade(node, bump, target) {
|
|
|
314
310
|
child.style.fill = fill;
|
|
315
311
|
}
|
|
316
312
|
}
|
|
313
|
+
function rulerOf(surface, progressOf) {
|
|
314
|
+
const params = parameters(surface);
|
|
315
|
+
const id = surface.getAttribute("data-sf-id") ?? "";
|
|
316
|
+
const width = Number(surface.getAttribute("width"));
|
|
317
|
+
const height = Number(surface.getAttribute("height"));
|
|
318
|
+
const horizontal = params.axis === "horizontal";
|
|
319
|
+
const across = horizontal ? height : width;
|
|
320
|
+
const dent = params.dent === void 0 ? 1 : Number(params.dent);
|
|
321
|
+
return {
|
|
322
|
+
id,
|
|
323
|
+
params,
|
|
324
|
+
x: Number(surface.getAttribute("x")),
|
|
325
|
+
y: Number(surface.getAttribute("y")),
|
|
326
|
+
width,
|
|
327
|
+
height,
|
|
328
|
+
horizontal,
|
|
329
|
+
progress: clamp01(progressOf(id) ?? Number(params.progress)),
|
|
330
|
+
inset: positive(params.inset, 0.05),
|
|
331
|
+
extent: horizontal ? width : height,
|
|
332
|
+
across,
|
|
333
|
+
depth: (dent < 0 ? 1 : dent) * 0.16 * across
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function placeKnob(svg, ruler) {
|
|
337
|
+
const { params, x, y, width, height, horizontal, across, depth } = ruler;
|
|
338
|
+
const knobId = typeof params.knob === "string" ? params.knob : "";
|
|
339
|
+
if (!knobId) {
|
|
340
|
+
return void 0;
|
|
341
|
+
}
|
|
342
|
+
const nodes = [...svg.querySelectorAll(`[data-sf-id="${CSS.escape(knobId)}"]`)];
|
|
343
|
+
const primary = nodes.find((node) => node.hasAttribute("data-sf-primary"));
|
|
344
|
+
if (!primary?.getBBox) {
|
|
345
|
+
return void 0;
|
|
346
|
+
}
|
|
347
|
+
move(primary, 0, 0);
|
|
348
|
+
const box = primary.getBBox();
|
|
349
|
+
const half = (horizontal ? box.height : box.width) / 2;
|
|
350
|
+
const along = ruler.inset + (1 - 2 * ruler.inset) * ruler.progress;
|
|
351
|
+
const line = positive(params.line, 0.7);
|
|
352
|
+
const gap = (params.gap === void 0 ? 0.04 : Number(params.gap)) * across;
|
|
353
|
+
const side = line * across - depth + half + gap;
|
|
354
|
+
const target = horizontal ? { x: x + width * along, y: y + side } : { x: x + side, y: y + height * (1 - along) };
|
|
355
|
+
const dx = target.x - (box.x + box.width / 2);
|
|
356
|
+
const dy = target.y - (box.y + box.height / 2);
|
|
357
|
+
for (const node of nodes) {
|
|
358
|
+
move(node, dx, dy);
|
|
359
|
+
}
|
|
360
|
+
return half / across;
|
|
361
|
+
}
|
|
362
|
+
function liftLabels(svg, ruler) {
|
|
363
|
+
const { id, params, horizontal, extent, inset, progress, depth } = ruler;
|
|
364
|
+
const { min, max } = rangeOf(params);
|
|
365
|
+
const peak = (typeof params.peak === "string" ? chunkLSEMXRB5_cjs.parseHexRgb(params.peak) : null) ?? WHITE;
|
|
366
|
+
const spread = positive(params.spread, 0.07) * extent;
|
|
367
|
+
const start = inset * extent;
|
|
368
|
+
const span = (1 - 2 * inset) * extent;
|
|
369
|
+
const knobAt = start + span * progress;
|
|
370
|
+
for (const label of svg.querySelectorAll(`text[data-sf-id="${CSS.escape(id)}"]`)) {
|
|
371
|
+
const value = Number(label.textContent);
|
|
372
|
+
if (!Number.isFinite(value) || max === min) {
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
const labelAt = start + span * clamp01((value - min) / (max - min));
|
|
376
|
+
const bump = Math.exp(-(((labelAt - knobAt) / spread) ** 2));
|
|
377
|
+
const shift = depth * 0.4 * bump;
|
|
378
|
+
move(label, horizontal ? 0 : -shift, horizontal ? -shift : 0);
|
|
379
|
+
shade(label, bump, peak);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
317
382
|
function placeRulerKnobs(svg, progressOf) {
|
|
318
383
|
const radii = /* @__PURE__ */ new Map();
|
|
319
384
|
for (const surface of svg.querySelectorAll('foreignObject[data-sf-shader="ruler"]')) {
|
|
320
|
-
const
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const y = Number(surface.getAttribute("y"));
|
|
325
|
-
const width = Number(surface.getAttribute("width"));
|
|
326
|
-
const height = Number(surface.getAttribute("height"));
|
|
327
|
-
const horizontal = params.axis === "horizontal";
|
|
328
|
-
const progress = clamp01(progressOf(id) ?? Number(params.progress));
|
|
329
|
-
const inset = positive(params.inset, 0.05);
|
|
330
|
-
const line = positive(params.line, 0.7);
|
|
331
|
-
const extent = horizontal ? width : height;
|
|
332
|
-
const across = horizontal ? height : width;
|
|
333
|
-
const along = inset + (1 - 2 * inset) * progress;
|
|
334
|
-
const dent = params.dent === void 0 ? 1 : Number(params.dent);
|
|
335
|
-
const depth = (dent < 0 ? 1 : dent) * 0.16 * across;
|
|
336
|
-
const knobId = typeof params.knob === "string" ? params.knob : "";
|
|
337
|
-
if (knobId) {
|
|
338
|
-
const nodes = [...svg.querySelectorAll(`[data-sf-id="${CSS.escape(knobId)}"]`)];
|
|
339
|
-
const primary = nodes.find((node) => node.hasAttribute("data-sf-primary"));
|
|
340
|
-
if (primary?.getBBox) {
|
|
341
|
-
move(primary, 0, 0);
|
|
342
|
-
const box = primary.getBBox();
|
|
343
|
-
const half = (horizontal ? box.height : box.width) / 2;
|
|
344
|
-
radii.set(id, half / across);
|
|
345
|
-
const gap = (params.gap === void 0 ? 0.04 : Number(params.gap)) * across;
|
|
346
|
-
const side = line * across - depth + half + gap;
|
|
347
|
-
const target = horizontal ? { x: x + width * along, y: y + side } : { x: x + side, y: y + height * (1 - along) };
|
|
348
|
-
const dx = target.x - (box.x + box.width / 2);
|
|
349
|
-
const dy = target.y - (box.y + box.height / 2);
|
|
350
|
-
for (const node of nodes) {
|
|
351
|
-
move(node, dx, dy);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
const min = Number(params.min) || 0;
|
|
356
|
-
const max = Number.isFinite(Number(params.max)) && params.max !== void 0 ? Number(params.max) : 100;
|
|
357
|
-
const spread = positive(params.spread, 0.07) * extent;
|
|
358
|
-
const start = inset * extent;
|
|
359
|
-
const span = (1 - 2 * inset) * extent;
|
|
360
|
-
const knobAt = start + span * progress;
|
|
361
|
-
for (const label of svg.querySelectorAll(`text[data-sf-id="${CSS.escape(id)}"]`)) {
|
|
362
|
-
const value = Number(label.textContent);
|
|
363
|
-
if (!Number.isFinite(value) || max === min) {
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
const labelAt = start + span * clamp01((value - min) / (max - min));
|
|
367
|
-
const bump = Math.exp(-(((labelAt - knobAt) / spread) ** 2));
|
|
368
|
-
const shift = depth * 0.4 * bump;
|
|
369
|
-
move(label, horizontal ? 0 : -shift, horizontal ? -shift : 0);
|
|
370
|
-
shade(label, bump, peak);
|
|
385
|
+
const ruler = rulerOf(surface, progressOf);
|
|
386
|
+
const radius = placeKnob(svg, ruler);
|
|
387
|
+
if (radius !== void 0) {
|
|
388
|
+
radii.set(ruler.id, radius);
|
|
371
389
|
}
|
|
390
|
+
liftLabels(svg, ruler);
|
|
372
391
|
}
|
|
373
392
|
return radii;
|
|
374
393
|
}
|
|
@@ -671,7 +690,7 @@ function mountDisplay(container, svgString) {
|
|
|
671
690
|
}
|
|
672
691
|
|
|
673
692
|
// src/runtime/viewer/events.ts
|
|
674
|
-
var Emitter2 = class extends
|
|
693
|
+
var Emitter2 = class extends chunkSCD3AHMY_cjs.Emitter {
|
|
675
694
|
};
|
|
676
695
|
|
|
677
696
|
// src/runtime/viewer/export/raster.ts
|
|
@@ -761,11 +780,11 @@ function svgElement(document, name, attributes) {
|
|
|
761
780
|
function readComponentStyle(surface) {
|
|
762
781
|
try {
|
|
763
782
|
return {
|
|
764
|
-
...
|
|
783
|
+
...chunkLSEMXRB5_cjs.DEFAULT_ROLLING_NUMBER_STYLE,
|
|
765
784
|
...JSON.parse(surface.getAttribute("data-sf-widget-style") ?? "{}")
|
|
766
785
|
};
|
|
767
786
|
} catch {
|
|
768
|
-
return
|
|
787
|
+
return chunkLSEMXRB5_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
|
|
769
788
|
}
|
|
770
789
|
}
|
|
771
790
|
function cellsOf(box, plain, fontSize = 0) {
|
|
@@ -905,7 +924,7 @@ function serializeSvgSnapshot(svg, captures) {
|
|
|
905
924
|
// src/runtime/viewer/interaction/changeFlash.ts
|
|
906
925
|
function createChangeFlash(svg) {
|
|
907
926
|
const timers = /* @__PURE__ */ new Map();
|
|
908
|
-
const flash = (ownerIds, color2 =
|
|
927
|
+
const flash = (ownerIds, color2 = chunkSCD3AHMY_cjs.CHANGE_COLOR) => {
|
|
909
928
|
const ids = [...new Set(ownerIds)];
|
|
910
929
|
if (ids.length === 0) {
|
|
911
930
|
return;
|
|
@@ -913,7 +932,7 @@ function createChangeFlash(svg) {
|
|
|
913
932
|
const doc = svg.ownerDocument;
|
|
914
933
|
const reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
915
934
|
for (const id of ids) {
|
|
916
|
-
const primary =
|
|
935
|
+
const primary = chunkSCD3AHMY_cjs.findOwnerNode(svg, id, chunkSCD3AHMY_cjs.isPrimary);
|
|
917
936
|
if (!primary) {
|
|
918
937
|
continue;
|
|
919
938
|
}
|
|
@@ -924,10 +943,10 @@ function createChangeFlash(svg) {
|
|
|
924
943
|
for (const stale of svg.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(id)}"]`)) {
|
|
925
944
|
stale.remove();
|
|
926
945
|
}
|
|
927
|
-
const overlay = primary.getAttribute("data-sf-role") === "link" ?
|
|
946
|
+
const overlay = primary.getAttribute("data-sf-role") === "link" ? chunkSCD3AHMY_cjs.linkChangeOverlay(doc, primary, id, color2) : chunkSCD3AHMY_cjs.shapeChangeOverlay(doc, primary, id, color2);
|
|
928
947
|
svg.appendChild(overlay);
|
|
929
|
-
|
|
930
|
-
const duration = reducedMotion ?
|
|
948
|
+
chunkSCD3AHMY_cjs.startChangeFade(overlay, reducedMotion);
|
|
949
|
+
const duration = reducedMotion ? chunkSCD3AHMY_cjs.REDUCED_MOTION_DURATION_MS : chunkSCD3AHMY_cjs.FLASH_DURATION_MS;
|
|
931
950
|
timers.set(
|
|
932
951
|
id,
|
|
933
952
|
setTimeout(() => {
|
|
@@ -1014,7 +1033,7 @@ var OwnerPointerController = class {
|
|
|
1014
1033
|
this.#selection = selection;
|
|
1015
1034
|
}
|
|
1016
1035
|
hover(event) {
|
|
1017
|
-
const owner =
|
|
1036
|
+
const owner = chunkSCD3AHMY_cjs.resolveOwner(event.target);
|
|
1018
1037
|
this.#emitter.emit(
|
|
1019
1038
|
"ownerHover",
|
|
1020
1039
|
owner ? { diagramId: this.#diagramId, owner, modifiers: modifiersOf(event) } : { diagramId: this.#diagramId, owner: null }
|
|
@@ -1022,7 +1041,7 @@ var OwnerPointerController = class {
|
|
|
1022
1041
|
}
|
|
1023
1042
|
select(event) {
|
|
1024
1043
|
const target = event.target;
|
|
1025
|
-
const owner =
|
|
1044
|
+
const owner = chunkSCD3AHMY_cjs.resolveOwner(target);
|
|
1026
1045
|
if (!owner) {
|
|
1027
1046
|
this.#clearWhenOutsideOverlay(target);
|
|
1028
1047
|
return;
|
|
@@ -1043,7 +1062,7 @@ var OwnerPointerController = class {
|
|
|
1043
1062
|
owner,
|
|
1044
1063
|
modifiers
|
|
1045
1064
|
});
|
|
1046
|
-
const node =
|
|
1065
|
+
const node = chunkSCD3AHMY_cjs.findOwnerNode(this.#svg, owner.id, chunkSCD3AHMY_cjs.isPrimary);
|
|
1047
1066
|
if (node && !node.hasAttribute("tabindex")) {
|
|
1048
1067
|
node.setAttribute("tabindex", "-1");
|
|
1049
1068
|
}
|
|
@@ -1071,12 +1090,12 @@ var PointerInteractionSession = class {
|
|
|
1071
1090
|
}
|
|
1072
1091
|
#onPointerDown = (event) => {
|
|
1073
1092
|
const target = event.target;
|
|
1074
|
-
const overContent = Boolean(
|
|
1093
|
+
const overContent = Boolean(chunkSCD3AHMY_cjs.resolveOwner(target)) || isSelectionOverlayControl(target);
|
|
1075
1094
|
this.#down = {
|
|
1076
1095
|
x: event.clientX,
|
|
1077
1096
|
y: event.clientY,
|
|
1078
1097
|
moved: false,
|
|
1079
|
-
panable:
|
|
1098
|
+
panable: chunkSCD3AHMY_cjs.isCameraGesture(event) || !overContent
|
|
1080
1099
|
};
|
|
1081
1100
|
};
|
|
1082
1101
|
#onPointerMove = (event) => {
|
|
@@ -1104,7 +1123,7 @@ var PointerInteractionSession = class {
|
|
|
1104
1123
|
if (!this.#down.moved) {
|
|
1105
1124
|
return false;
|
|
1106
1125
|
}
|
|
1107
|
-
if (this.#down.panable &&
|
|
1126
|
+
if (this.#down.panable && chunkSCD3AHMY_cjs.isCameraGesture(event)) {
|
|
1108
1127
|
this.#display.panBy(event.movementX, event.movementY);
|
|
1109
1128
|
}
|
|
1110
1129
|
return true;
|
|
@@ -1128,15 +1147,15 @@ function paintSelectionOverlays(svg, selectedIds, owners) {
|
|
|
1128
1147
|
}
|
|
1129
1148
|
const document = svg.ownerDocument;
|
|
1130
1149
|
for (const id of selectedIds) {
|
|
1131
|
-
const primary =
|
|
1150
|
+
const primary = chunkSCD3AHMY_cjs.findOwnerNode(svg, id, chunkSCD3AHMY_cjs.isPrimary);
|
|
1132
1151
|
if (!primary) {
|
|
1133
1152
|
continue;
|
|
1134
1153
|
}
|
|
1135
1154
|
const owner = owners.get(id);
|
|
1136
|
-
const overlay = owner?.role === "link" ?
|
|
1155
|
+
const overlay = owner?.role === "link" ? chunkSCD3AHMY_cjs.linkSelectionOverlay(document, primary, id, svg) : owner?.role === "path" ? chunkSCD3AHMY_cjs.pathSelectionOverlay(document, primary, id, svg) : owner?.role === "isometric" ? chunkSCD3AHMY_cjs.isometricSelectionOverlay(document, primary, id, svg) : chunkSCD3AHMY_cjs.shapeSelectionOverlay(document, primary, id, svg, owner ? chunkSCD3AHMY_cjs.DERIVED_HEIGHT_ROLES.has(owner.role) : false);
|
|
1137
1156
|
svg.appendChild(overlay);
|
|
1138
1157
|
if (owner?.role === "shape" && selectedIds.size === 1) {
|
|
1139
|
-
svg.appendChild(
|
|
1158
|
+
svg.appendChild(chunkSCD3AHMY_cjs.quickDuplicateBubbles(document, primary, id, svg));
|
|
1140
1159
|
}
|
|
1141
1160
|
}
|
|
1142
1161
|
}
|
|
@@ -1175,7 +1194,7 @@ var SelectionController = class {
|
|
|
1175
1194
|
selectIds(ids) {
|
|
1176
1195
|
for (const id of ids) {
|
|
1177
1196
|
const element = this.#svg.querySelector(`[data-sf-id="${CSS.escape(id)}"]`);
|
|
1178
|
-
const owner =
|
|
1197
|
+
const owner = chunkSCD3AHMY_cjs.resolveOwner(element);
|
|
1179
1198
|
if (owner) {
|
|
1180
1199
|
this.remember(owner);
|
|
1181
1200
|
}
|
|
@@ -1187,7 +1206,7 @@ var SelectionController = class {
|
|
|
1187
1206
|
// src/runtime/viewer/interaction/wheel.ts
|
|
1188
1207
|
function bindWheelZoom(display, selection) {
|
|
1189
1208
|
const onWheel = (event) => {
|
|
1190
|
-
if (!
|
|
1209
|
+
if (!chunkSCD3AHMY_cjs.isCameraGesture(event)) {
|
|
1191
1210
|
return;
|
|
1192
1211
|
}
|
|
1193
1212
|
event.preventDefault();
|
|
@@ -4044,8 +4063,7 @@ function applyBackdrop(surface, backdrop) {
|
|
|
4044
4063
|
}
|
|
4045
4064
|
var MAX_SURFACE_PIXELS = 2560;
|
|
4046
4065
|
var TRAIL_LENGTH = 16;
|
|
4047
|
-
function
|
|
4048
|
-
const { canvas, gl, parameters: parameters3 } = surface;
|
|
4066
|
+
function fitCanvas(canvas) {
|
|
4049
4067
|
const shown = canvas.getBoundingClientRect();
|
|
4050
4068
|
const density = Math.min(globalThis.devicePixelRatio || 1, 3);
|
|
4051
4069
|
const fit = Math.min(1, MAX_SURFACE_PIXELS / Math.max(1, shown.width * density, shown.height * density));
|
|
@@ -4055,32 +4073,22 @@ function renderSurface(surface, seconds) {
|
|
|
4055
4073
|
canvas.width = width;
|
|
4056
4074
|
canvas.height = height;
|
|
4057
4075
|
}
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
gl
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
surface,
|
|
4069
|
-
"uPixelScale",
|
|
4070
|
-
Number.isFinite(logicalWidth) && logicalWidth > 0 ? width / logicalWidth : density * fit
|
|
4071
|
-
);
|
|
4072
|
-
uniform1f(surface, "uTime", seconds);
|
|
4073
|
-
if (surface.backdropTexture) {
|
|
4074
|
-
syncBackdropBounds(surface);
|
|
4075
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
4076
|
-
gl.bindTexture(gl.TEXTURE_2D, surface.backdropTexture);
|
|
4077
|
-
const sampler = gl.getUniformLocation(surface.program, "uBackdrop");
|
|
4078
|
-
if (sampler) {
|
|
4079
|
-
gl.uniform1i(sampler, 0);
|
|
4080
|
-
}
|
|
4081
|
-
uniform2f(surface, "uBackdropOrigin", surface.backdropOrigin);
|
|
4082
|
-
uniform2f(surface, "uBackdropScale", surface.backdropScale);
|
|
4076
|
+
return { width, height, density, fit };
|
|
4077
|
+
}
|
|
4078
|
+
function bindBackdrop(surface, texture) {
|
|
4079
|
+
const { gl } = surface;
|
|
4080
|
+
syncBackdropBounds(surface);
|
|
4081
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
4082
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
4083
|
+
const sampler = gl.getUniformLocation(surface.program, "uBackdrop");
|
|
4084
|
+
if (sampler) {
|
|
4085
|
+
gl.uniform1i(sampler, 0);
|
|
4083
4086
|
}
|
|
4087
|
+
uniform2f(surface, "uBackdropOrigin", surface.backdropOrigin);
|
|
4088
|
+
uniform2f(surface, "uBackdropScale", surface.backdropScale);
|
|
4089
|
+
}
|
|
4090
|
+
function uploadParameters(surface) {
|
|
4091
|
+
const { parameters: parameters3 } = surface;
|
|
4084
4092
|
for (const [key, fallback] of Object.entries(SHADER_DEFAULTS.numbers)) {
|
|
4085
4093
|
uniform1f(surface, uniformName(key), number(parameters3[key], fallback));
|
|
4086
4094
|
}
|
|
@@ -4088,9 +4096,9 @@ function renderSurface(surface, seconds) {
|
|
|
4088
4096
|
uniform3f(surface, uniformName(key), color(parameters3[key], [...fallback]));
|
|
4089
4097
|
}
|
|
4090
4098
|
uniform3f(surface, "uShapeColor", surface.shapeColor);
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4099
|
+
}
|
|
4100
|
+
function uploadPointer(surface, seconds, elapsed) {
|
|
4101
|
+
const { gl, parameters: parameters3 } = surface;
|
|
4094
4102
|
surface.hover += ((surface.hovering ? 1 : 0) - surface.hover) * (1 - Math.exp(-elapsed / 0.18));
|
|
4095
4103
|
uniform2f(surface, "uPointer", [surface.pointer.x, surface.pointer.y]);
|
|
4096
4104
|
uniform1f(surface, "uHover", surface.hover);
|
|
@@ -4105,13 +4113,44 @@ function renderSurface(surface, seconds) {
|
|
|
4105
4113
|
if (trail) {
|
|
4106
4114
|
gl.uniform3fv(trail, places);
|
|
4107
4115
|
}
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
uniform1f(surface, "uGlowRadius", surface.reactiveLight.radius);
|
|
4113
|
-
uniform3f(surface, "uLightColor", surface.reactiveLight.color);
|
|
4116
|
+
}
|
|
4117
|
+
function uploadReactiveLight(surface) {
|
|
4118
|
+
if (!surface.reactiveLight) {
|
|
4119
|
+
return;
|
|
4114
4120
|
}
|
|
4121
|
+
uniform1f(surface, "uLightX", surface.reactiveLight.x);
|
|
4122
|
+
uniform1f(surface, "uLightY", surface.reactiveLight.y);
|
|
4123
|
+
uniform1f(surface, "uLightStrength", surface.reactiveLight.strength);
|
|
4124
|
+
uniform1f(surface, "uGlowRadius", surface.reactiveLight.radius);
|
|
4125
|
+
uniform3f(surface, "uLightColor", surface.reactiveLight.color);
|
|
4126
|
+
}
|
|
4127
|
+
function renderSurface(surface, seconds) {
|
|
4128
|
+
const { canvas, gl } = surface;
|
|
4129
|
+
const { width, height, density, fit } = fitCanvas(canvas);
|
|
4130
|
+
gl.viewport(0, 0, width, height);
|
|
4131
|
+
gl.clearColor(0, 0, 0, 0);
|
|
4132
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
4133
|
+
gl.useProgram(surface.program);
|
|
4134
|
+
const resolution = gl.getUniformLocation(surface.program, "uResolution");
|
|
4135
|
+
if (resolution) {
|
|
4136
|
+
gl.uniform2f(resolution, width, height);
|
|
4137
|
+
}
|
|
4138
|
+
const logicalWidth = Number(surface.owner.getAttribute("width"));
|
|
4139
|
+
uniform1f(
|
|
4140
|
+
surface,
|
|
4141
|
+
"uPixelScale",
|
|
4142
|
+
Number.isFinite(logicalWidth) && logicalWidth > 0 ? width / logicalWidth : density * fit
|
|
4143
|
+
);
|
|
4144
|
+
uniform1f(surface, "uTime", seconds);
|
|
4145
|
+
if (surface.backdropTexture) {
|
|
4146
|
+
bindBackdrop(surface, surface.backdropTexture);
|
|
4147
|
+
}
|
|
4148
|
+
uploadParameters(surface);
|
|
4149
|
+
const elapsed = surface.lastSeconds === void 0 ? 0 : Math.max(0, Math.min(seconds - surface.lastSeconds, 0.1));
|
|
4150
|
+
surface.lastSeconds = seconds;
|
|
4151
|
+
applyParameters(surface, elapsed);
|
|
4152
|
+
uploadPointer(surface, seconds, elapsed);
|
|
4153
|
+
uploadReactiveLight(surface);
|
|
4115
4154
|
uniform1f(surface, "uSurfacePadding", surface.surfacePadding);
|
|
4116
4155
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
4117
4156
|
}
|
|
@@ -4186,171 +4225,188 @@ function watchSvgChanges(svg, view, onChange) {
|
|
|
4186
4225
|
sizes?.disconnect();
|
|
4187
4226
|
};
|
|
4188
4227
|
}
|
|
4189
|
-
function
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4228
|
+
function rememberSurfaces(surfaces) {
|
|
4229
|
+
return new Map(
|
|
4230
|
+
surfaces.flatMap((surface) => {
|
|
4231
|
+
const ownerId = surface.owner.getAttribute("data-sf-id");
|
|
4232
|
+
return ownerId ? [
|
|
4233
|
+
[
|
|
4234
|
+
ownerId,
|
|
4235
|
+
{
|
|
4236
|
+
smoothed: new Map(surface.smoothed),
|
|
4237
|
+
reactiveLight: surface.reactiveLight,
|
|
4238
|
+
pointer: surface.pointer,
|
|
4239
|
+
hover: surface.hover,
|
|
4240
|
+
hovering: surface.hovering,
|
|
4241
|
+
trail: surface.trail
|
|
4242
|
+
}
|
|
4243
|
+
]
|
|
4244
|
+
] : [];
|
|
4245
|
+
})
|
|
4246
|
+
);
|
|
4247
|
+
}
|
|
4248
|
+
function createSurfaces(svg, memory) {
|
|
4249
|
+
return [...svg.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap((canvas) => {
|
|
4250
|
+
const surface = createSurface(canvas);
|
|
4251
|
+
const ownerId = surface?.owner.getAttribute("data-sf-id");
|
|
4252
|
+
const previous = ownerId ? memory.get(ownerId) : void 0;
|
|
4253
|
+
if (surface && previous) {
|
|
4254
|
+
Object.assign(surface, previous);
|
|
4255
|
+
}
|
|
4256
|
+
return surface ? [surface] : [];
|
|
4257
|
+
});
|
|
4258
|
+
}
|
|
4259
|
+
function followPointer(surface, event, now) {
|
|
4260
|
+
const box = surface.canvas.getBoundingClientRect();
|
|
4261
|
+
const inside = box.width > 0 && box.height > 0 && event.clientX >= box.left && event.clientX <= box.right && event.clientY >= box.top && event.clientY <= box.bottom;
|
|
4262
|
+
surface.hovering = inside;
|
|
4263
|
+
if (!inside) {
|
|
4264
|
+
return;
|
|
4265
|
+
}
|
|
4266
|
+
surface.pointer = { x: (event.clientX - box.left) / box.width, y: 1 - (event.clientY - box.top) / box.height };
|
|
4267
|
+
const last = surface.trail[surface.trail.length - 1];
|
|
4268
|
+
if (!last || now - last.at >= TRAIL_SPACING) {
|
|
4269
|
+
surface.trail.push({ ...surface.pointer, at: now });
|
|
4270
|
+
if (surface.trail.length > TRAIL_LENGTH2) {
|
|
4271
|
+
surface.trail.shift();
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
var ShaderSurfaces = class {
|
|
4276
|
+
constructor(svg) {
|
|
4277
|
+
this.svg = svg;
|
|
4278
|
+
this.view = svg.ownerDocument.defaultView;
|
|
4279
|
+
this.clock = createSurfaceClock(this.view);
|
|
4280
|
+
this.unwatch = watchSvgChanges(svg, this.view, this.scheduleRecapture);
|
|
4281
|
+
svg.addEventListener("pointermove", this.track);
|
|
4282
|
+
svg.addEventListener("pointerleave", this.leave);
|
|
4283
|
+
this.refresh();
|
|
4284
|
+
}
|
|
4285
|
+
svg;
|
|
4286
|
+
surfaces = [];
|
|
4287
|
+
frame;
|
|
4288
|
+
backdropGeneration = 0;
|
|
4289
|
+
recapture;
|
|
4290
|
+
view;
|
|
4291
|
+
clock;
|
|
4292
|
+
unwatch;
|
|
4293
|
+
capture() {
|
|
4294
|
+
return capturePngs(this.svg, this.surfaces, this.clock.now());
|
|
4295
|
+
}
|
|
4296
|
+
setParameters(ownerId, parameters3) {
|
|
4297
|
+
return updateParameters(this.surfaces, ownerId, parameters3, this.clock.now());
|
|
4298
|
+
}
|
|
4299
|
+
setPaused(paused) {
|
|
4300
|
+
this.clock.setPaused(paused);
|
|
4301
|
+
}
|
|
4302
|
+
refresh() {
|
|
4303
|
+
const memory = rememberSurfaces(this.surfaces);
|
|
4304
|
+
this.stop();
|
|
4305
|
+
const generation = ++this.backdropGeneration;
|
|
4306
|
+
this.surfaces = createSurfaces(this.svg, memory);
|
|
4307
|
+
updateReactiveLightFields(this.surfaces);
|
|
4308
|
+
this.captureBackdrops(generation);
|
|
4309
|
+
if (this.surfaces.length > 0) {
|
|
4310
|
+
this.startFrames();
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
destroy() {
|
|
4314
|
+
this.backdropGeneration += 1;
|
|
4315
|
+
this.unwatch();
|
|
4316
|
+
this.svg.removeEventListener("pointermove", this.track);
|
|
4317
|
+
this.svg.removeEventListener("pointerleave", this.leave);
|
|
4318
|
+
if (this.recapture !== void 0) {
|
|
4319
|
+
this.view?.clearTimeout(this.recapture);
|
|
4320
|
+
}
|
|
4321
|
+
this.stop();
|
|
4322
|
+
}
|
|
4323
|
+
draw = (milliseconds) => {
|
|
4324
|
+
if (!this.clock.paused()) {
|
|
4325
|
+
updateReactiveLightFields(this.surfaces);
|
|
4326
|
+
for (const surface of this.surfaces) {
|
|
4327
|
+
renderSurface(surface, milliseconds / 1e3 - this.clock.spent());
|
|
4201
4328
|
}
|
|
4202
4329
|
}
|
|
4203
|
-
frame = view?.requestAnimationFrame(draw);
|
|
4330
|
+
this.frame = this.view?.requestAnimationFrame(this.draw);
|
|
4204
4331
|
};
|
|
4205
|
-
|
|
4206
|
-
if (frame !== void 0) {
|
|
4207
|
-
view?.cancelAnimationFrame(frame);
|
|
4208
|
-
frame = void 0;
|
|
4332
|
+
stop() {
|
|
4333
|
+
if (this.frame !== void 0) {
|
|
4334
|
+
this.view?.cancelAnimationFrame(this.frame);
|
|
4335
|
+
this.frame = void 0;
|
|
4209
4336
|
}
|
|
4210
|
-
for (const surface of surfaces) {
|
|
4337
|
+
for (const surface of this.surfaces) {
|
|
4211
4338
|
releaseSurface(surface);
|
|
4212
4339
|
}
|
|
4213
|
-
surfaces = [];
|
|
4214
|
-
}
|
|
4215
|
-
|
|
4216
|
-
for (const surface of surfaces) {
|
|
4340
|
+
this.surfaces = [];
|
|
4341
|
+
}
|
|
4342
|
+
captureBackdrops(generation) {
|
|
4343
|
+
for (const surface of this.surfaces) {
|
|
4217
4344
|
if (!surface.usesBackdrop) {
|
|
4218
4345
|
continue;
|
|
4219
4346
|
}
|
|
4220
|
-
void captureShaderBackdrop(svg, surface.owner).then((backdrop) => {
|
|
4221
|
-
if (backdrop && generation === backdropGeneration) {
|
|
4347
|
+
void captureShaderBackdrop(this.svg, surface.owner).then((backdrop) => {
|
|
4348
|
+
if (backdrop && generation === this.backdropGeneration) {
|
|
4222
4349
|
applyBackdrop(surface, backdrop);
|
|
4223
4350
|
}
|
|
4224
4351
|
});
|
|
4225
4352
|
}
|
|
4226
|
-
}
|
|
4227
|
-
|
|
4228
|
-
if (!view?.requestAnimationFrame) {
|
|
4229
|
-
for (const surface of surfaces) {
|
|
4353
|
+
}
|
|
4354
|
+
startFrames() {
|
|
4355
|
+
if (!this.view?.requestAnimationFrame) {
|
|
4356
|
+
for (const surface of this.surfaces) {
|
|
4230
4357
|
renderSurface(surface, 0);
|
|
4231
4358
|
}
|
|
4232
4359
|
return;
|
|
4233
4360
|
}
|
|
4234
|
-
if (clock.paused()) {
|
|
4235
|
-
for (const surface of surfaces) {
|
|
4236
|
-
renderSurface(surface, clock.now());
|
|
4237
|
-
}
|
|
4238
|
-
}
|
|
4239
|
-
frame = view.requestAnimationFrame(draw);
|
|
4240
|
-
};
|
|
4241
|
-
const refresh = () => {
|
|
4242
|
-
const previousState = new Map(
|
|
4243
|
-
surfaces.flatMap((surface) => {
|
|
4244
|
-
const ownerId = surface.owner.getAttribute("data-sf-id");
|
|
4245
|
-
return ownerId ? [
|
|
4246
|
-
[
|
|
4247
|
-
ownerId,
|
|
4248
|
-
{
|
|
4249
|
-
smoothed: new Map(surface.smoothed),
|
|
4250
|
-
reactiveLight: surface.reactiveLight,
|
|
4251
|
-
pointer: surface.pointer,
|
|
4252
|
-
hover: surface.hover,
|
|
4253
|
-
hovering: surface.hovering,
|
|
4254
|
-
trail: surface.trail
|
|
4255
|
-
}
|
|
4256
|
-
]
|
|
4257
|
-
] : [];
|
|
4258
|
-
})
|
|
4259
|
-
);
|
|
4260
|
-
stop();
|
|
4261
|
-
const generation = ++backdropGeneration;
|
|
4262
|
-
surfaces = [...svg.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap((canvas) => {
|
|
4263
|
-
const surface = createSurface(canvas);
|
|
4264
|
-
const ownerId = surface?.owner.getAttribute("data-sf-id");
|
|
4265
|
-
const previous = ownerId ? previousState.get(ownerId) : void 0;
|
|
4266
|
-
if (surface && previous) {
|
|
4267
|
-
surface.smoothed = previous.smoothed;
|
|
4268
|
-
surface.reactiveLight = previous.reactiveLight;
|
|
4269
|
-
surface.pointer = previous.pointer;
|
|
4270
|
-
surface.hover = previous.hover;
|
|
4271
|
-
surface.hovering = previous.hovering;
|
|
4272
|
-
surface.trail = previous.trail;
|
|
4361
|
+
if (this.clock.paused()) {
|
|
4362
|
+
for (const surface of this.surfaces) {
|
|
4363
|
+
renderSurface(surface, this.clock.now());
|
|
4273
4364
|
}
|
|
4274
|
-
return surface ? [surface] : [];
|
|
4275
|
-
});
|
|
4276
|
-
updateReactiveLightFields(surfaces);
|
|
4277
|
-
captureBackdrops(generation);
|
|
4278
|
-
if (surfaces.length > 0) {
|
|
4279
|
-
startFrames();
|
|
4280
4365
|
}
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4366
|
+
this.frame = this.view.requestAnimationFrame(this.draw);
|
|
4367
|
+
}
|
|
4368
|
+
scheduleRecapture = () => {
|
|
4369
|
+
if (this.recapture !== void 0) {
|
|
4370
|
+
this.view?.clearTimeout(this.recapture);
|
|
4285
4371
|
}
|
|
4286
|
-
recapture = view?.setTimeout(() => {
|
|
4287
|
-
recapture = void 0;
|
|
4288
|
-
captureBackdrops(backdropGeneration);
|
|
4372
|
+
this.recapture = this.view?.setTimeout(() => {
|
|
4373
|
+
this.recapture = void 0;
|
|
4374
|
+
this.captureBackdrops(this.backdropGeneration);
|
|
4289
4375
|
}, RECAPTURE_DELAY_MS);
|
|
4290
4376
|
};
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
for (const surface of surfaces) {
|
|
4294
|
-
|
|
4295
|
-
const inside = box.width > 0 && box.height > 0 && event.clientX >= box.left && event.clientX <= box.right && event.clientY >= box.top && event.clientY <= box.bottom;
|
|
4296
|
-
surface.hovering = inside;
|
|
4297
|
-
if (inside) {
|
|
4298
|
-
surface.pointer = { x: (event.clientX - box.left) / box.width, y: 1 - (event.clientY - box.top) / box.height };
|
|
4299
|
-
const now = clock.now();
|
|
4300
|
-
const last = surface.trail[surface.trail.length - 1];
|
|
4301
|
-
if (!last || now - last.at >= TRAIL_SPACING) {
|
|
4302
|
-
surface.trail.push({ ...surface.pointer, at: now });
|
|
4303
|
-
if (surface.trail.length > TRAIL_LENGTH2) {
|
|
4304
|
-
surface.trail.shift();
|
|
4305
|
-
}
|
|
4306
|
-
}
|
|
4307
|
-
}
|
|
4377
|
+
track = (event) => {
|
|
4378
|
+
const now = this.clock.now();
|
|
4379
|
+
for (const surface of this.surfaces) {
|
|
4380
|
+
followPointer(surface, event, now);
|
|
4308
4381
|
}
|
|
4309
4382
|
};
|
|
4310
|
-
|
|
4311
|
-
for (const surface of surfaces) {
|
|
4383
|
+
leave = () => {
|
|
4384
|
+
for (const surface of this.surfaces) {
|
|
4312
4385
|
surface.hovering = false;
|
|
4313
4386
|
}
|
|
4314
4387
|
};
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
const destroy = () => {
|
|
4319
|
-
backdropGeneration += 1;
|
|
4320
|
-
unwatch();
|
|
4321
|
-
svg.removeEventListener("pointermove", track);
|
|
4322
|
-
svg.removeEventListener("pointerleave", leave);
|
|
4323
|
-
if (recapture !== void 0) {
|
|
4324
|
-
view?.clearTimeout(recapture);
|
|
4325
|
-
}
|
|
4326
|
-
stop();
|
|
4327
|
-
};
|
|
4328
|
-
return {
|
|
4329
|
-
capture: () => capturePngs(svg, surfaces, clock.now()),
|
|
4330
|
-
setParameters: (ownerId, parameters3) => updateParameters(surfaces, ownerId, parameters3, clock.now()),
|
|
4331
|
-
setPaused: clock.setPaused,
|
|
4332
|
-
refresh,
|
|
4333
|
-
destroy
|
|
4334
|
-
};
|
|
4388
|
+
};
|
|
4389
|
+
function mountShaderSurfaces(svg) {
|
|
4390
|
+
return new ShaderSurfaces(svg);
|
|
4335
4391
|
}
|
|
4336
4392
|
|
|
4337
4393
|
// src/runtime/viewer/source.ts
|
|
4338
4394
|
function renderViewerSource(next, defaultRenderOptions) {
|
|
4339
|
-
const svg = next.svg ?? (next.source != null ?
|
|
4395
|
+
const svg = next.svg ?? (next.source != null ? chunk5PJ55GPG_cjs.render(next.source, { ...next.renderOptions ?? defaultRenderOptions, linkHitAreas: true }).svg : null);
|
|
4340
4396
|
if (svg == null) {
|
|
4341
4397
|
throw new Error("createViewer: provide either `source` (SFL) or `svg`.");
|
|
4342
4398
|
}
|
|
4343
4399
|
return svg;
|
|
4344
4400
|
}
|
|
4345
4401
|
function assertCreateViewerContract(svg) {
|
|
4346
|
-
const version =
|
|
4347
|
-
if (!
|
|
4402
|
+
const version = chunkSCD3AHMY_cjs.parseContractVersion(svg);
|
|
4403
|
+
if (!chunkSCD3AHMY_cjs.isContractCompatible(version)) {
|
|
4348
4404
|
throw new Error(`createViewer: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
|
|
4349
4405
|
}
|
|
4350
4406
|
}
|
|
4351
4407
|
function assertViewerUpdateContract(svg) {
|
|
4352
|
-
const version =
|
|
4353
|
-
if (!
|
|
4408
|
+
const version = chunkSCD3AHMY_cjs.parseContractVersion(svg);
|
|
4409
|
+
if (!chunkSCD3AHMY_cjs.isContractCompatible(version)) {
|
|
4354
4410
|
throw new Error(`viewer.update: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
|
|
4355
4411
|
}
|
|
4356
4412
|
}
|
|
@@ -4584,7 +4640,7 @@ function trackScales(wiring, event) {
|
|
|
4584
4640
|
}
|
|
4585
4641
|
function driveValue(wiring, id, event) {
|
|
4586
4642
|
const { runtime, svg } = wiring;
|
|
4587
|
-
const kind =
|
|
4643
|
+
const kind = chunkLSEMXRB5_cjs.getComponentDescriptor(runtime.graph.elements.get(id)?.componentType)?.interaction;
|
|
4588
4644
|
if (kind !== "slide" && kind !== "pick" && kind !== "turn" && kind !== "range") {
|
|
4589
4645
|
return;
|
|
4590
4646
|
}
|
|
@@ -4723,5 +4779,5 @@ exports.connectInteraction = connectInteraction;
|
|
|
4723
4779
|
exports.createViewer = createViewer;
|
|
4724
4780
|
exports.registerShaderProgram = registerShaderProgram;
|
|
4725
4781
|
exports.shaderProgram = shaderProgram;
|
|
4726
|
-
//# sourceMappingURL=chunk-
|
|
4727
|
-
//# sourceMappingURL=chunk-
|
|
4782
|
+
//# sourceMappingURL=chunk-KRSX4UZ7.cjs.map
|
|
4783
|
+
//# sourceMappingURL=chunk-KRSX4UZ7.cjs.map
|