@sentropic/design-system-svelte 0.36.0 → 0.37.1

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 (66) hide show
  1. package/LICENSE.THIRD-PARTY.md +74 -1
  2. package/dist/DiagramCard.svelte +282 -0
  3. package/dist/DiagramCard.svelte.d.ts +44 -0
  4. package/dist/DiagramCard.svelte.d.ts.map +1 -0
  5. package/dist/DiagramCardHeader.svelte +173 -0
  6. package/dist/DiagramCardHeader.svelte.d.ts +37 -0
  7. package/dist/DiagramCardHeader.svelte.d.ts.map +1 -0
  8. package/dist/DiagramZone.svelte +378 -0
  9. package/dist/DiagramZone.svelte.d.ts +45 -0
  10. package/dist/DiagramZone.svelte.d.ts.map +1 -0
  11. package/dist/DiagramZoneHeader.svelte +97 -0
  12. package/dist/DiagramZoneHeader.svelte.d.ts +40 -0
  13. package/dist/DiagramZoneHeader.svelte.d.ts.map +1 -0
  14. package/dist/LabelledIconButton.svelte +63 -0
  15. package/dist/LabelledIconButton.svelte.d.ts +27 -0
  16. package/dist/LabelledIconButton.svelte.d.ts.map +1 -0
  17. package/dist/Pagination.svelte +5 -0
  18. package/dist/diagram-icons/DiagramIcon.svelte +65 -0
  19. package/dist/diagram-icons/DiagramIcon.svelte.d.ts +11 -0
  20. package/dist/diagram-icons/DiagramIcon.svelte.d.ts.map +1 -0
  21. package/dist/diagram-icons/PROVENANCE.md +72 -0
  22. package/dist/diagram-icons/index.d.ts +6 -0
  23. package/dist/diagram-icons/index.d.ts.map +1 -0
  24. package/dist/diagram-icons/index.js +4 -0
  25. package/dist/diagram-icons/registry.d.ts +52 -0
  26. package/dist/diagram-icons/registry.d.ts.map +1 -0
  27. package/dist/diagram-icons/registry.js +79 -0
  28. package/dist/diagram-render/index.d.ts +17 -0
  29. package/dist/diagram-render/index.d.ts.map +1 -0
  30. package/dist/diagram-render/index.js +11 -0
  31. package/dist/diagram-render/renderCardSvg.d.ts +83 -0
  32. package/dist/diagram-render/renderCardSvg.d.ts.map +1 -0
  33. package/dist/diagram-render/renderCardSvg.js +149 -0
  34. package/dist/diagram-render/renderZoneSvg.d.ts +88 -0
  35. package/dist/diagram-render/renderZoneSvg.d.ts.map +1 -0
  36. package/dist/diagram-render/renderZoneSvg.js +184 -0
  37. package/dist/diagramCardModel.d.ts +582 -0
  38. package/dist/diagramCardModel.d.ts.map +1 -0
  39. package/dist/diagramCardModel.js +1133 -0
  40. package/dist/icons.d.ts +2 -0
  41. package/dist/icons.d.ts.map +1 -1
  42. package/dist/icons.js +5 -1
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +3 -0
  46. package/dist/presence-badge/LockPresenceBadge.svelte +490 -0
  47. package/dist/presence-badge/LockPresenceBadge.svelte.d.ts +18 -0
  48. package/dist/presence-badge/LockPresenceBadge.svelte.d.ts.map +1 -0
  49. package/dist/presence-badge/index.d.ts +6 -0
  50. package/dist/presence-badge/index.d.ts.map +1 -0
  51. package/dist/presence-badge/index.js +3 -0
  52. package/dist/rich-text-editor/ComposerEditor.svelte +485 -0
  53. package/dist/rich-text-editor/ComposerEditor.svelte.d.ts +16 -0
  54. package/dist/rich-text-editor/ComposerEditor.svelte.d.ts.map +1 -0
  55. package/dist/rich-text-editor/RichTextEditor.svelte +557 -0
  56. package/dist/rich-text-editor/RichTextEditor.svelte.d.ts +45 -0
  57. package/dist/rich-text-editor/RichTextEditor.svelte.d.ts.map +1 -0
  58. package/dist/rich-text-editor/RichTextEditorFixture.svelte.d.ts +8 -0
  59. package/dist/rich-text-editor/RichTextEditorFixture.svelte.d.ts.map +1 -0
  60. package/dist/rich-text-editor/RichTextEditorNestedFixture.svelte.d.ts +13 -0
  61. package/dist/rich-text-editor/RichTextEditorNestedFixture.svelte.d.ts.map +1 -0
  62. package/dist/rich-text-editor/index.d.ts +10 -0
  63. package/dist/rich-text-editor/index.d.ts.map +1 -0
  64. package/dist/rich-text-editor/index.js +4 -0
  65. package/dist/rich-text-editor/rich-text-editor.css +115 -0
  66. package/package.json +54 -7
@@ -0,0 +1,65 @@
1
+ <script lang="ts">
2
+ import { DIAGRAM_GLYPHS, DIAGRAM_GLYPH_VIEWBOX, getDiagramGlyph } from "./registry.js";
3
+
4
+ interface DiagramIconProps {
5
+ /** A §9 glyph name. An unmapped name draws nothing (DIF-14). */
6
+ name: string;
7
+ /** Square box in px the 64-unit viewBox scales into. Default 70. */
8
+ size?: number;
9
+ class?: string;
10
+ }
11
+
12
+ let { name, size = 70, class: className }: DiagramIconProps = $props();
13
+
14
+ const glyph = $derived(getDiagramGlyph(name));
15
+ </script>
16
+
17
+ {#if glyph}
18
+ <svg
19
+ class={["st-diagramIcon", className].filter(Boolean).join(" ")}
20
+ data-diagram-icon={name}
21
+ viewBox={DIAGRAM_GLYPH_VIEWBOX}
22
+ width={size}
23
+ height={size}
24
+ aria-hidden="true"
25
+ focusable="false"
26
+ >
27
+ <path
28
+ class="st-diagramIcon-base"
29
+ d={glyph.base}
30
+ fill="var(--st-component-diagramIcon-baseFill, color-mix(in srgb, var(--st-semantic-feedback-info) 18%, var(--st-semantic-surface-raised)))"
31
+ />
32
+ <path
33
+ class="st-diagramIcon-face"
34
+ d={glyph.face}
35
+ fill="var(--st-component-diagramIcon-faceFill, color-mix(in srgb, var(--st-semantic-feedback-info) 75%, var(--st-semantic-surface-raised)))"
36
+ stroke="var(--st-component-diagramIcon-faceStroke, var(--st-semantic-feedback-info))"
37
+ stroke-width="1.5"
38
+ stroke-linejoin="round"
39
+ />
40
+ {#if glyph.line}
41
+ <path
42
+ class="st-diagramIcon-line"
43
+ class:st-diagramIcon-line--dark={glyph.darkLine}
44
+ d={glyph.line}
45
+ fill="none"
46
+ stroke={glyph.darkLine
47
+ ? "var(--st-component-diagramIcon-lineDarkStroke, var(--st-semantic-feedback-info))"
48
+ : "var(--st-component-diagramIcon-lineStroke, var(--st-semantic-surface-raised))"}
49
+ stroke-width="2.5"
50
+ stroke-linecap="round"
51
+ stroke-linejoin="round"
52
+ />
53
+ {/if}
54
+ {#if glyph.text}
55
+ <text
56
+ x="32"
57
+ y="47"
58
+ text-anchor="middle"
59
+ fill="var(--st-component-diagramIcon-lineStroke, var(--st-semantic-surface-raised))"
60
+ font-size="13"
61
+ font-weight="750"
62
+ >{glyph.text}</text>
63
+ {/if}
64
+ </svg>
65
+ {/if}
@@ -0,0 +1,11 @@
1
+ interface DiagramIconProps {
2
+ /** A §9 glyph name. An unmapped name draws nothing (DIF-14). */
3
+ name: string;
4
+ /** Square box in px the 64-unit viewBox scales into. Default 70. */
5
+ size?: number;
6
+ class?: string;
7
+ }
8
+ declare const DiagramIcon: import("svelte").Component<DiagramIconProps, {}, "">;
9
+ type DiagramIcon = ReturnType<typeof DiagramIcon>;
10
+ export default DiagramIcon;
11
+ //# sourceMappingURL=DiagramIcon.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagramIcon.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/diagram-icons/DiagramIcon.svelte.ts"],"names":[],"mappings":"AAME,UAAU,gBAAgB;IACxB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA2BH,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
@@ -0,0 +1,72 @@
1
+ # diagram-icons — provenance ledger (DC-1)
2
+
3
+ Spec: `spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md` §9.3. One row per shipped glyph:
4
+ shipped name, source repository + commit + file, canonical-base redraw
5
+ (yes/no), layer notes.
6
+
7
+ Family contract (§9.1): `viewBox="0 0 64 64"`, canonical base diamond
8
+ `M8 53L32 44L56 53L32 62Z`, layers base (info 18 %) / face (info 75 % +
9
+ stroke 1.5) / line (surface, 2.5; dark variant info). Layer colours resolve
10
+ through the `diagramIcon` component tokens. No per-glyph colour, no raw hex.
11
+
12
+ No name collides across the two sources (radar 19 vs kit 9 are disjoint),
13
+ so no collision alias was recorded.
14
+
15
+ ## radar-immobilier (19)
16
+
17
+ Source: `~/src/radar-immobilier`, commit `fa8133c2`,
18
+ `docs/architecture/focus/service-icons.js`. Header: "Original, local
19
+ pictograms. These are service symbols, not vendor logos." MIT package —
20
+ no third-party notice (original Sentropic pictograms, §9.3).
21
+
22
+ Redraw: **base-only**. The radar viewBox is already 64-unit and the
23
+ interiors are preserved verbatim; only the base diamond is replaced by the
24
+ canonical #711 base (radar `M7 54L32 42L57 54L32 64Z` differs by 1–2 units,
25
+ DIF-12). The radar fixed palette (`#dceaff` / `#639dff` / `#3f7ae0` /
26
+ `#e6f0ff` / `#3575d9`) is a provenance note only and is not shipped (DIF-13).
27
+
28
+ | Shipped name | Source name | Redraw | Layer notes |
29
+ | --- | --- | --- | --- |
30
+ | `s3` | `s3` | base-only | text `S3` (13 units, weight 750, surface fill) kept as glyph asset |
31
+ | `postgres` | `postgres` | base-only | face + line |
32
+ | `cluster` | `cluster` | base-only | face + line |
33
+ | `web` | `web` | base-only | face + line |
34
+ | `api` | `api` | base-only | face + line |
35
+ | `cronjob` | `cronjob` | base-only | face + line (empty source text dropped) |
36
+ | `identity` | `identity` | base-only | face + line |
37
+ | `workstation` | `workstation` | base-only | face + line |
38
+ | `document` | `document` | base-only | face + line |
39
+ | `map` | `map` | base-only | face + line |
40
+ | `join` | `join` | base-only | face + line, **dark line** (info accent stroke) |
41
+ | `graph` | `graph` | base-only | face + line, **dark line** (info accent stroke) |
42
+ | `check` | `check` | base-only | face + line |
43
+ | `release` | `release` | base-only | face + line |
44
+ | `user` | `user` | base-only | face + line |
45
+ | `url` | `url` | base-only | face + line |
46
+ | `llm` | `llm` | base-only | face + line |
47
+ | `network` | `network` | base-only | face + line, **dark line** (info accent stroke) |
48
+ | `unknown` | `unknown` | base-only | face + line |
49
+
50
+ ## sentropic #711 via the hrpolnav kit (9)
51
+
52
+ Source: `~/src/sentropic`, merge `4138a0ecba9c5b37409abb5ac00f732d02b7dc8d`,
53
+ `docs/governance/kit/src/architecture-icons.js` (byte-identical copy at
54
+ `/home/antoinefa/src/airbus-genair-hrpolnav/docs/ard/decision/focus/governance-kit/src/architecture-icons.js`,
55
+ sha256 `7a6b5c95fdc90dddf6340a2fc7f9aecce5010c393101b42a7d97826fe2ad1209`).
56
+
57
+ Redraw: **no** (verbatim geometry — already on the canonical base).
58
+
59
+ | Shipped name | Source name | Redraw | Layer notes |
60
+ | --- | --- | --- | --- |
61
+ | `people` | `people` | no | face only (no detail line) |
62
+ | `window` | `window` | no | face + line |
63
+ | `server` | `server` | no | face + line |
64
+ | `brain` | `brain` | no | face + line — mandatory frozen addition (AI) |
65
+ | `robot` | `robot` | no | face + line — mandatory frozen addition (agents) |
66
+ | `link` | `link` | no | face + line, **dark line** flag |
67
+ | `db` | `db` | no | face + line |
68
+ | `shield` | `shield` | no | face + line |
69
+ | `cloud` | `cloud` | no | face only (no detail line) |
70
+
71
+ The kit `groupIcons` zone→glyph table is scene content of those diagrams,
72
+ not part of the shipped set: the DS names the glyph per entity (§9.2, DH-11).
@@ -0,0 +1,6 @@
1
+ import DiagramIcon from "./DiagramIcon.svelte";
2
+ import { DIAGRAM_GLYPH_BASE, DIAGRAM_GLYPH_NAMES, DIAGRAM_GLYPH_VIEWBOX, DIAGRAM_GLYPHS, getDiagramGlyph, type DiagramGlyph } from "./registry.js";
3
+ export default DiagramIcon;
4
+ export { DiagramIcon, DIAGRAM_GLYPHS, DIAGRAM_GLYPH_NAMES, DIAGRAM_GLYPH_BASE, DIAGRAM_GLYPH_VIEWBOX, getDiagramGlyph };
5
+ export type { DiagramGlyph };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/diagram-icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAEvB,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAC;AACxH,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import DiagramIcon from "./DiagramIcon.svelte";
2
+ import { DIAGRAM_GLYPH_BASE, DIAGRAM_GLYPH_NAMES, DIAGRAM_GLYPH_VIEWBOX, DIAGRAM_GLYPHS, getDiagramGlyph, } from "./registry.js";
3
+ export default DiagramIcon;
4
+ export { DiagramIcon, DIAGRAM_GLYPHS, DIAGRAM_GLYPH_NAMES, DIAGRAM_GLYPH_BASE, DIAGRAM_GLYPH_VIEWBOX, getDiagramGlyph };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Diagram pictogram registry — the blue duotone family (DC-1).
3
+ *
4
+ * Spec: spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md §9. One family, drawn identically
5
+ * in cards and zones at the 70 px icon box: `viewBox="0 0 64 64"`, canonical
6
+ * base diamond `M8 53L32 44L56 53L32 62Z`, three layers (base / face / line),
7
+ * face stroke 1.5, line stroke 2.5. Layer colours resolve through the
8
+ * `diagramIcon` component tokens; no per-glyph colour, no raw hex here.
9
+ *
10
+ * Framework-neutral data: no Svelte import, so staged framework adapters
11
+ * (§12.6) reuse these path records without re-drawing a glyph. Provenance
12
+ * per glyph lives in PROVENANCE.md next to this file.
13
+ */
14
+ export interface DiagramGlyph {
15
+ /** Canonical base diamond path (identical for every glyph). */
16
+ readonly base: string;
17
+ /** Glyph face path (fill + stroke layer). */
18
+ readonly face: string;
19
+ /** Glyph detail path (stroke-only layer). Absent when the glyph has none. */
20
+ readonly line?: string;
21
+ /**
22
+ * When true, the detail line strokes in the info accent instead of the
23
+ * surface colour (the radar `join`/`graph`/`network` case, the kit `link`
24
+ * flag).
25
+ */
26
+ readonly darkLine?: true;
27
+ /**
28
+ * Text painted inside the glyph (part of the asset, never host content,
29
+ * never localised). Only `s3` carries one.
30
+ */
31
+ readonly text?: string;
32
+ }
33
+ /** Canonical base diamond — the validated #711 render (§9.1). */
34
+ export declare const DIAGRAM_GLYPH_BASE = "M8 53L32 44L56 53L32 62Z";
35
+ /** Glyph viewBox in force for the whole family. */
36
+ export declare const DIAGRAM_GLYPH_VIEWBOX = "0 0 64 64";
37
+ /**
38
+ * The shipped set (§9.2): the radar-immobilier 19 redrawn on the canonical
39
+ * base plus the sentropic #711 9 (verbatim geometry). 28 names, no
40
+ * collisions across the two sources — no aliasing was needed.
41
+ */
42
+ export declare const DIAGRAM_GLYPHS: Readonly<Record<string, DiagramGlyph>>;
43
+ /** Shipped glyph names (§9.2: 19 + 9 = 28). */
44
+ export declare const DIAGRAM_GLYPH_NAMES: string[];
45
+ /**
46
+ * Resolve a glyph name to its path record. Returns `undefined` for an
47
+ * unmapped name — the callers raise `card-icon-unknown` /
48
+ * `zone-icon-unknown` and draw nothing (DIF-14: no `server` fallback, no
49
+ * silent substitution).
50
+ */
51
+ export declare function getDiagramGlyph(name: string): DiagramGlyph | undefined;
52
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib/diagram-icons/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,mDAAmD;AACnD,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAejD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAyFjE,CAAC;AAEF,+CAA+C;AAC/C,eAAO,MAAM,mBAAmB,UAA8B,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEtE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Diagram pictogram registry — the blue duotone family (DC-1).
3
+ *
4
+ * Spec: spec/SPEC_EVOL_DS_DIAGRAM_CARDS.md §9. One family, drawn identically
5
+ * in cards and zones at the 70 px icon box: `viewBox="0 0 64 64"`, canonical
6
+ * base diamond `M8 53L32 44L56 53L32 62Z`, three layers (base / face / line),
7
+ * face stroke 1.5, line stroke 2.5. Layer colours resolve through the
8
+ * `diagramIcon` component tokens; no per-glyph colour, no raw hex here.
9
+ *
10
+ * Framework-neutral data: no Svelte import, so staged framework adapters
11
+ * (§12.6) reuse these path records without re-drawing a glyph. Provenance
12
+ * per glyph lives in PROVENANCE.md next to this file.
13
+ */
14
+ /** Canonical base diamond — the validated #711 render (§9.1). */
15
+ export const DIAGRAM_GLYPH_BASE = "M8 53L32 44L56 53L32 62Z";
16
+ /** Glyph viewBox in force for the whole family. */
17
+ export const DIAGRAM_GLYPH_VIEWBOX = "0 0 64 64";
18
+ function glyph(face, line, extra) {
19
+ return {
20
+ base: DIAGRAM_GLYPH_BASE,
21
+ face,
22
+ ...(line === undefined || line === "" ? {} : { line }),
23
+ ...extra,
24
+ };
25
+ }
26
+ /**
27
+ * The shipped set (§9.2): the radar-immobilier 19 redrawn on the canonical
28
+ * base plus the sentropic #711 9 (verbatim geometry). 28 names, no
29
+ * collisions across the two sources — no aliasing was needed.
30
+ */
31
+ export const DIAGRAM_GLYPHS = {
32
+ // --- radar-immobilier fa8133c2 (19): interiors preserved verbatim, base
33
+ // replaced by the canonical diamond (§9.1, DIF-12) ---
34
+ s3: glyph("M12 18Q32 6 52 18L47 47Q32 58 17 47Z", "M12 18Q32 30 52 18M18 29Q32 38 46 29", {
35
+ text: "S3",
36
+ }),
37
+ postgres: glyph("M12 16Q32 4 52 16V47Q32 59 12 47Z", "M12 16Q32 28 52 16M12 28Q32 40 52 28M12 40Q32 52 52 40"),
38
+ cluster: glyph("M32 7L54 20V44L32 57L10 44V20Z", "M32 19V32M21 26L32 32L43 26M32 32V46M32 32L20 40M32 32L44 40"),
39
+ web: glyph("M8 12H56V49H8Z", "M8 23H56M15 18H17M22 18H24M16 31H30V42H16ZM37 32H48M37 40H48"),
40
+ api: glyph("M8 12H56V50H8Z", "M22 24L15 31L22 38M42 24L49 31L42 38M35 22L29 40"),
41
+ cronjob: glyph("M32 8A24 24 0 1 1 31.9 8Z", "M32 16V32L43 39M17 16L12 21M47 16L52 21"),
42
+ identity: glyph("M32 6L52 14V31Q50 48 32 58Q14 48 12 31V14Z", "M26 29V24A6 6 0 0 1 38 24V29M23 29H41V42H23ZM32 34V37"),
43
+ workstation: glyph("M8 10H56V42H8Z", "M13 15H51V37H13ZM24 43V51M40 43V51M17 53H47M18 23L24 27L18 31M30 31H39"),
44
+ document: glyph("M15 6H37L50 19V57H15Z", "M37 6V19H50M23 28H42M23 36H42M23 44H35"),
45
+ map: glyph("M7 16L24 9L41 16L57 9V49L41 56L24 49L7 56Z", "M24 9V49M41 16V56M13 29L24 25L41 35L51 31"),
46
+ join: glyph("M8 12H24V27H8ZM40 12H56V27H40ZM24 42H40V57H24Z", "M16 27V34H48V27M32 34V42", {
47
+ darkLine: true,
48
+ }),
49
+ graph: glyph("M7 10H23V26H7ZM41 10H57V26H41ZM24 42H40V58H24Z", "M23 18H41M15 26L27 42M49 26L37 42", { darkLine: true }),
50
+ check: glyph("M14 8H50V57H14Z", "M23 8V15H41V8M23 35L30 42L43 27"),
51
+ release: glyph("M12 31L32 20L52 31V50L32 61L12 50Z", "M12 31L32 42L52 31M32 42V61M32 5V25M24 13L32 5L40 13"),
52
+ user: glyph("M22 17A10 10 0 1 1 42 17A10 10 0 1 1 22 17ZM12 54V44Q12 31 25 31H39Q52 31 52 44V54Z", "M20 44V54M44 44V54"),
53
+ url: glyph("M32 7A25 25 0 1 1 31.9 7Z", "M7 32H57M12 19H52M12 45H52M32 7C16 19 16 45 32 57C48 45 48 19 32 7Z"),
54
+ llm: glyph("M17 17H47V47H17Z", "M25 25H39V39H25ZM25 8V17M39 8V17M25 47V56M39 47V56M8 25H17M8 39H17M47 25H56M47 39H56"),
55
+ network: glyph("M24 7H40V23H24ZM5 42H21V58H5ZM43 42H59V58H43Z", "M32 23V33M13 42V33H51V42", { darkLine: true }),
56
+ unknown: glyph("M32 6L59 55H5Z", "M32 24V38M32 45V46"),
57
+ // --- sentropic #711 via the hrpolnav kit (9): verbatim geometry on the
58
+ // canonical base, 64-unit viewBox ---
59
+ people: glyph("M22 10a8 8 0 1 1 0 16a8 8 0 1 1 0-16Z M42 14a7 7 0 1 1 0 14a7 7 0 1 1 0-14Z M8 46c0-9 6-15 14-15s14 6 14 15Z M34 46c0-8 4-13 9-13s12 5 12 13Z"),
60
+ window: glyph("M9 11h46v36H9Z", "M9 19h46 M16 28h32 M16 35h22"),
61
+ server: glyph("M14 8h36v14H14Z M14 25h36v14H14Z", "M20 15h10 M20 32h10 M42 15h.1 M42 32h.1"),
62
+ brain: glyph("M32 12c-4-7-15-5-16 3c-8 1-11 11-6 17c-5 8 0 17 8 17c5 5 12 3 14-2c2 5 9 7 14 2c8 0 13-9 8-17c5-6 2-16-6-17c-1-8-12-10-16-3Z", "M32 12v35 M16 15c0 6 4 9 9 9 M10 32c4-4 9-3 12 1 M18 49c-2-5 0-10 5-12 M48 15c0-6-4-9-9-9 M54 32c-4-4-9-3-12 1 M46 49c2-5 0-10-5-12"),
63
+ robot: glyph("M14 16h36v31H14Z M8 25h6v13H8Z M50 25h6v13h-6Z M29 6h6v5h-6Z", "M32 11v5 M23 27h.1 M41 27h.1 M23 38h18"),
64
+ link: glyph("M10 12h16v14H10Z M38 30h16v14H38Z", "M26 19h12v11", { darkLine: true }),
65
+ db: glyph("M14 13c0-4 8-7 18-7s18 3 18 7v29c0 4-8 7-18 7s-18-3-18-7Z", "M14 13c0 4 8 7 18 7s18-3 18-7 M14 27c0 4 8 7 18 7s18-3 18-7"),
66
+ shield: glyph("M32 7l20 7v13c0 12-8 20-20 25C20 47 12 39 12 27V14Z", "M23 29l6 6 12-13"),
67
+ cloud: glyph("M18 44a10 10 0 0 1 0-20a14 14 0 0 1 27-4a11 11 0 0 1 3 24Z"),
68
+ };
69
+ /** Shipped glyph names (§9.2: 19 + 9 = 28). */
70
+ export const DIAGRAM_GLYPH_NAMES = Object.keys(DIAGRAM_GLYPHS);
71
+ /**
72
+ * Resolve a glyph name to its path record. Returns `undefined` for an
73
+ * unmapped name — the callers raise `card-icon-unknown` /
74
+ * `zone-icon-unknown` and draw nothing (DIF-14: no `server` fallback, no
75
+ * silent substitution).
76
+ */
77
+ export function getDiagramGlyph(name) {
78
+ return DIAGRAM_GLYPHS[name];
79
+ }
@@ -0,0 +1,17 @@
1
+ import { renderCardSvg, renderCardSvgFromPresentation, projectCardProps, type CardSvgResult } from "./renderCardSvg.js";
2
+ import { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent, type ZoneSvgResult } from "./renderZoneSvg.js";
3
+ import { cardLineMeasurer, type CardLineLayout, type CardMeasureRequest } from "../diagramCardModel.js";
4
+ import type { CardDiagnostic, CardLayout, CardLineMeasure, CardPresentationInput, DiagramCardProps, DiagramGlyphPaths } from "./renderCardSvg.js";
5
+ import type { DiagramZoneProps, ZoneChildSpec, ZoneDiagnostic, ZoneLayout, ZonePresentationInput } from "../diagramCardModel.js";
6
+ export { renderCardSvg, renderCardSvgFromPresentation, projectCardProps };
7
+ export { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent };
8
+ /**
9
+ * The canvas `LineMeasurer` bridge (diagram-canvas `MeasureRequest` shape):
10
+ * pass `cardLineMeasurer()` straight as the injected measurer. Exported
11
+ * through this subpath so hosts never reach into the barrel.
12
+ */
13
+ export { cardLineMeasurer };
14
+ export type { CardSvgResult, ZoneSvgResult };
15
+ export type { CardDiagnostic, CardLayout, CardLineLayout, CardLineMeasure, CardMeasureRequest, CardPresentationInput, DiagramCardProps, DiagramGlyphPaths, };
16
+ export type { DiagramZoneProps, ZoneChildSpec, ZoneDiagnostic, ZoneLayout, ZonePresentationInput, };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/diagram-render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,6BAA6B,EAC7B,gBAAgB,EAChB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,EACV,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AACvF;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAC7C,YAAY,EACV,cAAc,EACd,UAAU,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,CAAC;AACF,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,UAAU,EACV,qBAAqB,GACtB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { renderCardSvg, renderCardSvgFromPresentation, projectCardProps, } from "./renderCardSvg.js";
2
+ import { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent, } from "./renderZoneSvg.js";
3
+ import { cardLineMeasurer, } from "../diagramCardModel.js";
4
+ export { renderCardSvg, renderCardSvgFromPresentation, projectCardProps };
5
+ export { renderZoneSvg, renderZoneSvgFromPresentation, projectZoneProps, zoneContent };
6
+ /**
7
+ * The canvas `LineMeasurer` bridge (diagram-canvas `MeasureRequest` shape):
8
+ * pass `cardLineMeasurer()` straight as the injected measurer. Exported
9
+ * through this subpath so hosts never reach into the barrel.
10
+ */
11
+ export { cardLineMeasurer };
@@ -0,0 +1,83 @@
1
+ /**
2
+ * `renderCardSvg` — pure atomic-card SVG renderer (DC-1).
3
+ *
4
+ * Plain TypeScript, no Svelte import. Ships on the
5
+ * `@sentropic/design-system-svelte/diagram-render` subpath. Consumes the
6
+ * same geometry source as the Svelte `DiagramCard`: the `diagramCard`
7
+ * component tokens plus the `diagram-canvas` `measure.ts` constants, via
8
+ * `../diagramCardModel.js` (shared projection + line layout).
9
+ *
10
+ * Exactly one rule element, drawn non-scaling (§5.4, DIF-07, DH-04); fixed
11
+ * 460 × 200 box; square corners; footer pinned at 9.25; no shortening —
12
+ * over-long slots are reported through the returned diagnostics (DC-D4) and
13
+ * the result is refused (no `svg`): overflow = refusal, never a truncation.
14
+ */
15
+ import { layoutCard, projectCardProps, type CardDiagnostic, type CardLayout, type CardLineMeasure, type CardPresentationInput, type DiagramCardProps, type DiagramGlyphPaths } from "../diagramCardModel.js";
16
+ export type { CardDiagnostic, CardLayout, CardLineMeasure, CardPresentationInput, DiagramCardProps, DiagramGlyphPaths, };
17
+ export { projectCardProps };
18
+ /** Icon pictogram group at (x, y) in the caller's coordinate space. */
19
+ export declare function iconGroupFor(name: string, glyph: DiagramGlyphPaths | undefined, x: number, y: number, size: number): string;
20
+ /**
21
+ * Card-local content (border, accent bar, icon, slots, rule, footer,
22
+ * toggle) with no `<svg>` root — shared by `renderCardSvg` (wrapped in a
23
+ * standalone root) and `renderZoneSvg` (wrapped in a translated `<g>` for
24
+ * the collapsed zone, §6.2: the zone IS the card).
25
+ */
26
+ export declare function renderCardContent(props: DiagramCardProps, measure?: CardLineMeasure): {
27
+ readonly content: string;
28
+ readonly layout: ReturnType<typeof layoutCard>;
29
+ };
30
+ /** The +/- toggle glyph in its slot box (card-local coordinates). */
31
+ export declare function toggleGlyph(toggle: {
32
+ collapsed: boolean;
33
+ label: string;
34
+ }, box: {
35
+ x: number;
36
+ y: number;
37
+ size: number;
38
+ }): string;
39
+ /**
40
+ * The card render result. Overflow = refusal (owner criterion): when the
41
+ * layout raises `card-overflow` — a too-wide line, a line-count overflow, or
42
+ * a header+body height that does not fit above the pinned rule — the result
43
+ * is `{ kind: "refused" }` with NO `svg`: no normal card is emitted until the
44
+ * content fits. The diagnostics carry the original slot text so the host
45
+ * knows what to shorten. The Svelte `DiagramCard` renders the matching
46
+ * refusal state (`data-card-refused`) on the same predicate — one contract,
47
+ * both renderers.
48
+ */
49
+ export type CardSvgResult = {
50
+ readonly kind: "rendered";
51
+ readonly svg: string;
52
+ readonly diagnostics: readonly CardDiagnostic[];
53
+ readonly layout: CardLayout;
54
+ } | {
55
+ readonly kind: "refused";
56
+ readonly diagnostics: readonly CardDiagnostic[];
57
+ readonly layout: CardLayout;
58
+ };
59
+ /**
60
+ * Render one atomic card as a standalone SVG string. `measure` defaults to
61
+ * the deterministic greedy wrapper; production hosts pass their measured
62
+ * `LineMeasurer` adapter. Returns a refused result (no `svg`) when the
63
+ * content overflows its frozen allocation.
64
+ */
65
+ export declare function renderCardSvg(props: DiagramCardProps, measure?: CardLineMeasure): CardSvgResult;
66
+ /**
67
+ * Convenience: project an `EntityPresentation` then render it. Returns
68
+ * `{ kind: "label" }` when the view carries no card presentation for the
69
+ * entity — the host renders a simple label node and no card — and
70
+ * `{ kind: "card", result }` otherwise, where `result` is the refused or
71
+ * rendered `CardSvgResult`.
72
+ */
73
+ export declare function renderCardSvgFromPresentation(presentation: CardPresentationInput | undefined, opts: {
74
+ entityId: string;
75
+ toggle?: DiagramCardProps["toggle"];
76
+ measure?: CardLineMeasure;
77
+ }): {
78
+ kind: "card";
79
+ result: CardSvgResult;
80
+ } | {
81
+ kind: "label";
82
+ };
83
+ //# sourceMappingURL=renderCardSvg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCardSvg.d.ts","sourceRoot":"","sources":["../../src/lib/diagram-render/renderCardSvg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAIL,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAMhC,YAAY,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,CAAC;AACF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAY5B,uEAAuE;AACvE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,iBAAiB,GAAG,SAAS,EACpC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,GACX,MAAM,CAgBR;AAgBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,eAAoC,GAC5C;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;CAAE,CAiF9E;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CACzB,MAAM,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAC7C,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C,MAAM,CAOR;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GACrB;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,eAAoC,GAC5C,aAAa,CAyBf;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,qBAAqB,GAAG,SAAS,EAC/C,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,GACzF;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAQ7D"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * `renderCardSvg` — pure atomic-card SVG renderer (DC-1).
3
+ *
4
+ * Plain TypeScript, no Svelte import. Ships on the
5
+ * `@sentropic/design-system-svelte/diagram-render` subpath. Consumes the
6
+ * same geometry source as the Svelte `DiagramCard`: the `diagramCard`
7
+ * component tokens plus the `diagram-canvas` `measure.ts` constants, via
8
+ * `../diagramCardModel.js` (shared projection + line layout).
9
+ *
10
+ * Exactly one rule element, drawn non-scaling (§5.4, DIF-07, DH-04); fixed
11
+ * 460 × 200 box; square corners; footer pinned at 9.25; no shortening —
12
+ * over-long slots are reported through the returned diagnostics (DC-D4) and
13
+ * the result is refused (no `svg`): overflow = refusal, never a truncation.
14
+ */
15
+ import { CARD_GEOMETRY, defaultCardMeasure, firstOverflowDiagnostic, layoutCard, projectCardProps, } from "../diagramCardModel.js";
16
+ import { DIAGRAM_GLYPH_BASE, getDiagramGlyph, } from "../diagram-icons/registry.js";
17
+ export { projectCardProps };
18
+ function escapeXml(value) {
19
+ return String(value)
20
+ .replaceAll("&", "&amp;")
21
+ .replaceAll("<", "&lt;")
22
+ .replaceAll(">", "&gt;")
23
+ .replaceAll('"', "&quot;");
24
+ }
25
+ const FONT_STACK = "var(--st-font-sans, system-ui, sans-serif)";
26
+ /** Icon pictogram group at (x, y) in the caller's coordinate space. */
27
+ export function iconGroupFor(name, glyph, x, y, size) {
28
+ if (glyph === undefined)
29
+ return "";
30
+ const scale = size / 64;
31
+ const lineStroke = glyph.darkLine === true
32
+ ? "var(--st-component-diagramIcon-lineDarkStroke, var(--st-semantic-feedback-info))"
33
+ : "var(--st-component-diagramIcon-lineStroke, var(--st-semantic-surface-raised))";
34
+ return `<g class="st-diagramCard-icon" data-diagram-icon="${escapeXml(name)}" transform="translate(${x} ${y}) scale(${scale})" aria-hidden="true">` +
35
+ `<path d="${DIAGRAM_GLYPH_BASE}" fill="var(--st-component-diagramIcon-baseFill, color-mix(in srgb, var(--st-semantic-feedback-info) 18%, var(--st-semantic-surface-raised)))"/>` +
36
+ `<path d="${escapeXml(glyph.face)}" fill="var(--st-component-diagramIcon-faceFill, color-mix(in srgb, var(--st-semantic-feedback-info) 75%, var(--st-semantic-surface-raised)))" stroke="var(--st-component-diagramIcon-faceStroke, var(--st-semantic-feedback-info))" stroke-width="1.5" stroke-linejoin="round"/>` +
37
+ (glyph.line === undefined
38
+ ? ""
39
+ : `<path d="${escapeXml(glyph.line)}" fill="none" stroke="${lineStroke}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>`) +
40
+ (glyph.text === undefined
41
+ ? ""
42
+ : `<text x="32" y="47" text-anchor="middle" fill="var(--st-component-diagramIcon-lineStroke, var(--st-semantic-surface-raised))" font-size="13" font-weight="750">${escapeXml(glyph.text)}</text>`) +
43
+ `</g>`;
44
+ }
45
+ function textLines(lines, className, fill, extra) {
46
+ return lines
47
+ .map((line) => `<text class="${className}" x="${line.x}" y="${line.baseline}" text-anchor="${line.anchor === "middle" ? "middle" : "start"}" font-size="${line.size}" font-weight="${line.weight}" fill="${fill}"${extra}>${escapeXml(line.text)}</text>`)
48
+ .join("");
49
+ }
50
+ /**
51
+ * Card-local content (border, accent bar, icon, slots, rule, footer,
52
+ * toggle) with no `<svg>` root — shared by `renderCardSvg` (wrapped in a
53
+ * standalone root) and `renderZoneSvg` (wrapped in a translated `<g>` for
54
+ * the collapsed zone, §6.2: the zone IS the card).
55
+ */
56
+ export function renderCardContent(props, measure = defaultCardMeasure) {
57
+ const g = CARD_GEOMETRY;
58
+ const layout = layoutCard(props, measure);
59
+ const parts = [];
60
+ // Border, then the accent bar over the left stroke (border-left look).
61
+ // A proposed card is always drawn dashed, independently of the tint
62
+ // (owner criterion 5); the dash pattern is the kit's `4 5`.
63
+ parts.push(`<rect x="1" y="1" width="${g.width - 2}" height="${g.height - 2}" fill="var(--st-component-diagramCard-surface, var(--st-semantic-surface-raised))" stroke="var(--st-component-diagramCard-border, var(--st-semantic-border-strong))" stroke-width="${g.borderWidth}"${props.proposed === true ? ` stroke-dasharray="var(--st-component-diagramCard-proposedDashArray, 4 5)"` : ""}/>`);
64
+ parts.push(`<rect x="0" y="0" width="${g.accentWidth}" height="${g.height}" fill="var(--st-component-diagramCard-accent, var(--st-semantic-data-category1))"/>`);
65
+ if (layout.iconBox !== undefined && props.icon !== undefined) {
66
+ parts.push(iconGroupFor(props.icon, props.iconGlyph, layout.iconBox.x, layout.iconBox.y, layout.iconBox.size));
67
+ }
68
+ if (layout.kicker.length > 0) {
69
+ parts.push(textLines(layout.kicker, "st-diagramCard-kicker", "var(--st-component-diagramCard-secondaryText, var(--st-semantic-text-secondary))", ` letter-spacing="0.04em" style="text-transform:uppercase"`));
70
+ }
71
+ if (layout.title.length > 0) {
72
+ parts.push(textLines(layout.title, "st-diagramCard-title", "var(--st-component-diagramCard-text, var(--st-semantic-text-primary))", ""));
73
+ }
74
+ if (layout.body.length > 0) {
75
+ const secondary = layout.body.filter((line) => line.secondary);
76
+ const primary = layout.body.filter((line) => !line.secondary);
77
+ if (primary.length > 0) {
78
+ parts.push(textLines(primary, "st-diagramCard-body", "var(--st-component-diagramCard-text, var(--st-semantic-text-primary))", ""));
79
+ }
80
+ if (secondary.length > 0) {
81
+ parts.push(textLines(secondary, "st-diagramCard-detail", "var(--st-component-diagramCard-secondaryText, var(--st-semantic-text-secondary))", ""));
82
+ }
83
+ }
84
+ if (layout.ruleY !== undefined) {
85
+ parts.push(`<line class="st-diagramCard-rule" x1="${layout.ruleX1}" x2="${layout.ruleX2}" y1="${layout.ruleY}" y2="${layout.ruleY}" stroke="var(--st-component-diagramCard-rule, var(--st-semantic-border-subtle))" stroke-width="${g.ruleHeight}" vector-effect="non-scaling-stroke"/>`);
86
+ }
87
+ if (layout.footerLines.length > 0) {
88
+ parts.push(textLines(layout.footerLines, "st-diagramCard-footer", "var(--st-component-diagramCard-text, var(--st-semantic-text-primary))", ""));
89
+ }
90
+ if (layout.toggleBox !== undefined && props.toggle !== undefined) {
91
+ parts.push(toggleGlyph(props.toggle, layout.toggleBox));
92
+ }
93
+ return { content: parts.join(""), layout };
94
+ }
95
+ /** The +/- toggle glyph in its slot box (card-local coordinates). */
96
+ export function toggleGlyph(toggle, box) {
97
+ const center = box.size / 2;
98
+ const arm = 7;
99
+ const glyph = toggle.collapsed
100
+ ? `<path d="M ${center - arm} ${center} H ${center + arm} M ${center} ${center - arm} V ${center + arm}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>`
101
+ : `<path d="M ${center - arm} ${center} H ${center + arm}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>`;
102
+ return `<g class="st-diagramCard-toggle" data-toggle="true" data-collapsed="${toggle.collapsed ? "true" : "false"}" transform="translate(${box.x} ${box.y})" color="var(--st-semantic-text-primary)" aria-hidden="true"><title>${escapeXml(toggle.label)}</title><rect width="${box.size}" height="${box.size}" fill="transparent"/>${glyph}</g>`;
103
+ }
104
+ /**
105
+ * Render one atomic card as a standalone SVG string. `measure` defaults to
106
+ * the deterministic greedy wrapper; production hosts pass their measured
107
+ * `LineMeasurer` adapter. Returns a refused result (no `svg`) when the
108
+ * content overflows its frozen allocation.
109
+ */
110
+ export function renderCardSvg(props, measure = defaultCardMeasure) {
111
+ const g = CARD_GEOMETRY;
112
+ const { content, layout } = renderCardContent(props, measure);
113
+ const refused = firstOverflowDiagnostic(layout.diagnostics);
114
+ if (refused !== undefined) {
115
+ return { kind: "refused", diagnostics: layout.diagnostics, layout };
116
+ }
117
+ const overflowSlots = layout.diagnostics
118
+ .filter((diagnostic) => diagnostic.code === "card-overflow")
119
+ .map((diagnostic) => diagnostic.slot);
120
+ const unknownIcon = layout.diagnostics.some((diagnostic) => diagnostic.code === "card-icon-unknown");
121
+ const firstOverflow = overflowSlots.length === 0 ? undefined : overflowSlots[0];
122
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" class="st-diagramCard" data-entity="${escapeXml(props.entityId)}"${props.tone === undefined ? "" : ` data-tone="${escapeXml(props.tone)}"`}${props.proposed === true ? ' data-proposed="true"' : ""}${firstOverflow === undefined ? "" : ` data-card-overflow="${firstOverflow}"`}${unknownIcon ? ` data-card-icon-unknown=""` : ""} width="${g.width}" height="${g.height}" viewBox="0 0 ${g.width} ${g.height}" role="img" aria-label="${escapeXml(props.title)}" style="font-family:${FONT_STACK}">` +
123
+ `<title>${escapeXml(props.title)}</title>` +
124
+ content +
125
+ `</svg>`;
126
+ return {
127
+ kind: "rendered",
128
+ svg,
129
+ diagnostics: layout.diagnostics,
130
+ layout,
131
+ };
132
+ }
133
+ /**
134
+ * Convenience: project an `EntityPresentation` then render it. Returns
135
+ * `{ kind: "label" }` when the view carries no card presentation for the
136
+ * entity — the host renders a simple label node and no card — and
137
+ * `{ kind: "card", result }` otherwise, where `result` is the refused or
138
+ * rendered `CardSvgResult`.
139
+ */
140
+ export function renderCardSvgFromPresentation(presentation, opts) {
141
+ const resolved = projectCardProps(presentation, {
142
+ entityId: opts.entityId,
143
+ ...(opts.toggle === undefined ? {} : { toggle: opts.toggle }),
144
+ resolveGlyph: getDiagramGlyph,
145
+ });
146
+ if (resolved.kind !== "card")
147
+ return { kind: "label" };
148
+ return { kind: "card", result: renderCardSvg(resolved.props, opts.measure) };
149
+ }