@sebastianwessel/isostate 0.3.0 → 0.5.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/dist/animation/animation-engine.d.ts +1 -0
- package/dist/animation/animation-engine.d.ts.map +1 -1
- package/dist/animation/controller.d.ts +34 -2
- package/dist/animation/controller.d.ts.map +1 -1
- package/dist/browser/isostate.runtime.js +4 -4
- package/dist/browser/isostate.runtime.js.map +12 -11
- package/dist/chunks/{index-B6HlPnov.js → index-CB6XEsbY.js} +257 -43
- package/dist/chunks/index-CB6XEsbY.js.map +1 -0
- package/dist/chunks/{rendering-engine-BgHel7yX.js → rendering-engine-nkqYx0qc.js} +224 -38
- package/dist/chunks/rendering-engine-nkqYx0qc.js.map +1 -0
- package/dist/chunks/{scene-parser-xgVJh2FU.js → scene-parser-F69XGE0l.js} +100 -33
- package/dist/chunks/scene-parser-F69XGE0l.js.map +1 -0
- package/dist/dsl/browser.js +1 -1
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/scene-parser.d.ts.map +1 -1
- package/dist/dsl/scene-validator.d.ts.map +1 -1
- package/dist/editor-support/adapter.d.ts +1 -0
- package/dist/editor-support/adapter.d.ts.map +1 -1
- package/dist/editor-support/index.js +6 -3
- package/dist/editor-support/index.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +470 -4
- package/dist/index.js.map +1 -1
- package/dist/rendering/animation-css.d.ts.map +1 -1
- package/dist/rendering/asset-node.d.ts.map +1 -1
- package/dist/rendering/rendering-engine.d.ts +9 -0
- package/dist/rendering/rendering-engine.d.ts.map +1 -1
- package/dist/rendering/theme.d.ts +4 -0
- package/dist/rendering/theme.d.ts.map +1 -1
- package/dist/runtime/diagnostics-overlay.d.ts +29 -0
- package/dist/runtime/diagnostics-overlay.d.ts.map +1 -0
- package/dist/runtime/export.d.ts +27 -0
- package/dist/runtime/export.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/interactivity.d.ts +56 -0
- package/dist/runtime/interactivity.d.ts.map +1 -0
- package/dist/runtime/mount-scene.d.ts +11 -10
- package/dist/runtime/mount-scene.d.ts.map +1 -1
- package/dist/types/asset-registry.d.ts +1 -0
- package/dist/types/asset-registry.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/node.d.ts +18 -0
- package/dist/types/node.d.ts.map +1 -1
- package/dist/types/runtime-bundle.d.ts +35 -0
- package/dist/types/runtime-bundle.d.ts.map +1 -1
- package/dist/types/scene.d.ts +2 -0
- package/dist/types/scene.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-B6HlPnov.js.map +0 -1
- package/dist/chunks/rendering-engine-BgHel7yX.js.map +0 -1
- package/dist/chunks/scene-parser-xgVJh2FU.js.map +0 -1
|
@@ -35,13 +35,13 @@ const BUILTIN_THEMES = {
|
|
|
35
35
|
* Returns undefined if the theme is not found.
|
|
36
36
|
*/
|
|
37
37
|
function resolveTheme(name) {
|
|
38
|
-
return BUILTIN_THEMES[name];
|
|
38
|
+
return Object.hasOwn(BUILTIN_THEMES, name) ? BUILTIN_THEMES[name] : undefined;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Compose a new theme by extending an existing one with overrides.
|
|
42
42
|
*/
|
|
43
43
|
function composeTheme(baseName, overrides) {
|
|
44
|
-
const base =
|
|
44
|
+
const base = resolveTheme(baseName);
|
|
45
45
|
if (!base) {
|
|
46
46
|
return { name: baseName, vars: { ...overrides } };
|
|
47
47
|
}
|
|
@@ -73,6 +73,7 @@ class AssetRegistryImpl {
|
|
|
73
73
|
this._assets.delete(id);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
/** Create a registry populated with the given asset definitions. */
|
|
76
77
|
function createAssetRegistry(assets = []) {
|
|
77
78
|
const registry = new AssetRegistryImpl();
|
|
78
79
|
for (const asset of assets) {
|
|
@@ -161,12 +162,19 @@ function buildKeyframeCSS() {
|
|
|
161
162
|
"@keyframes iso-anim-glow{0%,100%{filter:drop-shadow(0 0 2px rgba(255,255,255,.5))}50%{filter:drop-shadow(0 0 8px rgba(255,255,255,.9))}}",
|
|
162
163
|
"@keyframes iso-anim-spin{from{rotate:0deg}to{rotate:360deg}}",
|
|
163
164
|
"@keyframes iso-anim-blink{0%,49%{opacity:1}50%,100%{opacity:0}}",
|
|
165
|
+
".iso-ambient-pulse{animation:iso-anim-pulse 2s ease-in-out infinite}",
|
|
166
|
+
".iso-ambient-float{animation:iso-anim-float 3s ease-in-out infinite}",
|
|
167
|
+
".iso-ambient-shake{animation:iso-anim-shake 0.5s ease-in-out infinite}",
|
|
168
|
+
".iso-ambient-glow{animation:iso-anim-glow 2s ease-in-out infinite}",
|
|
169
|
+
".iso-ambient-spin{animation:iso-anim-spin 4s linear infinite}",
|
|
170
|
+
".iso-ambient-blink{animation:iso-anim-blink 1.5s step-end infinite}",
|
|
164
171
|
"@keyframes iso-connector-flow-route{from{stroke-dashoffset:0}to{stroke-dashoffset:calc(-1px * var(--iso-flow-distance,20))}}",
|
|
165
172
|
"@keyframes iso-connector-flow-reverse{from{stroke-dashoffset:0}to{stroke-dashoffset:calc(1px * var(--iso-flow-distance,20))}}",
|
|
166
173
|
".iso-connector-pattern-dashed .iso-connector-shaft,.iso-connector-pattern-dotted .iso-connector-shaft{--iso-flow-distance:20}",
|
|
167
174
|
".iso-connector-direction-route .iso-connector-shaft.iso-ambient-flow{animation:iso-connector-flow-route 900ms linear infinite}",
|
|
168
175
|
".iso-connector-direction-reverse .iso-connector-shaft.iso-ambient-flow{animation:iso-connector-flow-reverse 900ms linear infinite}",
|
|
169
176
|
"@media (prefers-reduced-motion: reduce){.iso-element,.iso-connector{animation-duration:1ms!important}.iso-ambient-pulse,.iso-ambient-float,.iso-ambient-shake,.iso-ambient-glow,.iso-ambient-spin,.iso-ambient-blink,.iso-ambient-flow{animation:none!important}}",
|
|
177
|
+
".iso-interactive g[data-id]{cursor:pointer}",
|
|
170
178
|
].join("\n");
|
|
171
179
|
}
|
|
172
180
|
|
|
@@ -198,13 +206,15 @@ function createTextAssetNode(textContent, assetName, cellSize) {
|
|
|
198
206
|
const group = document.createElementNS(NS$1, "g");
|
|
199
207
|
const text = document.createElementNS(NS$1, "text");
|
|
200
208
|
const align = textContent.align ?? "middle";
|
|
209
|
+
const placement = textContent.placement ?? "cell";
|
|
201
210
|
const fontSize = textContent.fontSize ?? 12;
|
|
202
211
|
const lineHeight = textContent.lineHeight ?? 1.2;
|
|
203
212
|
const anchorX = textAnchorX(align, cellSize);
|
|
213
|
+
const vertical = textVerticalAnchor(placement, cellSize);
|
|
204
214
|
text.setAttribute("x", String(anchorX));
|
|
205
|
-
text.setAttribute("y", String(
|
|
215
|
+
text.setAttribute("y", String(vertical.y));
|
|
206
216
|
text.setAttribute("text-anchor", align);
|
|
207
|
-
text.setAttribute("dominant-baseline",
|
|
217
|
+
text.setAttribute("dominant-baseline", vertical.baseline);
|
|
208
218
|
text.setAttribute("font-family", "Arial, Helvetica, sans-serif");
|
|
209
219
|
text.setAttribute("font-size", String(fontSize));
|
|
210
220
|
text.setAttribute("font-weight", String(textContent.fontWeight ?? 700));
|
|
@@ -248,6 +258,11 @@ function textAnchorX(align, cellSize) {
|
|
|
248
258
|
return cellSize / 2;
|
|
249
259
|
return 0;
|
|
250
260
|
}
|
|
261
|
+
function textVerticalAnchor(placement, cellSize) {
|
|
262
|
+
if (placement === "caption")
|
|
263
|
+
return { y: -cellSize, baseline: "text-before-edge" };
|
|
264
|
+
return { y: -cellSize / 2, baseline: "middle" };
|
|
265
|
+
}
|
|
251
266
|
function normalizeTextLines(value) {
|
|
252
267
|
const normalized = value.replace(/\r\n?/g, "\n").replace(/\n$/, "");
|
|
253
268
|
return normalized.split("\n");
|
|
@@ -367,6 +382,10 @@ function isSafeAssetUrl(url) {
|
|
|
367
382
|
}
|
|
368
383
|
|
|
369
384
|
const CSS_CUSTOM_PROPERTY_PATTERN = /^--[a-zA-Z0-9-_]+$/;
|
|
385
|
+
/**
|
|
386
|
+
* Apply theme CSS custom properties to an element's inline style.
|
|
387
|
+
* Throws `RenderError` (`INVALID_THEME_VAR`) if a key is not a valid `--name` custom property.
|
|
388
|
+
*/
|
|
370
389
|
function applyThemeToElement(element, themeVars) {
|
|
371
390
|
for (const [name, value] of Object.entries(themeVars)) {
|
|
372
391
|
if (!CSS_CUSTOM_PROPERTY_PATTERN.test(name)) {
|
|
@@ -459,6 +478,7 @@ function buildSceneDOM(container, bundle, config) {
|
|
|
459
478
|
svg._layerMap = layerMap;
|
|
460
479
|
svg._elementMap = elementMap;
|
|
461
480
|
svg._connectorMap = connectorMap;
|
|
481
|
+
svg._depthGroup = depthGroup;
|
|
462
482
|
container.appendChild(svg);
|
|
463
483
|
return svg;
|
|
464
484
|
}
|
|
@@ -473,11 +493,17 @@ function updateElementTransforms(svg, elements, connectors = []) {
|
|
|
473
493
|
const state = map.get(def.id);
|
|
474
494
|
if (!state)
|
|
475
495
|
continue;
|
|
496
|
+
const previous = state.current;
|
|
476
497
|
state.current = def;
|
|
477
|
-
|
|
498
|
+
if (!hasEqualGeneratedContent(previous, def)) {
|
|
499
|
+
updateGeneratedElementContent(state.node, def, layout);
|
|
500
|
+
}
|
|
478
501
|
applyElementTransform(state.node, def, layout);
|
|
479
502
|
applyAmbientClasses(state, def.ambient ?? []);
|
|
480
503
|
}
|
|
504
|
+
if (svg._depthGroup) {
|
|
505
|
+
reconcileDepthOrder(svg._depthGroup, map);
|
|
506
|
+
}
|
|
481
507
|
}
|
|
482
508
|
const connectorMap = svg._connectorMap;
|
|
483
509
|
if (!connectorMap)
|
|
@@ -791,11 +817,45 @@ function sortElementsForPerspective(elements) {
|
|
|
791
817
|
});
|
|
792
818
|
}
|
|
793
819
|
function renderBucket(element) {
|
|
794
|
-
if (isPrimitiveAsset(element.asset))
|
|
795
|
-
return 0;
|
|
796
820
|
if (isTextAsset(element.asset))
|
|
797
|
-
return
|
|
798
|
-
return
|
|
821
|
+
return 1;
|
|
822
|
+
return 0;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Re-sort the depth group's live child nodes to match the current
|
|
826
|
+
* `(x + y)` + id perspective order. Only elements whose relative order
|
|
827
|
+
* changed are moved so in-flight CSS animation state on unaffected
|
|
828
|
+
* elements is preserved. Text elements live in the label group and are
|
|
829
|
+
* never part of this reconciliation.
|
|
830
|
+
*/
|
|
831
|
+
function reconcileDepthOrder(depthGroup, elementMap) {
|
|
832
|
+
const current = [];
|
|
833
|
+
for (const state of elementMap.values()) {
|
|
834
|
+
if (state.node.parentElement !== depthGroup)
|
|
835
|
+
continue;
|
|
836
|
+
current.push(state.current);
|
|
837
|
+
}
|
|
838
|
+
if (current.length < 2)
|
|
839
|
+
return;
|
|
840
|
+
const desiredOrder = sortElementsForPerspective(current);
|
|
841
|
+
const existingOrder = [...depthGroup.childNodes];
|
|
842
|
+
let orderMatches = existingOrder.length === desiredOrder.length;
|
|
843
|
+
if (orderMatches) {
|
|
844
|
+
for (let index = 0; index < desiredOrder.length; index++) {
|
|
845
|
+
const expectedId = desiredOrder[index]?.id;
|
|
846
|
+
if (existingOrder[index]?.getAttribute("data-id") !== expectedId) {
|
|
847
|
+
orderMatches = false;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (orderMatches)
|
|
853
|
+
return;
|
|
854
|
+
for (const def of desiredOrder) {
|
|
855
|
+
const state = elementMap.get(def.id);
|
|
856
|
+
if (state)
|
|
857
|
+
depthGroup.appendChild(state.node);
|
|
858
|
+
}
|
|
799
859
|
}
|
|
800
860
|
function collectElementDefinitions(bundle) {
|
|
801
861
|
const byId = new Map();
|
|
@@ -872,6 +932,41 @@ function updateGeneratedElementContent(node, def, layout) {
|
|
|
872
932
|
node.appendChild(child);
|
|
873
933
|
}
|
|
874
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Compare the generated-content payload (`text` or `primitive`) of two
|
|
937
|
+
* element states for structural equality. Used to skip destructive
|
|
938
|
+
* regeneration of text/primitive DOM content on frame updates where the
|
|
939
|
+
* asset, id, and content payload are unchanged from the previous frame.
|
|
940
|
+
*/
|
|
941
|
+
function hasEqualGeneratedContent(previous, next) {
|
|
942
|
+
if (!previous)
|
|
943
|
+
return false;
|
|
944
|
+
if (previous.asset !== next.asset)
|
|
945
|
+
return false;
|
|
946
|
+
if (!isTextAsset(next.asset) && !isPrimitiveAsset(next.asset))
|
|
947
|
+
return true;
|
|
948
|
+
if (isTextAsset(next.asset))
|
|
949
|
+
return deepEqual(previous.text, next.text);
|
|
950
|
+
return deepEqual(previous.primitive, next.primitive);
|
|
951
|
+
}
|
|
952
|
+
function deepEqual(a, b) {
|
|
953
|
+
if (a === b)
|
|
954
|
+
return true;
|
|
955
|
+
if (typeof a !== typeof b)
|
|
956
|
+
return false;
|
|
957
|
+
if (a === null || b === null || typeof a !== "object" || typeof b !== "object")
|
|
958
|
+
return false;
|
|
959
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
960
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
|
|
961
|
+
return false;
|
|
962
|
+
return a.every((item, index) => deepEqual(item, b[index]));
|
|
963
|
+
}
|
|
964
|
+
const aKeys = Object.keys(a);
|
|
965
|
+
const bKeys = Object.keys(b);
|
|
966
|
+
if (aKeys.length !== bKeys.length)
|
|
967
|
+
return false;
|
|
968
|
+
return aKeys.every((key) => deepEqual(a[key], b[key]));
|
|
969
|
+
}
|
|
875
970
|
function createConnectorInstance(def, layout) {
|
|
876
971
|
const node = document.createElementNS(NS, "g");
|
|
877
972
|
const shaft = document.createElementNS(NS, "path");
|
|
@@ -887,55 +982,145 @@ function createConnectorInstance(def, layout) {
|
|
|
887
982
|
return state;
|
|
888
983
|
}
|
|
889
984
|
function applyConnectorState(state, def, layout) {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
985
|
+
const previous = state.previous;
|
|
986
|
+
const routeChanged = !previous || !routesEqual(previous.route, def.route);
|
|
987
|
+
const styleChanged = !previous || !connectorStylesEqual(previous.style, def.style);
|
|
988
|
+
const shapeChanged = !previous ||
|
|
989
|
+
shouldRenderOutline(previous) !== shouldRenderOutline(def) ||
|
|
990
|
+
previous.style.variant !== def.style.variant ||
|
|
991
|
+
previous.style.lane !== def.style.lane ||
|
|
992
|
+
previous.start !== def.start ||
|
|
993
|
+
previous.end !== def.end ||
|
|
994
|
+
previous.route.length !== def.route.length;
|
|
995
|
+
applyConnectorGroupAttrs(state.node, def, previous);
|
|
996
|
+
const geometryChanged = routeChanged || shapeChanged || styleChanged;
|
|
997
|
+
const d = geometryChanged ? routePath(def.route, layout) : (state.shaft.getAttribute("d") ?? "");
|
|
998
|
+
if (shapeChanged) {
|
|
999
|
+
if (state.outline)
|
|
1000
|
+
state.node.removeChild(state.outline);
|
|
1001
|
+
state.outline = undefined;
|
|
1002
|
+
if (shouldRenderOutline(def)) {
|
|
1003
|
+
const outline = document.createElementNS(NS, "path");
|
|
1004
|
+
outline.classList.add("iso-connector-outline");
|
|
1005
|
+
applyConnectorPathAttrs(outline, def, d, {
|
|
1006
|
+
stroke: def.style.outline ?? def.style.stroke,
|
|
1007
|
+
strokeWidth: def.style.strokeWidth + def.style.outlineWidth * 2,
|
|
1008
|
+
includeDash: false,
|
|
1009
|
+
});
|
|
1010
|
+
state.node.insertBefore(outline, state.shaft);
|
|
1011
|
+
state.outline = outline;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
else if (state.outline && geometryChanged) {
|
|
1015
|
+
applyConnectorPathAttrs(state.outline, def, d, {
|
|
897
1016
|
stroke: def.style.outline ?? def.style.stroke,
|
|
898
1017
|
strokeWidth: def.style.strokeWidth + def.style.outlineWidth * 2,
|
|
899
1018
|
includeDash: false,
|
|
900
1019
|
});
|
|
901
|
-
state.node.appendChild(outline);
|
|
902
1020
|
}
|
|
903
|
-
state.shaft
|
|
1021
|
+
if (!state.shaft.parentNode)
|
|
1022
|
+
state.node.appendChild(state.shaft);
|
|
904
1023
|
state.shaft.classList.add("iso-connector-shaft");
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1024
|
+
if (geometryChanged) {
|
|
1025
|
+
applyConnectorPathAttrs(state.shaft, def, d, {
|
|
1026
|
+
stroke: def.style.stroke,
|
|
1027
|
+
strokeWidth: def.style.strokeWidth,
|
|
1028
|
+
includeDash: true,
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
if (shapeChanged) {
|
|
1032
|
+
if (state.lane)
|
|
1033
|
+
state.node.removeChild(state.lane);
|
|
1034
|
+
state.lane = undefined;
|
|
1035
|
+
if (def.style.variant === "road" && def.style.lane === "center-dashed") {
|
|
1036
|
+
const lane = document.createElementNS(NS, "path");
|
|
1037
|
+
lane.classList.add("iso-connector-lane");
|
|
1038
|
+
applyConnectorPathAttrs(lane, def, d, {
|
|
1039
|
+
stroke: "#ffffff",
|
|
1040
|
+
strokeWidth: Math.max(1, def.style.strokeWidth * 0.12),
|
|
1041
|
+
includeDash: false,
|
|
1042
|
+
});
|
|
1043
|
+
lane.setAttribute("stroke-dasharray", "8 8");
|
|
1044
|
+
state.node.appendChild(lane);
|
|
1045
|
+
state.lane = lane;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
else if (state.lane && geometryChanged) {
|
|
1049
|
+
applyConnectorPathAttrs(state.lane, def, d, {
|
|
915
1050
|
stroke: "#ffffff",
|
|
916
1051
|
strokeWidth: Math.max(1, def.style.strokeWidth * 0.12),
|
|
917
1052
|
includeDash: false,
|
|
918
1053
|
});
|
|
919
|
-
lane.setAttribute("stroke-dasharray", "8 8");
|
|
920
|
-
|
|
1054
|
+
state.lane.setAttribute("stroke-dasharray", "8 8");
|
|
1055
|
+
}
|
|
1056
|
+
if (geometryChanged) {
|
|
1057
|
+
if (state.startEndpoint)
|
|
1058
|
+
state.node.removeChild(state.startEndpoint);
|
|
1059
|
+
if (state.endEndpoint)
|
|
1060
|
+
state.node.removeChild(state.endEndpoint);
|
|
1061
|
+
state.startEndpoint = appendEndpoint(state.node, def, "start", layout);
|
|
1062
|
+
state.endEndpoint = appendEndpoint(state.node, def, "end", layout);
|
|
921
1063
|
}
|
|
922
|
-
appendEndpoint(state.node, def, "start", layout);
|
|
923
|
-
appendEndpoint(state.node, def, "end", layout);
|
|
924
1064
|
applyConnectorAmbientClasses(state, def.ambient ?? []);
|
|
1065
|
+
state.previous = def;
|
|
925
1066
|
}
|
|
926
1067
|
function clearChildren(node) {
|
|
927
1068
|
while (node.firstChild)
|
|
928
1069
|
node.removeChild(node.firstChild);
|
|
929
1070
|
}
|
|
930
|
-
function
|
|
931
|
-
|
|
1071
|
+
function routesEqual(a, b) {
|
|
1072
|
+
if (a === b)
|
|
1073
|
+
return true;
|
|
1074
|
+
if (a.length !== b.length)
|
|
1075
|
+
return false;
|
|
1076
|
+
return a.every((point, index) => {
|
|
1077
|
+
const other = b[index];
|
|
1078
|
+
return other !== undefined && point[0] === other[0] && point[1] === other[1];
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
function connectorStylesEqual(a, b) {
|
|
1082
|
+
if (a === b)
|
|
1083
|
+
return true;
|
|
1084
|
+
return (a.variant === b.variant &&
|
|
1085
|
+
a.pattern === b.pattern &&
|
|
1086
|
+
a.stroke === b.stroke &&
|
|
1087
|
+
a.strokeWidth === b.strokeWidth &&
|
|
1088
|
+
a.opacity === b.opacity &&
|
|
1089
|
+
a.outline === b.outline &&
|
|
1090
|
+
a.outlineWidth === b.outlineWidth &&
|
|
1091
|
+
a.lane === b.lane &&
|
|
1092
|
+
(a.dash ?? []).join(",") === (b.dash ?? []).join(","));
|
|
1093
|
+
}
|
|
1094
|
+
function applyConnectorGroupAttrs(node, def, previous) {
|
|
1095
|
+
const nextClasses = [
|
|
932
1096
|
"iso-connector",
|
|
933
1097
|
`iso-connector-${def.id}`,
|
|
934
1098
|
`iso-connector-variant-${def.style.variant}`,
|
|
935
1099
|
`iso-connector-pattern-${def.style.pattern}`,
|
|
936
1100
|
`iso-connector-direction-${def.direction}`,
|
|
937
1101
|
`iso-layer-${def.layer}`,
|
|
938
|
-
]
|
|
1102
|
+
];
|
|
1103
|
+
if (!previous) {
|
|
1104
|
+
node.classList.add(...nextClasses);
|
|
1105
|
+
}
|
|
1106
|
+
else {
|
|
1107
|
+
const previousClasses = [
|
|
1108
|
+
"iso-connector",
|
|
1109
|
+
`iso-connector-${previous.id}`,
|
|
1110
|
+
`iso-connector-variant-${previous.style.variant}`,
|
|
1111
|
+
`iso-connector-pattern-${previous.style.pattern}`,
|
|
1112
|
+
`iso-connector-direction-${previous.direction}`,
|
|
1113
|
+
`iso-layer-${previous.layer}`,
|
|
1114
|
+
];
|
|
1115
|
+
for (const name of previousClasses) {
|
|
1116
|
+
if (!nextClasses.includes(name))
|
|
1117
|
+
node.classList.remove(name);
|
|
1118
|
+
}
|
|
1119
|
+
for (const name of nextClasses) {
|
|
1120
|
+
if (!previousClasses.includes(name))
|
|
1121
|
+
node.classList.add(name);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
939
1124
|
node.setAttribute("data-id", def.id);
|
|
940
1125
|
node.setAttribute("data-layer", def.layer);
|
|
941
1126
|
node.style.overflow = "visible";
|
|
@@ -968,10 +1153,11 @@ function routePath(route, layout) {
|
|
|
968
1153
|
function appendEndpoint(group, def, kind, layout) {
|
|
969
1154
|
const endpoint = def[kind];
|
|
970
1155
|
if (endpoint === "none" || def.route.length < 2)
|
|
971
|
-
return;
|
|
1156
|
+
return undefined;
|
|
972
1157
|
const node = createEndpointNode(endpoint, def, kind, layout);
|
|
973
1158
|
node.classList.add(`iso-connector-${kind}`);
|
|
974
1159
|
group.appendChild(node);
|
|
1160
|
+
return node;
|
|
975
1161
|
}
|
|
976
1162
|
function createEndpointNode(endpoint, def, kind, layout) {
|
|
977
1163
|
switch (endpoint) {
|
|
@@ -1113,5 +1299,5 @@ function animateElement(node, keyframeName, type = "enter") {
|
|
|
1113
1299
|
node.style.animation = `${keyframeName} ${duration} ${easing} forwards`;
|
|
1114
1300
|
}
|
|
1115
1301
|
|
|
1116
|
-
export { AssetRegistryImpl as A, DEFAULT_CELL_SIZE as D,
|
|
1117
|
-
//# sourceMappingURL=rendering-engine-
|
|
1302
|
+
export { AssetRegistryImpl as A, DEFAULT_CELL_SIZE as D, getResolvedViewBox as a, getCurrentElementBounds as b, getElementState as c, getConnectorState as d, updateElementTransforms as e, projectToScreen as f, getResolvedProjectionLayout as g, hideElementAfterExit as h, applyThemeToElement as i, buildSceneDOM as j, calculateTransform as k, calculateVisualSize as l, composeTheme as m, createAssetRegistry as n, createDefaultRegistry as o, projectToRaw as p, getGridAreaBounds as q, resolveTheme as r, applySceneViewBox as s, animateElement as t, unhideElementOnReadd as u };
|
|
1303
|
+
//# sourceMappingURL=rendering-engine-nkqYx0qc.js.map
|