@sylwellsoftware/fray 0.6.0 → 0.7.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/README.md +164 -3
- package/dist/Components/component.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tab.d.ts +2 -0
- package/dist/Components/layout/tabpanel/tab.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tabline.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tabpanel.d.ts +9 -1
- package/dist/Components/layout/tabpanel/tabpanel.d.ts.map +1 -1
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts +0 -1
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Components/lineinputs/radio.d.ts +51 -0
- package/dist/Components/lineinputs/radio.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2065 -841
- package/dist/index.js.map +1 -1
- package/dist/{jsx-dev-runtime-CqunwZ8j.js → jsx-dev-runtime-Kf1Dhu-y.js} +277 -252
- package/dist/jsx-dev-runtime-Kf1Dhu-y.js.map +1 -0
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/routing/RouteLink.d.ts +17 -0
- package/dist/routing/RouteLink.d.ts.map +1 -0
- package/dist/routing/RouteQuery.d.ts +18 -0
- package/dist/routing/RouteQuery.d.ts.map +1 -0
- package/dist/routing/RouteScope.d.ts +17 -0
- package/dist/routing/RouteScope.d.ts.map +1 -0
- package/dist/routing/RouteValue.d.ts +18 -0
- package/dist/routing/RouteValue.d.ts.map +1 -0
- package/dist/routing/navigationAdapter.d.ts +33 -0
- package/dist/routing/navigationAdapter.d.ts.map +1 -0
- package/dist/routing/route.d.ts +64 -0
- package/dist/routing/route.d.ts.map +1 -0
- package/dist/routing/router.d.ts +109 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.d.ts.map +1 -1
- package/package.json +3 -3
- package/styles/structural.css +166 -34
- package/themes/dark.css +13 -1
- package/themes/java/theme.css +14 -2
- package/themes/light.css +13 -1
- package/themes/minimal/theme.css +14 -2
- package/themes/shiny/theme.css +95 -87
- package/dist/jsx-dev-runtime-CqunwZ8j.js.map +0 -1
package/themes/shiny/theme.css
CHANGED
|
@@ -3,27 +3,31 @@
|
|
|
3
3
|
@layer theme {
|
|
4
4
|
:where(:root:not([data-theme]), [data-theme="shiny"]) {
|
|
5
5
|
color-scheme: light;
|
|
6
|
-
--font-family:
|
|
7
|
-
--font-size: 0.
|
|
8
|
-
--line-height: 1.
|
|
9
|
-
--control-min-height:
|
|
10
|
-
--space-xs: 0.
|
|
11
|
-
--space-sm: 0.
|
|
12
|
-
--space-md:
|
|
13
|
-
--space-lg:
|
|
14
|
-
--radius-sm: 0.
|
|
15
|
-
--radius-md: 0.
|
|
16
|
-
--radius-lg: 0.
|
|
6
|
+
--font-family: Arial, Helvetica, sans-serif;
|
|
7
|
+
--font-size: 0.75rem;
|
|
8
|
+
--line-height: 1.2;
|
|
9
|
+
--control-min-height: 1.5rem;
|
|
10
|
+
--space-xs: 0.1875rem;
|
|
11
|
+
--space-sm: 0.375rem;
|
|
12
|
+
--space-md: 0.625rem;
|
|
13
|
+
--space-lg: 1rem;
|
|
14
|
+
--radius-sm: 0.125rem;
|
|
15
|
+
--radius-md: 0.1875rem;
|
|
16
|
+
--radius-lg: 0.25rem;
|
|
17
17
|
--motion-fast: 120ms;
|
|
18
18
|
|
|
19
|
-
--shiny-primary-gradient: linear-gradient(to bottom, var(--palette-primary-
|
|
20
|
-
--shiny-surface-gradient: linear-gradient(to
|
|
21
|
-
--shiny-
|
|
19
|
+
--shiny-primary-gradient: linear-gradient(to bottom, var(--palette-primary-900) 0%, var(--palette-primary) 65%, var(--palette-primary) 66%, var(--palette-primary-300) 100%);
|
|
20
|
+
--shiny-surface-gradient: linear-gradient(to top, var(--palette-neutral-50) 0.55rem, var(--palette-neutral-50) 0.8rem, var(--palette-neutral-200) 100%);
|
|
21
|
+
--shiny-surface-gradient-hover: linear-gradient(to bottom, var(--palette-neutral-50) 0.55rem, var(--palette-neutral-50) 0.8rem, var(--palette-neutral-200) 100%);
|
|
22
|
+
--shiny-list-gradient: linear-gradient(to bottom, var(--palette-neutral-600), var(--palette-neutral-800));
|
|
23
|
+
--shiny-highlight: radial-gradient(140% 75% at 30% 10%, color-mix(in oklch, var(--palette-light) 66%, transparent) 0 50%, transparent 51%);
|
|
24
|
+
--shiny-raised-shadow: inset 2px -2px 2px color-mix(in oklch, var(--palette-light) 48%, transparent), inset -2px 3px 3px -1px color-mix(in oklch, var(--palette-dark) 40%, transparent), -1px 1px 2px color-mix(in oklch, var(--palette-dark) 42%, transparent);
|
|
25
|
+
--shiny-control-shadow: inset 1px -1px 3px 1px color-mix(in oklch, var(--palette-light) 92%, transparent), inset 0 0 3px color-mix(in oklch, var(--palette-dark) 46%, transparent), -1px 1px 2px -1px color-mix(in oklch, var(--palette-dark) 46%, transparent);
|
|
22
26
|
|
|
23
27
|
--ui-background: var(--palette-neutral-50);
|
|
24
|
-
--ui-color: var(--palette-
|
|
28
|
+
--ui-color: var(--palette-primary-900);
|
|
25
29
|
--ui-border: 1px solid var(--palette-neutral-300);
|
|
26
|
-
--ui-shadow: 0
|
|
30
|
+
--ui-shadow: 0 1px 2.5px color-mix(in oklch, var(--palette-dark) 58%, transparent);
|
|
27
31
|
--focus-ring: 0 0 0 2px var(--palette-primary-400);
|
|
28
32
|
--focus-color: var(--palette-primary);
|
|
29
33
|
--error-color: var(--palette-red);
|
|
@@ -31,17 +35,17 @@
|
|
|
31
35
|
--success-color: var(--palette-green);
|
|
32
36
|
|
|
33
37
|
--panel-background: var(--palette-neutral-50);
|
|
34
|
-
--panel-color: var(--
|
|
38
|
+
--panel-color: var(--ui-color);
|
|
35
39
|
--panel-border: 1px solid var(--palette-neutral-300);
|
|
36
|
-
--panel-shadow: 0
|
|
37
|
-
--panel-radius:
|
|
40
|
+
--panel-shadow: 0 1px 2.5px color-mix(in oklch, var(--palette-dark) 58%, transparent);
|
|
41
|
+
--panel-radius: 0;
|
|
38
42
|
--dialog-shadow: 0 1.25rem 4rem color-mix(in oklch, var(--palette-dark) 35%, transparent);
|
|
39
43
|
--dialog-backdrop-background: color-mix(in oklch, var(--palette-dark) 55%, transparent);
|
|
40
44
|
|
|
41
|
-
--header-background: var(--shiny-primary-gradient);
|
|
45
|
+
--header-background: radial-gradient(140% 75% at 40% 15%, #fff2, #fff2 47%, #fff0 55%, #fff0), var(--shiny-primary-gradient);
|
|
42
46
|
--header-color: var(--palette-contrast-light);
|
|
43
47
|
--header-border: 0 solid transparent;
|
|
44
|
-
--header-shadow: 0 2px
|
|
48
|
+
--header-shadow: inset 2px -2px 2px 0 #fff7, inset -2px 3px 3px -1px #0006, -1px 1px 2px 0 #0005;
|
|
45
49
|
--section-header-background: var(--header-background);
|
|
46
50
|
--section-header-color: var(--header-color);
|
|
47
51
|
--section-header-border: var(--header-border);
|
|
@@ -49,18 +53,18 @@
|
|
|
49
53
|
--panel-header-background: var(--section-header-background);
|
|
50
54
|
--panel-header-color: var(--section-header-color);
|
|
51
55
|
--table-header-background: var(--palette-neutral-100);
|
|
52
|
-
--table-header-color: var(--
|
|
56
|
+
--table-header-color: var(--ui-color);
|
|
53
57
|
--dialog-header-background: var(--section-header-background);
|
|
54
58
|
--dialog-header-color: var(--section-header-color);
|
|
55
59
|
|
|
56
60
|
--button-background: var(--shiny-surface-gradient);
|
|
57
|
-
--button-background-hover:
|
|
61
|
+
--button-background-hover: var(--shiny-surface-gradient-hover);
|
|
58
62
|
--button-background-active: var(--shiny-primary-gradient);
|
|
59
63
|
--button-background-disabled: var(--palette-neutral-200);
|
|
60
|
-
--button-color: var(--
|
|
61
|
-
--button-border: 1px solid var(--palette-
|
|
62
|
-
--button-shadow:
|
|
63
|
-
--button-shadow-active:
|
|
64
|
+
--button-color: var(--ui-color);
|
|
65
|
+
--button-border: 1px solid var(--palette-light);
|
|
66
|
+
--button-shadow: -1px 1px 2px 1px color-mix(in oklch, var(--palette-dark) 50%, transparent), inset 0 1px 0 color-mix(in oklch, var(--palette-light) 72%, transparent);
|
|
67
|
+
--button-shadow-active: -1px 1px 2px 0 color-mix(in oklch, var(--palette-dark) 58%, transparent), inset 1px 1px 2px color-mix(in oklch, var(--palette-dark) 34%, transparent);
|
|
64
68
|
--toggle-button-background: var(--button-background);
|
|
65
69
|
--toggle-button-background-checked: var(--selection-background);
|
|
66
70
|
--tab-button-background: var(--button-background);
|
|
@@ -70,9 +74,9 @@
|
|
|
70
74
|
--table-header-button-background: var(--button-background);
|
|
71
75
|
|
|
72
76
|
--input-background: var(--palette-light);
|
|
73
|
-
--input-color: var(--
|
|
77
|
+
--input-color: var(--ui-color);
|
|
74
78
|
--input-border: 1px solid var(--palette-neutral-500);
|
|
75
|
-
--input-shadow:
|
|
79
|
+
--input-shadow: inset -1px 1px 3px -2px color-mix(in oklch, var(--palette-dark) 58%, transparent);
|
|
76
80
|
--input-background-disabled: var(--palette-neutral-200);
|
|
77
81
|
--input-color-disabled: var(--palette-neutral-700);
|
|
78
82
|
|
|
@@ -83,14 +87,14 @@
|
|
|
83
87
|
--table-row-alt-background: var(--palette-neutral-100);
|
|
84
88
|
--checkbox-box-background: var(--input-background);
|
|
85
89
|
--checkbox-box-background-checked: var(--selection-background);
|
|
86
|
-
--checkbox-box-border:
|
|
90
|
+
--checkbox-box-border: 0 solid transparent;
|
|
87
91
|
--checkbox-symbol-color: var(--selection-color);
|
|
88
92
|
--radio-background: var(--button-background);
|
|
89
93
|
--radio-background-checked: var(--selection-background);
|
|
90
94
|
--toolbar-background: var(--shiny-surface-gradient);
|
|
91
|
-
--toolbar-color: var(--
|
|
92
|
-
--toolbar-border:
|
|
93
|
-
--toolbar-shadow:
|
|
95
|
+
--toolbar-color: var(--ui-color);
|
|
96
|
+
--toolbar-border: 1px solid var(--palette-neutral-300);
|
|
97
|
+
--toolbar-shadow: 0 1px 2px color-mix(in oklch, var(--palette-dark) 30%, transparent);
|
|
94
98
|
--tabline-background: var(--palette-neutral-100);
|
|
95
99
|
--tab-active-background: var(--palette-neutral-50);
|
|
96
100
|
--progress-track-background: var(--palette-neutral-200);
|
|
@@ -123,7 +127,7 @@
|
|
|
123
127
|
--toggle-selected-bg: var(--selection-background);
|
|
124
128
|
--toggle-selected-text: var(--selection-color);
|
|
125
129
|
--panel-bg: var(--panel-background);
|
|
126
|
-
--panel-padding: var(--space-
|
|
130
|
+
--panel-padding: var(--space-sm);
|
|
127
131
|
--toolbar-bg: var(--toolbar-background);
|
|
128
132
|
--toolbar-radius: var(--radius-md);
|
|
129
133
|
--sectionheader-bg: var(--section-header-background);
|
|
@@ -160,6 +164,10 @@
|
|
|
160
164
|
user-select: none;
|
|
161
165
|
}
|
|
162
166
|
|
|
167
|
+
:where(button, .buttonlike, input, select, textarea, .inputlike, .inputshell, .selectshell, .checkboxshell, [role="checkbox"], [role="radio"], [role="tab"]) {
|
|
168
|
+
user-select: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
163
171
|
:where(button, .buttonlike):hover:not(:disabled, [aria-disabled="true"]) {
|
|
164
172
|
background: var(--button-background-hover);
|
|
165
173
|
}
|
|
@@ -196,7 +204,7 @@
|
|
|
196
204
|
background: var(--button-background);
|
|
197
205
|
}
|
|
198
206
|
|
|
199
|
-
:where(input, select, textarea, .inputlike) {
|
|
207
|
+
:where(input:not([type="checkbox"]), select, textarea, .inputlike) {
|
|
200
208
|
min-height: var(--control-min-height);
|
|
201
209
|
padding: var(--space-xs) var(--space-sm);
|
|
202
210
|
color: var(--input-color);
|
|
@@ -208,7 +216,7 @@
|
|
|
208
216
|
font: inherit;
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
:where(input, select, textarea, .inputlike):disabled,
|
|
219
|
+
:where(input:not([type="checkbox"]), select, textarea, .inputlike):disabled,
|
|
212
220
|
:where(.inputlike[aria-disabled="true"]) {
|
|
213
221
|
color: var(--input-color-disabled);
|
|
214
222
|
background: var(--input-background-disabled);
|
|
@@ -223,9 +231,31 @@
|
|
|
223
231
|
box-shadow: var(--input-shadow);
|
|
224
232
|
}
|
|
225
233
|
|
|
234
|
+
:where(.checkboxshell) {
|
|
235
|
+
color: var(--input-color);
|
|
236
|
+
background: var(--shiny-highlight), var(--shiny-surface-gradient);
|
|
237
|
+
border: var(--checkbox-box-border);
|
|
238
|
+
border-radius: var(--radius-sm);
|
|
239
|
+
box-shadow: var(--shiny-control-shadow);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
:where(input[type="checkbox"]:checked + .checkboxshell) {
|
|
243
|
+
color: var(--checkbox-symbol-color);
|
|
244
|
+
background: var(--shiny-highlight), var(--shiny-primary-gradient);
|
|
245
|
+
box-shadow: inset 0 0 3px color-mix(in oklch, var(--palette-primary-950) 72%, transparent), -1px 1px 2px -1px color-mix(in oklch, var(--palette-dark) 54%, transparent);
|
|
246
|
+
}
|
|
247
|
+
|
|
226
248
|
:where([role="checkbox"][aria-checked="true"] .inputshell) {
|
|
227
249
|
color: var(--checkbox-symbol-color);
|
|
228
|
-
background: var(--
|
|
250
|
+
background: var(--shiny-highlight), var(--shiny-primary-gradient);
|
|
251
|
+
box-shadow: inset 0 0 3px color-mix(in oklch, var(--palette-primary-950) 72%, transparent), -1px 1px 2px -1px color-mix(in oklch, var(--palette-dark) 54%, transparent);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:where(input[type="checkbox"]:disabled + .checkboxshell),
|
|
255
|
+
:where([role="checkbox"][aria-disabled="true"] .inputshell) {
|
|
256
|
+
color: var(--palette-neutral-600);
|
|
257
|
+
background: var(--palette-neutral-200);
|
|
258
|
+
box-shadow: inset 0 0 2px color-mix(in oklch, var(--palette-dark) 25%, transparent);
|
|
229
259
|
}
|
|
230
260
|
|
|
231
261
|
:where(.inputinner) {
|
|
@@ -258,9 +288,14 @@
|
|
|
258
288
|
color: var(--header-color);
|
|
259
289
|
background: var(--header-background);
|
|
260
290
|
border: var(--header-border);
|
|
291
|
+
border-radius: var(--radius-md);
|
|
261
292
|
box-shadow: var(--header-shadow);
|
|
262
293
|
}
|
|
263
294
|
|
|
295
|
+
:where(header, .headerlike) {
|
|
296
|
+
padding: var(--space-xs) var(--space-sm);
|
|
297
|
+
}
|
|
298
|
+
|
|
264
299
|
:where(th > button) {
|
|
265
300
|
color: var(--table-header-color);
|
|
266
301
|
background: var(--table-header-button-background);
|
|
@@ -341,13 +376,14 @@
|
|
|
341
376
|
--colored-dark: var(--palette-primary-dark);
|
|
342
377
|
--colored-contrast: var(--palette-contrast-light);
|
|
343
378
|
color: var(--colored-contrast);
|
|
344
|
-
background: var(--colored-base);
|
|
379
|
+
background: linear-gradient(to bottom, var(--colored-light) 0%, var(--colored-base) 65%, var(--colored-base) 65%, var(--colored-dark) 100%);
|
|
345
380
|
border-color: color-mix(in oklch, var(--colored-dark) 72%, currentColor);
|
|
381
|
+
box-shadow: inset 2px -2px 2px 0 #fff7, inset -2px 3px 3px -1px #0006, -1px 1px 2px 0 #0005;
|
|
346
382
|
}
|
|
347
383
|
|
|
348
384
|
:where(.coloredinner) {
|
|
349
385
|
color: var(--colored-contrast);
|
|
350
|
-
background:
|
|
386
|
+
background: transparent;
|
|
351
387
|
}
|
|
352
388
|
|
|
353
389
|
:where([aria-selected="true"], [aria-pressed="true"]) {
|
|
@@ -358,10 +394,13 @@
|
|
|
358
394
|
:where([role="tab"]) {
|
|
359
395
|
background: var(--tab-button-background);
|
|
360
396
|
border-radius: var(--radius-md) var(--radius-md) 0 0;
|
|
397
|
+
box-shadow: inset 0 -3px 3px -3px color-mix(in oklch, var(--palette-dark) 68%, transparent);
|
|
361
398
|
}
|
|
362
399
|
:where([role="tab"][aria-selected="true"]) {
|
|
363
400
|
color: var(--button-color);
|
|
364
401
|
background: var(--tab-button-background-active);
|
|
402
|
+
box-shadow: -1px -1px 2px color-mix(in oklch, var(--palette-dark) 35%, transparent);
|
|
403
|
+
transform: translateY(-2px);
|
|
365
404
|
}
|
|
366
405
|
:where([role="radio"]) { background: var(--toggle-button-background); }
|
|
367
406
|
:where([role="radio"][aria-checked="true"]) {
|
|
@@ -377,9 +416,26 @@
|
|
|
377
416
|
}
|
|
378
417
|
|
|
379
418
|
:where([role="option"], [role="treeitem"], tbody tr[tabindex]):hover {
|
|
419
|
+
color: var(--ui-color);
|
|
380
420
|
background: var(--row-hover-background);
|
|
381
421
|
}
|
|
382
422
|
|
|
423
|
+
:where([role="option"]:not([aria-selected="true"]):not(:hover)) {
|
|
424
|
+
margin: 2px;
|
|
425
|
+
color: var(--palette-contrast-light);
|
|
426
|
+
background: var(--shiny-list-gradient);
|
|
427
|
+
border: 1px solid var(--palette-neutral-600);
|
|
428
|
+
border-radius: var(--radius-md);
|
|
429
|
+
box-shadow: inset 1px 1px 2px color-mix(in oklch, var(--palette-light) 28%, transparent), -1px 1px 2px color-mix(in oklch, var(--palette-dark) 42%, transparent);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
:where([role="option"][aria-selected="true"]) {
|
|
433
|
+
margin: 2px;
|
|
434
|
+
border: 1px solid var(--palette-primary-700);
|
|
435
|
+
border-radius: var(--radius-md);
|
|
436
|
+
box-shadow: var(--shiny-raised-shadow);
|
|
437
|
+
}
|
|
438
|
+
|
|
383
439
|
:where([role="option"], [role="treeitem"], tbody tr[tabindex]):focus-visible {
|
|
384
440
|
outline: 2px solid var(--focus-color);
|
|
385
441
|
outline-offset: -2px;
|
|
@@ -412,54 +468,6 @@
|
|
|
412
468
|
}
|
|
413
469
|
}
|
|
414
470
|
|
|
415
|
-
:where(button, .buttonlike, [role="tab"], [role="radio"], [role="checkbox"]) {
|
|
416
|
-
position: relative;
|
|
417
|
-
isolation: isolate;
|
|
418
|
-
overflow: hidden;
|
|
419
|
-
transition: filter var(--motion-fast), transform var(--motion-fast);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
:where(.coloredlike, .coloredshell) {
|
|
423
|
-
background: linear-gradient(135deg, var(--colored-light), var(--colored-base) 55%, var(--colored-dark));
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
:where(.coloredinner) {
|
|
427
|
-
background: color-mix(in oklch, var(--colored-dark) 30%, transparent);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
:where(button, .buttonlike, [role="tab"], [role="radio"], [role="checkbox"])::before,
|
|
431
|
-
:where(header, th, .headerlike)::after,
|
|
432
|
-
:where(.inputshell)::before {
|
|
433
|
-
content: "";
|
|
434
|
-
position: absolute;
|
|
435
|
-
inset: 1px;
|
|
436
|
-
border-radius: inherit;
|
|
437
|
-
background: var(--shiny-highlight);
|
|
438
|
-
pointer-events: none;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
:where(button, .buttonlike, [role="tab"], [role="radio"], [role="checkbox"])::before {
|
|
442
|
-
z-index: -1;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
:where(header, .headerlike) {
|
|
446
|
-
position: relative;
|
|
447
|
-
isolation: isolate;
|
|
448
|
-
overflow: clip;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
:where(.inputshell) {
|
|
452
|
-
position: relative;
|
|
453
|
-
isolation: isolate;
|
|
454
|
-
overflow: hidden;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
:where(header, th, .headerlike)::after {
|
|
458
|
-
inset: 0;
|
|
459
|
-
z-index: -1;
|
|
460
|
-
border: 1px solid color-mix(in oklch, var(--palette-light) 22%, transparent);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
471
|
:where(.selectshell) > select {
|
|
464
472
|
appearance: none;
|
|
465
473
|
padding-inline-end: 2.25rem;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime-CqunwZ8j.js","sources":["../src/styling/baseStyleDefinitions.ts","../src/styling/styleRegistry.ts","../src/services.ts","../src/runtime.ts","../src/Components/component.ts","../src/jsx-runtime.ts"],"sourcesContent":["export type CSSDeclarations = Record<string, string>\nexport type CSSVariantMap = Record<string, CSSDeclarations>\nexport type BaseStyleDefinition = Record<string, string | CSSVariantMap>\n\nexport const baseStyleDefinitions = {\n after: {\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n 'pointer-events': 'none',\n },\n\n inputline: {\n display: 'flex',\n 'flex-flow': 'row nowrap',\n position: 'relative',\n 'min-height': 'var(--control-min-height, 2rem)',\n 'box-sizing': 'border-box',\n },\n\n input: {\n 'pointer-events': 'all',\n width: 'var(--input-width, 15rem)',\n 'box-sizing': 'border-box',\n 'white-space': 'nowrap',\n },\n\n inputlike: {\n 'pointer-events': 'all',\n 'box-sizing': 'border-box',\n 'white-space': 'nowrap',\n },\n\n labeledinput: {\n display: 'flex',\n 'flex-flow': 'row nowrap',\n 'align-items': 'center',\n gap: '.5em',\n },\n\n working: {\n display: 'inline',\n position: 'absolute',\n 'z-index': '1',\n margin: 'auto',\n animation: 'fray-placeholder-progress 0.8s linear infinite',\n 'background-repeat': 'repeat',\n 'background-size': '2rem 2rem',\n 'background-image': 'var(--working-background-image)',\n border: '0 solid transparent',\n 'border-radius': 'inherit',\n 'box-sizing': 'border-box',\n },\n\n uiline: {\n 'box-sizing': 'border-box',\n 'min-height': 'var(--control-min-height, 2rem)',\n cursor: 'pointer',\n 'user-select': 'none',\n },\n\n noselect: {\n 'user-select': 'var(--noselect-user-select)',\n 'cursor': 'var(--noselect-cursor)',\n },\n\n button: {\n 'box-sizing': 'border-box',\n cursor: 'default',\n 'user-select': 'none',\n variants: {\n ':disabled': {\n cursor: 'not-allowed',\n 'pointer-events': 'none',\n },\n },\n },\n\n} satisfies Record<string, BaseStyleDefinition>\n\nexport type BaseStyleName = keyof typeof baseStyleDefinitions\n","import {\n baseStyleDefinitions,\n} from './baseStyleDefinitions.js'\nimport type {\n BaseStyleDefinition,\n BaseStyleName,\n CSSDeclarations,\n CSSVariantMap,\n} from './baseStyleDefinitions.js'\n\nconst STYLE_ATTRIBUTE = 'data-fray-structural-styles'\nlet nextRegistryId = 1\n\n/** Application-scoped structural-style collection and injection. */\nexport class StyleRegistry {\n readonly id: string\n private readonly cssFragments = new Set<string>()\n private readonly baseStyleMap = new Map<BaseStyleName, Set<string>>()\n\n constructor(id: string = `runtime-${nextRegistryId++}`) {\n if (typeof id !== 'string') throw new TypeError('StyleRegistry id must be a string')\n this.id = id\n }\n\n registerCSS(css: string): this {\n if (typeof css !== 'string') throw new TypeError('Component CSS must be a string')\n if (css.trim().length > 0) this.cssFragments.add(css.trim())\n return this\n }\n\n registerBaseStyle(selector: string, styleNames: string | readonly string[]): this {\n if (typeof selector !== 'string' || selector.trim().length === 0) {\n throw new TypeError('Base style selector must be a non-empty string')\n }\n const names = typeof styleNames === 'string' ? [styleNames] : styleNames\n if (!Array.isArray(names)) {\n throw new TypeError('Base style names must be a string or array')\n }\n\n for (const name of names) {\n if (!Object.hasOwn(baseStyleDefinitions, name)) {\n throw new Error(`Unknown Fray base style: ${String(name)}`)\n }\n const styleName = name as BaseStyleName\n const selectors = this.baseStyleMap.get(styleName) ?? new Set<string>()\n selectors.add(selector.trim())\n this.baseStyleMap.set(styleName, selectors)\n }\n return this\n }\n\n generateRootCSS(): string {\n return `*, *::before, *::after {\n box-sizing: border-box;\n}\n\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after {\n scroll-behavior: auto !important;\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n\n@media (forced-colors: active) {\n :focus-visible {\n outline: 2px solid Highlight !important;\n outline-offset: 2px !important;\n }\n}`\n }\n\n generateBaseStyleCSS(): string {\n let generated = ''\n for (const [name, selectors] of this.baseStyleMap) {\n const {properties, variants} = splitDefinition(baseStyleDefinitions[name])\n const selectorList = [...selectors]\n generated += renderRule(name, selectorList, properties)\n for (const [variant, variantProperties] of Object.entries(variants)) {\n generated += renderRule(\n `${name}${variant}`,\n selectorList.map((selector) => appendVariant(selector, variant)),\n variantProperties,\n )\n }\n }\n return generated.trim()\n }\n\n generateCSS(): string {\n return [\n this.generateRootCSS(),\n this.generateBaseStyleCSS(),\n [...this.cssFragments].join('\\n\\n'),\n ].filter(Boolean).join('\\n\\n')\n }\n\n injectAll(targetDocument: Document = globalThis.document): HTMLStyleElement {\n if (targetDocument?.head == null) {\n throw new TypeError('StyleRegistry.injectAll requires a document with a head')\n }\n const selector = `style[${STYLE_ATTRIBUTE}=\"${escapeAttributeValue(this.id)}\"]`\n let style = targetDocument.head.querySelector<HTMLStyleElement>(selector)\n if (style == null) {\n style = targetDocument.createElement('style')\n style.setAttribute(STYLE_ATTRIBUTE, this.id)\n targetDocument.head.prepend(style)\n }\n const css = this.generateCSS()\n if (style.textContent !== css) style.textContent = css\n return style\n }\n\n reset(): void {\n this.cssFragments.clear()\n this.baseStyleMap.clear()\n }\n}\n\n/** Create an isolated registry for a configured Fray application runtime. */\nexport function createStyleRegistry(): StyleRegistry {\n return new StyleRegistry()\n}\n\n/** Backward-compatible structural styles for the default Fray runtime. */\nexport const styleRegistry = new StyleRegistry('')\n\nfunction splitDefinition(definition: BaseStyleDefinition): {\n properties: CSSDeclarations\n variants: CSSVariantMap\n} {\n const properties: CSSDeclarations = {}\n let variants: CSSVariantMap = {}\n for (const [property, value] of Object.entries(definition)) {\n if (property === 'variants') {\n if (typeof value !== 'object') {\n throw new TypeError('Base style variants must be declaration maps')\n }\n variants = value\n } else if (typeof value === 'string') {\n properties[property] = value\n } else {\n throw new TypeError(`Base style property ${property} must be a string`)\n }\n }\n return {properties, variants}\n}\n\nfunction renderRule(\n label: string,\n selectors: string[],\n properties: CSSDeclarations,\n): string {\n if (selectors.length === 0 || Object.keys(properties).length === 0) return ''\n const declarations = Object.entries(properties)\n .map(([property, value]) => ` ${property}: ${value};`)\n .join('\\n')\n return `/* ${label} */\\n${selectors.join(',\\n')} {\\n${declarations}\\n}\\n\\n`\n}\n\nfunction appendVariant(selector: string, variant: string): string {\n const pseudoElement = selector.indexOf('::')\n if (pseudoElement < 0) return `${selector}${variant}`\n return `${selector.slice(0, pseudoElement)}${variant}${selector.slice(pseudoElement)}`\n}\n\nfunction escapeAttributeValue(value: string): string {\n return value.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"')\n}\n","declare const serviceType: unique symbol\ndeclare const serviceProviderType: unique symbol\n\n/** Typed identity for one application service contract. */\nexport interface ServiceKey<TService> {\n readonly name: string\n readonly [serviceType]: TService\n}\n\n/** Read-only service access exposed to service factories. */\nexport interface ServiceResolver {\n has(key: ServiceKey<unknown>): boolean\n require<TService>(key: ServiceKey<TService>): TService\n}\n\nexport type ServiceFactory<TService> = (services: ServiceResolver) => TService\n\n/** Immutable registration for a lazily created, scope-shared service. */\nexport interface ServiceProvider<TService> {\n readonly key: ServiceKey<TService>\n readonly create: ServiceFactory<TService>\n readonly [serviceProviderType]: true\n}\n\nconst serviceKeys = new WeakSet<object>()\nconst serviceProviders = new WeakSet<object>()\n\n/** Declare a typed service identity without selecting an implementation. */\nexport function defineService<TService>(name: string): ServiceKey<TService> {\n if (typeof name !== 'string' || name.trim() === '') {\n throw new TypeError('Service name must be a non-empty string')\n }\n const key = Object.freeze({name: name.trim()}) as ServiceKey<TService>\n serviceKeys.add(key)\n return key\n}\n\n/** Select the factory for a service in one application composition root. */\nexport function provideService<TService>(\n key: ServiceKey<TService>,\n create: ServiceFactory<TService>,\n): ServiceProvider<TService> {\n assertServiceKey(key)\n if (typeof create !== 'function') {\n throw new TypeError(`Service provider \"${key.name}\" requires a factory function`)\n }\n const provider = Object.freeze({key, create}) as ServiceProvider<TService>\n serviceProviders.add(provider)\n return provider\n}\n\n/**\n * Explicit application service scope.\n *\n * Providers are fixed at construction. Each service is created lazily at most\n * once, shared inside this scope, and disposed in reverse creation order.\n */\nexport class ServiceScope implements ServiceResolver {\n private readonly providers = new Map<ServiceKey<unknown>, ServiceProvider<unknown>>()\n private readonly instances = new Map<ServiceKey<unknown>, unknown>()\n private readonly creationOrder: ServiceKey<unknown>[] = []\n private readonly resolving: ServiceKey<unknown>[] = []\n private disposed = false\n\n constructor(providers: readonly ServiceProvider<unknown>[] = []) {\n if (!Array.isArray(providers)) {\n throw new TypeError('ServiceScope providers must be an array')\n }\n for (const provider of providers) {\n assertServiceProvider(provider)\n if (this.providers.has(provider.key)) {\n throw new Error(`Service \"${provider.key.name}\" is registered more than once`)\n }\n this.providers.set(provider.key, provider)\n }\n }\n\n get isDisposed(): boolean {\n return this.disposed\n }\n\n has(key: ServiceKey<unknown>): boolean {\n this.assertActive()\n assertServiceKey(key)\n return this.providers.has(key)\n }\n\n require<TService>(key: ServiceKey<TService>): TService {\n this.assertActive()\n assertServiceKey(key)\n if (this.instances.has(key)) return this.instances.get(key) as TService\n\n const provider = this.providers.get(key) as ServiceProvider<TService> | undefined\n if (provider == null) throw new Error(`Service \"${key.name}\" is not registered`)\n\n const cycleStart = this.resolving.indexOf(key)\n if (cycleStart >= 0) {\n const cycle = [...this.resolving.slice(cycleStart), key]\n .map((entry) => entry.name)\n .join(' -> ')\n throw new Error(`Circular service dependency: ${cycle}`)\n }\n\n this.resolving.push(key)\n try {\n const instance = provider.create(this)\n this.instances.set(key, instance)\n this.creationOrder.push(key)\n return instance\n } finally {\n this.resolving.pop()\n }\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n const errors: unknown[] = []\n for (const key of [...this.creationOrder].reverse()) {\n const instance = this.instances.get(key)\n try {\n const dispose = readDispose(instance)\n if (dispose != null) dispose.call(instance)\n } catch (error) {\n errors.push(error)\n }\n }\n this.instances.clear()\n this.creationOrder.length = 0\n this.resolving.length = 0\n if (errors.length === 1) throw errors[0]\n if (errors.length > 1) {\n throw new AggregateError(errors, 'Several services failed during disposal')\n }\n }\n\n private assertActive(): void {\n if (this.disposed) throw new Error('ServiceScope has been disposed')\n }\n}\n\nexport function createServiceScope(\n providers: readonly ServiceProvider<unknown>[] = [],\n): ServiceScope {\n return new ServiceScope(providers)\n}\n\nfunction isServiceKey(value: unknown): value is ServiceKey<unknown> {\n return value != null\n && (typeof value === 'object' || typeof value === 'function')\n && serviceKeys.has(value as object)\n}\n\nfunction assertServiceKey(value: unknown): asserts value is ServiceKey<unknown> {\n if (!isServiceKey(value)) throw new TypeError('Expected a service key created by defineService()')\n}\n\nfunction assertServiceProvider(\n value: unknown,\n): asserts value is ServiceProvider<unknown> {\n if (value == null\n || (typeof value !== 'object' && typeof value !== 'function')\n || !serviceProviders.has(value as object)) {\n throw new TypeError('Expected a service provider created by provideService()')\n }\n}\n\nfunction readDispose(value: unknown): (() => void) | null {\n if (value == null || (typeof value !== 'object' && typeof value !== 'function')) return null\n const dispose = Reflect.get(value, 'dispose')\n return typeof dispose === 'function' ? dispose as () => void : null\n}\n","import type {\n Component,\n ComponentDependency,\n} from './Components/component.js'\nimport {\n createStyleRegistry,\n styleRegistry,\n} from './styling/styleRegistry.js'\nimport type {StyleRegistry} from './styling/styleRegistry.js'\nimport {ServiceScope, createServiceScope} from './services.js'\n\nconst RESERVED_CUSTOM_ELEMENT_NAMES = new Set([\n 'annotation-xml',\n 'color-profile',\n 'font-face',\n 'font-face-src',\n 'font-face-uri',\n 'font-face-format',\n 'font-face-name',\n 'missing-glyph',\n])\n\nexport interface FrayElementNameOptions {\n /** Namespace prepended to component host names. Defaults to `fray`. */\n prefix?: string | null\n /** Complete standards-valid tag names keyed by stable component host name. */\n overrides?: Readonly<Record<string, string>>\n}\n\nexport interface FrayRuntimeOptions {\n elementNames?: FrayElementNameOptions\n /** Service scope inherited by every component created or mounted here. */\n services?: ServiceScope\n}\n\n/** Immutable application scope for element naming and structural styles. */\nexport class FrayRuntime {\n readonly elementPrefix: string | null\n readonly elementNameOverrides: Readonly<Record<string, string>>\n readonly styleRegistry: StyleRegistry\n readonly services: ServiceScope\n\n constructor(\n options: FrayRuntimeOptions = {},\n registry: StyleRegistry = createStyleRegistry(),\n ) {\n if (options == null || typeof options !== 'object' || Array.isArray(options)) {\n throw new TypeError('FrayRuntime options must be an object')\n }\n const elementNames = options.elementNames ?? {}\n if (elementNames == null\n || typeof elementNames !== 'object'\n || Array.isArray(elementNames)) {\n throw new TypeError('Fray elementNames must be an object')\n }\n const prefix = elementNames.prefix === undefined ? 'fray' : elementNames.prefix\n if (prefix !== null) assertNamePart(prefix, 'Fray element prefix')\n\n const overrides = elementNames.overrides ?? {}\n if (overrides == null || typeof overrides !== 'object' || Array.isArray(overrides)) {\n throw new TypeError('Fray element-name overrides must be an object')\n }\n for (const [componentName, tagName] of Object.entries(overrides)) {\n assertNamePart(componentName, 'Fray component host name')\n assertCustomElementName(tagName)\n }\n\n this.elementPrefix = prefix\n this.elementNameOverrides = Object.freeze({...overrides})\n this.styleRegistry = registry\n this.services = options.services ?? createServiceScope()\n if (!(this.services instanceof ServiceScope)) {\n throw new TypeError('Fray services must be a ServiceScope')\n }\n }\n\n resolveElementName(hostName: string, standaloneHostName: string | null = null): string {\n assertNamePart(hostName, 'Fray component host name')\n const override = this.elementNameOverrides[hostName]\n const resolved = override\n ?? (this.elementPrefix == null\n ? standaloneHostName ?? hostName\n : `${this.elementPrefix}-${hostName}`)\n assertCustomElementName(resolved)\n return resolved\n }\n\n resolveHostSelector(\n selector: string,\n hostName: string,\n standaloneHostName: string | null = null,\n ): string {\n if (typeof selector !== 'string') throw new TypeError('Host selector must be a string')\n return selector.replaceAll('&', this.resolveElementName(hostName, standaloneHostName))\n }\n\n resolveHostCSS(\n cssText: string,\n hostName: string,\n standaloneHostName: string | null = null,\n ): string {\n if (typeof cssText !== 'string') throw new TypeError('Host CSS must be a string')\n return cssText.replaceAll('&', this.resolveElementName(hostName, standaloneHostName))\n }\n\n create<TArgs extends unknown[], TComponent extends Component>(\n componentType: new(...args: TArgs) => TComponent,\n ...args: TArgs\n ): TComponent {\n const component = new componentType(...args)\n component._setRuntime(this)\n return component\n }\n\n mount<TComponent extends Component>(\n component: TComponent,\n parent: ParentNode,\n before: Node | null = null,\n ): TComponent {\n component._setRuntime(this)\n component.mount(parent, before)\n return component\n }\n\n registerStyles(dependency: ComponentDependency): this {\n if (dependency == null || typeof dependency.registerStyles !== 'function') {\n throw new TypeError('registerStyles requires a Fray component dependency')\n }\n dependency.registerStyles(this)\n return this\n }\n\n injectStyles(targetDocument: Document = globalThis.document): HTMLStyleElement {\n return this.styleRegistry.injectAll(targetDocument)\n }\n}\n\nexport function createFrayRuntime(options: FrayRuntimeOptions = {}): FrayRuntime {\n return new FrayRuntime(options)\n}\n\n/** Runtime used by Component.new(), direct mount(), and the legacy styleRegistry export. */\nexport const defaultFrayRuntime = new FrayRuntime({}, styleRegistry)\n\nfunction assertNamePart(value: unknown, label: string): asserts value is string {\n if (typeof value !== 'string' || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(value)) {\n throw new TypeError(`${label} must be a lowercase kebab-case name`)\n }\n}\n\nfunction assertCustomElementName(value: unknown): asserts value is string {\n assertNamePart(value, 'Fray element name')\n if (!value.includes('-') || RESERVED_CUSTOM_ELEMENT_NAMES.has(value)) {\n throw new TypeError(`Fray element name must be a non-reserved name containing a hyphen: ${value}`)\n }\n}\n","import type {\n EventBubble,\n FetchStateValue,\n ReadableEmitter,\n} from '@sylwellsoftware/glue'\n\nimport {FrayRuntime, defaultFrayRuntime} from '../runtime.js'\nimport type {ServiceKey} from '../services.js'\n\nexport const Fragment = Symbol.for('@sylwellsoftware/fray.Fragment')\n\nexport type Key = string | number\n\nexport interface ComponentProps {\n key?: Key | null\n children?: FrayChild | readonly FrayChild[]\n class?: string | null\n className?: string | null\n [name: string]: unknown\n}\n\nexport type Ref<TNode extends Node = Node> =\n | ((value: TNode | null) => void)\n | {current: TNode | null}\n\nexport type FunctionComponent<TProps extends ComponentProps = ComponentProps> = (\n props: TProps,\n) => FrayChild\n\nexport type ComponentConstructor<\n TProps extends ComponentProps = ComponentProps,\n TInstance extends Component<TProps> = Component<TProps>,\n> = new(props: TProps) => TInstance\n\ntype AnyComponentConstructor = new(props?: never) => Component\ntype ConcreteComponentConstructor = new(...args: never[]) => Component\n\nexport type VNodeType<TProps extends ComponentProps = ComponentProps> =\n | string\n | typeof Fragment\n | ComponentConstructor<TProps>\n | FunctionComponent<TProps>\n\nexport interface VNode<TProps extends ComponentProps = ComponentProps> {\n readonly type: string | typeof Fragment | Function\n readonly key: Key | null\n readonly props: TProps & {children: NormalizedChild[]}\n}\n\nexport type FrayChild =\n | string\n | number\n | boolean\n | null\n | undefined\n | VNode\n | Component\n | ReadableEmitter<FrayChild, unknown>\n | readonly FrayChild[]\n\ntype NormalizedChild = string | number | VNode | Component | ReadableEmitter<FrayChild, unknown>\n\ndeclare const liveBindingBrand: unique symbol\n\n/** Explicitly subscribe a DOM or component property to an emitter's current value. */\nexport interface LiveBinding<TValue> {\n readonly emitter: ReadableEmitter<TValue, unknown>\n readonly [liveBindingBrand]: true\n}\n\n/** Minimal writable Glue contract used by native `bind:value` and `bind:checked`. */\nexport interface WritableEmitter<TValue, TError = unknown>\nextends ReadableEmitter<TValue, TError> {\n set(value: TValue, eventOrCause?: unknown): unknown\n}\n\nexport interface EmitterSnapshot<TValue, TError = unknown> {\n readonly value: TValue\n readonly fetchState: FetchStateValue\n readonly error: TError | null\n}\n\nexport type TemplateProps<TProps extends ComponentProps> = {\n [TName in keyof TProps]: TName extends 'key' | 'children'\n ? TProps[TName]\n : TProps[TName] | LiveBinding<Exclude<TProps[TName], undefined>>\n}\n\nexport type BaseStyleNames = string | readonly string[]\nexport type BaseStyles =\n | Readonly<Record<string, BaseStyleNames>>\n | ReadonlyArray<readonly [string, BaseStyleNames]>\n\nexport interface ComponentDependency {\n registerStyles(runtime?: FrayRuntime, seen?: Set<ComponentDependency>): void\n}\n\ninterface Watchable {\n subscribe(\n listener: (notification: {event: EventBubble<unknown> | null}) => void,\n options?: {emitCurrent?: boolean},\n ): () => void\n}\n\nconst liveBindingValues = new WeakSet<object>()\n\nconst BOOLEAN_ATTRIBUTES = new Set([\n 'allowFullScreen',\n 'async',\n 'autoFocus',\n 'autoPlay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formNoValidate',\n 'hidden',\n 'inert',\n 'loop',\n 'multiple',\n 'muted',\n 'noModule',\n 'noValidate',\n 'open',\n 'playsInline',\n 'readOnly',\n 'required',\n 'reversed',\n 'selected',\n])\n\nconst PROPERTY_PROPS = new Set([\n 'checked',\n 'defaultChecked',\n 'defaultValue',\n 'disabled',\n 'indeterminate',\n 'multiple',\n 'muted',\n 'readOnly',\n 'required',\n 'selected',\n 'selectedIndex',\n 'tabIndex',\n 'value',\n])\n\n/** Mark an emitter as a one-way live value for a DOM or component property. */\nexport function live<TValue>(emitter: ReadableEmitter<TValue, unknown>): LiveBinding<TValue> {\n assertReadableEmitter(emitter, 'live')\n const binding = Object.freeze({emitter}) as LiveBinding<TValue>\n liveBindingValues.add(binding)\n return binding\n}\n\n/** Build a Fray virtual node. */\nexport function h<TProps extends ComponentProps = ComponentProps>(\n type: VNodeType<TProps>,\n props: TemplateProps<TProps> | null = null,\n ...children: FrayChild[]\n): VNode<TProps> {\n const suppliedProps = props ?? {} as TemplateProps<TProps>\n if (typeof suppliedProps !== 'object' || Array.isArray(suppliedProps)) {\n throw new TypeError('VNode props must be an object or null')\n }\n const {\n children: propChildren,\n key = null,\n ...restProps\n } = suppliedProps\n return {\n type,\n key,\n props: {\n ...restProps,\n children: normalizeChildren([propChildren, children]),\n } as TProps & {children: NormalizedChild[]},\n }\n}\n\ntype LiveValue<TValue> = TValue | LiveBinding<Exclude<TValue, undefined>>\n\ntype AriaAttributes = {\n [TName in `aria-${string}`]?: LiveValue<string | number | boolean | null | undefined>\n}\n\ntype DataAttributes = {\n [TName in `data-${string}`]?: LiveValue<string | number | boolean | null | undefined>\n}\n\ninterface DOMEvents<TElement extends HTMLElement> {\n onClick?: ((event: MouseEvent & {currentTarget: TElement}) => void) | undefined\n onInput?: ((event: InputEvent & {currentTarget: TElement}) => void) | undefined\n onChange?: ((event: Event & {currentTarget: TElement}) => void) | undefined\n onKeyDown?: ((event: KeyboardEvent & {currentTarget: TElement}) => void) | undefined\n onKeyUp?: ((event: KeyboardEvent & {currentTarget: TElement}) => void) | undefined\n onFocus?: ((event: FocusEvent & {currentTarget: TElement}) => void) | undefined\n onBlur?: ((event: FocusEvent & {currentTarget: TElement}) => void) | undefined\n}\n\ntype FrayDOMProps<TElement extends HTMLElement> =\nOmit<ComponentProps, 'class' | 'className'>\n& DOMEvents<TElement>\n& AriaAttributes\n& DataAttributes\n& {\n class?: LiveValue<string | undefined>\n className?: LiveValue<string | undefined>\n for?: string | undefined\n htmlFor?: string | undefined\n ref?: Ref<TElement> | undefined\n style?: LiveValue<string | Record<string, string | number | null | undefined> | undefined>\n}\n\ntype LiveDOMProperties<TElement extends HTMLElement> = {\n [TName in keyof Omit<TElement, keyof ComponentProps | 'style' | 'children'>]?:\n LiveValue<TElement[TName] | undefined>\n}\n\ntype NativeValueBinding<TElement extends HTMLElement> =\n TElement extends HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement\n ? {'bind:value'?: WritableEmitter<string> | undefined}\n : {}\n\ntype NativeCheckedBinding<TElement extends HTMLElement> =\n TElement extends HTMLInputElement\n ? {'bind:checked'?: WritableEmitter<boolean> | undefined}\n : {}\n\nexport type FrayIntrinsicElements = {\n [TTag in keyof HTMLElementTagNameMap]: FrayDOMProps<HTMLElementTagNameMap[TTag]>\n & LiveDOMProperties<HTMLElementTagNameMap[TTag]>\n & NativeValueBinding<HTMLElementTagNameMap[TTag]>\n & NativeCheckedBinding<HTMLElementTagNameMap[TTag]>\n}\n\n/** Classic JSX type namespace for consumers configured with `jsxFactory: \"h\"`. */\nexport namespace h {\n export namespace JSX {\n export type Element = VNode | Component\n export interface ElementClass extends Component {}\n export interface ElementAttributesProperty {\n props: {}\n }\n export interface ElementChildrenAttribute {\n children: {}\n }\n export interface IntrinsicAttributes {\n key?: Key\n }\n export type LibraryManagedAttributes<_TComponent, TProps extends ComponentProps> =\n TemplateProps<TProps>\n export type IntrinsicElements = FrayIntrinsicElements\n }\n}\n\nexport function css(strings: TemplateStringsArray, ...values: unknown[]): string {\n return strings.reduce((result, string, index) =>\n result + string + String(values[index] ?? ''), '')\n}\n\nexport class Component<TProps extends ComponentProps = ComponentProps> {\n static dependencies: ComponentDependency[] = []\n static requiredServices: readonly ServiceKey<unknown>[] = []\n static css = ''\n static hostName: string | null = null\n static standaloneHostName: string | null = null\n\n static new<TConstructor extends ConcreteComponentConstructor>(\n this: TConstructor,\n ...args: ConstructorParameters<TConstructor>\n ): InstanceType<TConstructor> {\n const instance = new this(...args)\n if (!(instance instanceof Component)) {\n throw new TypeError('Component.new() requires a Component constructor')\n }\n return instance.mount() as InstanceType<TConstructor>\n }\n\n static get baseStyles(): unknown {\n return {}\n }\n\n static registerStyles(\n this: ComponentDependency & {\n css?: string\n baseStyles?: unknown\n dependencies?: ComponentDependency[]\n hostName?: string | null\n standaloneHostName?: string | null\n },\n runtime: FrayRuntime = defaultFrayRuntime,\n seen: Set<ComponentDependency> = new Set(),\n ): void {\n if (seen.has(this)) return\n seen.add(this)\n\n const hostName = this.hostName ?? null\n const standaloneHostName = this.standaloneHostName ?? null\n if (this.css) {\n runtime.styleRegistry.registerCSS(hostName == null\n ? this.css\n : runtime.resolveHostCSS(this.css, hostName, standaloneHostName))\n }\n const baseStyles = normalizeBaseStyles(this.baseStyles)\n for (const [selector, styleNames] of baseStyles) {\n runtime.styleRegistry.registerBaseStyle(hostName == null\n ? selector\n : runtime.resolveHostSelector(selector, hostName, standaloneHostName), styleNames)\n }\n for (const dependency of this.dependencies ?? []) {\n dependency.registerStyles(runtime, seen)\n }\n }\n\n props: TProps\n dom: ChildNode | null = null\n /** @internal */\n _rendered: RenderRecord | null = null\n /** @internal */\n readonly _childComponents = new Set<Component>()\n private initialized = false\n private mounted = false\n private destroyed = false\n private updating = false\n private updateRequested = false\n private readonly cleanupFunctions = new Set<() => void>()\n private readonly watched = new Map<Watchable, () => void>()\n private readonly renderReadSubscriptions = new Map<Watchable, () => void>()\n private collectingRenderReads: Set<Watchable> | null = null\n /** @internal */\n _runtime: FrayRuntime = defaultFrayRuntime\n\n constructor(props: TProps = {} as TProps) {\n if (props == null || typeof props !== 'object' || Array.isArray(props)) {\n throw new TypeError(`${this.constructor.name} props must be an object`)\n }\n this.props = props\n }\n\n /** One-time setup hook. Constructors must not subscribe or render. */\n initialize(): void {}\n\n render(): FrayChild {\n throw new Error(`${this.constructor.name} must implement render()`)\n }\n\n /** Render this component's configured custom host element. */\n protected host(props: ComponentProps | null = null, ...children: FrayChild[]): VNode {\n const componentType = this.constructor as typeof Component\n const hostName = componentType.hostName\n if (hostName == null) {\n throw new Error(`${this.constructor.name} does not declare a custom host name`)\n }\n return h(this._runtime.resolveElementName(\n hostName,\n componentType.standaloneHostName,\n ), {\n ...props,\n 'data-fray-component': hostName,\n }, ...children)\n }\n\n /** JSX component for this instance's runtime-configured custom host. */\n protected readonly Host: (props: ComponentProps) => VNode = ({\n children = [],\n ...props\n }) => this.host(props, children)\n\n /** @internal Assign an immutable application runtime before initialization or mounting. */\n _setRuntime(runtime: FrayRuntime): this {\n if (!(runtime instanceof FrayRuntime)) {\n throw new TypeError('Component runtime must be a FrayRuntime')\n }\n if (runtime === this._runtime) return this\n if (this.initialized || this.mounted || this._rendered != null) {\n throw new Error('Cannot change a component runtime after initialization')\n }\n this._runtime = runtime\n return this\n }\n\n mount(parent: ParentNode | null = null, before: Node | null = null): this {\n if (this.destroyed) throw new Error('Cannot mount a destroyed component')\n let mountedNow = false\n if (!this.initialized) {\n this.validateRequiredServices()\n this.initialized = true\n this.initialize()\n }\n if (!this.mounted) {\n this.mounted = true\n this.update()\n mountedNow = true\n }\n if (parent != null) {\n assertParentNode(parent)\n insertRecord(parent, this._rendered, before)\n }\n if (mountedNow) this.afterMount(this.dom)\n return this\n }\n\n attachTo(parent: ParentNode): this {\n this.mount(parent)\n return this\n }\n\n update(_event?: unknown): this {\n if (this.destroyed) return this\n if (!this.mounted) return this.mount()\n if (this.updating) {\n this.updateRequested = true\n return this\n }\n\n this.updating = true\n try {\n do {\n this.updateRequested = false\n const nextReads = new Set<Watchable>()\n this.collectingRenderReads = nextReads\n let nextVNode: NormalizedChild\n try {\n nextVNode = normalizeRoot(this.render())\n } finally {\n this.collectingRenderReads = null\n }\n this._rendered = patchRoot(this._rendered, nextVNode, this)\n this.dom = firstNode(this._rendered)\n this.reconcileRenderReads(nextReads)\n this.afterUpdate(this.dom)\n } while (this.updateRequested && !this.destroyed)\n } finally {\n this.updating = false\n }\n return this\n }\n\n setProps(nextProps: TProps): this {\n if (nextProps == null || typeof nextProps !== 'object' || Array.isArray(nextProps)) {\n throw new TypeError(`${this.constructor.name} props must be an object`)\n }\n this.props = nextProps\n if (this.mounted) this.update()\n return this\n }\n\n afterMount(_dom: ChildNode | null): void {}\n afterUpdate(_dom: ChildNode | null): void {}\n\n watch(...observables: Watchable[]): this {\n for (const observable of observables) {\n if (observable == null || typeof observable.subscribe !== 'function') {\n throw new TypeError('watch requires emitter-like values')\n }\n if (this.watched.has(observable)) continue\n const unsubscribe = observable.subscribe(({event}) => {\n if (this.mounted && !this.destroyed) this.update(event)\n }, {emitCurrent: false})\n this.watched.set(observable, unsubscribe)\n this.onCleanup(() => {\n unsubscribe()\n this.watched.delete(observable)\n })\n }\n return this\n }\n\n watchFutureValues(...observables: Watchable[]): this {\n return this.watch(...observables)\n }\n\n /** Read an emitter during render and rerender when that dependency changes. */\n read<TValue, TError>(emitter: ReadableEmitter<TValue, TError>): TValue {\n this.trackRenderRead(emitter)\n return emitter.get()\n }\n\n /** Read a Glue value, fetch state, and error as one tracked render dependency. */\n snapshot<TValue, TError>(\n emitter: ReadableEmitter<TValue, TError>,\n ): EmitterSnapshot<TValue, TError> {\n this.trackRenderRead(emitter)\n return Object.freeze({\n value: emitter.get(),\n fetchState: emitter.getFetchState(),\n error: emitter.getError(),\n })\n }\n\n onCleanup(cleanup: () => void): () => void {\n if (typeof cleanup !== 'function') throw new TypeError('cleanup must be a function')\n if (this.destroyed) {\n cleanup()\n return () => {}\n }\n this.cleanupFunctions.add(cleanup)\n let active = true\n return () => {\n if (!active) return\n active = false\n this.cleanupFunctions.delete(cleanup)\n cleanup()\n }\n }\n\n /** Resolve one explicitly declared application service from this component's runtime. */\n protected requireService<TService>(key: ServiceKey<TService>): TService {\n if (!this.initialized) {\n throw new Error('Components may resolve services during initialize() or later')\n }\n const componentType = this.constructor as typeof Component\n if (!componentType.requiredServices.includes(key)) {\n throw new Error(\n `${componentType.name} must declare service \"${key.name}\" in requiredServices`,\n )\n }\n return this._runtime.services.require(key)\n }\n\n listen<TEvent extends Event = Event>(\n target: EventTarget,\n type: string,\n listener: (event: TEvent) => void,\n options?: boolean | AddEventListenerOptions,\n ): this {\n if (target == null || typeof target.addEventListener !== 'function') {\n throw new TypeError('listen target must be an EventTarget')\n }\n const eventListener = listener as EventListener\n target.addEventListener(type, eventListener, options)\n this.onCleanup(() => target.removeEventListener(type, eventListener, options))\n return this\n }\n\n registerChild<TComponent extends Component>(component: TComponent): TComponent {\n if (!(component instanceof Component)) {\n throw new TypeError('registerChild requires a Component')\n }\n this._childComponents.add(component)\n return component\n }\n\n destroy(): void {\n if (this.destroyed) return\n this.destroyed = true\n this.mounted = false\n\n for (const cleanup of [...this.cleanupFunctions]) cleanup()\n this.cleanupFunctions.clear()\n this.watched.clear()\n for (const unsubscribe of this.renderReadSubscriptions.values()) unsubscribe()\n this.renderReadSubscriptions.clear()\n this.collectingRenderReads = null\n\n if (this._rendered) disposeRecord(this._rendered, true)\n this._rendered = null\n this.dom = null\n this._childComponents.clear()\n this.onDestroy()\n }\n\n private validateRequiredServices(): void {\n const componentType = this.constructor as typeof Component\n for (const key of componentType.requiredServices) {\n if (!this._runtime.services.has(key)) {\n throw new Error(`${componentType.name} requires unregistered service \"${key.name}\"`)\n }\n }\n }\n\n onDestroy(): void {}\n\n private trackRenderRead(emitter: ReadableEmitter<unknown, unknown>): void {\n assertReadableEmitter(emitter, 'Component.read')\n if (this.collectingRenderReads == null) {\n throw new Error('Component.read() and snapshot() may only be called during render()')\n }\n this.collectingRenderReads.add(emitter)\n }\n\n private reconcileRenderReads(nextReads: Set<Watchable>): void {\n for (const [emitter, unsubscribe] of this.renderReadSubscriptions) {\n if (nextReads.has(emitter)) continue\n unsubscribe()\n this.renderReadSubscriptions.delete(emitter)\n }\n for (const emitter of nextReads) {\n if (this.watched.has(emitter) || this.renderReadSubscriptions.has(emitter)) continue\n const unsubscribe = emitter.subscribe(({event}) => {\n if (this.mounted && !this.destroyed) this.update(event)\n }, {emitCurrent: false})\n this.renderReadSubscriptions.set(emitter, unsubscribe)\n }\n }\n}\n\ninterface RecordBase {\n readonly kind: string\n key: Key | null\n owner: Component\n}\n\ninterface TextRecord extends RecordBase {\n readonly kind: 'text'\n value: string | number\n node: Text\n}\n\ninterface EmitterRecord extends RecordBase {\n readonly kind: 'emitter'\n source: ReadableEmitter<FrayChild, unknown>\n start: Comment\n end: Comment\n child: RenderRecord\n unsubscribe: () => void\n}\n\ninterface LivePropRecord {\n source: ReadableEmitter<unknown, unknown>\n value: unknown\n unsubscribe: () => void\n}\n\ninterface NativeBindingRecord extends LivePropRecord {\n eventName: 'input' | 'change'\n listener: EventListener\n}\n\ninterface ElementRecord extends RecordBase {\n readonly kind: 'element'\n type: string\n node: HTMLElement\n props: ComponentProps\n listeners: Map<string, EventListener>\n liveProps: Map<string, LivePropRecord>\n nativeBindings: Map<string, NativeBindingRecord>\n ref: Ref<HTMLElement> | null\n children: RenderRecord[]\n}\n\ninterface FragmentRecord extends RecordBase {\n readonly kind: 'fragment'\n type: typeof Fragment\n start: Comment\n end: Comment\n children: RenderRecord[]\n}\n\ninterface ComponentRecord extends RecordBase {\n readonly kind: 'component'\n type: Function\n instance: Component\n prebuilt: boolean\n props: ComponentProps\n liveProps: Map<string, LivePropRecord>\n}\n\ninterface FunctionRecord extends RecordBase {\n readonly kind: 'function'\n type: FunctionComponent\n props: ComponentProps\n sourceProps: ComponentProps\n liveProps: Map<string, LivePropRecord>\n child: RenderRecord\n}\n\ntype RenderRecord =\n | TextRecord\n | EmitterRecord\n | ElementRecord\n | FragmentRecord\n | ComponentRecord\n | FunctionRecord\n\nfunction normalizeRoot(value: FrayChild): NormalizedChild {\n if (Array.isArray(value)) return h(Fragment, null, value)\n if (value == null || typeof value === 'boolean') return h(Fragment)\n return value as NormalizedChild\n}\n\nfunction normalizeChildren(values: FrayChild | readonly FrayChild[]): NormalizedChild[] {\n const normalized: NormalizedChild[] = []\n const visit = (value: FrayChild): void => {\n if (Array.isArray(value)) {\n for (const child of value) visit(child)\n } else if (value != null && typeof value !== 'boolean') {\n normalized.push(value as NormalizedChild)\n }\n }\n visit(values)\n return normalized\n}\n\nfunction createRecord(value: NormalizedChild, owner: Component): RenderRecord {\n if (typeof value === 'string' || typeof value === 'number') {\n return {\n kind: 'text',\n key: null,\n value,\n node: document.createTextNode(String(value)),\n owner,\n }\n }\n\n if (isReadableEmitter(value)) {\n const start = document.createComment('fray-emitter-start')\n const end = document.createComment('fray-emitter-end')\n const current = value.get()\n if (Object.is(current, value)) {\n throw new TypeError('A Fray emitter child cannot render itself')\n }\n const fragment = document.createDocumentFragment()\n fragment.append(start, end)\n const child = createRecord(normalizeRoot(current), owner)\n insertRecord(fragment, child, end)\n const record: EmitterRecord = {\n kind: 'emitter',\n key: null,\n source: value,\n start,\n end,\n child,\n unsubscribe: () => {},\n owner,\n }\n record.unsubscribe = value.subscribe(({value: nextValue}) => {\n if (Object.is(nextValue, value)) {\n throw new TypeError('A Fray emitter child cannot render itself')\n }\n record.child = patchRoot(record.child, normalizeRoot(nextValue), owner)\n }, {emitCurrent: false})\n return record\n }\n\n if (value instanceof Component) {\n value._setRuntime(owner._runtime)\n value.mount()\n owner.registerChild(value)\n return {\n kind: 'component',\n key: readKey(value.props),\n type: value.constructor,\n instance: value,\n prebuilt: true,\n props: value.props,\n liveProps: new Map(),\n owner,\n }\n }\n\n if (!isVNode(value)) {\n throw new TypeError(`Invalid Fray child: ${describeValue(value)}`)\n }\n\n const {type, key = null, props} = value\n if (type === Fragment) {\n const start = document.createComment('fray-fragment-start')\n const end = document.createComment('fray-fragment-end')\n const record: FragmentRecord = {\n kind: 'fragment',\n key,\n type,\n start,\n end,\n children: [],\n owner,\n }\n const fragment = document.createDocumentFragment()\n fragment.append(start, end)\n record.children = patchChildren(\n fragment,\n [],\n props.children,\n owner,\n end,\n start,\n )\n return record\n }\n\n if (typeof type === 'string') {\n const node = document.createElement(type)\n const record: ElementRecord = {\n kind: 'element',\n key,\n type,\n node,\n props: {},\n listeners: new Map(),\n liveProps: new Map(),\n nativeBindings: new Map(),\n ref: null,\n children: [],\n owner,\n }\n patchElementProps(record, props)\n record.children = patchChildren(node, [], props.children, owner)\n return record\n }\n\n if (isComponentClass(type)) {\n const sourceProps = props as ComponentProps\n const resolvedProps = resolveLivePropValues(sourceProps)\n const instance = new type(resolvedProps as never)\n instance._setRuntime(owner._runtime)\n const record: ComponentRecord = {\n kind: 'component',\n key,\n type,\n instance,\n prebuilt: false,\n props: resolvedProps,\n liveProps: new Map(),\n owner,\n }\n subscribeComponentLiveProps(record, sourceProps)\n instance.mount()\n owner.registerChild(instance)\n return record\n }\n\n if (typeof type === 'function') {\n const functionType = type as FunctionComponent\n const sourceProps = props as ComponentProps\n const functionProps = resolveLivePropValues(sourceProps)\n const rendered = normalizeRoot(functionType(functionProps))\n const record: FunctionRecord = {\n kind: 'function',\n key,\n type: functionType,\n props: functionProps,\n sourceProps,\n liveProps: new Map(),\n child: createRecord(rendered, owner),\n owner,\n }\n subscribeFunctionLiveProps(record)\n return record\n }\n\n throw new TypeError(`Unsupported vnode type: ${describeValue(type)}`)\n}\n\nfunction patchRoot(\n previous: RenderRecord | null,\n value: NormalizedChild,\n owner: Component,\n): RenderRecord {\n if (previous == null) return createRecord(value, owner)\n if (isCompatible(previous, value)) return patchCompatible(previous, value, owner)\n\n const next = createRecord(value, owner)\n const anchor = firstNode(previous)\n const parent = anchor?.parentNode ?? null\n if (parent) insertRecord(parent, next, anchor)\n disposeRecord(previous, true)\n return next\n}\n\nfunction patchCompatible(\n record: RenderRecord,\n value: NormalizedChild,\n owner: Component,\n): RenderRecord {\n if (record.kind === 'text') {\n if (typeof value !== 'string' && typeof value !== 'number') return record\n if (!Object.is(record.value, value)) {\n record.value = value\n record.node.data = String(value)\n }\n return record\n }\n\n if (record.kind === 'emitter') {\n if (!isReadableEmitter(value) || record.source !== value) return record\n return record\n }\n\n if (record.kind === 'component') {\n if (value instanceof Component) return record\n if (isVNode(value)) patchComponentLiveProps(record, value.props)\n return record\n }\n\n if (!isVNode(value)) return record\n\n if (record.kind === 'function') {\n patchFunctionLiveProps(record, value.props)\n return record\n }\n\n if (record.kind === 'fragment') {\n record.children = patchChildren(\n record.start.parentNode,\n record.children,\n value.props.children,\n owner,\n record.end,\n record.start,\n )\n return record\n }\n\n patchElementProps(record, value.props)\n record.children = patchChildren(\n record.node,\n record.children,\n value.props.children,\n owner,\n )\n return record\n}\n\nfunction resolveLivePropValues(sourceProps: ComponentProps): ComponentProps {\n return Object.fromEntries(Object.entries(sourceProps).map(([key, value]) => [\n key,\n isLiveBinding(value) ? value.emitter.get() : value,\n ]))\n}\n\nfunction subscribeComponentLiveProps(\n record: ComponentRecord,\n sourceProps: ComponentProps,\n): void {\n reconcileLiveProps(record.liveProps, sourceProps, (key, value) => {\n record.props = {...record.props, [key]: value}\n record.instance.setProps(record.props)\n })\n record.props = resolvedLiveProps(record.liveProps, sourceProps)\n record.instance.setProps(record.props)\n}\n\nfunction patchComponentLiveProps(record: ComponentRecord, sourceProps: ComponentProps): void {\n subscribeComponentLiveProps(record, sourceProps)\n}\n\nfunction subscribeFunctionLiveProps(record: FunctionRecord): void {\n reconcileLiveProps(record.liveProps, record.sourceProps, (key, value) => {\n record.props = {...record.props, [key]: value}\n rerenderFunctionRecord(record)\n })\n record.props = resolvedLiveProps(record.liveProps, record.sourceProps)\n}\n\nfunction patchFunctionLiveProps(record: FunctionRecord, sourceProps: ComponentProps): void {\n record.sourceProps = sourceProps\n reconcileLiveProps(record.liveProps, sourceProps, (key, value) => {\n record.props = {...record.props, [key]: value}\n rerenderFunctionRecord(record)\n })\n record.props = resolvedLiveProps(record.liveProps, sourceProps)\n rerenderFunctionRecord(record)\n}\n\nfunction rerenderFunctionRecord(record: FunctionRecord): void {\n const rendered = normalizeRoot(record.type(record.props))\n record.child = patchRoot(record.child, rendered, record.owner)\n}\n\nfunction reconcileLiveProps(\n subscriptions: Map<string, LivePropRecord>,\n sourceProps: ComponentProps,\n onValue: (key: string, value: unknown) => void,\n): void {\n for (const [key, existing] of subscriptions) {\n const next = sourceProps[key]\n if (isLiveBinding(next) && next.emitter === existing.source) continue\n existing.unsubscribe()\n subscriptions.delete(key)\n }\n\n for (const [key, value] of Object.entries(sourceProps)) {\n if (!isLiveBinding(value) || subscriptions.has(key)) continue\n const liveProp: LivePropRecord = {\n source: value.emitter,\n value: value.emitter.get(),\n unsubscribe: () => {},\n }\n liveProp.unsubscribe = value.emitter.subscribe(({value: nextValue}) => {\n if (subscriptions.get(key) !== liveProp) return\n liveProp.value = nextValue\n onValue(key, nextValue)\n }, {emitCurrent: false})\n subscriptions.set(key, liveProp)\n }\n}\n\nfunction resolvedLiveProps(\n subscriptions: Map<string, LivePropRecord>,\n sourceProps: ComponentProps,\n): ComponentProps {\n return Object.fromEntries(Object.entries(sourceProps).map(([key, value]) => [\n key,\n isLiveBinding(value) ? subscriptions.get(key)?.value ?? value.emitter.get() : value,\n ]))\n}\n\nfunction patchChildren(\n parent: ParentNode | null,\n previous: RenderRecord[],\n values: FrayChild | readonly FrayChild[],\n owner: Component,\n end: Node | null = null,\n start: Node | null = null,\n): RenderRecord[] {\n if (parent == null) throw new Error('Cannot patch a detached fragment range')\n const nextValues = normalizeChildren(values)\n const keyed = new Map<Key, RenderRecord>()\n const unkeyed: RenderRecord[] = []\n for (const record of previous) {\n if (record.key == null) unkeyed.push(record)\n else if (!keyed.has(record.key)) keyed.set(record.key, record)\n }\n\n const seenKeys = new Set<Key>()\n const retained = new Set<RenderRecord>()\n const nextRecords: RenderRecord[] = []\n let unkeyedIndex = 0\n\n for (const value of nextValues) {\n const key = valueKey(value)\n if (key != null) {\n if (seenKeys.has(key)) throw new Error(`Duplicate sibling key: ${String(key)}`)\n seenKeys.add(key)\n }\n const candidate = key == null\n ? unkeyed[unkeyedIndex++]\n : keyed.get(key)\n if (candidate && isCompatible(candidate, value)) {\n retained.add(candidate)\n nextRecords.push(patchCompatible(candidate, value, owner))\n } else {\n nextRecords.push(createRecord(value, owner))\n }\n }\n\n for (const record of previous) {\n if (!retained.has(record)) disposeRecord(record, true)\n }\n\n let cursor = start ? start.nextSibling : parent.firstChild\n for (const record of nextRecords) {\n for (const node of recordNodes(record)) {\n if (node === cursor) {\n cursor = cursor.nextSibling\n } else {\n parent.insertBefore(node, cursor ?? end)\n cursor = node.nextSibling\n }\n }\n }\n\n return nextRecords\n}\n\nfunction patchElementProps(record: ElementRecord, nextProps: ComponentProps): void {\n const {children: _nextChildren, ...next} = nextProps\n const previous = record.props\n const keys = new Set([...Object.keys(previous), ...Object.keys(next)])\n\n for (const property of ['value', 'checked'] as const) {\n if (Object.hasOwn(next, property) && Object.hasOwn(next, `bind:${property}`)) {\n throw new Error(`${property} and bind:${property} cannot be used together`)\n }\n }\n\n for (const key of keys) {\n const previousValue = previous[key]\n const nextValue = next[key]\n if (isNativeBindingProp(key)) {\n patchNativeBinding(record, key, nextValue)\n } else if (key === 'ref') {\n if (previousValue !== nextValue) patchRef(record, nextValue)\n } else if (isEventProp(key)) {\n patchEvent(record, key, nextValue)\n } else if (isLiveBinding(nextValue)) {\n patchLiveElementProp(record, key, nextValue)\n } else {\n const previousLive = record.liveProps.get(key)\n if (previousLive) {\n previousLive.unsubscribe()\n record.liveProps.delete(key)\n }\n const previousResolved = previousLive?.value ?? previousValue\n if (!Object.is(previousResolved, nextValue)) {\n patchDOMProp(record.node, key, previousResolved, nextValue)\n }\n }\n }\n record.props = {...next}\n}\n\nfunction patchLiveElementProp(\n record: ElementRecord,\n key: string,\n binding: LiveBinding<unknown>,\n): void {\n const existing = record.liveProps.get(key)\n if (existing?.source === binding.emitter) return\n\n existing?.unsubscribe()\n const value = binding.emitter.get()\n patchDOMProp(record.node, key, existing?.value ?? record.props[key], value)\n const liveProp: LivePropRecord = {\n source: binding.emitter,\n value,\n unsubscribe: () => {},\n }\n liveProp.unsubscribe = binding.emitter.subscribe(({value: nextValue}) => {\n const previousValue = liveProp.value\n liveProp.value = nextValue\n if (!Object.is(previousValue, nextValue)) {\n patchDOMProp(record.node, key, previousValue, nextValue)\n }\n }, {emitCurrent: false})\n record.liveProps.set(key, liveProp)\n}\n\nfunction patchNativeBinding(\n record: ElementRecord,\n key: 'bind:value' | 'bind:checked',\n next: unknown,\n): void {\n const property = key.slice(5) as 'value' | 'checked'\n const existing = record.nativeBindings.get(key)\n if (next == null) {\n if (existing) {\n existing.unsubscribe()\n record.node.removeEventListener(existing.eventName, existing.listener)\n record.nativeBindings.delete(key)\n patchDOMProp(record.node, property, existing.value, undefined)\n }\n return\n }\n assertWritableEmitter(next, key)\n if (existing?.source === next) return\n\n if (existing) {\n existing.unsubscribe()\n record.node.removeEventListener(existing.eventName, existing.listener)\n }\n assertNativeBindingTarget(record.node, property)\n const eventName = nativeBindingEvent(record.node, property)\n const value = next.get()\n patchDOMProp(record.node, property, existing?.value, value)\n const listener: EventListener = () => {\n next.set(Reflect.get(record.node, property), `${key} changed`)\n }\n const binding: NativeBindingRecord = {\n source: next,\n value,\n eventName,\n listener,\n unsubscribe: () => {},\n }\n binding.unsubscribe = next.subscribe(({value: nextValue}) => {\n const previousValue = binding.value\n binding.value = nextValue\n if (!Object.is(previousValue, nextValue)) {\n patchDOMProp(record.node, property, previousValue, nextValue)\n }\n }, {emitCurrent: false})\n record.node.addEventListener(eventName, listener)\n record.nativeBindings.set(key, binding)\n}\n\nfunction patchEvent(record: ElementRecord, key: string, next: unknown): void {\n const eventName = key.slice(2).toLowerCase()\n const registered = record.listeners.get(key)\n if (registered && registered !== next) {\n record.node.removeEventListener(eventName, registered)\n record.listeners.delete(key)\n }\n if (next != null && typeof next !== 'function') {\n throw new TypeError(`${key} must be a function or null`)\n }\n if (typeof next === 'function' && registered !== next) {\n const listener = next as EventListener\n record.node.addEventListener(eventName, listener)\n record.listeners.set(key, listener)\n }\n}\n\nfunction patchRef(record: ElementRecord, next: unknown): void {\n applyRef(record.ref, null)\n if (next != null && typeof next !== 'function' && typeof next !== 'object') {\n throw new TypeError('ref must be a function, object, or null')\n }\n record.ref = next as Ref<HTMLElement> | null\n applyRef(record.ref, record.node)\n}\n\nfunction patchDOMProp(\n node: HTMLElement,\n key: string,\n previous: unknown,\n next: unknown,\n): void {\n if (key === 'class' || key === 'className') {\n setAttribute(node, 'class', next)\n return\n }\n if (key === 'for' || key === 'htmlFor') {\n setAttribute(node, 'for', next)\n return\n }\n if (key === 'dataset') {\n patchDataset(node, previous, next)\n return\n }\n if (key === 'style') {\n patchStyle(node, previous, next)\n return\n }\n if (key === 'dangerouslySetInnerHTML') {\n throw new Error('dangerouslySetInnerHTML is not supported')\n }\n\n const property = normalizePropertyName(key)\n if (BOOLEAN_ATTRIBUTES.has(property)) {\n const enabled = Boolean(next)\n if (property in node) Reflect.set(node, property, enabled)\n node.toggleAttribute(normalizeAttributeName(key), enabled)\n return\n }\n if (PROPERTY_PROPS.has(property) && property in node) {\n const value = next ?? (property === 'value' ? '' : false)\n if (!Object.is(Reflect.get(node, property), value)) Reflect.set(node, property, value)\n if (next == null) node.removeAttribute(normalizeAttributeName(key))\n return\n }\n\n setAttribute(node, normalizeAttributeName(key), next)\n}\n\nfunction patchDataset(node: HTMLElement, previous: unknown, next: unknown): void {\n const oldValues = toPropertyRecord(previous, 'dataset')\n const newValues = toPropertyRecord(next, 'dataset')\n for (const key of new Set([...Object.keys(oldValues), ...Object.keys(newValues)])) {\n const value = newValues[key]\n if (value == null) delete node.dataset[key]\n else node.dataset[key] = String(value)\n }\n}\n\nfunction patchStyle(node: HTMLElement, previous: unknown, next: unknown): void {\n if (typeof next === 'string') {\n node.style.cssText = next\n return\n }\n const oldValues = typeof previous === 'string'\n ? {}\n : toPropertyRecord(previous, 'style')\n const newValues = toPropertyRecord(next, 'style')\n if (typeof previous === 'string') node.style.cssText = ''\n for (const key of new Set([...Object.keys(oldValues), ...Object.keys(newValues)])) {\n const value = newValues[key]\n if (key.startsWith('--')) {\n if (value == null) node.style.removeProperty(key)\n else node.style.setProperty(key, String(value))\n } else {\n Reflect.set(node.style, key, value == null ? '' : String(value))\n }\n }\n}\n\nfunction toPropertyRecord(value: unknown, label: string): Record<string, unknown> {\n if (value == null) return {}\n if (typeof value !== 'object' || Array.isArray(value)) {\n throw new TypeError(`${label} must be an object or null`)\n }\n return value as Record<string, unknown>\n}\n\nfunction setAttribute(node: HTMLElement, name: string, value: unknown): void {\n if (value == null || value === false) node.removeAttribute(name)\n else if (value === true) node.setAttribute(name, '')\n else node.setAttribute(name, String(value))\n}\n\nfunction normalizePropertyName(key: string): string {\n if (key === 'readonly') return 'readOnly'\n if (key === 'autofocus') return 'autoFocus'\n return key\n}\n\nfunction normalizeAttributeName(key: string): string {\n if (key === 'className') return 'class'\n if (key === 'htmlFor') return 'for'\n if (/^aria[A-Z]/.test(key)) return camelToKebab(key)\n if (/^data[A-Z]/.test(key)) return camelToKebab(key)\n return key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n}\n\nfunction camelToKebab(value: string): string {\n return value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n}\n\nfunction applyRef<TNode extends Node>(ref: Ref<TNode> | null, value: TNode | null): void {\n if (ref == null) return\n if (typeof ref === 'function') ref(value)\n else ref.current = value\n}\n\nfunction disposeRecord(record: RenderRecord, removeNodes: boolean): void {\n if (record.kind === 'emitter') {\n record.unsubscribe()\n disposeRecord(record.child, false)\n if (removeNodes) {\n for (const node of recordNodes(record)) node.remove()\n }\n return\n }\n if (record.kind === 'component') {\n for (const binding of record.liveProps.values()) binding.unsubscribe()\n record.liveProps.clear()\n record.owner._childComponents.delete(record.instance)\n record.instance.destroy()\n return\n }\n if (record.kind === 'function') {\n for (const binding of record.liveProps.values()) binding.unsubscribe()\n record.liveProps.clear()\n disposeRecord(record.child, removeNodes)\n return\n }\n if (record.kind === 'element') {\n applyRef(record.ref, null)\n for (const [key, listener] of record.listeners) {\n record.node.removeEventListener(key.slice(2).toLowerCase(), listener)\n }\n record.listeners.clear()\n for (const binding of record.liveProps.values()) binding.unsubscribe()\n record.liveProps.clear()\n for (const binding of record.nativeBindings.values()) {\n binding.unsubscribe()\n record.node.removeEventListener(binding.eventName, binding.listener)\n }\n record.nativeBindings.clear()\n for (const child of record.children) disposeRecord(child, false)\n if (removeNodes) record.node.remove()\n return\n }\n if (record.kind === 'fragment') {\n for (const child of record.children) disposeRecord(child, false)\n if (removeNodes) {\n for (const node of recordNodes(record)) node.remove()\n }\n return\n }\n if (removeNodes) record.node.remove()\n}\n\nfunction insertRecord(parent: ParentNode, record: RenderRecord | null, before: Node | null = null): void {\n if (record == null) return\n for (const node of recordNodes(record)) parent.insertBefore(node, before)\n}\n\nfunction recordNodes(record: RenderRecord | null): ChildNode[] {\n if (record == null) return []\n if (record.kind === 'text' || record.kind === 'element') return [record.node]\n if (record.kind === 'component') return recordNodes(record.instance._rendered)\n if (record.kind === 'function') return recordNodes(record.child)\n\n const nodes: ChildNode[] = []\n let node: ChildNode | null = record.start\n while (node) {\n nodes.push(node)\n if (node === record.end) break\n node = node.nextSibling\n }\n return nodes\n}\n\nfunction firstNode(record: RenderRecord | null): ChildNode | null {\n return recordNodes(record)[0] ?? null\n}\n\nfunction valueKey(value: NormalizedChild): Key | null {\n if (value instanceof Component) return readKey(value.props)\n return isVNode(value) ? value.key : null\n}\n\nfunction readKey(props: ComponentProps): Key | null {\n const key = props.key\n return typeof key === 'string' || typeof key === 'number' ? key : null\n}\n\nfunction isCompatible(record: RenderRecord, value: NormalizedChild): boolean {\n if (record.kind === 'text') {\n return typeof value === 'string' || typeof value === 'number'\n }\n if (record.kind === 'emitter') {\n return isReadableEmitter(value) && record.source === value\n }\n if (record.kind === 'component') {\n if (value instanceof Component) return record.instance === value\n return isVNode(value)\n && isComponentClass(value.type)\n && record.type === value.type\n && record.key === valueKey(value)\n }\n if (record.kind === 'function') {\n return isVNode(value)\n && record.type === value.type\n && record.key === valueKey(value)\n }\n if (record.kind === 'fragment') {\n return isVNode(value)\n && value.type === Fragment\n && record.key === valueKey(value)\n }\n return isVNode(value)\n && typeof value.type === 'string'\n && record.type === value.type\n && record.key === valueKey(value)\n}\n\nexport function isVNode(value: unknown): value is VNode {\n return value != null\n && typeof value === 'object'\n && Object.hasOwn(value, 'type')\n}\n\nfunction isComponentClass(value: unknown): value is AnyComponentConstructor {\n return typeof value === 'function'\n && (value === Component || value.prototype instanceof Component)\n}\n\nfunction isEventProp(key: string): boolean {\n return /^on[A-Z]/.test(key)\n}\n\nfunction isNativeBindingProp(key: string): key is 'bind:value' | 'bind:checked' {\n return key === 'bind:value' || key === 'bind:checked'\n}\n\nfunction isLiveBinding(value: unknown): value is LiveBinding<unknown> {\n return value != null\n && typeof value === 'object'\n && liveBindingValues.has(value)\n}\n\nfunction isReadableEmitter(value: unknown): value is ReadableEmitter<FrayChild, unknown> {\n if ((typeof value !== 'object' || value == null) && typeof value !== 'function') return false\n return typeof Reflect.get(value, 'get') === 'function'\n && typeof Reflect.get(value, 'getFetchState') === 'function'\n && typeof Reflect.get(value, 'getError') === 'function'\n && typeof Reflect.get(value, 'subscribe') === 'function'\n}\n\nfunction assertReadableEmitter(\n value: unknown,\n label: string,\n): asserts value is ReadableEmitter<unknown, unknown> {\n if (!isReadableEmitter(value)) throw new TypeError(`${label} requires a readable emitter`)\n}\n\nfunction assertWritableEmitter(\n value: unknown,\n label: string,\n): asserts value is WritableEmitter<unknown, unknown> {\n assertReadableEmitter(value, label)\n if (typeof Reflect.get(value, 'set') !== 'function') {\n throw new TypeError(`${label} requires a writable emitter`)\n }\n}\n\nfunction assertNativeBindingTarget(\n node: HTMLElement,\n property: 'value' | 'checked',\n): void {\n const tagName = node.localName\n const valid = property === 'checked'\n ? tagName === 'input'\n : tagName === 'input' || tagName === 'textarea' || tagName === 'select'\n if (!valid) throw new TypeError(`bind:${property} is not supported on ${tagName}`)\n}\n\nfunction nativeBindingEvent(\n node: HTMLElement,\n property: 'value' | 'checked',\n): 'input' | 'change' {\n return property === 'value' && node.localName !== 'select' ? 'input' : 'change'\n}\n\nfunction assertParentNode(value: unknown): asserts value is ParentNode {\n if (value == null\n || (typeof value !== 'object' && typeof value !== 'function')\n || typeof Reflect.get(value, 'insertBefore') !== 'function') {\n throw new TypeError('Component parent must be a DOM ParentNode')\n }\n}\n\nfunction describeValue(value: unknown): string {\n try {\n return String(value)\n } catch {\n return Object.prototype.toString.call(value)\n }\n}\n\nfunction normalizeBaseStyles(value: unknown): Array<[string, BaseStyleNames]> {\n if (value == null) return []\n if (Array.isArray(value)) {\n return value.map((entry) => {\n if (!Array.isArray(entry) || entry.length < 2 || typeof entry[0] !== 'string') {\n throw new TypeError('Component baseStyles entries must be selector/style tuples')\n }\n const names = entry[1]\n if (typeof names !== 'string'\n && (!Array.isArray(names) || names.some((name) => typeof name !== 'string'))) {\n throw new TypeError('Component base style names must be strings')\n }\n return [entry[0], names as BaseStyleNames]\n })\n }\n if (typeof value !== 'object') {\n throw new TypeError('Component baseStyles must be an object or tuple array')\n }\n return Object.entries(value).map(([selector, names]) => [\n selector,\n names as BaseStyleNames,\n ])\n}\n","import {\n Component,\n Fragment,\n h,\n} from './Components/component.js'\nimport type {\n ComponentProps,\n FrayIntrinsicElements,\n FrayChild,\n Key,\n TemplateProps,\n VNode,\n VNodeType,\n} from './Components/component.js'\n\nexport {Fragment}\n\nexport function jsx<TProps extends ComponentProps>(\n type: VNodeType<TProps>,\n props: TemplateProps<TProps> | null,\n key?: Key,\n): VNode<TProps> {\n const nextProps: TemplateProps<TProps> = props == null\n ? {} as TemplateProps<TProps>\n : {...props}\n if (key !== undefined) nextProps.key = key\n return h(type, nextProps)\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\n/** Preserve an explicitly constructed component instance in a vnode tree. */\nexport function createPrebuiltElement<TComponent extends Component>(\n component: TComponent,\n): TComponent {\n if (!(component instanceof Component)) {\n throw new TypeError('createPrebuiltElement requires a Component instance')\n }\n return component\n}\n\nexport namespace JSX {\n export type Element = VNode | Component\n export interface ElementClass extends Component {}\n export interface ElementAttributesProperty {\n props: {}\n }\n export interface ElementChildrenAttribute {\n children: {}\n }\n export interface IntrinsicAttributes {\n key?: Key\n }\n export type LibraryManagedAttributes<_TComponent, TProps extends ComponentProps> =\n TemplateProps<TProps>\n export type IntrinsicElements = FrayIntrinsicElements\n}\n\n// Used by declaration consumers that construct children without JSX.\nexport type JSXChild = FrayChild\n"],"names":["baseStyleDefinitions","STYLE_ATTRIBUTE","nextRegistryId","StyleRegistry","id","__publicField","css","selector","styleNames","names","name","styleName","selectors","generated","properties","variants","splitDefinition","selectorList","renderRule","variant","variantProperties","appendVariant","targetDocument","escapeAttributeValue","style","createStyleRegistry","styleRegistry","definition","property","value","label","declarations","pseudoElement","serviceKeys","serviceProviders","defineService","key","provideService","create","assertServiceKey","provider","ServiceScope","providers","assertServiceProvider","cycleStart","cycle","entry","instance","errors","dispose","readDispose","error","createServiceScope","isServiceKey","RESERVED_CUSTOM_ELEMENT_NAMES","FrayRuntime","options","registry","elementNames","prefix","assertNamePart","overrides","componentName","tagName","assertCustomElementName","hostName","standaloneHostName","resolved","cssText","componentType","args","component","parent","before","dependency","createFrayRuntime","defaultFrayRuntime","Fragment","liveBindingValues","BOOLEAN_ATTRIBUTES","PROPERTY_PROPS","live","emitter","assertReadableEmitter","binding","h","type","props","children","suppliedProps","propChildren","restProps","normalizeChildren","strings","values","result","string","index","_Component","runtime","seen","baseStyles","normalizeBaseStyles","mountedNow","assertParentNode","insertRecord","_event","nextReads","nextVNode","normalizeRoot","patchRoot","firstNode","nextProps","_dom","observables","observable","unsubscribe","event","cleanup","active","target","listener","eventListener","disposeRecord","Component","normalized","visit","child","createRecord","owner","isReadableEmitter","start","end","current","fragment","record","nextValue","readKey","isVNode","describeValue","patchChildren","node","patchElementProps","isComponentClass","sourceProps","resolvedProps","resolveLivePropValues","subscribeComponentLiveProps","functionType","functionProps","rendered","subscribeFunctionLiveProps","previous","isCompatible","patchCompatible","next","anchor","patchComponentLiveProps","patchFunctionLiveProps","isLiveBinding","reconcileLiveProps","resolvedLiveProps","rerenderFunctionRecord","subscriptions","onValue","existing","liveProp","_a","nextValues","keyed","unkeyed","seenKeys","retained","nextRecords","unkeyedIndex","valueKey","candidate","cursor","recordNodes","_nextChildren","keys","previousValue","isNativeBindingProp","patchNativeBinding","patchRef","isEventProp","patchEvent","patchLiveElementProp","previousLive","previousResolved","patchDOMProp","assertWritableEmitter","assertNativeBindingTarget","eventName","nativeBindingEvent","registered","applyRef","setAttribute","patchDataset","patchStyle","normalizePropertyName","enabled","normalizeAttributeName","oldValues","toPropertyRecord","newValues","camelToKebab","letter","ref","removeNodes","nodes","jsx","jsxs","jsxDEV","createPrebuiltElement"],"mappings":";;;AAIO,MAAMA,IAAuB;AAAA,EAChC,OAAO;AAAA,IACH,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,kBAAkB;AAAA,EAAA;AAAA,EAGtB,WAAW;AAAA,IACP,SAAS;AAAA,IACT,aAAa;AAAA,IACb,UAAU;AAAA,IACV,cAAc;AAAA,IACd,cAAc;AAAA,EAAA;AAAA,EAGlB,OAAO;AAAA,IACH,kBAAkB;AAAA,IAClB,OAAO;AAAA,IACP,cAAc;AAAA,IACd,eAAe;AAAA,EAAA;AAAA,EAGnB,WAAW;AAAA,IACP,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,eAAe;AAAA,EAAA;AAAA,EAGnB,cAAc;AAAA,IACV,SAAS;AAAA,I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