@sentropic/design-system-svelte 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSE.THIRD-PARTY.md +141 -0
- package/dist/Calendar.svelte +28 -1
- package/dist/Calendar.svelte.d.ts +7 -0
- package/dist/Calendar.svelte.d.ts.map +1 -1
- package/dist/ContentSwitcher.svelte +6 -1
- package/dist/ForceGraph.svelte +13 -135
- package/dist/ForceGraph.svelte.d.ts.map +1 -1
- package/dist/Icon.svelte +35 -3
- package/dist/Icon.svelte.d.ts +5 -1
- package/dist/Icon.svelte.d.ts.map +1 -1
- package/dist/MenuPopover.svelte +101 -12
- package/dist/MenuPopover.svelte.d.ts.map +1 -1
- package/dist/PriorityMatrix.svelte +241 -0
- package/dist/PriorityMatrix.svelte.d.ts +29 -0
- package/dist/PriorityMatrix.svelte.d.ts.map +1 -0
- package/dist/RadioGroup.svelte +4 -1
- package/dist/TimeRangePicker.svelte +57 -2
- package/dist/TimeRangePicker.svelte.d.ts +12 -0
- package/dist/TimeRangePicker.svelte.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/priorityLabels.d.ts +143 -0
- package/dist/priorityLabels.d.ts.map +1 -0
- package/dist/priorityLabels.js +239 -0
- package/package.json +5 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sentropic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<!-- GÉNÉRÉ par scripts/generate-third-party-notices.mjs — ne pas éditer à la main. -->
|
|
2
|
+
<!-- Régénérer : `npm run notices:generate`. La dérive fait échouer `npm run licensing:check`. -->
|
|
3
|
+
|
|
4
|
+
# Notices de tiers — `@sentropic/design-system-svelte`
|
|
5
|
+
|
|
6
|
+
Licence de ce paquet : **MIT** — voir `LICENSE`.
|
|
7
|
+
Ce fichier couvre le code **tiers**, et lui seul.
|
|
8
|
+
|
|
9
|
+
Périmètre, littéralement : le code tiers recopié dans ce paquet (§1) et la
|
|
10
|
+
fermeture transitive de ses dépendances d'exécution (§2). Hors périmètre, et
|
|
11
|
+
c'est délibéré : les `peerDependencies`, fournies par le consommateur, et les
|
|
12
|
+
`devDependencies`, qui n'entrent dans aucun tarball.
|
|
13
|
+
|
|
14
|
+
## 1. Code tiers recopié dans ce paquet
|
|
15
|
+
|
|
16
|
+
Le code ci-dessous n'est pas une dépendance : il est **copié dans nos sources**
|
|
17
|
+
et compilé dans le `dist/` publié. Nous en distribuons donc une copie, et la
|
|
18
|
+
notice de copyright comme la notice de permission doivent l'accompagner. Elles
|
|
19
|
+
sont reproduites intégralement, sans abréviation.
|
|
20
|
+
|
|
21
|
+
L'inventaire ci-dessous est **mesuré** à la génération, en comparant nos
|
|
22
|
+
sources à l'amont installé : il ne peut pas se désynchroniser en silence.
|
|
23
|
+
|
|
24
|
+
### lucide — mesuré contre `lucide-react` 0.562.0 — ISC AND MIT
|
|
25
|
+
|
|
26
|
+
**Ce qui est copié.** Des chaînes de tracé SVG (attribut `d`) identiques octet pour octet aux données d'icônes lucide, écrites directement dans nos fichiers source et compilées dans le `dist/` publié.
|
|
27
|
+
|
|
28
|
+
**Étendue mesurée.** 21 chaîne(s) de tracé distincte(s),
|
|
29
|
+
21 occurrence(s), dans 1 fichier(s) source de ce paquet :
|
|
30
|
+
|
|
31
|
+
| Fichier source | Occurrences |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `src/lib/cellDecoration.ts` | 21 |
|
|
34
|
+
|
|
35
|
+
Glyphes amont concernés (une chaîne partagée par plusieurs glyphes les nomme tous) :
|
|
36
|
+
`arrow-down`, `arrow-right`, `arrow-up`, `badge-percent`, `barcode`, `check`, `circle-check-big`, `circle-percent`, `circle-question-mark`, `circle-x`, `cloud-snow`, `file-exclamation-point`, `file-question-mark`, `flame`, `house-wifi`, `info`, `message-circle-question-mark`, `message-circle-x`, `minus`, `octagon-x`, `plus`, `shield-question-mark`, `square-check-big`, `square-percent`, `square-x`, `ticket-percent`, `trending-down`, `trending-up`, `triangle-alert`, `x`.
|
|
37
|
+
|
|
38
|
+
**Pourquoi c'est une redistribution.** Le jeu d'icônes du design system est lucide : `packages/components-angular/src/Icon.ts` le dit explicitement (« the same lucide (stroke-24) path data the other frameworks wrap — the single visual source of truth »). Inliner les données plutôt que dépendre du paquet ne supprime pas l'obligation : cela la déplace du `node_modules` du consommateur vers notre propre tarball. Le port Angular ne déclare aucune dépendance lucide et n'embarque que des copies ; les ports React, Vue et Svelte dépendent du paquet lucide ET en recopient une partie.
|
|
39
|
+
|
|
40
|
+
**Obligation.** ISC comme MIT exigent que la notice de copyright et la notice de permission figurent dans toute copie. Elles sont reproduites intégralement ci-dessous. Un identifiant SPDX seul ne satisfait ni l'une ni l'autre.
|
|
41
|
+
|
|
42
|
+
**Titulaires.** Lucide Contributors 2025 (ISC) ; Cole Bemis 2013-2023, pour les portions dérivées de Feather (MIT).
|
|
43
|
+
**Amont.** https://github.com/lucide-icons/lucide
|
|
44
|
+
|
|
45
|
+
**Notice intégrale**, telle que publiée par l'amont dans `node_modules/lucide-react/LICENSE` :
|
|
46
|
+
|
|
47
|
+
> ISC License
|
|
48
|
+
>
|
|
49
|
+
> Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2023 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2025.
|
|
50
|
+
>
|
|
51
|
+
> Permission to use, copy, modify, and/or distribute this software for any
|
|
52
|
+
> purpose with or without fee is hereby granted, provided that the above
|
|
53
|
+
> copyright notice and this permission notice appear in all copies.
|
|
54
|
+
>
|
|
55
|
+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
56
|
+
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
57
|
+
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
58
|
+
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
59
|
+
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
60
|
+
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
61
|
+
> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
62
|
+
>
|
|
63
|
+
> ---
|
|
64
|
+
>
|
|
65
|
+
> The MIT License (MIT) (for portions derived from Feather)
|
|
66
|
+
>
|
|
67
|
+
> Copyright (c) 2013-2023 Cole Bemis
|
|
68
|
+
>
|
|
69
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
70
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
71
|
+
> in the Software without restriction, including without limitation the rights
|
|
72
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
73
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
74
|
+
> furnished to do so, subject to the following conditions:
|
|
75
|
+
>
|
|
76
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
77
|
+
> copies or substantial portions of the Software.
|
|
78
|
+
>
|
|
79
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
80
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
81
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
82
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
83
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
84
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
85
|
+
> SOFTWARE.
|
|
86
|
+
|
|
87
|
+
## 2. Dépendances installées avec ce paquet
|
|
88
|
+
|
|
89
|
+
Fermeture **transitive** de `dependencies` et `optionalDependencies`, dérivée
|
|
90
|
+
de `package-lock.json` : 1 paquet(s), 1 famille(s) de licences.
|
|
91
|
+
Ces paquets ne sont pas recopiés dans notre tarball — npm les récupère du
|
|
92
|
+
registre avec leurs propres fichiers de licence. Ils sont recensés ici parce
|
|
93
|
+
qu'ils arrivent dans le `node_modules` du consommateur de notre fait.
|
|
94
|
+
|
|
95
|
+
| Paquet | Version | Licence déclarée |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `@lucide/svelte` | 0.562.0 | ISC |
|
|
98
|
+
|
|
99
|
+
### Textes de notice
|
|
100
|
+
|
|
101
|
+
#### `@lucide/svelte` 0.562.0 — ISC
|
|
102
|
+
|
|
103
|
+
> ISC License
|
|
104
|
+
>
|
|
105
|
+
> Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2023 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2025.
|
|
106
|
+
>
|
|
107
|
+
> Permission to use, copy, modify, and/or distribute this software for any
|
|
108
|
+
> purpose with or without fee is hereby granted, provided that the above
|
|
109
|
+
> copyright notice and this permission notice appear in all copies.
|
|
110
|
+
>
|
|
111
|
+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
112
|
+
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
113
|
+
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
114
|
+
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
115
|
+
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
116
|
+
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
117
|
+
> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
118
|
+
>
|
|
119
|
+
> ---
|
|
120
|
+
>
|
|
121
|
+
> The MIT License (MIT) (for portions derived from Feather)
|
|
122
|
+
>
|
|
123
|
+
> Copyright (c) 2013-2023 Cole Bemis
|
|
124
|
+
>
|
|
125
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
126
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
127
|
+
> in the Software without restriction, including without limitation the rights
|
|
128
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
129
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
130
|
+
> furnished to do so, subject to the following conditions:
|
|
131
|
+
>
|
|
132
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
133
|
+
> copies or substantial portions of the Software.
|
|
134
|
+
>
|
|
135
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
136
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
137
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
138
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
139
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
140
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
141
|
+
> SOFTWARE.
|
package/dist/Calendar.svelte
CHANGED
|
@@ -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(
|
|
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,C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C1C,+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:
|
|
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
|
|
package/dist/ForceGraph.svelte
CHANGED
|
@@ -334,43 +334,14 @@
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
// ---------------------------------------------------------------------------
|
|
337
|
-
//
|
|
338
|
-
//
|
|
339
|
-
//
|
|
340
|
-
//
|
|
341
|
-
//
|
|
337
|
+
// Node layout (GD-M2-DS-PRESENTATION): delegated to `@sentropic/graph/processing`.
|
|
338
|
+
// `computeLayout` is the upstream extraction of this component's former local
|
|
339
|
+
// simulation (same FNV-1a/mulberry32 deterministic seed, same fx/fy pin and
|
|
340
|
+
// repulsion-clamp semantics), so this file holds no physics of its own. Only
|
|
341
|
+
// the `./processing` subpath is imported — never the package root, which would
|
|
342
|
+
// drag the WebGL renderer into every consumer bundle.
|
|
342
343
|
// ---------------------------------------------------------------------------
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
function mulberry32(seed: number): () => number {
|
|
346
|
-
let a = seed >>> 0;
|
|
347
|
-
return () => {
|
|
348
|
-
a |= 0; a = (a + 0x6d2b79f5) | 0;
|
|
349
|
-
let t = Math.imul(a ^ (a >>> 15), 1 | a);
|
|
350
|
-
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
351
|
-
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Stable seed from the SET of node ids (sorted), not from ns.length/es.length.
|
|
356
|
-
// A length-based seed reshuffled the whole layout whenever a node was added or
|
|
357
|
-
// removed (notably after a reconciliation merge), making the graph "jump". A
|
|
358
|
-
// hash over the sorted ids keeps the same topology → same layout, so removing
|
|
359
|
-
// one node leaves the rest essentially in place. (FNV-1a 32-bit over the joined
|
|
360
|
-
// sorted ids; deterministic and order-independent.)
|
|
361
|
-
function stableSeed(ns: ForceGraphNode[]): number {
|
|
362
|
-
const ids = ns.map((n) => n.id).sort();
|
|
363
|
-
let h = 0x811c9dc5; // FNV offset basis
|
|
364
|
-
const joined = ids.join("|");
|
|
365
|
-
for (let i = 0; i < joined.length; i++) {
|
|
366
|
-
h ^= joined.charCodeAt(i);
|
|
367
|
-
h = Math.imul(h, 0x01000193); // FNV prime
|
|
368
|
-
}
|
|
369
|
-
// Fold in the count too so wholly different graphs of equal id-hash still
|
|
370
|
-
// differ, but the dominant term is the (order-independent) id hash.
|
|
371
|
-
h ^= ns.length;
|
|
372
|
-
return h >>> 0;
|
|
373
|
-
}
|
|
344
|
+
import { computeLayout } from "@sentropic/graph/processing";
|
|
374
345
|
|
|
375
346
|
function runSimulation(
|
|
376
347
|
ns: ForceGraphNode[],
|
|
@@ -380,107 +351,14 @@
|
|
|
380
351
|
ticks: number,
|
|
381
352
|
repulsionFactor: number
|
|
382
353
|
): Map<string, { x: number; y: number }> {
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const idIndex = new Map<string, number>();
|
|
389
|
-
const sim: SimNode[] = ns.map((n, i) => {
|
|
390
|
-
idIndex.set(n.id, i);
|
|
391
|
-
const fixed = typeof n.fx === "number" && typeof n.fy === "number";
|
|
392
|
-
// Seed on a loose ring so the first ticks fan the graph out predictably.
|
|
393
|
-
const angle = (i / Math.max(ns.length, 1)) * Math.PI * 2;
|
|
394
|
-
const r = Math.min(w, h) * 0.3 * (0.5 + rand() * 0.5);
|
|
395
|
-
return {
|
|
396
|
-
id: n.id,
|
|
397
|
-
x: fixed ? (n.fx as number) : cx + Math.cos(angle) * r,
|
|
398
|
-
y: fixed ? (n.fy as number) : cy + Math.sin(angle) * r,
|
|
399
|
-
vx: 0,
|
|
400
|
-
vy: 0,
|
|
401
|
-
fixed
|
|
402
|
-
};
|
|
354
|
+
const results = computeLayout(ns, es, {
|
|
355
|
+
width: w,
|
|
356
|
+
height: h,
|
|
357
|
+
iterations: ticks,
|
|
358
|
+
repulsion: repulsionFactor
|
|
403
359
|
});
|
|
404
|
-
|
|
405
|
-
const links = es
|
|
406
|
-
.map((e) => ({ s: idIndex.get(e.source), t: idIndex.get(e.target) }))
|
|
407
|
-
.filter((l): l is { s: number; t: number } => l.s !== undefined && l.t !== undefined);
|
|
408
|
-
|
|
409
|
-
const area = w * h;
|
|
410
|
-
const k = Math.sqrt(area / Math.max(ns.length, 1)); // ideal node distance
|
|
411
|
-
// Clamp the caller-supplied factor so extreme values can't explode or
|
|
412
|
-
// collapse the layout. >1 spreads nodes out, <1 packs them tighter; the
|
|
413
|
-
// fit-to-content viewBox is recomputed afterwards so spacing just fills space.
|
|
414
|
-
const clampedRepulsion = Math.min(Math.max(repulsionFactor, 0.1), 10);
|
|
415
|
-
const repulsion = k * k * 0.9 * clampedRepulsion;
|
|
416
|
-
const restLength = k * 0.8;
|
|
417
|
-
const springK = 0.04;
|
|
418
|
-
const gravity = 0.012;
|
|
419
|
-
const damping = 0.85;
|
|
420
|
-
let temperature = Math.min(w, h) * 0.08;
|
|
421
|
-
const cooling = ticks > 0 ? Math.pow(0.02, 1 / ticks) : 0.95;
|
|
422
|
-
|
|
423
|
-
for (let step = 0; step < ticks; step++) {
|
|
424
|
-
// Repulsion between all node pairs.
|
|
425
|
-
for (let i = 0; i < sim.length; i++) {
|
|
426
|
-
for (let j = i + 1; j < sim.length; j++) {
|
|
427
|
-
let dx = sim[i].x - sim[j].x;
|
|
428
|
-
let dy = sim[i].y - sim[j].y;
|
|
429
|
-
let dist2 = dx * dx + dy * dy;
|
|
430
|
-
if (dist2 < 0.01) {
|
|
431
|
-
dx = (rand() - 0.5) * 0.1;
|
|
432
|
-
dy = (rand() - 0.5) * 0.1;
|
|
433
|
-
dist2 = dx * dx + dy * dy + 0.01;
|
|
434
|
-
}
|
|
435
|
-
const dist = Math.sqrt(dist2);
|
|
436
|
-
const force = repulsion / dist2;
|
|
437
|
-
const fx = (dx / dist) * force;
|
|
438
|
-
const fy = (dy / dist) * force;
|
|
439
|
-
sim[i].vx += fx; sim[i].vy += fy;
|
|
440
|
-
sim[j].vx -= fx; sim[j].vy -= fy;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
// Spring attraction along links.
|
|
444
|
-
for (const l of links) {
|
|
445
|
-
const a = sim[l.s];
|
|
446
|
-
const b = sim[l.t];
|
|
447
|
-
const dx = b.x - a.x;
|
|
448
|
-
const dy = b.y - a.y;
|
|
449
|
-
const dist = Math.sqrt(dx * dx + dy * dy) || 0.01;
|
|
450
|
-
const force = (dist - restLength) * springK;
|
|
451
|
-
const fx = (dx / dist) * force;
|
|
452
|
-
const fy = (dy / dist) * force;
|
|
453
|
-
a.vx += fx; a.vy += fy;
|
|
454
|
-
b.vx -= fx; b.vy -= fy;
|
|
455
|
-
}
|
|
456
|
-
// Gravity toward centre + integrate with capped, cooling step.
|
|
457
|
-
for (const node of sim) {
|
|
458
|
-
if (node.fixed) { node.vx = 0; node.vy = 0; continue; }
|
|
459
|
-
node.vx += (cx - node.x) * gravity;
|
|
460
|
-
node.vy += (cy - node.y) * gravity;
|
|
461
|
-
node.vx *= damping;
|
|
462
|
-
node.vy *= damping;
|
|
463
|
-
const speed = Math.sqrt(node.vx * node.vx + node.vy * node.vy);
|
|
464
|
-
if (speed > temperature) {
|
|
465
|
-
node.vx = (node.vx / speed) * temperature;
|
|
466
|
-
node.vy = (node.vy / speed) * temperature;
|
|
467
|
-
}
|
|
468
|
-
node.x += node.vx;
|
|
469
|
-
node.y += node.vy;
|
|
470
|
-
// Soft clamp: allow the layout to overflow the canvas so it keeps a
|
|
471
|
-
// natural shape (fit-to-content reframes it afterwards). The wide bound
|
|
472
|
-
// only guards against runaway coordinates, it no longer glues nodes to
|
|
473
|
-
// the four edges.
|
|
474
|
-
const padX = w * 0.5 + nodeRadius * 2;
|
|
475
|
-
const padY = h * 0.5 + nodeRadius * 2;
|
|
476
|
-
node.x = Math.max(-padX, Math.min(w + padX, node.x));
|
|
477
|
-
node.y = Math.max(-padY, Math.min(h + padY, node.y));
|
|
478
|
-
}
|
|
479
|
-
temperature *= cooling;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
360
|
const out = new Map<string, { x: number; y: number }>();
|
|
483
|
-
for (const
|
|
361
|
+
for (const r of results) out.set(r.id, { x: r.x, y: r.y });
|
|
484
362
|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E,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7E,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAkqBJ,QAAA,MAAM,UAAU,qDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
package/dist/Icon.svelte
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
name: IconName;
|
|
8
8
|
/** Square size in px. Default 18 — the DS-standard inline glyph size. */
|
|
9
9
|
size?: number;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Stroke width. When omitted, the theme token
|
|
12
|
+
* `--st-component-icon-strokeWidth` applies (default 2.25 — the DS's
|
|
13
|
+
* existing lucide usage). When set, it wins over the token.
|
|
14
|
+
*/
|
|
11
15
|
strokeWidth?: number;
|
|
12
16
|
/**
|
|
13
17
|
* Accessible name. When set, the icon is exposed as an image with this
|
|
@@ -20,7 +24,7 @@
|
|
|
20
24
|
let {
|
|
21
25
|
name,
|
|
22
26
|
size = 18,
|
|
23
|
-
strokeWidth
|
|
27
|
+
strokeWidth,
|
|
24
28
|
title,
|
|
25
29
|
class: className,
|
|
26
30
|
...rest
|
|
@@ -28,12 +32,16 @@
|
|
|
28
32
|
|
|
29
33
|
const Glyph = $derived(ICONS[name]);
|
|
30
34
|
const classes = $derived(["st-icon", className].filter(Boolean).join(" "));
|
|
35
|
+
// An explicit prop is marked so the token rule below leaves it alone; the
|
|
36
|
+
// presentation attribute keeps 2.25 when no stylesheet or theme is loaded.
|
|
37
|
+
const strokeMarker = $derived(strokeWidth == null ? undefined : "prop");
|
|
31
38
|
</script>
|
|
32
39
|
|
|
33
40
|
{#if Glyph}
|
|
34
41
|
<Glyph
|
|
35
42
|
{size}
|
|
36
|
-
{strokeWidth}
|
|
43
|
+
strokeWidth={strokeWidth ?? 2.25}
|
|
44
|
+
data-st-icon-stroke={strokeMarker}
|
|
37
45
|
class={classes}
|
|
38
46
|
role={title ? "img" : undefined}
|
|
39
47
|
aria-label={title}
|
|
@@ -42,3 +50,27 @@
|
|
|
42
50
|
{...rest}
|
|
43
51
|
/>
|
|
44
52
|
{/if}
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
/* Stroke width and colour come from the theme tokens. The selectors only
|
|
56
|
+
match the DS defaults (stroke-width 2.25 set by no prop, stroke
|
|
57
|
+
currentColor), so an explicit strokeWidth prop or colour keeps its
|
|
58
|
+
presentation attribute. The rules live in the cascade layer `st-icon`: a
|
|
59
|
+
layered rule still beats the SVG presentation attributes, and any unlayered
|
|
60
|
+
consumer rule beats it. A consumer rule inside a layer (Tailwind v4
|
|
61
|
+
utilities) only wins if `st-icon` comes first in the layer order: declare
|
|
62
|
+
`@layer st-icon;` before `@import "tailwindcss";`. Svelte usually emits
|
|
63
|
+
component CSS after the app's global CSS, so without that declaration the
|
|
64
|
+
token rules beat layered utilities on the icon. The fallbacks reproduce
|
|
65
|
+
the former render when no theme is loaded. Same rules as the
|
|
66
|
+
React/Vue/Angular styles.css. */
|
|
67
|
+
@layer st-icon {
|
|
68
|
+
:global(:where(.st-icon[stroke-width="2.25"]:not([data-st-icon-stroke]))) {
|
|
69
|
+
stroke-width: var(--st-component-icon-strokeWidth, 2.25);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(:where(.st-icon[stroke="currentColor"])) {
|
|
73
|
+
stroke: var(--st-component-icon-color, currentColor);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</style>
|
package/dist/Icon.svelte.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ type IconProps = Omit<SVGAttributes<SVGElement>, "class"> & {
|
|
|
5
5
|
name: IconName;
|
|
6
6
|
/** Square size in px. Default 18 — the DS-standard inline glyph size. */
|
|
7
7
|
size?: number;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Stroke width. When omitted, the theme token
|
|
10
|
+
* `--st-component-icon-strokeWidth` applies (default 2.25 — the DS's
|
|
11
|
+
* existing lucide usage). When set, it wins over the token.
|
|
12
|
+
*/
|
|
9
13
|
strokeWidth?: number;
|
|
10
14
|
/**
|
|
11
15
|
* Accessible name. When set, the icon is exposed as an image with this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,KAAK,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1D,qDAAqD;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd
|
|
1
|
+
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,KAAK,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1D,qDAAqD;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA8BJ,QAAA,MAAM,IAAI,+CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|