@sentropic/design-system-svelte 0.43.1 → 0.44.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/DiagramSceneFigure.svelte +386 -82
- package/dist/DiagramSceneFigure.svelte.d.ts +9 -1
- package/dist/DiagramSceneFigure.svelte.d.ts.map +1 -1
- package/dist/LineChart.svelte +52 -13
- package/dist/LineChart.svelte.d.ts +6 -0
- package/dist/LineChart.svelte.d.ts.map +1 -1
- package/dist/diagramRenderedBounds.d.ts +5 -5
- package/dist/diagramRenderedBounds.d.ts.map +1 -1
- package/dist/diagramRenderedBounds.js +25 -14
- package/package.json +4 -4
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
clampZoom,
|
|
8
8
|
createLayoutCache,
|
|
9
9
|
FIT_ASPECT,
|
|
10
|
+
isR7ConnectorPresentation,
|
|
10
11
|
zoomReadout,
|
|
11
12
|
type LayoutHints,
|
|
12
13
|
type LayoutMetrics,
|
|
@@ -36,13 +37,24 @@
|
|
|
36
37
|
} from "./diagramCardModel.js";
|
|
37
38
|
import {
|
|
38
39
|
collapsedOccurrencesOf,
|
|
40
|
+
connectorDashArray, connectorDashPaint,
|
|
41
|
+
connectorMarkerIds,
|
|
42
|
+
connectorMarkerRef,
|
|
43
|
+
connectorPath,
|
|
44
|
+
DEFAULT_EDGE_CORNER_RADIUS,
|
|
45
|
+
DEFAULT_EDGE_LABEL_SIZE,
|
|
39
46
|
DEFAULT_SCENE_LABELS,
|
|
47
|
+
parseCssLengthPx,
|
|
48
|
+
resolveEdgeLabelSizeToken,
|
|
49
|
+
extraConnectorMarkers,
|
|
40
50
|
sceneContentSize,
|
|
41
51
|
type DiagramSceneSize,
|
|
42
52
|
type SceneLayoutCache,
|
|
43
53
|
DEFAULT_SCENE_TARGET_WIDTH,
|
|
44
54
|
displayedRects,
|
|
45
55
|
layoutScene,
|
|
56
|
+
linkLegendBoxStyle,
|
|
57
|
+
linkLegendSwatchGeometry,
|
|
46
58
|
parseDurationMs,
|
|
47
59
|
parseEasing,
|
|
48
60
|
parseScale,
|
|
@@ -50,6 +62,7 @@
|
|
|
50
62
|
resolveScene,
|
|
51
63
|
resolveZoom,
|
|
52
64
|
sameRects,
|
|
65
|
+
scaleEdgeLabelMeasurer,
|
|
53
66
|
sceneConnectorMask,
|
|
54
67
|
sceneFit,
|
|
55
68
|
sceneNodesOnPlane,
|
|
@@ -58,6 +71,7 @@
|
|
|
58
71
|
WHEEL_ZOOM_RATE,
|
|
59
72
|
ZOOM_STEP_RATIO,
|
|
60
73
|
type Easing,
|
|
74
|
+
type LinkLegendAnchor,
|
|
61
75
|
type SceneDocument,
|
|
62
76
|
type SceneModel,
|
|
63
77
|
type SceneNodeModel,
|
|
@@ -124,6 +138,8 @@
|
|
|
124
138
|
collapse: (title: string) => string;
|
|
125
139
|
/** Localized fallback label for containment relations without an explicit edge label (DE-1b). */
|
|
126
140
|
contains?: string;
|
|
141
|
+
/** Heading for the automatic link-style legend strip (DE-2). */
|
|
142
|
+
legend?: string;
|
|
127
143
|
}
|
|
128
144
|
|
|
129
145
|
export interface DiagramSceneCamera {
|
|
@@ -171,11 +187,17 @@
|
|
|
171
187
|
/** Accessible name of the figure. Defaults to `title`. */
|
|
172
188
|
label?: string;
|
|
173
189
|
compact?: boolean;
|
|
190
|
+
/** Opt-in fit-to-window host framing (`max-height: calc(100vh - 24px)`, `max-width: 100%`, centred; DE-2 ask 9). Default `false` preserves `Z-3 / AC-23`. */
|
|
191
|
+
fitToWindow?: boolean;
|
|
174
192
|
labels?: Partial<DiagramSceneFigureLabels>;
|
|
175
193
|
iconBindings?: import("@sentropic/diagram-canvas/diagramSceneModel").SceneIconBindings;
|
|
176
194
|
strictIcons?: boolean;
|
|
177
195
|
/** Selectable start parity for alternating zone depth surfaces (`0` default, `1` flipped). */
|
|
178
196
|
depthParityStart?: 0 | 1;
|
|
197
|
+
/** Automatic link-style legend anchor (`"right"` default; `"none"` suppresses). */
|
|
198
|
+
legend?: LinkLegendAnchor;
|
|
199
|
+
/** Optional custom labels for automatic link-style legend entries, keyed by `linkStyleKey(...)`. */
|
|
200
|
+
legendLabels?: Readonly<Record<string, string>>;
|
|
179
201
|
resolveGlyph?: (name: string) => DiagramGlyphPaths | undefined;
|
|
180
202
|
onFoldChange?: (
|
|
181
203
|
collapsed: readonly SceneOccurrenceRef[],
|
|
@@ -215,11 +237,14 @@
|
|
|
215
237
|
title,
|
|
216
238
|
label,
|
|
217
239
|
compact = false,
|
|
240
|
+
fitToWindow = false,
|
|
218
241
|
labels,
|
|
219
242
|
resolveGlyph = getDiagramGlyph,
|
|
220
243
|
iconBindings,
|
|
221
244
|
strictIcons = true,
|
|
222
245
|
depthParityStart,
|
|
246
|
+
legend,
|
|
247
|
+
legendLabels,
|
|
223
248
|
onFoldChange,
|
|
224
249
|
onSelect,
|
|
225
250
|
onLayout,
|
|
@@ -252,23 +277,72 @@
|
|
|
252
277
|
const collapsedNow = $derived(collapsed ?? foldState);
|
|
253
278
|
const arrowInstance = $props.id();
|
|
254
279
|
const arrowId = "diagram-arrow-" + arrowInstance;
|
|
280
|
+
const markerIds = connectorMarkerIds(arrowId);
|
|
255
281
|
const maskId = "diagram-connector-mask-" + arrowInstance;
|
|
256
282
|
let browserMeasure = $state.raw<CardLineMeasure>();
|
|
283
|
+
let frameWidth = $state<number>();
|
|
257
284
|
const effectiveMeasure = $derived(sceneCardMeasure(measure === defaultCardMeasure ? browserMeasure ?? measure : measure));
|
|
258
285
|
let tokenMetrics = $state.raw<Partial<LayoutMetrics>>({});
|
|
259
286
|
const effectiveMetrics = $derived({ ...tokenMetrics, ...metrics });
|
|
260
287
|
const lineMeasurer = $derived<LineMeasurer>(measureLines ?? cardLineMeasurer(effectiveMeasure));
|
|
288
|
+
const r7Mode = $derived(isR7ConnectorPresentation(presentation, view, semanticDocument));
|
|
261
289
|
|
|
262
290
|
// O-4: the orientation record last emitted, fed back to the next layout
|
|
263
291
|
// call. Deliberately not reactive state: it is an input of the next pass,
|
|
264
292
|
// never a reason to run one. A different document starts with no record.
|
|
293
|
+
// On r7 scenes only, returning to a previously visited fold state within the
|
|
294
|
+
// same non-fold input revision reuses the orientation seed recorded on its
|
|
295
|
+
// first visit so unfolding restores initial geometry; any revision, hint,
|
|
296
|
+
// metric, or measurer change resets that map, and legacy scenes keep main O-4.
|
|
265
297
|
let previousOrientation: SceneOrientations | undefined;
|
|
266
298
|
let orientationDocument: string | undefined;
|
|
299
|
+
let orientationInputTuple: readonly unknown[] | undefined;
|
|
300
|
+
const orientationSeedByFold = new Map<string, SceneOrientations | undefined>();
|
|
267
301
|
|
|
268
302
|
const layoutResult = $derived.by<LayoutResult>(() => {
|
|
269
303
|
if (orientationDocument !== semanticDocument.documentId) {
|
|
270
304
|
orientationDocument = semanticDocument.documentId;
|
|
271
305
|
previousOrientation = undefined;
|
|
306
|
+
orientationInputTuple = undefined;
|
|
307
|
+
orientationSeedByFold.clear();
|
|
308
|
+
}
|
|
309
|
+
let orientationSeed: SceneOrientations | undefined = previousOrientation;
|
|
310
|
+
if (r7Mode) {
|
|
311
|
+
const nextInputs: readonly unknown[] = [
|
|
312
|
+
semanticDocument,
|
|
313
|
+
semanticDocument.revision,
|
|
314
|
+
view,
|
|
315
|
+
presentation,
|
|
316
|
+
JSON.stringify(hints ?? null),
|
|
317
|
+
JSON.stringify(effectiveMetrics),
|
|
318
|
+
JSON.stringify(rowPack ?? null),
|
|
319
|
+
targetWidth,
|
|
320
|
+
lineMeasurer,
|
|
321
|
+
lineMeasurer.version,
|
|
322
|
+
JSON.stringify(flowOptions),
|
|
323
|
+
JSON.stringify(flowTokens),
|
|
324
|
+
iconBindings,
|
|
325
|
+
strictIcons,
|
|
326
|
+
depthParityStart,
|
|
327
|
+
];
|
|
328
|
+
const sameNonFoldInputs =
|
|
329
|
+
orientationInputTuple !== undefined &&
|
|
330
|
+
orientationInputTuple.length === nextInputs.length &&
|
|
331
|
+
nextInputs.every((value, index) => Object.is(value, orientationInputTuple![index]));
|
|
332
|
+
if (!sameNonFoldInputs) {
|
|
333
|
+
orientationInputTuple = nextInputs;
|
|
334
|
+
orientationSeedByFold.clear();
|
|
335
|
+
}
|
|
336
|
+
const foldKey = [...collapsedNow].sort().join("\0");
|
|
337
|
+
orientationSeed = orientationSeedByFold.has(foldKey)
|
|
338
|
+
? orientationSeedByFold.get(foldKey)
|
|
339
|
+
: previousOrientation;
|
|
340
|
+
if (!orientationSeedByFold.has(foldKey)) {
|
|
341
|
+
orientationSeedByFold.set(foldKey, orientationSeed);
|
|
342
|
+
}
|
|
343
|
+
} else if (orientationSeedByFold.size > 0 || orientationInputTuple !== undefined) {
|
|
344
|
+
orientationInputTuple = undefined;
|
|
345
|
+
orientationSeedByFold.clear();
|
|
272
346
|
}
|
|
273
347
|
const result = layoutScene({
|
|
274
348
|
cache: layoutCache ?? ownedCache,
|
|
@@ -289,7 +363,7 @@
|
|
|
289
363
|
metrics: effectiveMetrics,
|
|
290
364
|
...(rowPack === undefined ? {} : { rowPack }),
|
|
291
365
|
...(targetWidth === undefined ? {} : { targetWidth }),
|
|
292
|
-
...(
|
|
366
|
+
...(orientationSeed === undefined ? {} : { previousOrientation: orientationSeed }),
|
|
293
367
|
});
|
|
294
368
|
if (result.status === "laid-out" && result.orientations !== undefined) {
|
|
295
369
|
previousOrientation = result.orientations;
|
|
@@ -297,6 +371,21 @@
|
|
|
297
371
|
return result;
|
|
298
372
|
});
|
|
299
373
|
|
|
374
|
+
let viewWidth = $state<number>();
|
|
375
|
+
let windowHeight = $state<number>();
|
|
376
|
+
let scrollbarHeight = $state(0);
|
|
377
|
+
let maxDisplayScale = $state<number>();
|
|
378
|
+
let minReadableScale = $state<number>();
|
|
379
|
+
const sceneFitInput = $derived({
|
|
380
|
+
// Before the frame is measured (server render, hidden mount) the fit
|
|
381
|
+
// box is the nominal 16:9 box of the layout target width.
|
|
382
|
+
viewWidth: frameWidth ?? targetWidth ?? DEFAULT_SCENE_TARGET_WIDTH,
|
|
383
|
+
windowHeight: windowHeight ?? Number.POSITIVE_INFINITY,
|
|
384
|
+
...(maxDisplayScale === undefined ? {} : { maxDisplayScale }),
|
|
385
|
+
...(minReadableScale === undefined ? {} : { minReadableScale }),
|
|
386
|
+
...(fitToWindow ? { fitToWindow: true } : {}),
|
|
387
|
+
});
|
|
388
|
+
|
|
300
389
|
const scene = $derived<SceneModel | undefined>(
|
|
301
390
|
layoutResult.status === "laid-out"
|
|
302
391
|
? resolveScene(layoutResult, {
|
|
@@ -306,11 +395,14 @@
|
|
|
306
395
|
...(iconBindings === undefined ? {} : { iconBindings }),
|
|
307
396
|
strictIcons,
|
|
308
397
|
...(depthParityStart === undefined ? {} : { depthParityStart }),
|
|
398
|
+
...(legend === undefined ? {} : { legend }),
|
|
399
|
+
...(strings.legend === undefined ? {} : { legendTitle: strings.legend }),
|
|
400
|
+
...(legendLabels === undefined ? {} : { legendLabels }),
|
|
309
401
|
resolveGlyph,
|
|
310
402
|
measureLines: lineMeasurer,
|
|
311
403
|
flows: flowOptions,
|
|
312
404
|
metrics: effectiveMetrics,
|
|
313
|
-
})
|
|
405
|
+
}, fitToWindow ? sceneFitInput : undefined)
|
|
314
406
|
: undefined,
|
|
315
407
|
);
|
|
316
408
|
const sceneRects = $derived<ReadonlyMap<string, Rect>>(scene === undefined ? new Map() : rectsOf(scene));
|
|
@@ -496,11 +588,6 @@
|
|
|
496
588
|
if (select !== undefined && select !== null) select.value = filter === undefined ? "all" : `scenario:${filter}`;
|
|
497
589
|
}
|
|
498
590
|
});
|
|
499
|
-
let viewWidth = $state<number>();
|
|
500
|
-
let windowHeight = $state<number>();
|
|
501
|
-
let scrollbarHeight = $state(0);
|
|
502
|
-
let maxDisplayScale = $state<number>();
|
|
503
|
-
let minReadableScale = $state<number>();
|
|
504
591
|
let renderedBounds = $state.raw<{ scene: SceneModel; bounds: Rect }>();
|
|
505
592
|
const cameraBounds = $derived(renderedBounds?.scene === scene ? renderedBounds?.bounds : scene?.bounds);
|
|
506
593
|
// `zoom` is the scale the world is painted at: the fit is quantised once,
|
|
@@ -516,7 +603,6 @@
|
|
|
516
603
|
const bounds = measureRenderedBounds(frameEl, scene.bounds, zoom);
|
|
517
604
|
const previous = renderedBounds?.scene === scene ? renderedBounds.bounds : undefined;
|
|
518
605
|
if (bounds === undefined || !shouldRefitRenderedBounds(previous, bounds)) return;
|
|
519
|
-
if (atFit) requestedZoom = undefined;
|
|
520
606
|
renderedBounds = { scene, bounds };
|
|
521
607
|
}
|
|
522
608
|
$effect(() => {
|
|
@@ -530,13 +616,9 @@
|
|
|
530
616
|
$effect(() => {
|
|
531
617
|
const element = frameEl;
|
|
532
618
|
const current = scene;
|
|
533
|
-
if (element === undefined || current === undefined || browserMeasure !== undefined
|
|
534
|
-
|| measureLines !== undefined || measure !== defaultCardMeasure) return;
|
|
619
|
+
if (element === undefined || current === undefined || browserMeasure !== undefined) return;
|
|
535
620
|
let active = true;
|
|
536
|
-
void document.fonts?.ready.then(() => {
|
|
537
|
-
if (!active) return;
|
|
538
|
-
browserMeasure = measureRenderedSceneFont(element, current, effectiveMeasure);
|
|
539
|
-
});
|
|
621
|
+
void document.fonts?.ready.then(() => { if (active) refitForFonts(); });
|
|
540
622
|
return () => { active = false; };
|
|
541
623
|
});
|
|
542
624
|
|
|
@@ -546,22 +628,86 @@
|
|
|
546
628
|
return value === "" ? undefined : value;
|
|
547
629
|
}
|
|
548
630
|
|
|
549
|
-
|
|
550
|
-
|
|
631
|
+
function lengthTokenValue(name: string): number | undefined {
|
|
632
|
+
if (frameEl === undefined) return undefined;
|
|
633
|
+
const raw = tokenValue(name);
|
|
634
|
+
if (raw === undefined) return undefined;
|
|
635
|
+
const docEl = frameEl.ownerDocument?.documentElement;
|
|
636
|
+
const rootFontSize = docEl ? parseFloat(getComputedStyle(docEl).fontSize) : Number.NaN;
|
|
637
|
+
const elementFontSize = parseFloat(getComputedStyle(frameEl).fontSize);
|
|
638
|
+
const context = { rootFontSize, elementFontSize };
|
|
639
|
+
const parsed = parseCssLengthPx(raw, context);
|
|
640
|
+
if (parsed !== undefined || !/^(calc|min|max|clamp)\(/i.test(raw)) return parsed;
|
|
641
|
+
const probe = frameEl.ownerDocument.createElement("span");
|
|
642
|
+
probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none";
|
|
643
|
+
probe.style.fontSize = raw;
|
|
644
|
+
if (probe.style.fontSize === "") return undefined;
|
|
645
|
+
frameEl.appendChild(probe);
|
|
646
|
+
try {
|
|
647
|
+
return parseCssLengthPx(getComputedStyle(probe).fontSize, context);
|
|
648
|
+
} finally {
|
|
649
|
+
probe.remove();
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// A user zoom lasts until the next resize, fold or font load.
|
|
551
654
|
let requestedZoom = $state<number>();
|
|
552
|
-
let
|
|
655
|
+
let fittedFonts: Promise<FontFaceSet> | undefined;
|
|
656
|
+
|
|
657
|
+
function resetToFit(): void {
|
|
658
|
+
requestedZoom = undefined;
|
|
659
|
+
const element = viewportEl;
|
|
660
|
+
if (element === undefined) return;
|
|
661
|
+
void tick().then(() => {
|
|
662
|
+
element.scrollLeft = 0;
|
|
663
|
+
element.scrollTop = 0;
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
function refitForFonts(): void {
|
|
668
|
+
const ready = document.fonts?.ready;
|
|
669
|
+
const useBrowserMeasure = measureLines === undefined && measure === defaultCardMeasure;
|
|
670
|
+
if (frameEl === undefined || scene === undefined) return;
|
|
671
|
+
const fontsChanged = ready !== fittedFonts;
|
|
672
|
+
if (!fontsChanged && (!useBrowserMeasure || browserMeasure !== undefined)) return;
|
|
673
|
+
fittedFonts = ready;
|
|
674
|
+
// A later scene can supply a card to measure within the same font load.
|
|
675
|
+
if (useBrowserMeasure) {
|
|
676
|
+
browserMeasure = measureRenderedSceneFont(frameEl, scene, effectiveMeasure);
|
|
677
|
+
}
|
|
678
|
+
if (fontsChanged) resetToFit();
|
|
679
|
+
else if (browserMeasure === undefined) return;
|
|
680
|
+
void tick().then(readRenderedBounds);
|
|
681
|
+
}
|
|
553
682
|
|
|
554
683
|
// m3: camera tokens are re-read on every measure and before every camera
|
|
555
684
|
// input, so a post-mount theme change applies without waiting for a resize.
|
|
556
685
|
function readCameraTokens(): void {
|
|
557
686
|
const values: Record<string, number> = {};
|
|
558
|
-
|
|
559
|
-
|
|
687
|
+
const baseKeys = ["gapMin","gapMinBlock","gapBase","gapBaseBlock","trackSpacing","trackSpacingBlock","labelBand","gapMax","bundleLabelMaxWidth","containerPadding"];
|
|
688
|
+
const r7Keys = ["zoneGutter","routeSpacing","routeBorderClearance","edgeCornerRadius","linkStrokeWidth","linkRelatedStrokeWidth","linkEmphasisStrokeWidth"];
|
|
689
|
+
for (const key of baseKeys) {
|
|
690
|
+
const value = parseFloat(tokenValue("--st-component-diagramScene-" + key) ?? "");
|
|
560
691
|
if (Number.isFinite(value)) values[key] = value;
|
|
561
692
|
}
|
|
562
|
-
const labelMargin = parseFloat(tokenValue(
|
|
693
|
+
const labelMargin = parseFloat(tokenValue("--st-component-diagramScene-labelPadding") ?? "");
|
|
563
694
|
if (Number.isFinite(labelMargin)) values.labelMargin = labelMargin;
|
|
564
|
-
if (
|
|
695
|
+
if (r7Mode) {
|
|
696
|
+
for (const key of r7Keys) {
|
|
697
|
+
const value = lengthTokenValue("--st-component-diagramScene-" + key);
|
|
698
|
+
if (value !== undefined && Number.isFinite(value)) values[key] = value;
|
|
699
|
+
}
|
|
700
|
+
const edgeLabelSize = resolveEdgeLabelSizeToken(
|
|
701
|
+
lengthTokenValue("--st-component-diagramScene-edgeLabelSize"),
|
|
702
|
+
lengthTokenValue("--st-component-diagramScene-edgeLabelFontSize"),
|
|
703
|
+
);
|
|
704
|
+
if (edgeLabelSize !== undefined) values.edgeLabelSize = edgeLabelSize;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (JSON.stringify(values) !== JSON.stringify(tokenMetrics)) {
|
|
708
|
+
ownedCache.clear();
|
|
709
|
+
tokenMetrics = values;
|
|
710
|
+
}
|
|
565
711
|
const nextTokens = { ...DEFAULT_FLOW_TOKENS };
|
|
566
712
|
for (const name of Object.keys(nextTokens) as (keyof FlowTokens)[]) {
|
|
567
713
|
const value = tokenValue(`--st-component-diagramScene-${name}`);
|
|
@@ -573,52 +719,76 @@
|
|
|
573
719
|
minReadableScale = parseScale(tokenValue(TOKEN_MIN_READABLE_SCALE));
|
|
574
720
|
}
|
|
575
721
|
|
|
576
|
-
|
|
722
|
+
$effect(() => {
|
|
723
|
+
void r7Mode;
|
|
724
|
+
untrack(readCameraTokens);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
let previousFrameHeight: number | undefined;
|
|
728
|
+
let previousViewportHeight = 0;
|
|
729
|
+
|
|
730
|
+
function measureFrame(resize = false): void {
|
|
577
731
|
if (frameEl === undefined) return;
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
732
|
+
const width = frameEl.clientWidth || undefined;
|
|
733
|
+
const frameHeight = frameEl.clientHeight;
|
|
734
|
+
const viewportOuterHeight = viewportEl?.offsetHeight ?? 0;
|
|
735
|
+
// The frame can grow with its viewport when a scrollbar appears.
|
|
736
|
+
// Refit when the frame height changes independently of that growth.
|
|
737
|
+
const frameHeightChanged = previousFrameHeight !== undefined
|
|
738
|
+
&& frameHeight !== previousFrameHeight
|
|
739
|
+
&& frameHeight - previousFrameHeight !== viewportOuterHeight - previousViewportHeight;
|
|
740
|
+
previousFrameHeight = frameHeight;
|
|
741
|
+
previousViewportHeight = viewportOuterHeight;
|
|
742
|
+
const height = window.innerHeight > 0 ? window.innerHeight : undefined;
|
|
743
|
+
const refit = resize || width !== frameWidth || frameHeightChanged || height !== windowHeight;
|
|
744
|
+
frameWidth = width;
|
|
745
|
+
viewWidth = viewportEl?.clientWidth || width;
|
|
746
|
+
scrollbarHeight = viewportOuterHeight - (viewportEl?.clientHeight ?? 0);
|
|
747
|
+
windowHeight = height;
|
|
585
748
|
readCameraTokens();
|
|
586
|
-
if (
|
|
749
|
+
if (refit) {
|
|
750
|
+
resetToFit();
|
|
751
|
+
void tick().then(readRenderedBounds);
|
|
752
|
+
}
|
|
587
753
|
}
|
|
588
754
|
|
|
589
755
|
$effect(() => {
|
|
590
756
|
const element = frameEl;
|
|
591
757
|
if (element === undefined) return;
|
|
592
|
-
untrack(measureFrame);
|
|
593
|
-
const onResize = (): void => measureFrame();
|
|
758
|
+
untrack(() => measureFrame());
|
|
759
|
+
const onResize = (): void => measureFrame(true);
|
|
760
|
+
const fonts = document.fonts;
|
|
594
761
|
window.addEventListener("resize", onResize);
|
|
595
|
-
|
|
762
|
+
fonts?.addEventListener?.("loadingdone", refitForFonts);
|
|
763
|
+
const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(() => measureFrame());
|
|
596
764
|
observer?.observe(element);
|
|
597
765
|
if (viewportEl !== undefined) observer?.observe(viewportEl);
|
|
598
766
|
return () => {
|
|
599
767
|
window.removeEventListener("resize", onResize);
|
|
768
|
+
fonts?.removeEventListener?.("loadingdone", refitForFonts);
|
|
600
769
|
observer?.disconnect();
|
|
601
770
|
};
|
|
602
771
|
});
|
|
603
772
|
|
|
604
773
|
/* ── camera (Z-1–Z-8) ──────────────────────────────────────────── */
|
|
605
774
|
|
|
606
|
-
const measured = $derived(
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
);
|
|
775
|
+
const measured = $derived(frameWidth !== undefined && windowHeight !== undefined);
|
|
776
|
+
const fitInput = $derived({
|
|
777
|
+
...(cameraBounds === undefined ? {} : { bounds: cameraBounds }),
|
|
778
|
+
...sceneFitInput,
|
|
779
|
+
});
|
|
780
|
+
// Try the full width first so scrollbars from a user zoom cannot trap
|
|
781
|
+
// the next fit at the floor. If it still pans, account for the bars.
|
|
782
|
+
const frameFit = $derived(sceneFit(fitInput));
|
|
783
|
+
const fit = $derived(frameFit.pans
|
|
784
|
+
? sceneFit({ ...fitInput, viewWidth: viewWidth ?? fitInput.viewWidth, scrollbarHeight })
|
|
785
|
+
: frameFit);
|
|
786
|
+
const viewportHeight = $derived(fit.fitHeight + (frameFit.pans ? scrollbarHeight : 0));
|
|
619
787
|
const zoom = $derived(resolveZoom(requestedZoom, fit));
|
|
620
788
|
const readout = $derived(zoomReadout(zoom, fit.maxZoom));
|
|
621
|
-
const placement = $derived(scenePlacement(cameraBounds, zoom, fit
|
|
789
|
+
const placement = $derived(scenePlacement(cameraBounds, zoom, zoom > fit.zoom
|
|
790
|
+
? { fitWidth: viewWidth ?? fit.fitWidth, fitHeight: Math.max(0, viewportHeight - scrollbarHeight) }
|
|
791
|
+
: fit));
|
|
622
792
|
const canZoomIn = $derived(zoom < fit.maxZoom);
|
|
623
793
|
const canZoomOut = $derived(zoom > fit.minZoom);
|
|
624
794
|
|
|
@@ -627,8 +797,8 @@
|
|
|
627
797
|
$effect.pre(() => {
|
|
628
798
|
const id = semanticDocument.documentId;
|
|
629
799
|
if (cameraDocument !== undefined && cameraDocument !== id) {
|
|
630
|
-
|
|
631
|
-
|
|
800
|
+
untrack(resetToFit);
|
|
801
|
+
fittedFonts = undefined;
|
|
632
802
|
browserMeasure = undefined;
|
|
633
803
|
renderedBounds = undefined;
|
|
634
804
|
}
|
|
@@ -637,34 +807,23 @@
|
|
|
637
807
|
|
|
638
808
|
// Refit the camera and reset pan on every fold or unfold (uncontrolled toggle
|
|
639
809
|
// or controlled `collapsed` change) so unfolding never leaves the diagram
|
|
640
|
-
// overflowing the frame.
|
|
810
|
+
// overflowing the frame.
|
|
641
811
|
const foldKey = $derived([...collapsedNow].sort().join("\0"));
|
|
642
812
|
let cameraFoldKey: string | undefined;
|
|
643
813
|
$effect.pre(() => {
|
|
644
814
|
const key = foldKey;
|
|
645
815
|
untrack(() => {
|
|
646
|
-
if (cameraFoldKey !== undefined && cameraFoldKey !== key)
|
|
647
|
-
atFit = true;
|
|
648
|
-
requestedZoom = undefined;
|
|
649
|
-
const element = viewportEl;
|
|
650
|
-
if (element !== undefined) {
|
|
651
|
-
void tick().then(() => {
|
|
652
|
-
if (element.scrollLeft !== 0) element.scrollLeft = 0;
|
|
653
|
-
if (element.scrollTop !== 0) element.scrollTop = 0;
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
}
|
|
816
|
+
if (cameraFoldKey !== undefined && cameraFoldKey !== key) resetToFit();
|
|
657
817
|
cameraFoldKey = key;
|
|
658
818
|
});
|
|
659
819
|
});
|
|
660
820
|
|
|
661
|
-
// Z-7: clamp a user-selected zoom
|
|
662
|
-
// at fit through token, font and painted-bounds updates during mounting.
|
|
821
|
+
// Z-7: re-clamp a user-selected zoom when the allowed range changes.
|
|
663
822
|
$effect(() => {
|
|
664
823
|
if (!measured) return;
|
|
665
824
|
const current = zoom;
|
|
666
825
|
untrack(() => {
|
|
667
|
-
if (
|
|
826
|
+
if (requestedZoom !== undefined && requestedZoom !== current) requestedZoom = current;
|
|
668
827
|
});
|
|
669
828
|
});
|
|
670
829
|
|
|
@@ -686,8 +845,10 @@
|
|
|
686
845
|
readCameraTokens();
|
|
687
846
|
const before = zoom;
|
|
688
847
|
const target = clampZoom(next, fit);
|
|
689
|
-
|
|
690
|
-
|
|
848
|
+
if (target === before) {
|
|
849
|
+
if (target === fit.zoom) requestedZoom = undefined;
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
691
852
|
const element = viewportEl;
|
|
692
853
|
const centre =
|
|
693
854
|
element === undefined
|
|
@@ -696,7 +857,7 @@
|
|
|
696
857
|
x: (element.scrollLeft + element.clientWidth / 2 - placement.translateX) / before,
|
|
697
858
|
y: (element.scrollTop + element.clientHeight / 2 - placement.translateY) / before,
|
|
698
859
|
};
|
|
699
|
-
requestedZoom = target;
|
|
860
|
+
requestedZoom = target === fit.zoom ? undefined : target;
|
|
700
861
|
if (element === undefined || centre === undefined) return;
|
|
701
862
|
void tick().then(() => {
|
|
702
863
|
element.scrollLeft = centre.x * zoom + placement.translateX - element.clientWidth / 2;
|
|
@@ -721,14 +882,7 @@
|
|
|
721
882
|
if (animating) settle();
|
|
722
883
|
readCameraTokens();
|
|
723
884
|
if (scene === painted) readRenderedBounds();
|
|
724
|
-
|
|
725
|
-
requestedZoom = undefined;
|
|
726
|
-
const element = viewportEl;
|
|
727
|
-
if (element === undefined) return;
|
|
728
|
-
void tick().then(() => {
|
|
729
|
-
element.scrollLeft = 0;
|
|
730
|
-
element.scrollTop = 0;
|
|
731
|
-
});
|
|
885
|
+
resetToFit();
|
|
732
886
|
}
|
|
733
887
|
|
|
734
888
|
export function getCamera(): DiagramSceneCamera {
|
|
@@ -932,12 +1086,31 @@
|
|
|
932
1086
|
|
|
933
1087
|
const erdTable = $derived(semanticDocument.profileRefs.includes("erd@1") ? renderErdTable(semanticDocument) : "");
|
|
934
1088
|
|
|
1089
|
+
const edgeCornerRadius = $derived(effectiveMetrics.edgeCornerRadius ?? DEFAULT_EDGE_CORNER_RADIUS);
|
|
1090
|
+
const pathOf = (points: readonly { readonly x: number; readonly y: number }[]): string =>
|
|
1091
|
+
connectorPath(points, edgeCornerRadius);
|
|
935
1092
|
const pointsOf = (points: readonly { readonly x: number; readonly y: number }[]): string =>
|
|
936
1093
|
points.map((point) => `${point.x},${point.y}`).join(" ");
|
|
937
1094
|
|
|
938
|
-
const edgeLabelLineHeight = $derived(lineMeasurer({ text: "Mg", role: "edge-label", availableWidth: 400, allocatedLines: 1, folded: false }).height);
|
|
1095
|
+
const edgeLabelLineHeight = $derived(scaleEdgeLabelMeasurer(lineMeasurer, r7Mode ? effectiveMetrics.edgeLabelSize : undefined)({ text: "Mg", role: "edge-label", availableWidth: 400, allocatedLines: 1, folded: false }).height);
|
|
1096
|
+
const metricPaintVars = $derived(
|
|
1097
|
+
!r7Mode ? "" :
|
|
1098
|
+
(metrics?.edgeLabelSize !== undefined ||
|
|
1099
|
+
(effectiveMetrics.edgeLabelSize !== undefined && effectiveMetrics.edgeLabelSize !== DEFAULT_EDGE_LABEL_SIZE)
|
|
1100
|
+
? `;--st-diagram-edge-label-size:${effectiveMetrics.edgeLabelSize}px`
|
|
1101
|
+
: "") +
|
|
1102
|
+
(metrics?.linkStrokeWidth !== undefined ? `;--st-diagram-link-stroke-width:${metrics.linkStrokeWidth}px` : "") +
|
|
1103
|
+
(metrics?.linkRelatedStrokeWidth !== undefined ? `;--st-diagram-link-related-stroke-width:${metrics.linkRelatedStrokeWidth}px` : "") +
|
|
1104
|
+
(metrics?.linkEmphasisStrokeWidth !== undefined ? `;--st-diagram-link-emphasis-stroke-width:${metrics.linkEmphasisStrokeWidth}px` : ""),
|
|
1105
|
+
);
|
|
1106
|
+
const overviewLabelPaintVars = $derived.by(() => {
|
|
1107
|
+
const size = scene?.overviewEdgeLabelSize;
|
|
1108
|
+
if (size === undefined) return "";
|
|
1109
|
+
const lineHeight = edgeLabelLineHeight * size / (effectiveMetrics.edgeLabelSize ?? DEFAULT_EDGE_LABEL_SIZE);
|
|
1110
|
+
return `;--st-diagram-overview-edge-label-size:${size}px;--st-diagram-overview-edge-label-line-height:${lineHeight}px`;
|
|
1111
|
+
});
|
|
939
1112
|
const viewportStyle = $derived(
|
|
940
|
-
`height:${
|
|
1113
|
+
`height:${viewportHeight}px;${fitToWindow ? "max-height:calc(100vh - 24px);max-width:100%;margin-inline:auto;" : `aspect-ratio:${FIT_ASPECT};`}overflow-x:${placement.overflowX ? 'auto' : 'hidden'};overflow-y:${placement.overflowY ? 'auto' : 'hidden'};--st-diagram-zoom:${zoom};--st-diagram-label-line-height:${edgeLabelLineHeight}px${metricPaintVars}${overviewLabelPaintVars}${flowSteps.length > 0 ? `;--st-diagramSceneFigure-flowHit:${flowHitSize(zoom, flowTokens)}px` : ""}`,
|
|
941
1114
|
);
|
|
942
1115
|
const worldStyle = $derived(
|
|
943
1116
|
`transform:translate(${placement.translateX}px,${placement.translateY}px) scale(${zoom})`,
|
|
@@ -945,10 +1118,11 @@
|
|
|
945
1118
|
</script>
|
|
946
1119
|
|
|
947
1120
|
<figure
|
|
948
|
-
class="st-diagramSceneFigure{compact ? " st-diagramSceneFigure--compact" : ""}"
|
|
1121
|
+
class="st-diagramSceneFigure{compact ? " st-diagramSceneFigure--compact" : ""}{fitToWindow ? " st-diagramSceneFigure--fitToWindow" : ""}"
|
|
949
1122
|
aria-label={label ?? title}
|
|
950
1123
|
data-zoom={zoom}
|
|
951
1124
|
data-zoom-readout={readout}
|
|
1125
|
+
data-fit-to-window={fitToWindow ? "true" : undefined}
|
|
952
1126
|
data-scene-refused={layoutResult.status === "refused" ? layoutResult.refusals[0]?.code : undefined}
|
|
953
1127
|
>
|
|
954
1128
|
{#if title !== undefined}
|
|
@@ -1047,6 +1221,7 @@
|
|
|
1047
1221
|
</div>
|
|
1048
1222
|
{/snippet}
|
|
1049
1223
|
{@const connectorMask = sceneConnectorMask(scene)}
|
|
1224
|
+
{@const extraMarkers = extraConnectorMarkers(scene.edges, markerIds)}
|
|
1050
1225
|
<!-- Paint order (diagram-canvas `scenePaintPlane`): expanded zone
|
|
1051
1226
|
frames, connectors, boxes, labels last. A zone frame is opaque:
|
|
1052
1227
|
painted after the connectors it would hide every route that
|
|
@@ -1060,10 +1235,14 @@
|
|
|
1060
1235
|
aria-hidden="true"
|
|
1061
1236
|
style={animating ? `opacity:${eased}` : undefined}
|
|
1062
1237
|
>
|
|
1063
|
-
<defs><marker id={arrowId} viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10Z" fill="var(--st-component-diagramScene-edgeStroke, #64748b)" /></marker>{#if connectorMask !== undefined}<mask id={maskId} maskUnits="userSpaceOnUse" x={connectorMask.region.x} y={connectorMask.region.y} width={connectorMask.region.width} height={connectorMask.region.height}><rect x={connectorMask.region.x} y={connectorMask.region.y} width={connectorMask.region.width} height={connectorMask.region.height} fill="#fff" />{#each connectorMask.cutouts as cutout, index (index)}<rect data-scene-cutout={index} x={cutout.x} y={cutout.y} width={cutout.width} height={cutout.height} fill="#000" />{/each}</mask>{/if}</defs>
|
|
1238
|
+
<defs><marker id={arrowId} viewBox="0 0 10 10" refX="9" refY="5" markerUnits={scene.r7Connectors ? "userSpaceOnUse" : undefined} markerWidth={scene.r7Connectors ? "10.5" : "7"} markerHeight={scene.r7Connectors ? "10.5" : "7"} orient="auto-start-reverse"><path d="M0 0L10 5L0 10Z" fill="var(--st-component-diagramScene-edgeStroke, #64748b)" /></marker>{#each extraMarkers as marker (marker.id)}<marker id={marker.id} data-arrowhead-kind={marker.kind} data-arrowhead-emphasis={marker.emphasis} viewBox={marker.viewBox} refX={marker.refX} refY={marker.refY} markerUnits={marker.markerUnits} markerWidth={marker.markerWidth} markerHeight={marker.markerHeight} orient={marker.orient}><path d={marker.path} fill={marker.fill} stroke={marker.stroke} stroke-width={marker.strokeWidth} /></marker>{/each}{#if connectorMask !== undefined}<mask id={maskId} maskUnits="userSpaceOnUse" x={connectorMask.region.x} y={connectorMask.region.y} width={connectorMask.region.width} height={connectorMask.region.height}><rect x={connectorMask.region.x} y={connectorMask.region.y} width={connectorMask.region.width} height={connectorMask.region.height} fill="#fff" />{#each connectorMask.cutouts as cutout, index (index)}<rect data-scene-cutout={index} x={cutout.x} y={cutout.y} width={cutout.width} height={cutout.height} fill="#000" />{/each}</mask>{/if}</defs>
|
|
1064
1239
|
<g data-scene-connectors="" mask={connectorMask === undefined ? undefined : `url(#${maskId})`}>
|
|
1065
1240
|
{#each scene.edges as edge (edge.occurrence)}
|
|
1066
|
-
|
|
1241
|
+
{#if edge.r7}
|
|
1242
|
+
<path marker-end={connectorMarkerRef(edge, markerIds)} stroke-dasharray={connectorDashArray(edge.strokeStyle)} style={connectorDashPaint(edge.strokeStyle)} class="st-diagramSceneFigure-edge" data-scene-edge={edge.occurrence} data-connector-mode="r7" data-edge-stroke={edge.strokeStyle} data-edge-arrowhead={edge.arrowhead} data-edge-emphasis={edge.emphasis} data-flow-step={edge.flow?.relation} data-flow-bundle={edge.bundle?.id} data-flow-state={stateOf(edge.occurrence)} d={pathOf(edge.points)} />
|
|
1243
|
+
{:else}
|
|
1244
|
+
<polyline marker-end={edge.markers === undefined && !edge.directed ? `url(#${arrowId})` : undefined} class="st-diagramSceneFigure-edge" data-scene-edge={edge.occurrence} data-flow-step={edge.flow?.relation} data-flow-bundle={edge.bundle?.id} data-flow-state={stateOf(edge.occurrence)} points={pointsOf(edge.points)} />
|
|
1245
|
+
{/if}
|
|
1067
1246
|
{#if edge.directed}
|
|
1068
1247
|
<polyline class="st-diagramSceneFigure-flowHit" data-flow-hit={edge.occurrence} points={pointsOf(edge.points)} />
|
|
1069
1248
|
{#each edge.arrows as arrow, index (index)}
|
|
@@ -1075,7 +1254,13 @@
|
|
|
1075
1254
|
{#if edge.markers}<g>{@html edge.markers}</g>{/if}
|
|
1076
1255
|
{/each}
|
|
1077
1256
|
{#each scene.labels as edgeLabel (edgeLabel.occurrence)}
|
|
1078
|
-
{#if edgeLabel.leader}
|
|
1257
|
+
{#if edgeLabel.leader}
|
|
1258
|
+
{#if scene.r7Connectors && !edgeLabel.erd}
|
|
1259
|
+
<path class="st-diagramSceneFigure-edge" data-connector-mode="r7" d={pathOf(edgeLabel.leader)} />
|
|
1260
|
+
{:else}
|
|
1261
|
+
<polyline class="st-diagramSceneFigure-edge" points={pointsOf(edgeLabel.leader)} />
|
|
1262
|
+
{/if}
|
|
1263
|
+
{/if}
|
|
1079
1264
|
{/each}
|
|
1080
1265
|
</g>
|
|
1081
1266
|
</svg>
|
|
@@ -1092,6 +1277,7 @@
|
|
|
1092
1277
|
<div
|
|
1093
1278
|
class="st-diagramSceneFigure-edgeLabel"
|
|
1094
1279
|
data-scene-label={edgeLabel.occurrence}
|
|
1280
|
+
data-connector-mode={scene.r7Connectors && !edgeLabel.erd ? "r7" : undefined}
|
|
1095
1281
|
title={edgeLabel.title}
|
|
1096
1282
|
data-erd-label={edgeLabel.erd || undefined}
|
|
1097
1283
|
style={`left:${edgeLabel.box.x}px;top:${edgeLabel.box.y}px;width:${edgeLabel.box.width}px;height:${edgeLabel.box.height}px${animating ? `;opacity:${eased}` : ""}`}
|
|
@@ -1108,6 +1294,52 @@
|
|
|
1108
1294
|
{/if}
|
|
1109
1295
|
</div>
|
|
1110
1296
|
{/each}
|
|
1297
|
+
{#if scene.linkLegend !== undefined}
|
|
1298
|
+
<aside
|
|
1299
|
+
class="st-diagramSceneFigure-legend"
|
|
1300
|
+
role="region"
|
|
1301
|
+
aria-label={scene.linkLegend.title}
|
|
1302
|
+
data-scene-legend=""
|
|
1303
|
+
data-legend-anchor={scene.linkLegend.anchor}
|
|
1304
|
+
style={linkLegendBoxStyle(scene.linkLegend, animating ? eased : undefined)}
|
|
1305
|
+
>
|
|
1306
|
+
<div class="st-diagramSceneFigure-legendTitle">{scene.linkLegend.title}</div>
|
|
1307
|
+
<ul class="st-diagramSceneFigure-legendList">
|
|
1308
|
+
{#each scene.linkLegend.entries as entry (entry.key)}
|
|
1309
|
+
{@const swatch = linkLegendSwatchGeometry(entry, effectiveMetrics)}
|
|
1310
|
+
<li
|
|
1311
|
+
class="st-diagramSceneFigure-legendItem"
|
|
1312
|
+
data-legend-style={entry.key}
|
|
1313
|
+
data-edge-stroke={entry.strokeStyle}
|
|
1314
|
+
data-edge-arrowhead={entry.arrowhead}
|
|
1315
|
+
data-edge-emphasis={entry.emphasis}
|
|
1316
|
+
>
|
|
1317
|
+
<svg class="st-diagramSceneFigure-legendSwatch" viewBox={swatch.viewBox} aria-hidden="true">
|
|
1318
|
+
<path
|
|
1319
|
+
data-legend-swatch={entry.key}
|
|
1320
|
+
d={swatch.linePath}
|
|
1321
|
+
fill="none"
|
|
1322
|
+
stroke={swatch.stroke}
|
|
1323
|
+
stroke-width={swatch.strokeWidth}
|
|
1324
|
+
stroke-dasharray={swatch.dashArray}
|
|
1325
|
+
style={connectorDashPaint(entry.strokeStyle)}
|
|
1326
|
+
vector-effect="non-scaling-stroke"
|
|
1327
|
+
/>
|
|
1328
|
+
{#if swatch.arrowPath !== undefined}
|
|
1329
|
+
<path
|
|
1330
|
+
d={swatch.arrowPath}
|
|
1331
|
+
fill={swatch.arrowFill}
|
|
1332
|
+
stroke={swatch.arrowStroke}
|
|
1333
|
+
stroke-width={swatch.arrowStrokeWidth}
|
|
1334
|
+
/>
|
|
1335
|
+
{/if}
|
|
1336
|
+
</svg>
|
|
1337
|
+
<span class="st-diagramSceneFigure-legendLabel">{entry.label}</span>
|
|
1338
|
+
</li>
|
|
1339
|
+
{/each}
|
|
1340
|
+
</ul>
|
|
1341
|
+
</aside>
|
|
1342
|
+
{/if}
|
|
1111
1343
|
{/if}
|
|
1112
1344
|
</div>
|
|
1113
1345
|
</div>
|
|
@@ -1155,6 +1387,15 @@
|
|
|
1155
1387
|
.st-diagramSceneFigure--compact {
|
|
1156
1388
|
gap: var(--st-spacing-1, 0.25rem);
|
|
1157
1389
|
}
|
|
1390
|
+
.st-diagramSceneFigure--fitToWindow {
|
|
1391
|
+
margin-inline: auto;
|
|
1392
|
+
max-width: 100%;
|
|
1393
|
+
}
|
|
1394
|
+
.st-diagramSceneFigure--fitToWindow .st-diagramSceneFigure-viewport {
|
|
1395
|
+
margin-inline: auto;
|
|
1396
|
+
max-height: calc(100vh - var(--st-spacing-6, 1.5rem));
|
|
1397
|
+
max-width: 100%;
|
|
1398
|
+
}
|
|
1158
1399
|
.st-diagramSceneFigure-title {
|
|
1159
1400
|
color: var(--st-semantic-text-primary);
|
|
1160
1401
|
grid-column: 1;
|
|
@@ -1235,6 +1476,16 @@
|
|
|
1235
1476
|
stroke-width: var(--st-component-diagramZone-borderWidth, 1.5px);
|
|
1236
1477
|
vector-effect: non-scaling-stroke;
|
|
1237
1478
|
}
|
|
1479
|
+
.st-diagramSceneFigure-edge[data-connector-mode="r7"] {
|
|
1480
|
+
stroke-width: var(--st-diagram-link-stroke-width, var(--st-component-diagramScene-linkStrokeWidth, 2.5px));
|
|
1481
|
+
}
|
|
1482
|
+
.st-diagramSceneFigure-edge[data-connector-mode="r7"][data-edge-arrowhead="none"] {
|
|
1483
|
+
stroke-width: var(--st-diagram-link-related-stroke-width, var(--st-component-diagramScene-linkRelatedStrokeWidth, 3px));
|
|
1484
|
+
}
|
|
1485
|
+
.st-diagramSceneFigure-edge[data-connector-mode="r7"][data-edge-emphasis="emphasis"] {
|
|
1486
|
+
stroke: var(--st-component-diagramScene-linkEmphasisStroke, var(--st-semantic-border-interactive));
|
|
1487
|
+
stroke-width: var(--st-diagram-link-emphasis-stroke-width, var(--st-component-diagramScene-linkEmphasisStrokeWidth, 3.5px));
|
|
1488
|
+
}
|
|
1238
1489
|
.st-diagramSceneFigure-edgeLabel {
|
|
1239
1490
|
box-sizing: border-box;
|
|
1240
1491
|
background: var(--st-component-diagramScene-labelSurface, var(--st-semantic-surface-raised));
|
|
@@ -1251,8 +1502,61 @@
|
|
|
1251
1502
|
position: absolute;
|
|
1252
1503
|
white-space: nowrap;
|
|
1253
1504
|
}
|
|
1254
|
-
.st-diagramSceneFigure-edgeLabel
|
|
1505
|
+
.st-diagramSceneFigure-edgeLabel[data-connector-mode="r7"] {
|
|
1506
|
+
font-size: var(--st-diagram-overview-edge-label-size, var(--st-diagram-edge-label-size, var(--st-component-diagramScene-edgeLabelSize, var(--st-component-diagramScene-edgeLabelFontSize, 18px))));
|
|
1507
|
+
--st-diagram-edge-label-line-height: var(--st-diagram-overview-edge-label-line-height, var(--st-diagram-label-line-height, 22px));
|
|
1508
|
+
line-height: var(--st-diagram-edge-label-line-height);
|
|
1509
|
+
}
|
|
1510
|
+
.st-diagramSceneFigure-edgeLabel > span { display: block; flex: none; height: var(--st-diagram-edge-label-line-height, var(--st-diagram-label-line-height, 22px)); }
|
|
1255
1511
|
.st-diagramSceneFigure-bundleHeader { display: block; padding: var(--st-component-diagramScene-labelPadding, 4px); font-weight: 400; }
|
|
1256
1512
|
.st-diagramSceneFigure-bundleRelation { display: flex; align-self: stretch; gap: var(--st-component-diagramScene-bundleMarkerGap, 6px); padding: var(--st-component-diagramScene-labelPadding, 4px); box-shadow: inset 0 var(--st-component-diagramScene-labelBorderWidth, 1px) 0 var(--st-component-diagramScene-labelBorder, var(--st-semantic-border-subtle)); }
|
|
1257
1513
|
.st-diagramSceneFigure-bundleRelation div { display: flex; flex-direction: column; }
|
|
1514
|
+
.st-diagramSceneFigure-legend {
|
|
1515
|
+
background: var(--st-component-diagramScene-labelSurface, var(--st-semantic-surface-raised));
|
|
1516
|
+
box-shadow: inset 0 0 0 var(--st-component-diagramScene-labelBorderWidth, 1px) var(--st-component-diagramScene-labelBorder, var(--st-semantic-border-subtle));
|
|
1517
|
+
box-sizing: border-box;
|
|
1518
|
+
color: var(--st-component-diagramScene-labelText, var(--st-semantic-text-primary));
|
|
1519
|
+
display: flex;
|
|
1520
|
+
flex-direction: column;
|
|
1521
|
+
font-family: var(--st-component-diagramCard-fontFamily, var(--st-font-sans, Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif));
|
|
1522
|
+
font-size: var(--st-diagram-legend-font-size, var(--st-component-diagramScene-edgeLabelSize, var(--st-component-diagramScene-edgeLabelFontSize, 18px)));
|
|
1523
|
+
gap: var(--st-diagram-legend-header-gap);
|
|
1524
|
+
line-height: var(--st-diagram-label-line-height, var(--st-component-diagramScene-edgeLabelLineHeight, 22px));
|
|
1525
|
+
padding: var(--st-diagram-legend-padding);
|
|
1526
|
+
position: absolute;
|
|
1527
|
+
}
|
|
1528
|
+
.st-diagramSceneFigure-legendTitle {
|
|
1529
|
+
align-items: center;
|
|
1530
|
+
border-bottom: var(--st-component-diagramScene-labelBorderWidth, 1px) solid var(--st-component-diagramScene-labelBorder, var(--st-semantic-border-subtle));
|
|
1531
|
+
box-sizing: border-box;
|
|
1532
|
+
display: flex;
|
|
1533
|
+
flex: none;
|
|
1534
|
+
font-weight: var(--st-component-diagramCard-titleFontWeight, 700);
|
|
1535
|
+
height: var(--st-diagram-legend-header-height);
|
|
1536
|
+
white-space: nowrap;
|
|
1537
|
+
}
|
|
1538
|
+
.st-diagramSceneFigure-legendList {
|
|
1539
|
+
display: flex;
|
|
1540
|
+
flex-direction: column;
|
|
1541
|
+
gap: var(--st-diagram-legend-row-gap);
|
|
1542
|
+
list-style: none;
|
|
1543
|
+
margin: 0;
|
|
1544
|
+
padding: 0;
|
|
1545
|
+
}
|
|
1546
|
+
.st-diagramSceneFigure-legendItem {
|
|
1547
|
+
align-items: center;
|
|
1548
|
+
box-sizing: border-box;
|
|
1549
|
+
display: flex;
|
|
1550
|
+
flex: none;
|
|
1551
|
+
gap: var(--st-diagram-legend-swatch-gap);
|
|
1552
|
+
height: var(--st-diagram-legend-row-height);
|
|
1553
|
+
white-space: nowrap;
|
|
1554
|
+
}
|
|
1555
|
+
.st-diagramSceneFigure-legendSwatch {
|
|
1556
|
+
flex: none;
|
|
1557
|
+
height: var(--st-diagram-legend-swatch-height);
|
|
1558
|
+
overflow: visible;
|
|
1559
|
+
width: var(--st-diagram-legend-swatch-width);
|
|
1560
|
+
}
|
|
1561
|
+
.st-diagramSceneFigure-legendLabel { white-space: nowrap; }
|
|
1258
1562
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type LayoutHints, type LayoutMetrics, type LayoutOptions, type LayoutResult, type LineMeasurer, type RowPackOptions } from "@sentropic/diagram-canvas";
|
|
2
2
|
import { type StepChange, type EffectiveTarget } from "@sentropic/diagram-canvas/flowModel";
|
|
3
3
|
import { type CardLineMeasure, type DiagramGlyphPaths } from "./diagramCardModel.js";
|
|
4
|
-
import { type DiagramSceneSize, type SceneLayoutCache, type SceneDocument, type SceneOccurrenceRef, type ScenePresentation, type SceneView } from "@sentropic/diagram-canvas/diagramSceneModel";
|
|
4
|
+
import { type DiagramSceneSize, type SceneLayoutCache, type LinkLegendAnchor, type SceneDocument, type SceneOccurrenceRef, type ScenePresentation, type SceneView } from "@sentropic/diagram-canvas/diagramSceneModel";
|
|
5
5
|
/**
|
|
6
6
|
* `DiagramSceneFigure` — the generic scene host (DC-2a lot L4,
|
|
7
7
|
* SPEC_EVOL_DC2A §4.3, §5, §6.7 and Appendix D; CARDS §7.6).
|
|
@@ -59,6 +59,8 @@ export interface DiagramSceneFigureLabels {
|
|
|
59
59
|
collapse: (title: string) => string;
|
|
60
60
|
/** Localized fallback label for containment relations without an explicit edge label (DE-1b). */
|
|
61
61
|
contains?: string;
|
|
62
|
+
/** Heading for the automatic link-style legend strip (DE-2). */
|
|
63
|
+
legend?: string;
|
|
62
64
|
}
|
|
63
65
|
export interface DiagramSceneCamera {
|
|
64
66
|
readonly zoom: number;
|
|
@@ -106,11 +108,17 @@ export interface DiagramSceneFigureProps {
|
|
|
106
108
|
/** Accessible name of the figure. Defaults to `title`. */
|
|
107
109
|
label?: string;
|
|
108
110
|
compact?: boolean;
|
|
111
|
+
/** Opt-in fit-to-window host framing (`max-height: calc(100vh - 24px)`, `max-width: 100%`, centred; DE-2 ask 9). Default `false` preserves `Z-3 / AC-23`. */
|
|
112
|
+
fitToWindow?: boolean;
|
|
109
113
|
labels?: Partial<DiagramSceneFigureLabels>;
|
|
110
114
|
iconBindings?: import("@sentropic/diagram-canvas/diagramSceneModel").SceneIconBindings;
|
|
111
115
|
strictIcons?: boolean;
|
|
112
116
|
/** Selectable start parity for alternating zone depth surfaces (`0` default, `1` flipped). */
|
|
113
117
|
depthParityStart?: 0 | 1;
|
|
118
|
+
/** Automatic link-style legend anchor (`"right"` default; `"none"` suppresses). */
|
|
119
|
+
legend?: LinkLegendAnchor;
|
|
120
|
+
/** Optional custom labels for automatic link-style legend entries, keyed by `linkStyleKey(...)`. */
|
|
121
|
+
legendLabels?: Readonly<Record<string, string>>;
|
|
114
122
|
resolveGlyph?: (name: string) => DiagramGlyphPaths | undefined;
|
|
115
123
|
onFoldChange?: (collapsed: readonly SceneOccurrenceRef[], change: {
|
|
116
124
|
occurrence: SceneOccurrenceRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiagramSceneFigure.svelte.d.ts","sourceRoot":"","sources":["../src/lib/DiagramSceneFigure.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"DiagramSceneFigure.svelte.d.ts","sourceRoot":"","sources":["../src/lib/DiagramSceneFigure.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,EAOH,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EAEjB,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AASrC,OAAO,EAA+L,KAAK,UAAU,EAAE,KAAK,eAAe,EAAoB,MAAM,qCAAqC,CAAC;AAC3S,OAAO,EAMH,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AACjC,OAAO,EAaH,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAsBrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGlB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,6CAA6C,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,SAAS,EAAE,CAAC,OAAO,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AS,EAAE,SAAS,kBAAkB,EAAE,EACxC,MAAM,EAAE;QAAE,UAAU,EAAE,kBAAkB,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,KAC3D,IAAI,CAAC;IACV,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACjD;AAwjCH,QAAA,MAAM,kBAAkB;oBA/aE,MAAM,KAAG,IAAI;kBAyBjB,IAAI;mBAIH,IAAI;sBAKD,IAAI;qBAWL,kBAAkB;iBAkYqB,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
package/dist/LineChart.svelte
CHANGED
|
@@ -100,6 +100,12 @@
|
|
|
100
100
|
* several LineCharts share one scale. Invalid/absent → auto range (unchanged).
|
|
101
101
|
*/
|
|
102
102
|
domain?: [number, number];
|
|
103
|
+
/** Fixed numeric x domain shared by aligned LineCharts. */
|
|
104
|
+
xDomain?: [number, number];
|
|
105
|
+
/** Formats x ticks and tooltips while preserving the numeric coordinates. */
|
|
106
|
+
formatX?: (x: number | string) => string;
|
|
107
|
+
/** A composed chart can provide a shared accessible data table. */
|
|
108
|
+
showDataList?: boolean;
|
|
103
109
|
/**
|
|
104
110
|
* Value-axis scale. `"linear"` (default) is unchanged. `"log"` switches the
|
|
105
111
|
* y axis to base-10 logarithmic — values `<= 0` are ignored for domain/ticks
|
|
@@ -160,6 +166,9 @@
|
|
|
160
166
|
annotations,
|
|
161
167
|
dataLabels,
|
|
162
168
|
domain,
|
|
169
|
+
xDomain: sharedXDomain,
|
|
170
|
+
formatX = String,
|
|
171
|
+
showDataList = true,
|
|
163
172
|
scale = "linear",
|
|
164
173
|
invertAxis = false,
|
|
165
174
|
showLegend,
|
|
@@ -192,9 +201,16 @@
|
|
|
192
201
|
else step = 10 * pow;
|
|
193
202
|
const start = Math.floor(min / step) * step;
|
|
194
203
|
const end = Math.ceil(max / step) * step;
|
|
204
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || start + step <= start) return [min, max];
|
|
195
205
|
const ticks: number[] = [];
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
const steps = Math.round((end - start) / step);
|
|
207
|
+
if (!Number.isFinite(steps)) return [min, max];
|
|
208
|
+
for (let index = 0; index <= steps; index++) {
|
|
209
|
+
const tick = start + index * step;
|
|
210
|
+
if (!Number.isFinite(tick)) return [min, max];
|
|
211
|
+
const roundedTick = step < 1e-10 ? tick : Number(tick.toFixed(10));
|
|
212
|
+
// Near the precision limit, different steps can round to the same number.
|
|
213
|
+
if (roundedTick !== ticks[ticks.length - 1]) ticks.push(roundedTick);
|
|
198
214
|
}
|
|
199
215
|
return ticks;
|
|
200
216
|
}
|
|
@@ -349,6 +365,9 @@
|
|
|
349
365
|
const plotHeight = $derived(Math.max(height - MARGIN.top - MARGIN.bottom, 1));
|
|
350
366
|
|
|
351
367
|
const xDomain = $derived.by(() => {
|
|
368
|
+
if (sharedXDomain) {
|
|
369
|
+
return { kind: "numeric" as const, min: sharedXDomain[0], max: sharedXDomain[1] };
|
|
370
|
+
}
|
|
352
371
|
if (data.length === 0) return { kind: "ordinal" as const, values: [] as (number | string)[] };
|
|
353
372
|
const allNumeric = data.every((d) => isNumeric(d.x));
|
|
354
373
|
if (allNumeric) {
|
|
@@ -393,8 +412,14 @@
|
|
|
393
412
|
let maxRaw = ys.length ? Math.max(...ys) : 0;
|
|
394
413
|
// Fold overlay values into the domain so they never fall outside the plot.
|
|
395
414
|
[minRaw, maxRaw] = extendValueDomain(minRaw, maxRaw, referenceLines, bands, goal);
|
|
396
|
-
const
|
|
397
|
-
|
|
415
|
+
const range = maxRaw - minRaw;
|
|
416
|
+
const padded = (Number.isFinite(range) ? range * 0.08 : maxRaw * 0.08 - minRaw * 0.08)
|
|
417
|
+
|| Math.max(Math.abs(maxRaw), 1) * 0.1;
|
|
418
|
+
return niceTicks(
|
|
419
|
+
Math.max(-Number.MAX_VALUE, minRaw - padded),
|
|
420
|
+
Math.min(Number.MAX_VALUE, maxRaw + padded),
|
|
421
|
+
5,
|
|
422
|
+
);
|
|
398
423
|
});
|
|
399
424
|
|
|
400
425
|
const yDomain = $derived.by(() => {
|
|
@@ -412,7 +437,10 @@
|
|
|
412
437
|
const clamped = v > 0 ? v : yDomain.min;
|
|
413
438
|
f = hi === lo ? 0 : (Math.log10(clamped) - lo) / (hi - lo);
|
|
414
439
|
} else {
|
|
415
|
-
|
|
440
|
+
const { min, max } = yDomain;
|
|
441
|
+
const range = max - min;
|
|
442
|
+
f = !Number.isFinite(range) ? (v / 2 - min / 2) / (max / 2 - min / 2)
|
|
443
|
+
: range === 0 ? 0 : (v - min) / range;
|
|
416
444
|
}
|
|
417
445
|
return clampFraction(invertAxis ? 1 - f : f);
|
|
418
446
|
});
|
|
@@ -634,23 +662,32 @@
|
|
|
634
662
|
}))
|
|
635
663
|
);
|
|
636
664
|
|
|
637
|
-
const xTickEntries = $derived.by(() => {
|
|
665
|
+
const xTickEntries = $derived.by<{ x: number; label: string; anchor?: "start" | "end" }[]>(() => {
|
|
666
|
+
if (sharedXDomain) {
|
|
667
|
+
const [min, max] = sharedXDomain;
|
|
668
|
+
return min === max
|
|
669
|
+
? [{ x: MARGIN.left, label: formatX(min), anchor: "start" as const }]
|
|
670
|
+
: [
|
|
671
|
+
{ x: MARGIN.left, label: formatX(min), anchor: "start" as const },
|
|
672
|
+
{ x: MARGIN.left + plotWidth, label: formatX(max), anchor: "end" as const },
|
|
673
|
+
];
|
|
674
|
+
}
|
|
638
675
|
if (data.length === 0) return [];
|
|
639
676
|
if (xDomain.kind === "ordinal") {
|
|
640
677
|
return points.map((p, i) => ({
|
|
641
678
|
x: p.x,
|
|
642
|
-
label:
|
|
679
|
+
label: formatX(data[i].x)
|
|
643
680
|
}));
|
|
644
681
|
}
|
|
645
682
|
const target = Math.min(5, data.length);
|
|
646
683
|
const stride = Math.max(1, Math.round((data.length - 1) / (target - 1 || 1)));
|
|
647
684
|
const entries: { x: number; label: string }[] = [];
|
|
648
685
|
for (let i = 0; i < data.length; i += stride) {
|
|
649
|
-
entries.push({ x: points[i].x, label:
|
|
686
|
+
entries.push({ x: points[i].x, label: formatX(data[i].x) });
|
|
650
687
|
}
|
|
651
688
|
const lastIdx = data.length - 1;
|
|
652
|
-
if (entries[entries.length - 1]?.label !==
|
|
653
|
-
entries.push({ x: points[lastIdx].x, label:
|
|
689
|
+
if (entries[entries.length - 1]?.label !== formatX(data[lastIdx].x)) {
|
|
690
|
+
entries.push({ x: points[lastIdx].x, label: formatX(data[lastIdx].x) });
|
|
654
691
|
}
|
|
655
692
|
return entries;
|
|
656
693
|
});
|
|
@@ -773,7 +810,7 @@
|
|
|
773
810
|
class="st-lineChart__tickLabel"
|
|
774
811
|
x={tick.x}
|
|
775
812
|
y={height - MARGIN.bottom + 16}
|
|
776
|
-
text-anchor="middle"
|
|
813
|
+
text-anchor={tick.anchor ?? "middle"}
|
|
777
814
|
>
|
|
778
815
|
{tick.label}
|
|
779
816
|
</text>
|
|
@@ -950,7 +987,9 @@
|
|
|
950
987
|
{/if}
|
|
951
988
|
</div>
|
|
952
989
|
|
|
953
|
-
|
|
990
|
+
{#if showDataList}
|
|
991
|
+
<ChartDataList {label} items={dataValueItems} />
|
|
992
|
+
{/if}
|
|
954
993
|
|
|
955
994
|
{#if activeIndex >= 0 && points[activeIndex]}
|
|
956
995
|
{@const p = points[activeIndex]}
|
|
@@ -959,7 +998,7 @@
|
|
|
959
998
|
role="presentation"
|
|
960
999
|
style="left: {(p.x / width) * 100}%; top: {(p.y / height) * 100}%"
|
|
961
1000
|
>
|
|
962
|
-
<span class="st-lineChart__tooltipLabel">{p.datum.x}</span>
|
|
1001
|
+
<span class="st-lineChart__tooltipLabel">{formatX(p.datum.x)}</span>
|
|
963
1002
|
<span class="st-lineChart__tooltipValue">{p.datum.y}</span>
|
|
964
1003
|
</div>
|
|
965
1004
|
{/if}
|
|
@@ -73,6 +73,12 @@ type LineChartProps = {
|
|
|
73
73
|
* several LineCharts share one scale. Invalid/absent → auto range (unchanged).
|
|
74
74
|
*/
|
|
75
75
|
domain?: [number, number];
|
|
76
|
+
/** Fixed numeric x domain shared by aligned LineCharts. */
|
|
77
|
+
xDomain?: [number, number];
|
|
78
|
+
/** Formats x ticks and tooltips while preserving the numeric coordinates. */
|
|
79
|
+
formatX?: (x: number | string) => string;
|
|
80
|
+
/** A composed chart can provide a shared accessible data table. */
|
|
81
|
+
showDataList?: boolean;
|
|
76
82
|
/**
|
|
77
83
|
* Value-axis scale. `"linear"` (default) is unchanged. `"log"` switches the
|
|
78
84
|
* y axis to base-10 logarithmic — values `<= 0` are ignored for domain/ticks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.svelte.d.ts","sourceRoot":"","sources":["../src/lib/LineChart.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,S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C,CAAC;IAC1B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACzC,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA+vBJ,QAAA,MAAM,SAAS,oDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -14,7 +14,7 @@ export declare const RENDERED_BOUNDS_GRID_STEPS = 64;
|
|
|
14
14
|
* LayoutUnit grid, so a read places it within one LayoutUnit of screen
|
|
15
15
|
* space: `1 / (64 × zoom)` world unit;
|
|
16
16
|
* - no read happens under the readability floor (the camera never applies
|
|
17
|
-
* a smaller zoom), where that step is at its widest: `1 / (64 × 0.
|
|
17
|
+
* a smaller zoom), where that step is at its widest: `1 / (64 × 0.30)`;
|
|
18
18
|
* - the edge is then rounded outward to the 1/64 world-unit grid, which
|
|
19
19
|
* moves it by less than one more step;
|
|
20
20
|
* - a stroke is added to its edge in world units, at one width for every
|
|
@@ -22,13 +22,13 @@ export declare const RENDERED_BOUNDS_GRID_STEPS = 64;
|
|
|
22
22
|
* both reads alike.
|
|
23
23
|
*
|
|
24
24
|
* Two reads of an unchanged edge, through any two transforms, therefore
|
|
25
|
-
* differ by less than `(2 / 0.
|
|
25
|
+
* differ by less than `(2 / 0.30 + 1) / 64` ≈ 0.120 world unit. On screen
|
|
26
26
|
* that is more than `(1 + zoom) / 64` CSS px at every zoom the camera
|
|
27
27
|
* applies: one LayoutUnit step read back through the outward rounding,
|
|
28
|
-
* which spans up to `ceil(1 / zoom) / 64` world unit (2/64 at 0.62,
|
|
29
|
-
* 0.
|
|
28
|
+
* which spans up to `ceil(1 / zoom) / 64` world unit (2/64 at 0.62, 4/64 at
|
|
29
|
+
* 0.30). A bare 1/64 CSS px is under that step: it refits on a flip of the
|
|
30
30
|
* last grid step, and a fit then alternates between two transforms. At the
|
|
31
|
-
* 0.62 cap the tolerance is 0.
|
|
31
|
+
* 0.62 cap the tolerance is 0.075 CSS px, far under the 1 CSS px paint
|
|
32
32
|
* inset, so it cannot hide a real overflow.
|
|
33
33
|
*/
|
|
34
34
|
export declare const RENDERED_BOUNDS_REFIT_TOLERANCE: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagramRenderedBounds.d.ts","sourceRoot":"","sources":["../src/lib/diagramRenderedBounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,+BAA+B,QAA8C,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CASzF;
|
|
1
|
+
{"version":3,"file":"diagramRenderedBounds.d.ts","sourceRoot":"","sources":["../src/lib/diagramRenderedBounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,+BAA+B,QAA8C,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CASzF;AAkED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CA8ExH"}
|
|
@@ -15,7 +15,7 @@ const GRID = RENDERED_BOUNDS_GRID_STEPS;
|
|
|
15
15
|
* LayoutUnit grid, so a read places it within one LayoutUnit of screen
|
|
16
16
|
* space: `1 / (64 × zoom)` world unit;
|
|
17
17
|
* - no read happens under the readability floor (the camera never applies
|
|
18
|
-
* a smaller zoom), where that step is at its widest: `1 / (64 × 0.
|
|
18
|
+
* a smaller zoom), where that step is at its widest: `1 / (64 × 0.30)`;
|
|
19
19
|
* - the edge is then rounded outward to the 1/64 world-unit grid, which
|
|
20
20
|
* moves it by less than one more step;
|
|
21
21
|
* - a stroke is added to its edge in world units, at one width for every
|
|
@@ -23,13 +23,13 @@ const GRID = RENDERED_BOUNDS_GRID_STEPS;
|
|
|
23
23
|
* both reads alike.
|
|
24
24
|
*
|
|
25
25
|
* Two reads of an unchanged edge, through any two transforms, therefore
|
|
26
|
-
* differ by less than `(2 / 0.
|
|
26
|
+
* differ by less than `(2 / 0.30 + 1) / 64` ≈ 0.120 world unit. On screen
|
|
27
27
|
* that is more than `(1 + zoom) / 64` CSS px at every zoom the camera
|
|
28
28
|
* applies: one LayoutUnit step read back through the outward rounding,
|
|
29
|
-
* which spans up to `ceil(1 / zoom) / 64` world unit (2/64 at 0.62,
|
|
30
|
-
* 0.
|
|
29
|
+
* which spans up to `ceil(1 / zoom) / 64` world unit (2/64 at 0.62, 4/64 at
|
|
30
|
+
* 0.30). A bare 1/64 CSS px is under that step: it refits on a flip of the
|
|
31
31
|
* last grid step, and a fit then alternates between two transforms. At the
|
|
32
|
-
* 0.62 cap the tolerance is 0.
|
|
32
|
+
* 0.62 cap the tolerance is 0.075 CSS px, far under the 1 CSS px paint
|
|
33
33
|
* inset, so it cannot hide a real overflow.
|
|
34
34
|
*/
|
|
35
35
|
export const RENDERED_BOUNDS_REFIT_TOLERANCE = (2 / DEFAULT_MIN_READABLE_SCALE + 1) / GRID;
|
|
@@ -46,8 +46,10 @@ export function shouldRefitRenderedBounds(previous, next) {
|
|
|
46
46
|
const delta = Math.max(Math.abs(next.x - previous.x), Math.abs(next.y - previous.y), Math.abs(next.x + next.width - previous.x - previous.width), Math.abs(next.y + next.height - previous.y - previous.height));
|
|
47
47
|
return delta > RENDERED_BOUNDS_REFIT_TOLERANCE;
|
|
48
48
|
}
|
|
49
|
-
/** Token default of a resting
|
|
50
|
-
const
|
|
49
|
+
/** Token default of a resting numbered-flow stroke, CSS px (DC-2c). */
|
|
50
|
+
const RESTING_FLOW_STROKE_WIDTH = 1.5;
|
|
51
|
+
/** Token default of a resting connector stroke, CSS px (DE-2 `linkStrokeWidth`). */
|
|
52
|
+
const RESTING_EDGE_STROKE_WIDTH = 2.5;
|
|
51
53
|
/** Whether a computed colour paints nothing: `transparent` or a zero alpha. */
|
|
52
54
|
function isTransparent(color) {
|
|
53
55
|
const value = color.trim().toLowerCase();
|
|
@@ -60,11 +62,11 @@ function isTransparent(color) {
|
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
64
|
* What the scene hosts fade during a fold transition: the connector layer,
|
|
63
|
-
* the edge labels
|
|
64
|
-
* a frame of that fade, not a hidden element: it
|
|
65
|
-
* transition settles, and the fit has to frame it.
|
|
65
|
+
* the edge labels, the entering nodes and the automatic link legend. A zero
|
|
66
|
+
* opacity on one of these is a frame of that fade, not a hidden element: it
|
|
67
|
+
* is painted once the transition settles, and the fit has to frame it.
|
|
66
68
|
*/
|
|
67
|
-
const TRANSITION_FADED = '.st-diagramSceneFigure-edges,.st-diagramSceneFigure-edgeLabel,.st-diagramSceneFigure-node';
|
|
69
|
+
const TRANSITION_FADED = '.st-diagramSceneFigure-edges,.st-diagramSceneFigure-edgeLabel,.st-diagramSceneFigure-node,.st-diagramSceneFigure-legend';
|
|
68
70
|
/** Whether an element removes itself and its subtree from the paint for
|
|
69
71
|
* good: not rendered, fully transparent at rest, or clipped to nothing (the
|
|
70
72
|
* screen-reader-only idioms: `clip-path: inset(50%)`, `clip: rect(0 0 0 0)`,
|
|
@@ -96,9 +98,18 @@ function restingStrokeWidth(element, style) {
|
|
|
96
98
|
const state = element.getAttribute('data-flow-state');
|
|
97
99
|
if (state !== 'primary' && state !== 'related')
|
|
98
100
|
return width;
|
|
99
|
-
const
|
|
101
|
+
const isFlow = element.hasAttribute('data-flow-step');
|
|
102
|
+
const isR7 = element.getAttribute('data-connector-mode') === 'r7';
|
|
103
|
+
const token = isFlow
|
|
104
|
+
? '--st-component-diagramScene-flowStrokeWidth'
|
|
105
|
+
: element.getAttribute('data-edge-emphasis') === 'emphasis'
|
|
106
|
+
? '--st-component-diagramScene-linkEmphasisStrokeWidth'
|
|
107
|
+
: isR7
|
|
108
|
+
? '--st-component-diagramScene-linkStrokeWidth'
|
|
109
|
+
: '--st-component-diagramZone-borderWidth';
|
|
100
110
|
const resting = parseFloat(style.getPropertyValue(token));
|
|
101
|
-
|
|
111
|
+
const fallbackWidth = isFlow || !isR7 ? RESTING_FLOW_STROKE_WIDTH : RESTING_EDGE_STROKE_WIDTH;
|
|
112
|
+
return Number.isFinite(resting) ? resting : Math.min(width, fallbackWidth);
|
|
102
113
|
}
|
|
103
114
|
/**
|
|
104
115
|
* Painted bounds in world units, after font/layout settling. DOM-free scene
|
|
@@ -169,7 +180,7 @@ export function measureRenderedBounds(frame, fallback, hostZoom) {
|
|
|
169
180
|
// computed value of the painting element itself counts.
|
|
170
181
|
const paints = (element) => !element.closest('defs,[hidden],[data-flow-hit],[data-flow-node]')
|
|
171
182
|
&& styleOf(element).visibility !== 'hidden' && styleOf(element).visibility !== 'collapse' && inPaintedSubtree(element);
|
|
172
|
-
for (const element of world.querySelectorAll('[data-scene-occurrence],.st-diagramCard,.st-diagramZone,[data-scene-label],[data-diagram-icon],.st-badge,[data-badge],.st-diagramCard-rule,.st-diagramZone-rule,.st-diagramZone-footerRule,button,svg polyline,svg path,svg line,svg rect,svg circle,svg text')) {
|
|
183
|
+
for (const element of world.querySelectorAll('[data-scene-occurrence],.st-diagramCard,.st-diagramZone,[data-scene-label],[data-scene-legend],[data-diagram-icon],.st-badge,[data-badge],.st-diagramCard-rule,.st-diagramZone-rule,.st-diagramZone-footerRule,button,svg polyline,svg path,svg line,svg rect,svg circle,svg text')) {
|
|
173
184
|
if (!paints(element))
|
|
174
185
|
continue;
|
|
175
186
|
const style = styleOf(element);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/design-system-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@lucide/svelte": "^0.562.0",
|
|
66
66
|
"@sentropic/design-system-review-core": "0.1.0",
|
|
67
67
|
"@sentropic/design-system-rich-text": "0.1.1",
|
|
68
|
-
"@sentropic/design-system-themes": "0.
|
|
69
|
-
"@sentropic/diagram-canvas": "0.
|
|
68
|
+
"@sentropic/design-system-themes": "0.16.0",
|
|
69
|
+
"@sentropic/diagram-canvas": "0.4.0",
|
|
70
70
|
"@sentropic/graph": "0.3.1"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@sentropic/design-system-theme-dsfr": "0.2.2",
|
|
101
|
-
"@sentropic/design-system-themes": "0.
|
|
101
|
+
"@sentropic/design-system-themes": "0.16.0",
|
|
102
102
|
"@sveltejs/package": "^2.5.0",
|
|
103
103
|
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
104
104
|
"@testing-library/svelte": "^5.2.8",
|