@sentropic/design-system-svelte 0.35.1 → 0.37.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.
Files changed (69) hide show
  1. package/LICENSE.THIRD-PARTY.md +74 -1
  2. package/dist/Calendar.svelte +28 -1
  3. package/dist/Calendar.svelte.d.ts +7 -0
  4. package/dist/Calendar.svelte.d.ts.map +1 -1
  5. package/dist/ContentSwitcher.svelte +6 -1
  6. package/dist/DiagramCard.svelte +282 -0
  7. package/dist/DiagramCard.svelte.d.ts +44 -0
  8. package/dist/DiagramCard.svelte.d.ts.map +1 -0
  9. package/dist/DiagramCardHeader.svelte +173 -0
  10. package/dist/DiagramCardHeader.svelte.d.ts +37 -0
  11. package/dist/DiagramCardHeader.svelte.d.ts.map +1 -0
  12. package/dist/DiagramZone.svelte +378 -0
  13. package/dist/DiagramZone.svelte.d.ts +45 -0
  14. package/dist/DiagramZone.svelte.d.ts.map +1 -0
  15. package/dist/DiagramZoneHeader.svelte +97 -0
  16. package/dist/DiagramZoneHeader.svelte.d.ts +40 -0
  17. package/dist/DiagramZoneHeader.svelte.d.ts.map +1 -0
  18. package/dist/MenuPopover.svelte +101 -12
  19. package/dist/MenuPopover.svelte.d.ts.map +1 -1
  20. package/dist/Pagination.svelte +5 -0
  21. package/dist/RadioGroup.svelte +4 -1
  22. package/dist/TimeRangePicker.svelte +19 -1
  23. package/dist/TimeRangePicker.svelte.d.ts.map +1 -1
  24. package/dist/diagram-icons/DiagramIcon.svelte +65 -0
  25. package/dist/diagram-icons/DiagramIcon.svelte.d.ts +11 -0
  26. package/dist/diagram-icons/DiagramIcon.svelte.d.ts.map +1 -0
  27. package/dist/diagram-icons/PROVENANCE.md +72 -0
  28. package/dist/diagram-icons/index.d.ts +6 -0
  29. package/dist/diagram-icons/index.d.ts.map +1 -0
  30. package/dist/diagram-icons/index.js +4 -0
  31. package/dist/diagram-icons/registry.d.ts +52 -0
  32. package/dist/diagram-icons/registry.d.ts.map +1 -0
  33. package/dist/diagram-icons/registry.js +79 -0
  34. package/dist/diagram-render/index.d.ts +17 -0
  35. package/dist/diagram-render/index.d.ts.map +1 -0
  36. package/dist/diagram-render/index.js +11 -0
  37. package/dist/diagram-render/renderCardSvg.d.ts +83 -0
  38. package/dist/diagram-render/renderCardSvg.d.ts.map +1 -0
  39. package/dist/diagram-render/renderCardSvg.js +149 -0
  40. package/dist/diagram-render/renderZoneSvg.d.ts +88 -0
  41. package/dist/diagram-render/renderZoneSvg.d.ts.map +1 -0
  42. package/dist/diagram-render/renderZoneSvg.js +184 -0
  43. package/dist/diagramCardModel.d.ts +582 -0
  44. package/dist/diagramCardModel.d.ts.map +1 -0
  45. package/dist/diagramCardModel.js +1133 -0
  46. package/dist/index.d.ts +5 -0
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +2 -0
  49. package/dist/presence-badge/LockPresenceBadge.svelte +490 -0
  50. package/dist/presence-badge/LockPresenceBadge.svelte.d.ts +18 -0
  51. package/dist/presence-badge/LockPresenceBadge.svelte.d.ts.map +1 -0
  52. package/dist/presence-badge/index.d.ts +6 -0
  53. package/dist/presence-badge/index.d.ts.map +1 -0
  54. package/dist/presence-badge/index.js +3 -0
  55. package/dist/rich-text-editor/ComposerEditor.svelte +485 -0
  56. package/dist/rich-text-editor/ComposerEditor.svelte.d.ts +16 -0
  57. package/dist/rich-text-editor/ComposerEditor.svelte.d.ts.map +1 -0
  58. package/dist/rich-text-editor/RichTextEditor.svelte +557 -0
  59. package/dist/rich-text-editor/RichTextEditor.svelte.d.ts +45 -0
  60. package/dist/rich-text-editor/RichTextEditor.svelte.d.ts.map +1 -0
  61. package/dist/rich-text-editor/RichTextEditorFixture.svelte.d.ts +8 -0
  62. package/dist/rich-text-editor/RichTextEditorFixture.svelte.d.ts.map +1 -0
  63. package/dist/rich-text-editor/RichTextEditorNestedFixture.svelte.d.ts +13 -0
  64. package/dist/rich-text-editor/RichTextEditorNestedFixture.svelte.d.ts.map +1 -0
  65. package/dist/rich-text-editor/index.d.ts +10 -0
  66. package/dist/rich-text-editor/index.d.ts.map +1 -0
  67. package/dist/rich-text-editor/index.js +4 -0
  68. package/dist/rich-text-editor/rich-text-editor.css +115 -0
  69. package/package.json +54 -7
@@ -0,0 +1,173 @@
1
+ <script lang="ts">
2
+ import IconButton from "./IconButton.svelte";
3
+ import { Minus, Plus } from "@lucide/svelte";
4
+ import type { DiagramGlyphPaths, LaidOutLine } from "./diagramCardModel.js";
5
+
6
+ /**
7
+ * Internal shared header row (DC-D1): icon box, kicker over title, toggle
8
+ * slot. Composed by `DiagramCard` and (DC-2) by `DiagramZoneHeader`, so
9
+ * zone and card headers cannot diverge in size, spacing or typography.
10
+ * Not a public export: exercised through `DiagramCard`.
11
+ */
12
+ interface DiagramCardHeaderProps {
13
+ kicker: readonly LaidOutLine[];
14
+ title: readonly LaidOutLine[];
15
+ iconName?: string;
16
+ iconGlyph?: DiagramGlyphPaths;
17
+ /** Width the title/kicker block may take (toggle-aware). */
18
+ headerTextWidth: number;
19
+ /**
20
+ * Header row height from the shared model (`headerSlotGeometry`, review
21
+ * pass 2 item 10): `max(icon 70, kicker+title)` with an icon, the bare
22
+ * kicker+title line boxes without one. Applied here as the row height so
23
+ * the Svelte header places the body exactly where `layoutCard` /
24
+ * `layoutZone` and the SVG renderers place it.
25
+ */
26
+ headerBlockHeight: number;
27
+ toggle?: { collapsed: boolean; label: string; onToggle?: () => void };
28
+ /**
29
+ * Extra px the toggle slot is pulled up (zone expanded: the toggle sits
30
+ * at frame top + 10 while the header band starts at + 16, so −6).
31
+ */
32
+ toggleTopOffset?: number;
33
+ }
34
+
35
+ let {
36
+ kicker,
37
+ title,
38
+ iconName,
39
+ iconGlyph,
40
+ headerTextWidth,
41
+ headerBlockHeight,
42
+ toggle,
43
+ toggleTopOffset,
44
+ }: DiagramCardHeaderProps = $props();
45
+ </script>
46
+
47
+ <div class="st-diagramCardHeader" style={`height:${headerBlockHeight}px`}>
48
+ {#if iconName !== undefined && iconGlyph !== undefined}
49
+ <svg
50
+ class="st-diagramCardHeader-icon"
51
+ data-diagram-icon={iconName}
52
+ viewBox="0 0 64 64"
53
+ width="70"
54
+ height="70"
55
+ aria-hidden="true"
56
+ focusable="false"
57
+ >
58
+ <path
59
+ d="M8 53L32 44L56 53L32 62Z"
60
+ fill="var(--st-component-diagramIcon-baseFill, color-mix(in srgb, var(--st-semantic-feedback-info) 18%, var(--st-semantic-surface-raised)))"
61
+ />
62
+ <path
63
+ d={iconGlyph.face}
64
+ fill="var(--st-component-diagramIcon-faceFill, color-mix(in srgb, var(--st-semantic-feedback-info) 75%, var(--st-semantic-surface-raised)))"
65
+ stroke="var(--st-component-diagramIcon-faceStroke, var(--st-semantic-feedback-info))"
66
+ stroke-width="1.5"
67
+ stroke-linejoin="round"
68
+ />
69
+ {#if iconGlyph.line !== undefined}
70
+ <path
71
+ d={iconGlyph.line}
72
+ fill="none"
73
+ stroke={iconGlyph.darkLine === true
74
+ ? "var(--st-component-diagramIcon-lineDarkStroke, var(--st-semantic-feedback-info))"
75
+ : "var(--st-component-diagramIcon-lineStroke, var(--st-semantic-surface-raised))"}
76
+ stroke-width="2.5"
77
+ stroke-linecap="round"
78
+ stroke-linejoin="round"
79
+ />
80
+ {/if}
81
+ {#if iconGlyph.text !== undefined}
82
+ <text
83
+ x="32"
84
+ y="47"
85
+ text-anchor="middle"
86
+ fill="var(--st-component-diagramIcon-lineStroke, var(--st-semantic-surface-raised))"
87
+ font-size="13"
88
+ font-weight="750"
89
+ >{iconGlyph.text}</text>
90
+ {/if}
91
+ </svg>
92
+ {/if}
93
+ <div class="st-diagramCardHeader-text" style={`width:${headerTextWidth}px`}>
94
+ {#each kicker as line, kickerIndex (kickerIndex)}
95
+ <span class="st-diagramCard-kicker">{line.text}</span>
96
+ {/each}
97
+ {#each title as line, titleIndex (titleIndex)}
98
+ <span class="st-diagramCard-title">{line.text}</span>
99
+ {/each}
100
+ </div>
101
+ {#if toggle !== undefined}
102
+ <div
103
+ class="st-diagramCard-toggle"
104
+ style={toggleTopOffset === undefined ? undefined : `margin-top:${toggleTopOffset}px`}
105
+ >
106
+ <IconButton
107
+ size="sm"
108
+ variant="ghost"
109
+ aria-label={toggle.label}
110
+ aria-expanded={!toggle.collapsed}
111
+ onclick={toggle.onToggle}
112
+ >
113
+ {#if toggle.collapsed}
114
+ <Plus size="var(--st-component-button-anatomy-density-sm-fontSize)" aria-hidden="true" />
115
+ {:else}
116
+ <Minus size="var(--st-component-button-anatomy-density-sm-fontSize)" aria-hidden="true" />
117
+ {/if}
118
+ </IconButton>
119
+ </div>
120
+ {/if}
121
+ </div>
122
+
123
+ <style>
124
+ .st-diagramCardHeader {
125
+ display: flex;
126
+ align-items: center;
127
+ gap: var(--st-component-diagramCard-iconTextGap, 6px);
128
+ min-width: 0;
129
+ flex: 0 0 auto;
130
+ }
131
+ .st-diagramCardHeader-icon {
132
+ flex: 0 0 var(--st-component-diagramCard-iconSize, 70px);
133
+ width: var(--st-component-diagramCard-iconSize, 70px);
134
+ height: var(--st-component-diagramCard-iconSize, 70px);
135
+ }
136
+ .st-diagramCardHeader-text {
137
+ display: flex;
138
+ flex-direction: column;
139
+ justify-content: center;
140
+ min-width: 0;
141
+ flex: 0 1 auto;
142
+ }
143
+ .st-diagramCard-kicker {
144
+ display: block;
145
+ min-width: 0;
146
+ font-size: var(--st-component-diagramCard-kickerFontSize, 22px);
147
+ font-weight: var(--st-component-diagramCard-kickerFontWeight, 400);
148
+ line-height: var(--st-component-diagramCard-kickerLineHeight, 1.3);
149
+ letter-spacing: var(--st-component-diagramCard-kickerLetterSpacing, 0.04em);
150
+ text-transform: var(--st-component-diagramCard-kickerTextTransform, uppercase);
151
+ color: var(--st-component-diagramCard-secondaryText, var(--st-semantic-text-secondary));
152
+ /* No mid-word break: an over-long word is diagnosed, never broken. */
153
+ overflow-wrap: normal;
154
+ word-break: normal;
155
+ }
156
+ .st-diagramCard-title {
157
+ display: block;
158
+ min-width: 0;
159
+ font-size: var(--st-component-diagramCard-titleFontSize, 32px);
160
+ font-weight: var(--st-component-diagramCard-titleFontWeight, 700);
161
+ line-height: var(--st-component-diagramCard-titleLineHeight, 1.3);
162
+ color: var(--st-component-diagramCard-text, var(--st-semantic-text-primary));
163
+ overflow-wrap: normal;
164
+ word-break: normal;
165
+ }
166
+ .st-diagramCard-toggle {
167
+ flex: 0 0 auto;
168
+ margin-left: auto;
169
+ /* Top right of the header row with the card's own top margin
170
+ (hrpn folded-card placement), not vertically centred. */
171
+ align-self: flex-start;
172
+ }
173
+ </style>
@@ -0,0 +1,37 @@
1
+ import type { DiagramGlyphPaths, LaidOutLine } from "./diagramCardModel.js";
2
+ /**
3
+ * Internal shared header row (DC-D1): icon box, kicker over title, toggle
4
+ * slot. Composed by `DiagramCard` and (DC-2) by `DiagramZoneHeader`, so
5
+ * zone and card headers cannot diverge in size, spacing or typography.
6
+ * Not a public export: exercised through `DiagramCard`.
7
+ */
8
+ interface DiagramCardHeaderProps {
9
+ kicker: readonly LaidOutLine[];
10
+ title: readonly LaidOutLine[];
11
+ iconName?: string;
12
+ iconGlyph?: DiagramGlyphPaths;
13
+ /** Width the title/kicker block may take (toggle-aware). */
14
+ headerTextWidth: number;
15
+ /**
16
+ * Header row height from the shared model (`headerSlotGeometry`, review
17
+ * pass 2 item 10): `max(icon 70, kicker+title)` with an icon, the bare
18
+ * kicker+title line boxes without one. Applied here as the row height so
19
+ * the Svelte header places the body exactly where `layoutCard` /
20
+ * `layoutZone` and the SVG renderers place it.
21
+ */
22
+ headerBlockHeight: number;
23
+ toggle?: {
24
+ collapsed: boolean;
25
+ label: string;
26
+ onToggle?: () => void;
27
+ };
28
+ /**
29
+ * Extra px the toggle slot is pulled up (zone expanded: the toggle sits
30
+ * at frame top + 10 while the header band starts at + 16, so −6).
31
+ */
32
+ toggleTopOffset?: number;
33
+ }
34
+ declare const DiagramCardHeader: import("svelte").Component<DiagramCardHeaderProps, {}, "">;
35
+ type DiagramCardHeader = ReturnType<typeof DiagramCardHeader>;
36
+ export default DiagramCardHeader;
37
+ //# sourceMappingURL=DiagramCardHeader.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagramCardHeader.svelte.d.ts","sourceRoot":"","sources":["../src/lib/DiagramCardHeader.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG1E;;;;;GAKG;AACH,UAAU,sBAAsB;IAC9B,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IACtE;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA2DH,QAAA,MAAM,iBAAiB,4DAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,378 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from "svelte";
3
+ import DiagramCard from "./DiagramCard.svelte";
4
+ import DiagramZoneHeader from "./DiagramZoneHeader.svelte";
5
+ import {
6
+ ZONE_GEOMETRY,
7
+ defaultCardMeasure,
8
+ firstOverflowDiagnostic,
9
+ layoutZone,
10
+ zoneCollapsedCardProps,
11
+ type CardLineMeasure,
12
+ type DiagramZoneProps as DiagramZoneData,
13
+ type ZoneDiagnostic,
14
+ } from "./diagramCardModel.js";
15
+
16
+ /**
17
+ * `DiagramZone` — the wrapping diagram card (DC-2, spec §6).
18
+ *
19
+ * Collapsed, the zone IS the atomic card (§6.2): `DiagramCard` with the
20
+ * subtitle as the centred body, the footer pinning the rule, and the
21
+ * "+" `IconButton` in the top-right toggle slot. Expanded, the component
22
+ * paints the frame, the shared header (`DiagramZoneHeader` =
23
+ * `DiagramCardHeader` + subtitle), the header rule and the toggle around
24
+ * the occurrence box it is given (`x`/`y`/`width`/`height`); children are
25
+ * host-rendered content and are positioned by the host layout, never by
26
+ * the zone (§6.1).
27
+ *
28
+ * Both states render inside the SAME positioning wrapper
29
+ * (`.st-diagramZone-pos`, absolute at `x`/`y`): folding never moves the
30
+ * zone occurrence. Overflow = refusal (owner criterion): a `zone-overflow`
31
+ * renders no normal zone — the wrapper carries the host-visible refusal
32
+ * state `data-zone-refused="<slot>"`, matching the pure renderer's refused
33
+ * result.
34
+ *
35
+ * The component owns no view state: `collapsed` is a prop (§4.3) and
36
+ * activating the toggle emits the §7.2 intent through `onToggle`.
37
+ */
38
+ export interface DiagramZoneProps extends DiagramZoneData {
39
+ /** Text measurer, shared with the card and the pure renderer. */
40
+ measure?: CardLineMeasure;
41
+ /** §7.2 intent out: collapse/expand with the zone as target. */
42
+ onToggle?: (event: { entityId: string; collapsed: boolean }) => void;
43
+ /** Select intent (§4.6). */
44
+ onSelect?: (event: { entityId: string }) => void;
45
+ /** One call per zone diagnostic the layout raises. */
46
+ onDiagnostic?: (diagnostic: ZoneDiagnostic) => void;
47
+ /** Expanded state only: host-rendered children (cards, sub-zones). */
48
+ children?: Snippet;
49
+ }
50
+
51
+ let {
52
+ entityId,
53
+ kicker,
54
+ title,
55
+ subtitle,
56
+ footer,
57
+ icon,
58
+ iconGlyph,
59
+ tone,
60
+ proposed,
61
+ collapsed,
62
+ toggleLabel,
63
+ align,
64
+ x = 0,
65
+ y = 0,
66
+ width,
67
+ height,
68
+ measure = defaultCardMeasure,
69
+ onToggle,
70
+ onSelect,
71
+ onDiagnostic,
72
+ children,
73
+ }: DiagramZoneProps = $props();
74
+
75
+ const zoneProps = $derived({
76
+ entityId,
77
+ ...(kicker === undefined ? {} : { kicker }),
78
+ title,
79
+ ...(subtitle === undefined ? {} : { subtitle }),
80
+ ...(footer === undefined ? {} : { footer }),
81
+ ...(icon === undefined ? {} : { icon }),
82
+ ...(iconGlyph === undefined ? {} : { iconGlyph }),
83
+ ...(tone === undefined ? {} : { tone }),
84
+ ...(proposed === undefined ? {} : { proposed }),
85
+ collapsed,
86
+ ...(toggleLabel === undefined ? {} : { toggleLabel }),
87
+ ...(align === undefined ? {} : { align }),
88
+ x,
89
+ y,
90
+ ...(width === undefined ? {} : { width }),
91
+ ...(height === undefined ? {} : { height }),
92
+ });
93
+
94
+ // Children geometry is host layout data (§6.1): the Svelte zone paints
95
+ // around the supplied box, so the layout pass sees no child specs.
96
+ const layout = $derived(layoutZone(zoneProps, measure, []));
97
+
98
+ const cardProps = $derived(
99
+ toggleLabel === undefined
100
+ ? zoneCollapsedCardProps(zoneProps)
101
+ : {
102
+ ...zoneCollapsedCardProps(zoneProps),
103
+ toggle: {
104
+ collapsed: true,
105
+ label: toggleLabel,
106
+ onToggle: () => onToggle?.({ entityId, collapsed: true }),
107
+ },
108
+ },
109
+ );
110
+
111
+ const overflowSlot = $derived(
112
+ layout.diagnostics.find((diagnostic) => diagnostic.code === "zone-overflow")?.slot,
113
+ );
114
+ const unknownIcon = $derived(
115
+ layout.diagnostics.some((diagnostic) => diagnostic.code === "zone-icon-unknown"),
116
+ );
117
+ // Overflow = refusal: the same predicate as the pure renderer
118
+ // (`firstOverflowDiagnostic`), so both renderers refuse together.
119
+ const refused = $derived(firstOverflowDiagnostic(layout.diagnostics));
120
+
121
+ const header = $derived(layout.header);
122
+ // Expanded subtitle measure: the layout's own `subtitleWidth`
123
+ // (min(width, 460) − 26) — the single geometry source shared with
124
+ // `renderZoneSvg`, no local arithmetic here.
125
+ const subtitleWidth = $derived(header?.subtitleWidth ?? 0);
126
+
127
+ // Review pass 4 (blocking): the expanded frame positions its header,
128
+ // rules, content and footer from the shared layout (`layout.header` /
129
+ // `layout.box`) — never from an independent CSS stack of border +
130
+ // padding + line boxes. Layout coordinates are frame-edge based, while
131
+ // an absolutely positioned child resolves against the frame's PADDING
132
+ // box, so the CSS border is subtracted exactly once, through the border
133
+ // token, in every frame-edge offset below. The footer is pinned the
134
+ // other way round: the model's `footerBottom = frame bottom − border −
135
+ // inset` is already measured from the inner border edge, so from the
136
+ // padding box the whole offset is the inset itself (9.25 px) — no
137
+ // border subtraction in the value.
138
+ const borderToken = "var(--st-component-diagramZone-borderWidth, 1.5px)";
139
+ const frameTop = (frameY: number): string => `calc(${frameY - y}px - ${borderToken})`;
140
+ const frameInset = (inset: number): string => `calc(${inset}px - ${borderToken})`;
141
+ // Header band: frame top + headerInset, spanning the header/content
142
+ // inline insets, as tall as the layout's header block + subtitle.
143
+ const headerStyle = $derived(
144
+ header === undefined
145
+ ? undefined
146
+ : `top:${frameTop(y + ZONE_GEOMETRY.headerInset)};left:${frameInset(ZONE_GEOMETRY.headerInset)};right:${frameInset(ZONE_GEOMETRY.contentInsetInline)};height:${header.ruleY - ZONE_GEOMETRY.headerRuleGap - y - ZONE_GEOMETRY.headerInset}px`,
147
+ );
148
+ const ruleStyle = $derived(
149
+ header === undefined
150
+ ? undefined
151
+ : `top:${frameTop(header.ruleY)};left:${frameInset(ZONE_GEOMETRY.ruleInsetStart)};right:${frameInset(ZONE_GEOMETRY.ruleInsetEnd)}`,
152
+ );
153
+ const contentStyle = $derived(
154
+ header === undefined
155
+ ? undefined
156
+ : `top:${frameTop(header.contentTop)};left:${frameInset(ZONE_GEOMETRY.contentInsetInline)};right:${frameInset(ZONE_GEOMETRY.contentInsetInline)};bottom:${frameInset(ZONE_GEOMETRY.contentInsetBottom)}`,
157
+ );
158
+ const footerRuleStyle = $derived(
159
+ header?.footerRuleY === undefined
160
+ ? undefined
161
+ : `top:${frameTop(header.footerRuleY)};left:${frameInset(ZONE_GEOMETRY.ruleInsetStart)};right:${frameInset(ZONE_GEOMETRY.ruleInsetEnd)}`,
162
+ );
163
+ const footerStyle = $derived(
164
+ header === undefined
165
+ ? undefined
166
+ : `left:${frameInset(ZONE_GEOMETRY.contentInsetInline)};right:${frameInset(ZONE_GEOMETRY.contentInsetInline)};bottom:var(--st-component-diagramZone-footerBottomInset, var(--st-component-diagramCard-footerBottomInset, 9.25px))`,
167
+ );
168
+
169
+ $effect(() => {
170
+ if (onDiagnostic === undefined) return;
171
+ for (const diagnostic of layout.diagnostics) onDiagnostic(diagnostic);
172
+ });
173
+
174
+ function remapDiagnostic(diagnostic: {
175
+ code: string;
176
+ slot: string;
177
+ entityId: string;
178
+ neededPx: number;
179
+ allocatedPx: number;
180
+ text?: string;
181
+ }): void {
182
+ if (onDiagnostic === undefined) return;
183
+ onDiagnostic({
184
+ code: diagnostic.code === "card-icon-unknown" ? "zone-icon-unknown" : "zone-overflow",
185
+ slot: diagnostic.slot,
186
+ entityId: diagnostic.entityId,
187
+ neededPx: diagnostic.neededPx,
188
+ allocatedPx: diagnostic.allocatedPx,
189
+ ...(diagnostic.text === undefined ? {} : { text: diagnostic.text }),
190
+ });
191
+ }
192
+ </script>
193
+
194
+ <!-- One positioning wrapper in BOTH states (second review, blocking): the
195
+ occurrence never moves on fold/unfold — only the inner rendering
196
+ changes. Overflow = refusal: a refused zone renders no normal frame
197
+ or card, the wrapper carries data-zone-refused for the host. -->
198
+ <div
199
+ class="st-diagramZone-pos"
200
+ style={`left:${x}px;top:${y}px`}
201
+ data-entity={entityId}
202
+ data-collapsed={collapsed ? "true" : "false"}
203
+ data-zone-refused={refused === undefined ? undefined : refused.slot}
204
+ data-zone-overflow={overflowSlot}
205
+ data-zone-icon-unknown={unknownIcon ? "" : undefined}
206
+ >
207
+ {#if refused !== undefined}
208
+ <div
209
+ class="st-diagramZone st-diagramZone--refused"
210
+ style={`width:${layout.box.width}px;height:${layout.box.height}px`}
211
+ role="group"
212
+ aria-label={title}
213
+ ></div>
214
+ {:else if collapsed}
215
+ <DiagramCard
216
+ {...cardProps}
217
+ measure={measure}
218
+ onSelect={onSelect === undefined ? undefined : (event) => onSelect(event)}
219
+ onDiagnostic={onDiagnostic === undefined ? undefined : remapDiagnostic}
220
+ />
221
+ {:else}
222
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
223
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
224
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
225
+ <div
226
+ class="st-diagramZone st-diagramZone--expanded{align === "center" ? " st-diagramZone--center" : ""}{proposed === true ? " st-diagramZone--proposed" : ""}"
227
+ style={`width:${layout.box.width}px;height:${layout.box.height}px`}
228
+ data-tone={tone}
229
+ data-proposed={proposed === true ? "true" : undefined}
230
+ role="group"
231
+ aria-label={title}
232
+ onclick={() => onSelect?.({ entityId })}
233
+ >
234
+ {#if header !== undefined}
235
+ <!-- Every part below is absolutely positioned from the shared
236
+ layout's inline offsets (review pass 4): the CSS border is
237
+ accounted exactly once in those calc offsets. -->
238
+ <div class="st-diagramZone-header" style={headerStyle}>
239
+ <DiagramZoneHeader
240
+ kicker={header.kicker}
241
+ title={header.title}
242
+ subtitle={header.subtitle}
243
+ iconName={icon}
244
+ iconGlyph={iconGlyph}
245
+ headerTextWidth={header.headerTextWidth}
246
+ headerBlockHeight={header.headerBlockHeight}
247
+ subtitleWidth={subtitleWidth}
248
+ toggle={toggleLabel === undefined
249
+ ? undefined
250
+ : {
251
+ collapsed: false,
252
+ label: toggleLabel,
253
+ onToggle: () => onToggle?.({ entityId, collapsed: false }),
254
+ }}
255
+ toggleTopInset={ZONE_GEOMETRY.toggleTopInset}
256
+ />
257
+ </div>
258
+ <div class="st-diagramZone-rule" style={ruleStyle} aria-hidden="true"></div>
259
+ <div class="st-diagramZone-content" style={contentStyle}>
260
+ {#if children !== undefined}
261
+ {@render children()}
262
+ {/if}
263
+ </div>
264
+ {#if header.footer.length > 0}
265
+ <!-- The footer is identical in both states (§6.1): folding never
266
+ changes it. Pinned at the frame bottom like the card footer:
267
+ from the padding box the whole bottom offset is the
268
+ footerBottomInset (9.25 px), the border already accounted by
269
+ the containing block. -->
270
+ {#if header.footerRuleY !== undefined}
271
+ <div class="st-diagramZone-footerRule" style={footerRuleStyle} aria-hidden="true"></div>
272
+ {/if}
273
+ <div class="st-diagramZone-footer" style={footerStyle}>
274
+ {#each header.footer as line, footerIndex (footerIndex)}
275
+ <span class="st-diagramZone-footerLine">{line.text}</span>
276
+ {/each}
277
+ </div>
278
+ {/if}
279
+ {/if}
280
+ </div>
281
+ {/if}
282
+ </div>
283
+
284
+ <style>
285
+ /* The positioning wrapper, present in collapsed AND expanded states:
286
+ folding never moves the occurrence (second review, blocking). */
287
+ .st-diagramZone-pos {
288
+ position: absolute;
289
+ }
290
+ .st-diagramZone {
291
+ /* Expanded frame: the containing block of every part below. The parts
292
+ are absolutely positioned from the shared layout's inline offsets
293
+ (review pass 4), so the frame is a plain bordered box — no flex
294
+ stack of border + padding + line boxes. */
295
+ position: relative;
296
+ box-sizing: border-box;
297
+ border: var(--st-component-diagramZone-borderWidth, 1.5px) solid
298
+ var(--st-component-diagramZone-border, var(--st-semantic-border-strong));
299
+ border-radius: var(--st-component-diagramZone-radius, 0);
300
+ background: var(--st-component-diagramZone-surface, var(--st-semantic-surface-raised));
301
+ color: var(--st-component-diagramZone-text, var(--st-semantic-text-primary));
302
+ text-align: left;
303
+ font-family: var(--st-component-diagramCard-fontFamily, var(--st-font-sans));
304
+ }
305
+ .st-diagramZone--center {
306
+ /* Owner variant: every text slot centred inside its allocation. */
307
+ text-align: center;
308
+ }
309
+ /* Neutral status prop: a proposed zone is always drawn dashed,
310
+ independently of the tint (owner criterion 5). */
311
+ .st-diagramZone--proposed {
312
+ border-style: dashed;
313
+ }
314
+ /* Refusal state (overflow = refusal): no normal frame, a dashed
315
+ placeholder the host can see via data-zone-refused on the wrapper. */
316
+ .st-diagramZone--refused {
317
+ border-style: dashed;
318
+ background: transparent;
319
+ }
320
+ .st-diagramZone-header {
321
+ /* top/left/right/height come from the shared layout inline; the CSS
322
+ border is already accounted exactly once in those calc offsets
323
+ (frame-edge layout coordinate − border token). */
324
+ position: absolute;
325
+ min-width: 0;
326
+ }
327
+ .st-diagramZone-rule {
328
+ position: absolute;
329
+ display: block;
330
+ /* 1 screen px at every zoom with a constant LAYOUT footprint (review
331
+ pass 2, item 5): the box keeps a fixed 1 px height and only the
332
+ painted stroke is counter-scaled by scaleY(1/zoom), same contract
333
+ as the card rule — the zone footer never moves at overview zoom.
334
+ The rule's top/left/right come from the shared layout inline
335
+ (ruleY and the rule insets). */
336
+ height: var(--st-component-diagramCard-ruleHeight, 1px);
337
+ transform: scaleY(calc(1 / var(--st-diagram-zoom, 1)));
338
+ transform-origin: center;
339
+ background: var(--st-component-diagramZone-rule, var(--st-semantic-border-subtle));
340
+ }
341
+ .st-diagramZone-content {
342
+ /* top/left/right/bottom from the shared layout inline (contentTop and
343
+ the content insets); still the positioning context for the
344
+ host-rendered children. */
345
+ position: absolute;
346
+ min-height: 0;
347
+ }
348
+ .st-diagramZone-footerRule {
349
+ position: absolute;
350
+ display: block;
351
+ /* Same constant-footprint rule contract as the card and the header
352
+ rule (review pass 2, item 5): fixed 1 px layout box, paint-only
353
+ counter-scale. Top/left/right come from the shared layout inline
354
+ (footerRuleY and the rule insets). */
355
+ height: var(--st-component-diagramCard-ruleHeight, 1px);
356
+ transform: scaleY(calc(1 / var(--st-diagram-zoom, 1)));
357
+ transform-origin: center;
358
+ background: var(--st-component-diagramZone-rule, var(--st-semantic-border-subtle));
359
+ }
360
+ .st-diagramZone-footer {
361
+ position: absolute;
362
+ /* Pinned at the frame bottom like the card footer: the model pins
363
+ footerBottom at (frame bottom − border − inset), and the padding
364
+ box already sits inside the border, so the whole bottom offset is
365
+ the footerBottomInset token (9.25 px) — no border subtraction in
366
+ the value (review pass 4). Inline insets: the layout's footerX. */
367
+ font-size: var(--st-component-diagramZone-footerFontSize, var(--st-component-diagramCard-footerFontSize, 24px));
368
+ font-weight: var(--st-component-diagramZone-footerFontWeight, var(--st-component-diagramCard-footerFontWeight, 700));
369
+ line-height: var(--st-component-diagramZone-footerLineHeight, var(--st-component-diagramCard-footerLineHeight, 1.3));
370
+ color: var(--st-component-diagramZone-text, var(--st-semantic-text-primary));
371
+ }
372
+ .st-diagramZone-footerLine {
373
+ display: block;
374
+ min-width: 0;
375
+ overflow-wrap: normal;
376
+ word-break: normal;
377
+ }
378
+ </style>
@@ -0,0 +1,45 @@
1
+ import type { Snippet } from "svelte";
2
+ import { type CardLineMeasure, type DiagramZoneProps as DiagramZoneData, type ZoneDiagnostic } from "./diagramCardModel.js";
3
+ /**
4
+ * `DiagramZone` — the wrapping diagram card (DC-2, spec §6).
5
+ *
6
+ * Collapsed, the zone IS the atomic card (§6.2): `DiagramCard` with the
7
+ * subtitle as the centred body, the footer pinning the rule, and the
8
+ * "+" `IconButton` in the top-right toggle slot. Expanded, the component
9
+ * paints the frame, the shared header (`DiagramZoneHeader` =
10
+ * `DiagramCardHeader` + subtitle), the header rule and the toggle around
11
+ * the occurrence box it is given (`x`/`y`/`width`/`height`); children are
12
+ * host-rendered content and are positioned by the host layout, never by
13
+ * the zone (§6.1).
14
+ *
15
+ * Both states render inside the SAME positioning wrapper
16
+ * (`.st-diagramZone-pos`, absolute at `x`/`y`): folding never moves the
17
+ * zone occurrence. Overflow = refusal (owner criterion): a `zone-overflow`
18
+ * renders no normal zone — the wrapper carries the host-visible refusal
19
+ * state `data-zone-refused="<slot>"`, matching the pure renderer's refused
20
+ * result.
21
+ *
22
+ * The component owns no view state: `collapsed` is a prop (§4.3) and
23
+ * activating the toggle emits the §7.2 intent through `onToggle`.
24
+ */
25
+ export interface DiagramZoneProps extends DiagramZoneData {
26
+ /** Text measurer, shared with the card and the pure renderer. */
27
+ measure?: CardLineMeasure;
28
+ /** §7.2 intent out: collapse/expand with the zone as target. */
29
+ onToggle?: (event: {
30
+ entityId: string;
31
+ collapsed: boolean;
32
+ }) => void;
33
+ /** Select intent (§4.6). */
34
+ onSelect?: (event: {
35
+ entityId: string;
36
+ }) => void;
37
+ /** One call per zone diagnostic the layout raises. */
38
+ onDiagnostic?: (diagnostic: ZoneDiagnostic) => void;
39
+ /** Expanded state only: host-rendered children (cards, sub-zones). */
40
+ children?: Snippet;
41
+ }
42
+ declare const DiagramZone: import("svelte").Component<DiagramZoneProps, {}, "">;
43
+ type DiagramZone = ReturnType<typeof DiagramZone>;
44
+ export default DiagramZone;
45
+ //# sourceMappingURL=DiagramZone.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagramZone.svelte.d.ts","sourceRoot":"","sources":["../src/lib/DiagramZone.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAMH,KAAK,eAAe,EACpB,KAAK,gBAAgB,IAAI,eAAe,EACxC,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,iEAAiE;IACjE,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,sDAAsD;IACtD,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IACpD,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuMH,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}