@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
@@ -87,7 +87,7 @@ Glyphes amont concernés (une chaîne partagée par plusieurs glyphes les nomme
87
87
  ## 2. Dépendances installées avec ce paquet
88
88
 
89
89
  Fermeture **transitive** de `dependencies` et `optionalDependencies`, dérivée
90
- de `package-lock.json` : 1 paquet(s), 1 famille(s) de licences.
90
+ de `package-lock.json` : 3 paquet(s), 2 famille(s) de licences.
91
91
  Ces paquets ne sont pas recopiés dans notre tarball — npm les récupère du
92
92
  registre avec leurs propres fichiers de licence. Ils sont recensés ici parce
93
93
  qu'ils arrivent dans le `node_modules` du consommateur de notre fait.
@@ -95,6 +95,8 @@ qu'ils arrivent dans le `node_modules` du consommateur de notre fait.
95
95
  | Paquet | Version | Licence déclarée |
96
96
  |---|---|---|
97
97
  | `@lucide/svelte` | 0.562.0 | ISC |
98
+ | `@tiptap/markdown` | 3.32.0 | MIT |
99
+ | `marked` | 17.0.6 | MIT |
98
100
 
99
101
  ### Textes de notice
100
102
 
@@ -139,3 +141,74 @@ qu'ils arrivent dans le `node_modules` du consommateur de notre fait.
139
141
  > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
140
142
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
141
143
  > SOFTWARE.
144
+
145
+ #### `@tiptap/markdown` 3.32.0 — MIT
146
+
147
+ > MIT License
148
+ >
149
+ > Copyright (c) 2025, Tiptap GmbH
150
+ >
151
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
152
+ > of this software and associated documentation files (the "Software"), to deal
153
+ > in the Software without restriction, including without limitation the rights
154
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
155
+ > copies of the Software, and to permit persons to whom the Software is
156
+ > furnished to do so, subject to the following conditions:
157
+ >
158
+ > The above copyright notice and this permission notice shall be included in all
159
+ > copies or substantial portions of the Software.
160
+ >
161
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
162
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
163
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
164
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
165
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
166
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
167
+ > SOFTWARE.
168
+
169
+ #### `marked` 17.0.6 — MIT
170
+
171
+ > # License information
172
+ >
173
+ > ## Contribution License Agreement
174
+ >
175
+ > If you contribute code to this project, you are implicitly allowing your code
176
+ > to be distributed under the MIT license. You are also implicitly verifying that
177
+ > all code is your original work. `</legalese>`
178
+ >
179
+ > ## Marked
180
+ >
181
+ > Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
182
+ > Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
183
+ >
184
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
185
+ > of this software and associated documentation files (the "Software"), to deal
186
+ > in the Software without restriction, including without limitation the rights
187
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
188
+ > copies of the Software, and to permit persons to whom the Software is
189
+ > furnished to do so, subject to the following conditions:
190
+ >
191
+ > The above copyright notice and this permission notice shall be included in
192
+ > all copies or substantial portions of the Software.
193
+ >
194
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
195
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
196
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
197
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
198
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
199
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
200
+ > THE SOFTWARE.
201
+ >
202
+ > ## Markdown
203
+ >
204
+ > Copyright © 2004, John Gruber
205
+ > http://daringfireball.net/
206
+ > All rights reserved.
207
+ >
208
+ > Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
209
+ >
210
+ > * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
211
+ > * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
212
+ > * Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
213
+ >
214
+ > This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
@@ -27,6 +27,13 @@
27
27
  locale?: string;
28
28
  /** Mois affiché ("YYYY-MM"), contrôlable de l'extérieur. */
29
29
  month?: string;
30
+ /**
31
+ * Appelé avec le nouveau mois affiché ("YYYY-MM") quand il change par une
32
+ * navigation interne (boutons précédent/suivant, clavier qui franchit un
33
+ * mois, PageUp/PageDown). Jamais émis quand c'est le parent qui change la
34
+ * prop `month` (pas de boucle).
35
+ */
36
+ onMonthChange?: (month: string) => void;
30
37
  class?: string;
31
38
  previousMonthLabel?: string;
32
39
  nextMonthLabel?: string;
@@ -41,6 +48,7 @@
41
48
  weekStartsOn = 1,
42
49
  locale = "fr-FR",
43
50
  month,
51
+ onMonthChange,
44
52
  class: className,
45
53
  previousMonthLabel,
46
54
  nextMonthLabel,
@@ -204,6 +212,10 @@
204
212
  return null;
205
213
  }
206
214
 
215
+ function currentMonthId(): string {
216
+ return `${viewYear}-${String(viewMonth + 1).padStart(2, "0")}`;
217
+ }
218
+
207
219
  function previousMonth() {
208
220
  const targetMonth = viewMonth === 0 ? 11 : viewMonth - 1;
209
221
  const targetYear = viewMonth === 0 ? viewYear - 1 : viewYear;
@@ -213,6 +225,7 @@
213
225
  if (clamped) focusDate = clamped;
214
226
  // Si clamped === null, le mois est entièrement hors-bornes : focusDate garde
215
227
  // l'ancienne valeur — aucune cellule ne sera tabindex=0 car toutes sont disabled.
228
+ onMonthChange?.(currentMonthId());
216
229
  }
217
230
 
218
231
  function nextMonth() {
@@ -223,6 +236,7 @@
223
236
  const clamped = clampToMonth(focusDate, targetYear, targetMonth);
224
237
  if (clamped) focusDate = clamped;
225
238
  // Si clamped === null, le mois est entièrement hors-bornes : idem.
239
+ onMonthChange?.(currentMonthId());
226
240
  }
227
241
 
228
242
  function pickDate(date: Date) {
@@ -322,6 +336,7 @@
322
336
  if (next.getFullYear() !== viewYear || next.getMonth() !== viewMonth) {
323
337
  viewYear = next.getFullYear();
324
338
  viewMonth = next.getMonth();
339
+ onMonthChange?.(currentMonthId());
325
340
  }
326
341
  focusDate = startOfDay(next);
327
342
  // Focus après rendu.
@@ -584,8 +599,20 @@
584
599
  box-shadow: inset 0 0 0 1px var(--st-semantic-border-interactive);
585
600
  }
586
601
 
602
+ /* Plage : teinte dérivée de la primaire (suit chaque thème), avec point
603
+ d'entrée de personnalisation. Le texte repasse en couleur primaire :
604
+ les jours hors-mois (.st-calendar__day--outside, texte atténué) resteraient
605
+ sinon sous 4.5:1 sur ce fond dans plusieurs thèmes. */
587
606
  .st-calendar__day--inRange {
588
- background: var(--st-component-control-hoverBackground, var(--st-semantic-surface-subtle));
607
+ background: var(
608
+ --st-component-calendar-rangeBackground,
609
+ color-mix(
610
+ in srgb,
611
+ var(--st-semantic-action-primary) 32%,
612
+ var(--st-component-popover-background, var(--st-semantic-surface-raised))
613
+ )
614
+ );
615
+ color: var(--st-component-popover-text, var(--st-semantic-text-primary));
589
616
  }
590
617
 
591
618
  .st-calendar__day--selected {
@@ -21,6 +21,13 @@ type CalendarProps = Omit<HTMLAttributes<HTMLDivElement>, "class" | "onchange">
21
21
  locale?: string;
22
22
  /** Mois affiché ("YYYY-MM"), contrôlable de l'extérieur. */
23
23
  month?: string;
24
+ /**
25
+ * Appelé avec le nouveau mois affiché ("YYYY-MM") quand il change par une
26
+ * navigation interne (boutons précédent/suivant, clavier qui franchit un
27
+ * mois, PageUp/PageDown). Jamais émis quand c'est le parent qui change la
28
+ * prop `month` (pas de boucle).
29
+ */
30
+ onMonthChange?: (month: string) => void;
24
31
  class?: string;
25
32
  previousMonthLabel?: string;
26
33
  nextMonthLabel?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Calendar.svelte.ts"],"names":[],"mappings":"AAGE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAI7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IAChF,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAmaJ,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Calendar.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Calendar.svelte.ts"],"names":[],"mappings":"AAGE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAI7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IAChF,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AA2aJ,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -114,9 +114,14 @@
114
114
  outline-offset: 1px;
115
115
  }
116
116
 
117
+ /* Indicateur d'état non-chromatique : la pastille blanche sur piste claire
118
+ (~1.05:1) ne suffit pas (WCAG 1.4.11). L'anneau intérieur sur la bordure
119
+ interactive mesure >= 3:1 contre la piste sur tous les thèmes mesurés. */
117
120
  .st-contentSwitcher__option--selected {
118
121
  background: var(--st-semantic-surface-default);
119
- box-shadow: var(--st-shadow-subtle);
122
+ box-shadow:
123
+ inset 0 0 0 1px var(--st-semantic-border-interactive),
124
+ var(--st-shadow-subtle);
120
125
  color: var(--st-semantic-text-primary);
121
126
  }
122
127
 
@@ -0,0 +1,282 @@
1
+ <script lang="ts">
2
+ import DiagramCardHeader from "./DiagramCardHeader.svelte";
3
+ import { defaultCardMeasure, firstOverflowDiagnostic, layoutCard } from "./diagramCardModel.js";
4
+ import type {
5
+ CardDiagnostic,
6
+ CardLineMeasure,
7
+ DiagramCardProps as DiagramCardData,
8
+ } from "./diagramCardModel.js";
9
+
10
+ /**
11
+ * `DiagramCard` — the atomic diagram card (DC-1).
12
+ *
13
+ * Spec: spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md §5. Fixed 460 × 200 box, square
14
+ * corners, footer pinned at 9.25, one 1 px rule, no shortening. Overflow
15
+ * = refusal (owner criterion): any `card-overflow` — a too-wide line, a
16
+ * line-count overflow, or a header+body height that does not fit above the
17
+ * pinned rule — renders NO normal card; the root carries the host-visible
18
+ * refusal state `data-card-refused="<slot>"` and the diagnostics keep the
19
+ * original slot text. An icon name with no glyph data raises
20
+ * `card-icon-unknown` and the slot collapses (DIF-14).
21
+ *
22
+ * The rule stays 1 screen px at every zoom WITHOUT moving the layout: the
23
+ * host publishes the current camera zoom as `--st-diagram-zoom` on the
24
+ * canvas viewport, the rule's layout box keeps a constant 1 px footprint,
25
+ * and only its painted stroke is counter-scaled by `scaleY(1/zoom)`
26
+ * (review pass 2, item 5) — the HTML twin of the SVG
27
+ * `vector-effect="non-scaling-stroke"`.
28
+ *
29
+ * The pictogram path data arrives via the `iconGlyph` prop (resolved by
30
+ * the host from the `diagram-icons` subpath, e.g. `getDiagramGlyph`, or by
31
+ * `projectCardProps` from `diagram-render`): the barrel never resolves the
32
+ * icon registry graph (§5.6). Line splits come from the shared
33
+ * `layoutCard`, the same geometry the pure `renderCardSvg` consumes.
34
+ */
35
+ export interface DiagramCardProps extends DiagramCardData {
36
+ /**
37
+ * Text measurer. Defaults to the deterministic greedy wrapper;
38
+ * production hosts pass their measured `LineMeasurer` adapter so the
39
+ * Svelte card wraps against the same advances as layout and rendering.
40
+ */
41
+ measure?: CardLineMeasure;
42
+ /** Select intent (§4.6): `{ event: "intent", name: "select", target }`. */
43
+ onSelect?: (event: { entityId: string }) => void;
44
+ /** One call per diagnostic the layout raises. */
45
+ onDiagnostic?: (diagnostic: CardDiagnostic) => void;
46
+ }
47
+
48
+ let {
49
+ entityId,
50
+ kicker,
51
+ title,
52
+ body,
53
+ detailCount,
54
+ footer,
55
+ icon,
56
+ iconGlyph,
57
+ tone,
58
+ proposed,
59
+ toggle,
60
+ align,
61
+ bodyMode,
62
+ measure = defaultCardMeasure,
63
+ onSelect,
64
+ onDiagnostic,
65
+ }: DiagramCardProps = $props();
66
+
67
+ const layout = $derived(
68
+ layoutCard(
69
+ {
70
+ entityId,
71
+ ...(kicker === undefined ? {} : { kicker }),
72
+ title,
73
+ body,
74
+ ...(detailCount === undefined ? {} : { detailCount }),
75
+ ...(footer === undefined ? {} : { footer }),
76
+ ...(icon === undefined ? {} : { icon }),
77
+ ...(iconGlyph === undefined ? {} : { iconGlyph }),
78
+ ...(tone === undefined ? {} : { tone }),
79
+ ...(proposed === undefined ? {} : { proposed }),
80
+ ...(toggle === undefined ? {} : { toggle }),
81
+ ...(align === undefined ? {} : { align }),
82
+ ...(bodyMode === undefined ? {} : { bodyMode }),
83
+ },
84
+ measure,
85
+ ),
86
+ );
87
+
88
+ const overflowSlot = $derived(
89
+ layout.diagnostics.find((diagnostic) => diagnostic.code === "card-overflow")?.slot,
90
+ );
91
+ const unknownIcon = $derived(
92
+ layout.diagnostics.some((diagnostic) => diagnostic.code === "card-icon-unknown"),
93
+ );
94
+ // Overflow = refusal: the same predicate as the pure renderer
95
+ // (`firstOverflowDiagnostic`), so both renderers refuse together.
96
+ const refused = $derived(firstOverflowDiagnostic(layout.diagnostics));
97
+
98
+ $effect(() => {
99
+ if (onDiagnostic === undefined) return;
100
+ for (const diagnostic of layout.diagnostics) onDiagnostic(diagnostic);
101
+ });
102
+ </script>
103
+
104
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
105
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
106
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
107
+ <!-- Click selects (the §4.6 select intent), like BarChart's point select:
108
+ keyboard activation of a card is the host figure's concern (DC-2). -->
109
+ {#if refused !== undefined}
110
+ <!-- Overflow = refusal: no normal card is rendered for refused content.
111
+ The host sees the refusal state on the root (data-card-refused) and
112
+ gets the original slot text through onDiagnostic. -->
113
+ <div
114
+ class="st-diagramCard st-diagramCard--refused"
115
+ data-entity={entityId}
116
+ data-tone={tone}
117
+ data-proposed={proposed === true ? "true" : undefined}
118
+ data-card-refused={refused.slot}
119
+ data-card-overflow={refused.slot}
120
+ role="group"
121
+ aria-label={title}
122
+ onclick={() => onSelect?.({ entityId })}
123
+ ></div>
124
+ {:else}
125
+ <div
126
+ class="st-diagramCard{bodyMode === "subtitle" ? " st-diagramCard--subtitle" : ""}{align === "center" ? " st-diagramCard--center" : ""}{proposed === true ? " st-diagramCard--proposed" : ""}"
127
+ data-entity={entityId}
128
+ data-tone={tone}
129
+ data-proposed={proposed === true ? "true" : undefined}
130
+ data-card-overflow={overflowSlot}
131
+ data-card-icon-unknown={unknownIcon ? "" : undefined}
132
+ role="group"
133
+ aria-label={title}
134
+ onclick={() => onSelect?.({ entityId })}
135
+ >
136
+ <DiagramCardHeader
137
+ kicker={layout.kicker}
138
+ title={layout.title}
139
+ iconName={icon}
140
+ iconGlyph={iconGlyph}
141
+ headerTextWidth={layout.headerTextWidth}
142
+ headerBlockHeight={layout.headerBlockHeight}
143
+ toggle={toggle}
144
+ />
145
+ <div class="st-diagramCard-gap" aria-hidden="true"></div>
146
+ <div
147
+ class="st-diagramCard-body"
148
+ style={`margin-left:${layout.bodyX - 16}px;width:${layout.bodyWidth}px`}
149
+ >
150
+ {#each layout.body as line, bodyIndex (bodyIndex)}
151
+ <span class={line.secondary ? "st-diagramCard-detail" : "st-diagramCard-line"}>{line.text}</span>
152
+ {/each}
153
+ </div>
154
+ <!-- The rule and the footer are positioned together from the shared
155
+ geometry: the foot wrapper is pinned to the bottom (margin-top:auto),
156
+ the rule keeps its 4 px margins inside it, so the rule→footer gap is
157
+ the frozen 4 px at every body line count, exactly as the SVG pins
158
+ ruleY from the footer. -->
159
+ <div class="st-diagramCard-foot">
160
+ {#if layout.ruleY !== undefined}
161
+ <div class="st-diagramCard-rule" aria-hidden="true"></div>
162
+ {/if}
163
+ {#if layout.footerLines.length > 0}
164
+ <div class="st-diagramCard-footer">
165
+ {#each layout.footerLines as line, footerIndex (footerIndex)}
166
+ <span class="st-diagramCard-footerLine">{line.text}</span>
167
+ {/each}
168
+ </div>
169
+ {/if}
170
+ </div>
171
+ </div>
172
+ {/if}
173
+
174
+ <style>
175
+ .st-diagramCard {
176
+ width: var(--st-component-diagramCard-width, 460px);
177
+ height: var(--st-component-diagramCard-height, 200px);
178
+ box-sizing: border-box;
179
+ border: var(--st-component-diagramCard-borderWidth, 2px) solid
180
+ var(--st-component-diagramCard-border, var(--st-semantic-border-strong));
181
+ border-left: var(--st-component-diagramCard-accentWidth, 8px) solid
182
+ var(--st-component-diagramCard-accent, var(--st-semantic-data-category1));
183
+ border-radius: var(--st-component-diagramCard-radius, 0);
184
+ background: var(--st-component-diagramCard-surface, var(--st-semantic-surface-raised));
185
+ color: var(--st-component-diagramCard-text, var(--st-semantic-text-primary));
186
+ padding: var(--st-component-diagramCard-padding, 8px);
187
+ display: flex;
188
+ flex-direction: column;
189
+ text-align: left;
190
+ font-family: var(--st-component-diagramCard-fontFamily, var(--st-font-sans));
191
+ }
192
+ .st-diagramCard--center {
193
+ /* Owner variant: every text slot centred inside its allocation. */
194
+ text-align: center;
195
+ }
196
+ /* Neutral status prop: a proposed card is always drawn dashed,
197
+ independently of the tint (owner criterion 5). */
198
+ .st-diagramCard--proposed {
199
+ border-style: dashed;
200
+ }
201
+ .st-diagramCard-gap {
202
+ display: block;
203
+ height: var(--st-component-diagramCard-gap, 6px);
204
+ flex: 0 0 var(--st-component-diagramCard-gap, 6px);
205
+ }
206
+ .st-diagramCard-body {
207
+ /* margin-left and width both come from the shared layout: the body box
208
+ is exactly layout.bodyWidth wide at layout.bodyX — −2 px / 436 px for
209
+ leaf bodies (bodyInsetFromBar 14 vs headerInset 16), 16 px / 396 px
210
+ for the centred collapsed-subtitle measure (§6.2.1: the subtitle is
211
+ centred at 32 + 396/2 = 230, not over the wider content box). */
212
+ min-width: 0;
213
+ flex: 0 0 auto;
214
+ font-size: var(--st-component-diagramCard-bodyFontSize, 24px);
215
+ font-weight: var(--st-component-diagramCard-bodyFontWeight, 400);
216
+ line-height: var(--st-component-diagramCard-bodyLineHeight, 1.3);
217
+ }
218
+ .st-diagramCard--subtitle .st-diagramCard-body {
219
+ /* §6.2.1: the collapsed-zone subtitle block is centred horizontally
220
+ and vertically inside the card body area. */
221
+ flex: 1 1 auto;
222
+ display: flex;
223
+ flex-direction: column;
224
+ justify-content: center;
225
+ text-align: center;
226
+ }
227
+ .st-diagramCard-line,
228
+ .st-diagramCard-detail {
229
+ display: block;
230
+ min-width: 0;
231
+ /* No mid-word break: an over-long word overflows and is diagnosed
232
+ (Astra J4), never silently broken or cut. */
233
+ overflow-wrap: normal;
234
+ word-break: normal;
235
+ }
236
+ .st-diagramCard-detail {
237
+ color: var(--st-component-diagramCard-secondaryText, var(--st-semantic-text-secondary));
238
+ }
239
+ /* Rule and footer share one pinned wrapper (`.st-diagramCard-foot`):
240
+ the wrapper takes the automatic top margin, so spare body space grows
241
+ above the rule and the rule→footer gap stays the frozen 4 px. */
242
+ .st-diagramCard-foot {
243
+ margin-top: auto;
244
+ flex: 0 0 auto;
245
+ }
246
+ .st-diagramCard-rule {
247
+ display: block;
248
+ flex: 0 0 auto;
249
+ /* 1 screen px at every zoom, with a constant LAYOUT footprint (review
250
+ pass 2, item 5): the box height never reads --st-diagram-zoom, so at
251
+ overview zoom 0.25 the rule still occupies exactly 1 px of layout and
252
+ the pinned footer never moves. Only the painted stroke is
253
+ counter-scaled: the host scales the viewport by --st-diagram-zoom, so
254
+ scaleY(1/zoom) on the fixed 1 px box paints exactly 1 screen px — the
255
+ HTML twin of the SVG vector-effect="non-scaling-stroke". */
256
+ height: var(--st-component-diagramCard-ruleHeight, 1px);
257
+ margin: var(--st-component-diagramCard-ruleMargin, 4px) 0;
258
+ background: var(--st-component-diagramCard-rule, var(--st-semantic-border-subtle));
259
+ transform: scaleY(calc(1 / var(--st-diagram-zoom, 1)));
260
+ transform-origin: center;
261
+ }
262
+ .st-diagramCard-footer {
263
+ /* Pinned footer: text-box bottom at (height − border − inset); the flex
264
+ content bottom sits at (height − padding − border), so the margin is
265
+ (inset − padding) = 1.25 px at the frozen values. No margin-top:auto
266
+ here: the rule and the footer are positioned together by the shared
267
+ foot wrapper. */
268
+ margin-bottom: calc(
269
+ var(--st-component-diagramCard-footerBottomInset, 9.25px) -
270
+ var(--st-component-diagramCard-padding, 8px)
271
+ );
272
+ font-size: var(--st-component-diagramCard-footerFontSize, 24px);
273
+ font-weight: var(--st-component-diagramCard-footerFontWeight, 700);
274
+ line-height: var(--st-component-diagramCard-footerLineHeight, 1.3);
275
+ }
276
+ .st-diagramCard-footerLine {
277
+ display: block;
278
+ min-width: 0;
279
+ overflow-wrap: normal;
280
+ word-break: normal;
281
+ }
282
+ </style>
@@ -0,0 +1,44 @@
1
+ import type { CardDiagnostic, CardLineMeasure, DiagramCardProps as DiagramCardData } from "./diagramCardModel.js";
2
+ /**
3
+ * `DiagramCard` — the atomic diagram card (DC-1).
4
+ *
5
+ * Spec: spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md §5. Fixed 460 × 200 box, square
6
+ * corners, footer pinned at 9.25, one 1 px rule, no shortening. Overflow
7
+ * = refusal (owner criterion): any `card-overflow` — a too-wide line, a
8
+ * line-count overflow, or a header+body height that does not fit above the
9
+ * pinned rule — renders NO normal card; the root carries the host-visible
10
+ * refusal state `data-card-refused="<slot>"` and the diagnostics keep the
11
+ * original slot text. An icon name with no glyph data raises
12
+ * `card-icon-unknown` and the slot collapses (DIF-14).
13
+ *
14
+ * The rule stays 1 screen px at every zoom WITHOUT moving the layout: the
15
+ * host publishes the current camera zoom as `--st-diagram-zoom` on the
16
+ * canvas viewport, the rule's layout box keeps a constant 1 px footprint,
17
+ * and only its painted stroke is counter-scaled by `scaleY(1/zoom)`
18
+ * (review pass 2, item 5) — the HTML twin of the SVG
19
+ * `vector-effect="non-scaling-stroke"`.
20
+ *
21
+ * The pictogram path data arrives via the `iconGlyph` prop (resolved by
22
+ * the host from the `diagram-icons` subpath, e.g. `getDiagramGlyph`, or by
23
+ * `projectCardProps` from `diagram-render`): the barrel never resolves the
24
+ * icon registry graph (§5.6). Line splits come from the shared
25
+ * `layoutCard`, the same geometry the pure `renderCardSvg` consumes.
26
+ */
27
+ export interface DiagramCardProps extends DiagramCardData {
28
+ /**
29
+ * Text measurer. Defaults to the deterministic greedy wrapper;
30
+ * production hosts pass their measured `LineMeasurer` adapter so the
31
+ * Svelte card wraps against the same advances as layout and rendering.
32
+ */
33
+ measure?: CardLineMeasure;
34
+ /** Select intent (§4.6): `{ event: "intent", name: "select", target }`. */
35
+ onSelect?: (event: {
36
+ entityId: string;
37
+ }) => void;
38
+ /** One call per diagnostic the layout raises. */
39
+ onDiagnostic?: (diagnostic: CardDiagnostic) => void;
40
+ }
41
+ declare const DiagramCard: import("svelte").Component<DiagramCardProps, {}, "">;
42
+ type DiagramCard = ReturnType<typeof DiagramCard>;
43
+ export default DiagramCard;
44
+ //# sourceMappingURL=DiagramCard.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagramCard.svelte.d.ts","sourceRoot":"","sources":["../src/lib/DiagramCard.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,IAAI,eAAe,EACpC,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;CACrD;AAmGH,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}