@bythium/unisson 0.0.0-stage → 0.1.1-rc.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 +201 -0
- package/NOTICE +28 -0
- package/README.md +145 -2
- package/dist/CHANGELOG.md +22 -0
- package/dist/button-group.d.ts +29 -0
- package/dist/button-group.js +1 -0
- package/dist/button.d.ts +37 -0
- package/dist/button.js +1 -0
- package/dist/chunks/chunk-4GXKKP4T.js +460 -0
- package/dist/chunks/chunk-5TUKFRTD.js +376 -0
- package/dist/chunks/chunk-5VNPX7DT.js +1 -0
- package/dist/chunks/chunk-6TMCYM5S.js +436 -0
- package/dist/chunks/chunk-BAYUYXVR.js +1 -0
- package/dist/chunks/chunk-FGJHPGJI.js +1 -0
- package/dist/chunks/chunk-JOXL2SMV.js +373 -0
- package/dist/chunks/chunk-MWNIQCR3.js +298 -0
- package/dist/chunks/chunk-MYB6FQX2.js +394 -0
- package/dist/chunks/chunk-W3ASGVKH.js +1 -0
- package/dist/chunks/chunk-WKXQ2JMZ.js +557 -0
- package/dist/confirm-button.d.ts +37 -0
- package/dist/confirm-button.js +1 -0
- package/dist/copy-button.d.ts +25 -0
- package/dist/copy-button.js +1 -0
- package/dist/custom-elements.json +1480 -0
- package/dist/define.d.ts +8 -0
- package/dist/define.js +1 -0
- package/dist/icon-button.d.ts +33 -0
- package/dist/icon-button.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/react/attributes.d.ts +10 -0
- package/dist/react/attributes.js +25 -0
- package/dist/react/button-group.d.ts +27 -0
- package/dist/react/button-group.js +7 -0
- package/dist/react/button.d.ts +35 -0
- package/dist/react/button.js +7 -0
- package/dist/react/confirm-button.d.ts +35 -0
- package/dist/react/confirm-button.js +7 -0
- package/dist/react/copy-button.d.ts +23 -0
- package/dist/react/copy-button.js +7 -0
- package/dist/react/icon-button.d.ts +31 -0
- package/dist/react/icon-button.js +7 -0
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.js +9 -0
- package/dist/react/runtime.js +11 -0
- package/dist/react/split-button.d.ts +31 -0
- package/dist/react/split-button.js +7 -0
- package/dist/react/toggle-button.d.ts +27 -0
- package/dist/react/toggle-button.js +7 -0
- package/dist/split-button.d.ts +33 -0
- package/dist/split-button.js +1 -0
- package/dist/svelte/OButton.svelte +14 -0
- package/dist/svelte/OButton.svelte.d.ts +36 -0
- package/dist/svelte/OButtonGroup.svelte +14 -0
- package/dist/svelte/OButtonGroup.svelte.d.ts +28 -0
- package/dist/svelte/OConfirmButton.svelte +14 -0
- package/dist/svelte/OConfirmButton.svelte.d.ts +36 -0
- package/dist/svelte/OCopyButton.svelte +14 -0
- package/dist/svelte/OCopyButton.svelte.d.ts +24 -0
- package/dist/svelte/OIconButton.svelte +14 -0
- package/dist/svelte/OIconButton.svelte.d.ts +32 -0
- package/dist/svelte/OSplitButton.svelte +14 -0
- package/dist/svelte/OSplitButton.svelte.d.ts +32 -0
- package/dist/svelte/OToggleButton.svelte +14 -0
- package/dist/svelte/OToggleButton.svelte.d.ts +28 -0
- package/dist/svelte/attributes.d.ts +10 -0
- package/dist/svelte/attributes.js +25 -0
- package/dist/svelte/index.d.ts +8 -0
- package/dist/svelte/index.js +8 -0
- package/dist/toggle-button.d.ts +29 -0
- package/dist/toggle-button.js +1 -0
- package/dist/tokens.css +200 -0
- package/dist/vue/attributes.d.ts +10 -0
- package/dist/vue/attributes.js +25 -0
- package/dist/vue/button-group.d.ts +27 -0
- package/dist/vue/button-group.js +6 -0
- package/dist/vue/button.d.ts +35 -0
- package/dist/vue/button.js +6 -0
- package/dist/vue/confirm-button.d.ts +35 -0
- package/dist/vue/confirm-button.js +6 -0
- package/dist/vue/copy-button.d.ts +23 -0
- package/dist/vue/copy-button.js +6 -0
- package/dist/vue/icon-button.d.ts +31 -0
- package/dist/vue/icon-button.js +6 -0
- package/dist/vue/index.d.ts +8 -0
- package/dist/vue/index.js +8 -0
- package/dist/vue/runtime.js +31 -0
- package/dist/vue/split-button.d.ts +31 -0
- package/dist/vue/split-button.js +6 -0
- package/dist/vue/toggle-button.d.ts +27 -0
- package/dist/vue/toggle-button.js +6 -0
- package/package.json +199 -4
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import{a as x,b as l,c as k}from"./chunk-BAYUYXVR.js";import{a as o,b as g,d as y,e as v}from"./chunk-W3ASGVKH.js";var c=0,d="";function F(){if(c++===0){let e=document.documentElement.style;d=e.getPropertyValue("overflow"),e.setProperty("overflow","hidden")}}function C(){if(c!==0&&--c===0){let e=document.documentElement.style;d?e.setProperty("overflow",d):e.removeProperty("overflow")}}var a=new WeakMap;function H(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement?e:null}function u(e,t,n){if(!(!e||!e.isConnected))if(t&&!e.open){a.get(e)?.listener.abort();let r=new AbortController;a.set(e,{opener:H(),listener:r}),e.showModal(),F(),e.addEventListener("close",()=>{!e.open&&a.get(e)?.listener===r&&w(e,n)},{signal:r.signal})}else!t&&e.open&&(e.close(),w(e,n))}function w(e,t){let n=a.get(e);if(!n)return;a.delete(e),n.listener.abort(),C();let r=t??n.opener;r?.isConnected&&r.focus({preventScroll:!0})}function E(e){e&&a.has(e)&&(a.get(e)?.listener.abort(),a.delete(e),C())}function A(e){let t=[],n=r=>{if(r instanceof HTMLElement&&r.matches('button,a[href],input,select,textarea,[tabindex],summary,[contenteditable="true"]')&&r.tabIndex>=0&&!r.matches(":disabled")&&r.getClientRects().length>0&&getComputedStyle(r).visibility!=="hidden"&&t.push(r),r instanceof HTMLSlotElement){let i=r.assignedElements({flatten:!0});for(let s of i.length?i:[...r.children])n(s)}else if(r instanceof HTMLElement&&r.shadowRoot)n(r.shadowRoot);else for(let i of r.children)n(i)};return n(e),t.sort((r,i)=>(r.tabIndex>0?r.tabIndex:1/0)-(i.tabIndex>0?i.tabIndex:1/0))}function T(e,t){if(e.key!=="Tab")return;let n=A(t),r=e.composedPath()[0],i=n.indexOf(r);n.length?(i<0||e.shiftKey&&i===0||!e.shiftKey&&i===n.length-1)&&(e.preventDefault(),n[e.shiftKey?n.length-1:0]?.focus()):(e.preventDefault(),t.tabIndex=-1,t.focus())}var M={label:{type:"string",default:"Supprimer"},disabled:{type:"boolean",default:!1},mode:{type:"string",default:"typed",enum:["typed","hold"]},"confirmation-text":{type:"string",default:"SUPPRIMER"},"hold-duration":{type:"number",default:1500},description:{type:"string",default:"Cette action n\xE9cessite une confirmation explicite."},"heading-level":{type:"number",default:2,minimum:1,maximum:6},locale:{type:"string",default:"fr-CA"}},z=`/* Styles de base de toute tranche : repris de src/shared/base.styles.css d'Orchestre, aux r\xE8gles de la convention
|
|
2
|
+
(jetons --bythium-*, propri\xE9t\xE9s logiques, pas de !important, mouvement sous no-preference).
|
|
3
|
+
tools/wc.generate.ts les place devant la feuille de chaque tranche : m\xEAme cascade que l'ancien d\xE9p\xF4t. */
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
max-inline-size: 100%;
|
|
8
|
+
color: var(--bythium-text-primary);
|
|
9
|
+
font-family: var(--font-sans);
|
|
10
|
+
font-size: var(--font-size-base);
|
|
11
|
+
line-height: var(--line-height-base);
|
|
12
|
+
font-feature-settings: var(--font-features, normal);
|
|
13
|
+
letter-spacing: -0.006em;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
}
|
|
16
|
+
:host([hidden]) {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
/* D\xE9sactiv\xE9 : couleurs att\xE9nu\xE9es qui gardent 4,5:1 (texte) et 3:1 (contour), jamais d'opacit\xE9 sur l'h\xF4te, qui ferait
|
|
20
|
+
\xE9chouer le contraste du libell\xE9 et des textes voisins (axe, WC-R04). Une tranche peut pr\xE9ciser sa propre r\xE8gle. */
|
|
21
|
+
:host([disabled]) {
|
|
22
|
+
color: var(--bythium-text-muted);
|
|
23
|
+
}
|
|
24
|
+
*,
|
|
25
|
+
*::before,
|
|
26
|
+
*::after {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
button,
|
|
30
|
+
input,
|
|
31
|
+
a,
|
|
32
|
+
select,
|
|
33
|
+
textarea {
|
|
34
|
+
font: inherit;
|
|
35
|
+
color: inherit;
|
|
36
|
+
}
|
|
37
|
+
button,
|
|
38
|
+
a,
|
|
39
|
+
input {
|
|
40
|
+
touch-action: manipulation;
|
|
41
|
+
}
|
|
42
|
+
button {
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
button:disabled,
|
|
46
|
+
input:disabled {
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
}
|
|
49
|
+
button:disabled,
|
|
50
|
+
.control:disabled {
|
|
51
|
+
color: var(--bythium-text-muted);
|
|
52
|
+
}
|
|
53
|
+
/* Profil Linear : un bouton se lit par son fond et son libell\xE9, sa bordure reste d\xE9corative ; un champ garde un contour \xE0 3:1. */
|
|
54
|
+
button {
|
|
55
|
+
min-block-size: var(--control-height);
|
|
56
|
+
padding: 4px 10px;
|
|
57
|
+
border: 1px solid var(--bythium-border-subtle);
|
|
58
|
+
border-radius: var(--radius-control);
|
|
59
|
+
background-color: var(--bythium-surface-raised);
|
|
60
|
+
color: var(--bythium-text-primary);
|
|
61
|
+
font-size: var(--font-size-caption);
|
|
62
|
+
font-weight: var(--font-weight-medium);
|
|
63
|
+
}
|
|
64
|
+
.control {
|
|
65
|
+
min-block-size: var(--control-height);
|
|
66
|
+
padding: 4px 9px;
|
|
67
|
+
border: 1px solid var(--bythium-border-strong);
|
|
68
|
+
border-radius: var(--radius-control);
|
|
69
|
+
background-color: var(--bythium-surface-base);
|
|
70
|
+
color: var(--bythium-text-primary);
|
|
71
|
+
font-size: var(--font-size-base);
|
|
72
|
+
}
|
|
73
|
+
.control:hover:not(:disabled):not(:focus-visible) {
|
|
74
|
+
border-color: var(--bythium-text-muted);
|
|
75
|
+
}
|
|
76
|
+
button:hover:not(:disabled) {
|
|
77
|
+
background: color-mix(in oklch, var(--bythium-text-primary) 8%, var(--bythium-surface-raised));
|
|
78
|
+
}
|
|
79
|
+
button:active:not(:disabled) {
|
|
80
|
+
background: color-mix(in oklch, var(--bythium-text-primary) 12%, var(--bythium-surface-raised));
|
|
81
|
+
}
|
|
82
|
+
a {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: var(--space-2);
|
|
86
|
+
min-block-size: var(--target-touch-min);
|
|
87
|
+
color: var(--bythium-link);
|
|
88
|
+
text-decoration: underline;
|
|
89
|
+
text-underline-offset: 3px;
|
|
90
|
+
}
|
|
91
|
+
:where(button, input, a, select, textarea, [tabindex]):focus-visible {
|
|
92
|
+
outline: var(--focus-ring-width) solid var(--bythium-border-focus);
|
|
93
|
+
outline-offset: 1px;
|
|
94
|
+
}
|
|
95
|
+
input {
|
|
96
|
+
min-inline-size: 0;
|
|
97
|
+
max-inline-size: 100%;
|
|
98
|
+
accent-color: var(--bythium-brand-primary);
|
|
99
|
+
}
|
|
100
|
+
::placeholder {
|
|
101
|
+
color: var(--bythium-text-muted);
|
|
102
|
+
opacity: 1;
|
|
103
|
+
}
|
|
104
|
+
input[type='range'] {
|
|
105
|
+
min-block-size: var(--target-touch-min);
|
|
106
|
+
}
|
|
107
|
+
input[type='checkbox'],
|
|
108
|
+
input[type='radio'] {
|
|
109
|
+
inline-size: 16px;
|
|
110
|
+
block-size: 16px;
|
|
111
|
+
margin: 0;
|
|
112
|
+
}
|
|
113
|
+
label {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: var(--space-2);
|
|
117
|
+
font-size: var(--font-size-caption);
|
|
118
|
+
}
|
|
119
|
+
.field {
|
|
120
|
+
display: grid;
|
|
121
|
+
gap: var(--space-1-5);
|
|
122
|
+
}
|
|
123
|
+
.row {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-wrap: wrap;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: var(--space-2);
|
|
128
|
+
}
|
|
129
|
+
.sr-only {
|
|
130
|
+
position: absolute;
|
|
131
|
+
inline-size: 1px;
|
|
132
|
+
block-size: 1px;
|
|
133
|
+
padding: 0;
|
|
134
|
+
margin: -1px;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
clip-path: inset(50%);
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
border: 0;
|
|
139
|
+
}
|
|
140
|
+
/* A field inside a table whose column headers name its controls (bythium-slot-table labels="hidden") keeps its label
|
|
141
|
+
for assistive technologies only: the custom property inherits across the shadow boundaries down to the field. */
|
|
142
|
+
@container style(--bythium-field-labels: hidden) {
|
|
143
|
+
label[part=label][for],
|
|
144
|
+
legend[part=label] {
|
|
145
|
+
position: absolute;
|
|
146
|
+
inline-size: 1px;
|
|
147
|
+
block-size: 1px;
|
|
148
|
+
padding: 0;
|
|
149
|
+
margin: -1px;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
clip-path: inset(50%);
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
border: 0;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
.muted {
|
|
157
|
+
color: var(--bythium-text-muted);
|
|
158
|
+
}
|
|
159
|
+
.error {
|
|
160
|
+
color: var(--bythium-status-danger);
|
|
161
|
+
font-size: var(--font-size-base);
|
|
162
|
+
}
|
|
163
|
+
.primary {
|
|
164
|
+
border-color: var(--bythium-brand-primary);
|
|
165
|
+
background: var(--bythium-brand-primary);
|
|
166
|
+
color: var(--bythium-on-brand-primary);
|
|
167
|
+
box-shadow: inset 0 1px 0 0 color-mix(in oklch, var(--bythium-on-brand-primary) 16%, transparent);
|
|
168
|
+
}
|
|
169
|
+
.primary:hover:not(:disabled) {
|
|
170
|
+
background: var(--bythium-brand-primary-hover);
|
|
171
|
+
color: var(--bythium-on-brand-primary);
|
|
172
|
+
}
|
|
173
|
+
[aria-current],
|
|
174
|
+
[aria-selected='true'],
|
|
175
|
+
[aria-pressed='true'] {
|
|
176
|
+
border-color: var(--bythium-border-subtle);
|
|
177
|
+
background: var(--bythium-state-selected, var(--bythium-surface-raised));
|
|
178
|
+
}
|
|
179
|
+
slot {
|
|
180
|
+
max-inline-size: 100%;
|
|
181
|
+
}
|
|
182
|
+
/* Cible tactile de 44 px sans changer la taille visuelle (WC-R05, WC-D03) : classe \xAB target \xBB sur le contr\xF4le.
|
|
183
|
+
Le pseudo-\xE9l\xE9ment d\xE9borde du contr\xF4le de fa\xE7on sym\xE9trique, donc identique en ltr et en rtl. */
|
|
184
|
+
.target {
|
|
185
|
+
position: relative;
|
|
186
|
+
isolation: isolate;
|
|
187
|
+
}
|
|
188
|
+
/* Sous le contenu du contr\xF4le (z-index -1 dans son propre contexte d'empilement) : il ne masque jamais un enfant. */
|
|
189
|
+
.target::after {
|
|
190
|
+
content: '';
|
|
191
|
+
position: absolute;
|
|
192
|
+
z-index: -1;
|
|
193
|
+
inset-block: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
194
|
+
inset-inline: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
195
|
+
}
|
|
196
|
+
/* Rang\xE9es denses (H-05, WCAG 2.2 AA 2.5.8) : quand des zones de 44 px se chevaucheraient (points de pagination,
|
|
197
|
+
\xE9toiles, \xD7 d'\xE9tiquettes, lignes de cases, onglets serr\xE9s), la classe \xAB target-dense \xBB donne une zone d'au moins
|
|
198
|
+
24 px ; au pointeur grossier, elle revient \xE0 44 px (WC-D03). \xC0 poser \xE0 la place de \xAB target \xBB, sur le contr\xF4le. */
|
|
199
|
+
.target-dense {
|
|
200
|
+
position: relative;
|
|
201
|
+
isolation: isolate;
|
|
202
|
+
}
|
|
203
|
+
.target-dense::after {
|
|
204
|
+
content: '';
|
|
205
|
+
position: absolute;
|
|
206
|
+
z-index: -1;
|
|
207
|
+
inset-block: min(0px, calc((100% - 24px) / 2));
|
|
208
|
+
inset-inline: min(0px, calc((100% - 24px) / 2));
|
|
209
|
+
}
|
|
210
|
+
@media (pointer: coarse) {
|
|
211
|
+
.target-dense::after {
|
|
212
|
+
inset-block: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
213
|
+
inset-inline: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/* Transition pos\xE9e \xE0 l'arriv\xE9e du survol seulement : une bascule de th\xE8me ne s'anime pas, l'audit de contraste mesure l'\xE9tat final. */
|
|
217
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
218
|
+
button:hover:not(:disabled),
|
|
219
|
+
.control:hover:not(:disabled) {
|
|
220
|
+
transition:
|
|
221
|
+
background-color var(--duration-fast) var(--ease-standard),
|
|
222
|
+
border-color var(--duration-fast) var(--ease-standard);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
@media (prefers-contrast: more) {
|
|
226
|
+
button,
|
|
227
|
+
.control {
|
|
228
|
+
border-color: currentColor;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
@media (forced-colors: active) {
|
|
232
|
+
button,
|
|
233
|
+
input,
|
|
234
|
+
a {
|
|
235
|
+
border: 1px solid ButtonText;
|
|
236
|
+
}
|
|
237
|
+
:focus-visible {
|
|
238
|
+
outline-color: Highlight;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/* Densit\xE9 confortable sur les appareils tactiles ; focus explicite, jamais supprim\xE9. */
|
|
242
|
+
@media (pointer: coarse) {
|
|
243
|
+
button,
|
|
244
|
+
.control,
|
|
245
|
+
select {
|
|
246
|
+
min-block-size: var(--target-touch-min);
|
|
247
|
+
}
|
|
248
|
+
input[type='checkbox'],
|
|
249
|
+
input[type='radio'] {
|
|
250
|
+
inline-size: 20px;
|
|
251
|
+
block-size: 20px;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/* Action destructrice sobre : texte danger, fond transparent, bordure m\xEAl\xE9e. */
|
|
255
|
+
:host {
|
|
256
|
+
display: block;
|
|
257
|
+
inline-size: 100%;
|
|
258
|
+
min-inline-size: 0;
|
|
259
|
+
}
|
|
260
|
+
[part=base] {
|
|
261
|
+
border-radius: var(--radius-control);
|
|
262
|
+
color: var(--bythium-text-primary);
|
|
263
|
+
display: grid;
|
|
264
|
+
gap: 8px;
|
|
265
|
+
justify-items: start;
|
|
266
|
+
}
|
|
267
|
+
[hidden] {
|
|
268
|
+
display: none;
|
|
269
|
+
}
|
|
270
|
+
button {
|
|
271
|
+
display: inline-flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
padding: 0 10px;
|
|
275
|
+
line-height: 1;
|
|
276
|
+
white-space: nowrap;
|
|
277
|
+
vertical-align: top;
|
|
278
|
+
}
|
|
279
|
+
[part=trigger],[part=confirm] {
|
|
280
|
+
background: transparent;
|
|
281
|
+
color: var(--bythium-status-danger);
|
|
282
|
+
border-color: color-mix(in oklch,var(--bythium-status-danger) 30%,var(--bythium-border-subtle));
|
|
283
|
+
}
|
|
284
|
+
[part=confirm] {
|
|
285
|
+
font-weight: 600;
|
|
286
|
+
background: color-mix(in oklch,var(--bythium-status-danger) 10%,var(--bythium-surface-card));
|
|
287
|
+
}
|
|
288
|
+
[part=trigger]:hover:not(:disabled) {
|
|
289
|
+
background: color-mix(in oklch,var(--bythium-status-danger) 10%,var(--bythium-surface-base));
|
|
290
|
+
}
|
|
291
|
+
[part=confirm]:hover:not(:disabled),[part=confirm]:active:not(:disabled) {
|
|
292
|
+
background: color-mix(in oklch,var(--bythium-status-danger) 18%,var(--bythium-surface-card));
|
|
293
|
+
}
|
|
294
|
+
[part=confirm]:disabled,[part=trigger]:disabled {
|
|
295
|
+
background: transparent;
|
|
296
|
+
color: var(--bythium-text-muted);
|
|
297
|
+
border-color: var(--bythium-border-subtle);
|
|
298
|
+
font-weight: 500;
|
|
299
|
+
}
|
|
300
|
+
:host([disabled]) {
|
|
301
|
+
opacity: 1;
|
|
302
|
+
}
|
|
303
|
+
dialog {
|
|
304
|
+
color: var(--bythium-text-primary);
|
|
305
|
+
background: var(--bythium-surface-card);
|
|
306
|
+
border: 1px solid var(--bythium-border-subtle);
|
|
307
|
+
border-radius: var(--radius-lg);
|
|
308
|
+
box-shadow: var(--shadow-overlay);
|
|
309
|
+
inline-size: min(96vw,400px);
|
|
310
|
+
max-inline-size: min(96vw,400px);
|
|
311
|
+
padding: 20px;
|
|
312
|
+
}
|
|
313
|
+
dialog[open] {
|
|
314
|
+
display: grid;
|
|
315
|
+
gap: 12px;
|
|
316
|
+
}
|
|
317
|
+
dialog::backdrop {
|
|
318
|
+
background: color-mix(in oklch,var(--bythium-surface-page) 70%,transparent);
|
|
319
|
+
}
|
|
320
|
+
[part=title] {
|
|
321
|
+
overflow-wrap: anywhere;
|
|
322
|
+
font-size: 14px;
|
|
323
|
+
font-weight: 600;
|
|
324
|
+
letter-spacing: -.01em;
|
|
325
|
+
line-height: 1.4;
|
|
326
|
+
margin: 0;
|
|
327
|
+
}
|
|
328
|
+
p {
|
|
329
|
+
margin: 0;
|
|
330
|
+
color: var(--bythium-text-secondary);
|
|
331
|
+
}
|
|
332
|
+
dialog label {
|
|
333
|
+
display: block;
|
|
334
|
+
margin-block-end: 6px;
|
|
335
|
+
color: var(--bythium-text-secondary);
|
|
336
|
+
}
|
|
337
|
+
input {
|
|
338
|
+
inline-size: 100%;
|
|
339
|
+
min-inline-size: 0;
|
|
340
|
+
max-inline-size: 100%;
|
|
341
|
+
}
|
|
342
|
+
/* Progression du maintien peinte par les jetons : la barre native restait sans remplissage visible en th\xE8me sombre. */
|
|
343
|
+
progress {
|
|
344
|
+
appearance: none;
|
|
345
|
+
display: block;
|
|
346
|
+
inline-size: 100%;
|
|
347
|
+
block-size: 4px;
|
|
348
|
+
margin-block-start: 8px;
|
|
349
|
+
border: 0;
|
|
350
|
+
border-radius: 2px;
|
|
351
|
+
overflow: hidden;
|
|
352
|
+
accent-color: var(--bythium-status-danger);
|
|
353
|
+
background: color-mix(in oklch,var(--bythium-text-primary) 14%,var(--bythium-surface-card));
|
|
354
|
+
}
|
|
355
|
+
progress::-webkit-progress-bar {
|
|
356
|
+
background: color-mix(in oklch,var(--bythium-text-primary) 14%,var(--bythium-surface-card));
|
|
357
|
+
}
|
|
358
|
+
progress::-webkit-progress-value {
|
|
359
|
+
background: var(--bythium-status-danger);
|
|
360
|
+
}
|
|
361
|
+
progress::-moz-progress-bar {
|
|
362
|
+
background: var(--bythium-status-danger);
|
|
363
|
+
}
|
|
364
|
+
@media (forced-colors:active) {
|
|
365
|
+
progress {
|
|
366
|
+
appearance: auto;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
.actions {
|
|
370
|
+
display: flex;
|
|
371
|
+
flex-wrap: wrap;
|
|
372
|
+
justify-content: flex-end;
|
|
373
|
+
gap: 8px;
|
|
374
|
+
margin-block-start: 4px;
|
|
375
|
+
}
|
|
376
|
+
.muted,[part=hint] {
|
|
377
|
+
color: var(--bythium-text-muted);
|
|
378
|
+
font-size: 12px;
|
|
379
|
+
}
|
|
380
|
+
.error,[part=error] {
|
|
381
|
+
color: var(--bythium-status-danger);
|
|
382
|
+
}
|
|
383
|
+
[aria-invalid=true] {
|
|
384
|
+
border-color: var(--bythium-status-danger);
|
|
385
|
+
}
|
|
386
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
387
|
+
[part=trigger]:hover {
|
|
388
|
+
transition: background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard);
|
|
389
|
+
}
|
|
390
|
+
[part=cancel],[part=confirm] {
|
|
391
|
+
transition: none;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
`;var L=new Map;function D(e,t){let n=`${e}|${JSON.stringify(t)}`,r=L.get(n);return r||(r=new Intl.NumberFormat(e,t),L.set(n,r)),r}var p={opened:!1,typed:"",progress:0};function f(e){return Math.max(500,e.holdDuration)}function h(e,t){return e.confirmationText.trim()!==""&&t===e.confirmationText}var m={fr:{label:"Supprimer",description:"Cette action n\xE9cessite une confirmation explicite.",title:"Confirmer : {label}",typed:"Tapez \xAB {text} \xBB pour confirmer",hold:"Maintenez le bouton ou la touche Espace pendant {seconds} seconde(s). Rel\xE2cher annule le maintien.",progress:"Progression de la confirmation",cancel:"Annuler",confirm:"Confirmer",holdConfirm:"Maintenir pour confirmer"},en:{label:"Delete",description:"This action needs an explicit confirmation.",title:"Confirm: {label}",typed:"Type \u201C{text}\u201D to confirm",hold:"Hold the button or the Space key for {seconds} second(s). Releasing cancels the hold.",progress:"Confirmation progress",cancel:"Cancel",confirm:"Confirm",holdConfirm:"Hold to confirm"}};function S(e,t=p){let n=e.mode==="hold",r=t.opened&&!e.disabled,i=x(m,e.locale),s=e.label&&e.label!==m.fr.label?e.label:i.label;return[o("div",{part:"base"},o("button",{part:"trigger",class:"target",type:"button","data-trigger":!0,"aria-haspopup":"dialog","aria-controls":"confirmation","aria-expanded":String(r),disabled:e.disabled},s),o("dialog",{part:"dialog",id:"confirmation","aria-labelledby":"confirm-title","aria-describedby":"confirm-description"},g(e.headingLevel,{part:"title",id:"confirm-title"},l(i.title,{label:s})),o("p",{part:"description",id:"confirm-description"},e.description&&e.description!==m.fr.description?e.description:i.description),o("div",{hidden:n},o("label",{for:"confirmation-input"},l(i.typed,{text:e.confirmationText})),o("input",{part:"input",class:"control",id:"confirmation-input",autocomplete:"off",spellcheck:"false",value:t.typed,disabled:e.disabled})),o("div",{hidden:!n},o("p",{},l(i.hold,{seconds:D(k(e.locale),{}).format(f(e)/1e3)})),o("progress",{part:"progress",max:100,value:Math.round(t.progress),"aria-label":i.progress})),o("div",{class:"actions"},o("button",{part:"cancel",class:"target",type:"button","data-cancel":!0},i.cancel),o("button",{part:"confirm",class:"target",type:"button","data-confirm":!0,disabled:e.disabled||!n&&!h(e,t.typed)},n?i.holdConfirm:i.confirm))))]}var b=class extends y{static props=M;static css=z;static delegatesFocus=!0;#e=p;#r=null;#a=0;#s=!1;constructor(){super(),this.root.addEventListener("click",t=>{let n=t.target.closest("button");n?.hasAttribute("data-trigger")?this.#u():n?.hasAttribute("data-cancel")?this.#o():n?.hasAttribute("data-confirm")&&this.mode!=="hold"&&this.#c()}),this.root.addEventListener("input",t=>{!(t.target instanceof HTMLInputElement)||t.target.id!=="confirmation-input"||(this.#n({typed:t.target.value}),this.update())}),this.root.addEventListener("pointerdown",t=>{t.target.closest("[data-confirm]")&&this.#d()});for(let t of["pointerleave","blur"])this.root.addEventListener(t,n=>{n.target instanceof Element&&n.target.matches("[data-confirm]")&&this.#t()},!0);this.root.addEventListener("keydown",t=>{let n=t;if(!this.#e.opened)return;if(n.key==="Escape"){n.preventDefault(),this.#o();return}let r=this.#i;r&&T(n,r),n.target.closest("[data-confirm]")&&this.mode==="hold"&&(n.key===" "||n.key==="Enter")&&(n.preventDefault(),n.repeat||this.#d())}),this.root.addEventListener("keyup",t=>{[" ","Enter"].includes(t.key)&&this.#t()}),this.root.addEventListener("cancel",t=>{t.preventDefault(),this.#o()},!0),this.root.addEventListener("close",()=>{this.#i?.open||this.#o()},!0)}get#i(){return this.root.querySelector("dialog")}get#l(){return this.root.querySelector("[data-trigger]")}#n(t){this.#e={...this.#e,...t}}view(){return S(this.props,this.#e)}updated(){this.disabled&&this.#e.opened&&(this.#t(),this.#n({opened:!1}));let t=this.root.querySelector("#confirmation-input");t&&t.value!==this.#e.typed&&(t.value=this.#e.typed),u(this.#i,this.#e.opened,this.#l),this.#s&&this.#e.opened&&(this.#s=!1,this.root.querySelector(this.mode==="hold"?"[data-cancel]":"input")?.focus())}connected(){for(let t of["pointerup","pointercancel"])document.addEventListener(t,()=>this.#t(),{signal:this.signal});window.addEventListener("blur",()=>this.#t(),{signal:this.signal}),this.signal.addEventListener("abort",()=>this.#t()),u(this.#i,this.#e.opened,this.#l)}disconnected(){E(this.#i)}#u(){this.disabled||(this.#n({opened:!0,typed:"",progress:0}),this.#s=!0,this.update())}#m(){this.#t(),this.#n({opened:!1}),this.update()}#o(){this.#t(),this.#e.opened&&(this.#n({opened:!1}),this.emit("bythium-cancel",{reason:"annulation explicite"}),this.update())}#c(){if(this.disabled||!this.#e.opened)return;let t=this.mode==="hold"?"hold":"typed";t==="typed"&&!h(this.props,this.#e.typed)||(this.#m(),this.emit("bythium-confirm",{mode:t,confirmation:t==="typed"?this.confirmationText:"maintien explicite"}))}#d(){if(this.disabled||!this.#e.opened||this.mode!=="hold"||this.#r!==null)return;this.#a=performance.now();let t=f(this.props);this.#r=setInterval(()=>{let n=performance.now()-this.#a;this.#n({progress:Math.min(100,n/t*100)}),this.requestUpdate(),n>=t&&this.#c()},25)}#t(){this.#r!==null&&clearInterval(this.#r),this.#r=null,this.#a=0,this.#e.progress!==0&&(this.#n({progress:0}),this.requestUpdate())}};v("bythium-confirm-button",b);export{b as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var N="http://www.w3.org/2000/svg";var $=new Set(["script","style","iframe","object","embed","base","link","meta"]),D=new Set(["href","src","action","formaction","poster","xlink:href"]),z=new Set(["https","mailto","tel"]),A=/^[a-zA-Z][a-zA-Z0-9:._-]*$/;function b(e){let t=e.replace(/[\u0000-\u0020\u007f]/g,""),o=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(t);return o?z.has((o[1]??"").toLowerCase()):!t.startsWith("//")}function _(e,t={},...o){if(!A.test(e)||$.has(e.toLowerCase()))throw new Error(`view: forbidden tag <${e}>`);let n;if(Object.hasOwn(t,"key")){let{key:s,...a}=t;s!=null&&s!==!1&&(n=String(s)),t=a}for(let[s,a]of Object.entries(t)){let i=s.toLowerCase();if(!A.test(s)||i.startsWith("on")||i==="srcdoc"||i==="style")throw new Error(`view: forbidden attribute "${s}" on <${e}>`);if(D.has(i)&&typeof a=="string"&&!b(a))throw new Error(`view: unsafe URL in "${s}" on <${e}>`)}let r=[],l=s=>{for(let a of s)if(Array.isArray(a))l(a);else{if(a===!1||a==null||a==="")continue;typeof a=="string"&&typeof r.at(-1)=="string"?r[r.length-1]+=a:r.push(a)}};return l(o),n===void 0?{tag:e,attrs:t,children:r}:{tag:e,attrs:t,children:r,key:n}}function J(e,t={},...o){let n=Math.min(6,Math.max(1,Math.round(Number.isFinite(e)?e:2)));return _(`h${n}`,t,...o)}function m(e){return e==null||e===!1?null:e===!0?"":String(e)}var V=Object.freeze({slotted:Object.freeze(new Set),light:Object.freeze([]),id:""}),v=new WeakMap;function E(e,t){let o=n=>"light"in n&&"id"in n?n:{slotted:n.slotted,light:n.light??V.light,id:n.id??""};return v.set(e,typeof t=="function"?()=>o(t()):o(t)),e}function Q(e){let t=v.get(e);return typeof t=="function"?t():t??V}var w="h1,h2,h3,h4,h5,h6,bythium-heading,[role=heading]";var R=e=>(e??"").trim().replace(/\s+/g," ");function k(e){let t=new Set;for(let o of e)typeof o=="string"?o.trim()!==""&&t.add("default"):t.add(o.slot||"default");return t}var I=/^--[a-zA-Z][a-zA-Z0-9-]*$/,B=/^[a-zA-Z0-9 .,%#()+*\/-]*$/;function O(e){let t=[];for(let[o,n]of Object.entries(e)){if(n==null||n===!1)continue;if(!I.test(o))throw new Error(`view: "${o}" is not a custom property name`);if(typeof n=="number"&&!Number.isFinite(n))throw new Error(`view: "${o}" is not a finite number`);let r=String(n);if(!B.test(r)||/url\s*\(|image\s*\(|expression|attr\s*\(/i.test(r))throw new Error(`view: unsafe value for "${o}"`);t.push(`${o}:${r}`)}return t.length?`:host{${t.join(";")}}`:""}function F(e){return e==="tabindex"||e==="role"||e==="hidden"||e==="inert"||/^aria-[a-z]+$/.test(e)||/^data-[a-z][a-z0-9-]*$/.test(e)&&e!=="data-key"}function j(e){let t={};for(let[o,n]of Object.entries(e??{})){if(!F(o))throw new Error(`view: a host may not write "${o}" on a light child`);t[o]=m(n)}return t}var f=new WeakMap,H={dialog:["open"],details:["open"]},h=new WeakMap;function y(e,t){return typeof t=="string"?e.nodeType===3:e.nodeType===1&&e.localName===t.tag}function P(e,t,o){if(typeof t=="string"){e.nodeValue!==t&&(e.nodeValue=t);return}let n=e,r=H[t.tag],l=t.tag.includes("-");for(let s of n.getAttributeNames())r?.includes(s)&&!Object.hasOwn(t.attrs,s)||l&&s.startsWith("data-")&&!Object.hasOwn(t.attrs,s)||f.get(n)?.has(s)&&!Object.hasOwn(t.attrs,s)||m(t.attrs[s])===null&&n.removeAttribute(s);for(let[s,a]of Object.entries(t.attrs)){let i=m(a);i!==null&&n.getAttribute(s)!==i&&n.setAttribute(s,i)}S(n,t.children,o)}function U(e,t,o){if(typeof e=="string")return t.createTextNode(e);let n=e.tag==="svg"?N:o,r=n?t.createElementNS(n,e.tag):t.createElement(e.tag);return e.key!==void 0&&h.set(r,e.key),P(r,e,n),r}function G(e,t){let o=new Map,n=0;for(let i of t.values())o.set(i,n++);let r=[];for(let i of e){if(typeof i=="string"||i.key===void 0)continue;let u=t.get(i.key);u&&y(u,i)&&r.push(u)}let l=[],s=new Array(r.length).fill(-1);for(let i=0;i<r.length;i+=1){let u=o.get(r[i]),c=0,g=l.length;for(;c<g;){let d=c+g>>1;o.get(r[l[d]])<u?c=d+1:g=d}c>0&&(s[i]=l[c-1]),l[c]=i}let a=new Set;for(let i=l.at(-1)??-1;i>=0;i=s[i])a.add(r[i]);return new Set(r.filter(i=>!a.has(i)))}function Z(e,t,o){let n=e;if(typeof n.moveBefore=="function")try{n.moveBefore(t,o);return}catch{}e.insertBefore(t,o)}function x(e){if(e.nodeType!==1)return!1;let t=e.localName;return t==="style"||t==="link"&&e.getAttribute("rel")==="stylesheet"}function S(e,t,o=null){let n=e.ownerDocument??e,r=e.firstChild;for(;r&&x(r);)r=r.nextSibling;let l=new Set;for(let i of t)typeof i!="string"&&i.key!==void 0&&l.add(i.key);let s=new Map;if(l.size)for(let i=r;i;i=i.nextSibling){let u=h.get(i);u!==void 0&&s.set(u,i)}let a=s.size?G(t,s):null;for(let i of t){for(;r&&h.has(r);){let d=r.nextSibling;if(!l.has(h.get(r)))r.remove();else if(!a?.has(r))break;r=d}let u=typeof i=="string"?void 0:i.key,c=null;if(u!==void 0){let d=s.get(u);d&&y(d,i)?c=d:r&&!h.has(r)&&y(r,i)&&(c=r),s.delete(u)}else r&&!h.has(r)&&y(r,i)&&(c=r);let g=typeof i!="string"&&i.tag==="svg"?N:o;c?(c===r?r=r.nextSibling:Z(e,c,r),u!==void 0&&h.set(c,u),P(c,i,g)):e.insertBefore(U(i,n,o),r)}for(;r;){let i=r.nextSibling;r.remove(),r=i}}var q=new Set(["view","updated","before","after"]);function C(e){return q.has(p(e))}function p(e){return e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}function W(e,t){if(e.type==="boolean")return t!=null&&t!==!1;if(t==null||t===!1)return e.nullable?null:e.default;if(t===!0)return e.default;if(e.type==="number"){let n=Number(t);if(!Number.isFinite(n))return e.default;let r=e.minimum??-1/0,l=e.maximum??1/0;return n>=r&&n<=l?n:e.clamp?Math.min(l,Math.max(r,n)):e.default}let o=String(t);return(!e.enum||e.enum.includes(o))&&(e.format!=="url"||b(o))?o:e.default}function T(e,t){let o={};for(let[n,r]of Object.entries(e))o[p(n)]=W(r,t[n]);return o}var L=new Map;function K(e){let t=L.get(e);return t||(t=new CSSStyleSheet,t.replaceSync(e),L.set(e,t)),t}var M=class extends HTMLElement{static props={};static css="";static delegatesFocus=!1;static get observedAttributes(){return Object.keys(this.props)}root;#e=!1;#s=!1;#r=null;#o=null;#l="";#i=!1;#n=null;#t=null;constructor(){super();let t=this.constructor;this.root=this.shadowRoot??this.attachShadow({mode:"open",delegatesFocus:t.delegatesFocus});let o=[...this.root.children].filter(x),n=o.filter(r=>r.localName==="link");(n.length||!o.length)&&(this.root.adoptedStyleSheets=[K(t.css)]);for(let r of n)r.remove()}connectedCallback(){let t=this.constructor;for(let o of Object.keys(t.props)){if(C(o))continue;let n=p(o);if(Object.hasOwn(this,n)){let r=this,l=r[n];delete r[n],r[n]=l}}this.#e=!0,this.#t=null,this.update(),this.connected()}disconnectedCallback(){this.#e=!1,this.#n?.disconnect(),this.#n=null,this.#r?.abort(),this.#r=null,this.disconnected()}attributeChangedCallback(t,o,n){this.#e&&o!==n&&this.update()}get isConnectedElement(){return this.#e}get signal(){return this.#r??=new AbortController,this.#r.signal}connected(){}disconnected(){}get props(){let t=this.constructor,o={};for(let n of Object.keys(t.props))o[n]=this.getAttribute(n);return E(T(t.props,o),()=>this.context)}get slotted(){return this.#i=!0,this.#t??=this.#a(),this.#t}get context(){let t=()=>(this.#i=!0,this.lightChildren);return{slotted:this.slotted,get light(){return t()},id:this.id}}#a(){let t=[];for(let o of this.childNodes)o.nodeType===3?t.push(o.nodeValue??""):o.nodeType===1&&t.push({slot:o.getAttribute("slot")});return k(t)}#u(){this.#n||!this.#e||(this.#n=new MutationObserver(t=>{if(!t.some(l=>l.target===this||l.target.parentNode===this))return;let n=this.#t;this.#t=this.#a(),(!(n&&n.size===this.#t.size&&[...n].every(l=>this.#t?.has(l)))||t.some(l=>l.type==="childList"))&&this.requestUpdate()}),this.#n.observe(this,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}))}cssVars(){return{}}lightAttrs(t){return[]}get lightChildren(){return[...this.children].map((t,o)=>{let n=f.get(t),r={};for(let s of t.getAttributeNames())s!=="slot"&&s!=="data-key"&&!n?.has(s)&&(r[s]=t.getAttribute(s)??"");let l=t.matches(w)?t:t.querySelector(w);return{tag:t.localName,slot:t.getAttribute("slot")||"default",attrs:r,index:o,heading:R(l?.textContent)}})}#c(){let t=O(this.cssVars());t!==this.#l&&(this.#l=t,this.#o||(this.#o=new CSSStyleSheet,this.root.adoptedStyleSheets=[...this.root.adoptedStyleSheets,this.#o]),this.#o.replaceSync(t))}#d(){let t=[...this.children],o=this.lightAttrs(this.lightChildren);o.length&&(this.#i=!0),t.forEach((n,r)=>{let l=j(o[r]),s=f.get(n)??new Set;for(let i of s)(!Object.hasOwn(l,i)||l[i]===null)&&n.removeAttribute(i);let a=new Set;for(let[i,u]of Object.entries(l))u!==null&&(a.add(i),n.getAttribute(i)!==u&&n.setAttribute(i,u));a.size?f.set(n,a):f.delete(n)})}update(){S(this.root,this.view()),this.#c(),this.#d(),this.#i&&this.#u(),this.updated()}requestUpdate(){this.#s||(this.#s=!0,queueMicrotask(()=>{this.#s=!1,this.#e&&this.update()}))}updated(){}emit(t,o,n={}){return this.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,composed:!0,cancelable:n.cancelable===!0}))}};function rt(e,t){for(let[o,n]of Object.entries(t.props)){if(C(o))continue;let r=p(o);Object.hasOwn(t.prototype,r)||Object.defineProperty(t.prototype,r,{configurable:!0,enumerable:!0,get(){return this.props[r]},set(l){n.type==="boolean"?this.toggleAttribute(o,!!l):l==null?this.removeAttribute(o):this.setAttribute(o,String(l))}})}customElements.get(e)||customElements.define(e,t)}export{_ as a,J as b,Q as c,M as d,rt as e};
|