@sentropic/design-system-svelte 0.38.0 → 0.40.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.
@@ -0,0 +1,114 @@
1
+ import { type LayoutHints, type LayoutMetrics, type LayoutOptions, type LayoutResult, type LineMeasurer, type RowPackOptions } from "@sentropic/diagram-canvas";
2
+ import { type CardLineMeasure, type DiagramGlyphPaths } from "./diagramCardModel.js";
3
+ import { type DiagramSceneSize, type SceneLayoutCache, type SceneDocument, type SceneOccurrenceRef, type ScenePresentation, type SceneView } from "@sentropic/diagram-canvas/diagramSceneModel";
4
+ /**
5
+ * `DiagramSceneFigure` — the generic scene host (DC-2a lot L4,
6
+ * SPEC_EVOL_DC2A §4.3, §5, §6.7 and Appendix D; CARDS §7.6).
7
+ *
8
+ * The figure lays a scene out with the `@sentropic/diagram-canvas`
9
+ * row-pack engine and draws it at emitted geometry with `DiagramCard` /
10
+ * `DiagramZone`. It keeps no packer of its own.
11
+ *
12
+ * Camera (Z-1–Z-8). Readout 100 % is the maximum display scale (token
13
+ * `diagramScene.maxDisplayScale`), never zoom 1: no input — buttons,
14
+ * keys, Ctrl + wheel, pinch, `setZoom` — goes above it. The fit frames
15
+ * the scene bounds plus the placed label boxes on both axes inside the
16
+ * fit box `viewW × min(viewW × 9/16, 0.85 × windowH)`; it holds at the
17
+ * readability floor (token `diagramScene.minReadableScale`), where the
18
+ * viewport scrolls the overflowing axis from its start, and zoom-out
19
+ * still reaches the whole drawing. The camera is never seeded from the
20
+ * layout fit report. Zoom is a transform: it re-runs no layout.
21
+ *
22
+ * Folds. A fold toggle re-runs the whole layout, feeding the previous
23
+ * orientation record back so a level keeps its orientation inside the
24
+ * hysteresis band (O-4), reclamps the zoom into the new range, then
25
+ * moves every box from its displayed to its new rectangle over the
26
+ * `diagramScene.transitionDuration` token with the
27
+ * `foundation.motion.easing` token. Under `prefers-reduced-motion:
28
+ * reduce`, read at toggle time, the new geometry applies at once. A
29
+ * toggle during a transition retargets from the displayed rectangles.
30
+ *
31
+ * The figure owns no model: the documents are props, and the fold state
32
+ * is either controlled (`collapsed` + `onFoldChange`) or starts from
33
+ * `defaultFolds` / the source view's fold groups.
34
+ *
35
+ * SSR-safe: `window`, `document` and the observers are read in effects
36
+ * and handlers only; a server render draws the scene at its fit in a
37
+ * nominal 16:9 box.
38
+ */
39
+ export interface DiagramSceneFigureLabels {
40
+ /** Accessible name of the camera control group. */
41
+ controls: string;
42
+ zoomIn: string;
43
+ zoomOut: string;
44
+ /** Visible text of the fit / reset control (« Ajuster »). */
45
+ fit: string;
46
+ /** Accessible name of the readout, e.g. « Zoom 85 % ». */
47
+ zoomLevel: (percent: number) => string;
48
+ /** Accessible name of the scrollable drawing region. */
49
+ viewport: string;
50
+ expand: (title: string) => string;
51
+ collapse: (title: string) => string;
52
+ }
53
+ export interface DiagramSceneCamera {
54
+ readonly zoom: number;
55
+ /** `round(zoom / maxDisplayScale × 100)`. */
56
+ readonly readout: number;
57
+ readonly minZoom: number;
58
+ readonly maxZoom: number;
59
+ /** The zoom a fit or reset applies. */
60
+ readonly fitZoom: number;
61
+ readonly pans: boolean;
62
+ }
63
+ export interface DiagramSceneFigureProps {
64
+ document: SceneDocument;
65
+ /** Retained source view (occurrences, fold groups). Optional: the engine synthesises one. */
66
+ view?: SceneView;
67
+ registry: LayoutOptions["registry"];
68
+ bindings?: LayoutOptions["bindings"];
69
+ presentation: ScenePresentation;
70
+ /** Declaration order (`rootOrder`, `ordering[parent]`) and the other layout hints. */
71
+ hints?: LayoutHints;
72
+ /** Runtime token numbers for the engine (gaps, caps). */
73
+ metrics?: Partial<LayoutMetrics>;
74
+ rowPack?: RowPackOptions;
75
+ /** L-R7 report width. The measured path never re-packs on it (D-3). */
76
+ targetWidth?: number;
77
+ /** Card text measurer, shared by the cards, the zones and the layout. */
78
+ measure?: CardLineMeasure;
79
+ /** Layout line measurer. Defaults to the bridge over `measure`. */
80
+ measureLines?: LineMeasurer;
81
+ /** Controlled fold state: collapsed occurrence ids. */
82
+ collapsed?: readonly SceneOccurrenceRef[];
83
+ /** Initial collapsed occurrence ids when `collapsed` is not controlled. */
84
+ defaultFolds?: readonly SceneOccurrenceRef[];
85
+ title?: string;
86
+ /** Accessible name of the figure. Defaults to `title`. */
87
+ label?: string;
88
+ compact?: boolean;
89
+ labels?: Partial<DiagramSceneFigureLabels>;
90
+ resolveGlyph?: (name: string) => DiagramGlyphPaths | undefined;
91
+ onFoldChange?: (collapsed: readonly SceneOccurrenceRef[], change: {
92
+ occurrence: SceneOccurrenceRef;
93
+ collapsed: boolean;
94
+ }) => void;
95
+ onSelect?: (event: {
96
+ entityId: string;
97
+ }) => void;
98
+ /** One call per layout pass, with the engine result (warnings, refusals, orientations). */
99
+ onLayout?: (result: LayoutResult) => void;
100
+ onCameraChange?: (camera: DiagramSceneCamera) => void;
101
+ layoutCache?: SceneLayoutCache;
102
+ contentSize?: DiagramSceneSize;
103
+ onSizeChange?: (size: DiagramSceneSize) => void;
104
+ }
105
+ declare const DiagramSceneFigure: import("svelte").Component<DiagramSceneFigureProps, {
106
+ setZoom: (next: number) => void;
107
+ zoomIn: () => void;
108
+ zoomOut: () => void;
109
+ fitToFrame: () => void;
110
+ getCamera: () => DiagramSceneCamera;
111
+ }, "contentSize">;
112
+ type DiagramSceneFigure = ReturnType<typeof DiagramSceneFigure>;
113
+ export default DiagramSceneFigure;
114
+ //# sourceMappingURL=DiagramSceneFigure.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagramSceneFigure.svelte.d.ts","sourceRoot":"","sources":["../src/lib/DiagramSceneFigure.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EAEjB,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAKrC,OAAO,EAKH,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,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