@zazz-ui/core 0.13.1 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/README.md +5 -9
- package/dist/sri.json +35 -31
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +173 -3
- package/editor/zazz.html-data.json +138 -0
- package/editor/zazz.language-data.json +313 -125
- package/editor/zazz.lint-data.json +1501 -1383
- package/package.json +1 -5
- package/src/base/_defaults.css +1 -1
- package/src/base/_reset.css +16 -2
- package/src/base/_variables.css +43 -31
- package/src/base/carousel-scroll.d.ts +161 -0
- package/src/base/carousel-scroll.d.ts.map +1 -0
- package/src/base/carousel-scroll.js +1035 -0
- package/src/base/carousel-scroll.ts +1227 -0
- package/src/base/carousel.d.ts +34 -0
- package/src/base/carousel.d.ts.map +1 -0
- package/src/base/carousel.js +279 -0
- package/src/base/carousel.ts +292 -0
- package/src/base/dialog-lifecycle.js +1 -1
- package/src/base/dialog-lifecycle.ts +1 -1
- package/src/base/gesture.d.ts +201 -0
- package/src/base/gesture.d.ts.map +1 -0
- package/src/base/gesture.js +317 -0
- package/src/base/gesture.ts +494 -0
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +182 -162
- package/src/base/kit-styling.ts +182 -162
- package/src/base/navigation.d.ts +12 -1
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +65 -1
- package/src/base/navigation.ts +66 -1
- package/src/base/utils.d.ts +1 -1
- package/src/base/utils.js +2 -2
- package/src/base/utils.ts +2 -2
- package/src/globals.d.ts +7 -30
- package/src/head.d.ts.map +1 -1
- package/src/head.js +1 -25
- package/src/head.ts +1 -25
- package/src/index.css +1 -0
- package/src/index.d.ts +6 -5
- package/src/index.d.ts.map +1 -1
- package/src/index.js +6 -5
- package/src/index.ts +6 -5
- package/src/manifest.d.ts +1 -1
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +25 -13
- package/src/manifest.ts +26 -14
- package/src/primitives/button/button.css +1 -1
- package/src/primitives/carousel/carousel.css +103 -20
- package/src/primitives/carousel/carousel.d.ts +4 -32
- package/src/primitives/carousel/carousel.d.ts.map +1 -1
- package/src/primitives/carousel/carousel.js +39 -14
- package/src/primitives/carousel/carousel.ts +21 -25
- package/src/primitives/dialog/dialog.css +14 -8
- package/src/primitives/drawer/drawer-indent.html +27 -0
- package/src/primitives/drawer/drawer-nested.html +72 -0
- package/src/primitives/drawer/drawer-responsive-dialog.html +44 -0
- package/src/primitives/drawer/drawer-snap.html +26 -0
- package/src/primitives/drawer/drawer.css +528 -0
- package/src/primitives/drawer/drawer.d.ts +24 -0
- package/src/primitives/drawer/drawer.d.ts.map +1 -0
- package/src/primitives/drawer/drawer.html +42 -0
- package/src/primitives/drawer/drawer.js +765 -0
- package/src/primitives/drawer/drawer.ts +823 -0
- package/src/primitives/fields/fields.css +4 -2
- package/src/primitives/input/input.css +1 -1
- package/src/primitives/input-group/input-group.css +5 -5
- package/src/primitives/lightbox/lightbox.css +2 -2
- package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
- package/src/primitives/lightbox/lightbox.js +9 -8
- package/src/primitives/lightbox/lightbox.ts +9 -8
- package/src/primitives/password-group/password-group.css +5 -5
- package/src/primitives/radio/radio.css +15 -10
- package/src/primitives/slider/slider.css +2 -2
- package/src/primitives/switch/switch.css +6 -6
- package/src/primitives/tabs/tabs.css +10 -10
- package/src/primitives/toaster/toaster.css +29 -1
- package/src/primitives/toaster/toaster.d.ts.map +1 -1
- package/src/primitives/toaster/toaster.js +117 -9
- package/src/primitives/toaster/toaster.ts +136 -9
- package/src/primitives/tooltip/tooltip.css +93 -10
- package/src/base/embla.d.ts +0 -90
- package/src/base/embla.d.ts.map +0 -1
- package/src/base/embla.js +0 -878
- package/src/base/embla.ts +0 -1066
package/src/base/kit-styling.ts
CHANGED
|
@@ -71,6 +71,8 @@ export const KIT_SELECTORS: readonly string[] = [
|
|
|
71
71
|
':is(ui-command, [data-ui~="command"]) [data-command-slot~="panel"]',
|
|
72
72
|
':is(ui-command, [data-ui~="command"]) [data-command-slot~="panel"][popover]',
|
|
73
73
|
':is(ui-command, [data-ui~="command"]) dialog[data-command-slot~="panel"]',
|
|
74
|
+
':is(ui-drawer-indent, [data-ui~="drawer-indent"])',
|
|
75
|
+
':is(ui-drawer-indent, [data-ui~="drawer-indent"])[data-drawer-indent-state~="on"]',
|
|
74
76
|
':is(ui-kbd-group, [data-ui~="kbd-group"])',
|
|
75
77
|
':is(ui-layout, [data-ui~="layout"])',
|
|
76
78
|
':is(ui-layout, [data-ui~="layout"]) > *',
|
|
@@ -169,7 +171,20 @@ export const KIT_SELECTORS: readonly string[] = [
|
|
|
169
171
|
'[data-ui~="dialog"] [data-dialog-slot~="content"]',
|
|
170
172
|
'[data-ui~="dialog"] [data-dialog-slot~="footer"]',
|
|
171
173
|
'[data-ui~="dialog"] [data-dialog-slot~="header"]',
|
|
174
|
+
'[data-ui~="dialog"]:not([data-ui~="drawer"]) [data-dialog-slot~="content"]',
|
|
175
|
+
'[data-ui~="dialog"][data-ui~="drawer"]',
|
|
172
176
|
'[data-ui~="dialog"][open]',
|
|
177
|
+
'[data-ui~="drawer"] :is([data-drawer-slot~="content"], [data-dialog-slot~="content"])',
|
|
178
|
+
'[data-ui~="drawer"] [data-drawer-slot~="body"]',
|
|
179
|
+
'[data-ui~="drawer"] [data-drawer-slot~="close"]',
|
|
180
|
+
'[data-ui~="drawer"] [data-drawer-slot~="content"]',
|
|
181
|
+
'[data-ui~="drawer"] [data-drawer-slot~="footer"]',
|
|
182
|
+
'[data-ui~="drawer"] [data-drawer-slot~="handle"]',
|
|
183
|
+
'[data-ui~="drawer"] [data-drawer-slot~="header"]',
|
|
184
|
+
'[data-ui~="drawer"]:not([data-ui~="dialog"])',
|
|
185
|
+
'[data-ui~="drawer"][data-drawer-snap]',
|
|
186
|
+
'[data-ui~="drawer"][data-drawer-state~="dragging"] [data-drawer-slot~="handle"]',
|
|
187
|
+
'[data-ui~="drawer"][data-drawer-state~="stacked"]',
|
|
173
188
|
'[data-ui~="field"]',
|
|
174
189
|
'[data-ui~="field"] :is([data-field-slot~="hint"], [data-field-slot~="error"])',
|
|
175
190
|
'[data-ui~="field"] > :not([data-field-slot~="label"], [data-field-slot~="description"])',
|
|
@@ -265,6 +280,7 @@ export const KIT_SELECTORS: readonly string[] = [
|
|
|
265
280
|
"abbr[title]",
|
|
266
281
|
"blockquote",
|
|
267
282
|
"body",
|
|
283
|
+
'body:has(:is(ui-drawer-indent, [data-ui~="drawer-indent"])[data-drawer-indent-state~="on"])',
|
|
268
284
|
"button",
|
|
269
285
|
"code",
|
|
270
286
|
"dialog",
|
|
@@ -286,63 +302,64 @@ export const KIT_SELECTORS: readonly string[] = [
|
|
|
286
302
|
|
|
287
303
|
/** For each utility, the elements the kit reads it on through its own chain: a tier alone works there. */
|
|
288
304
|
export const TIER_READS: Readonly<Record<string, readonly number[]>> = {
|
|
289
|
-
band: [
|
|
305
|
+
band: [73],
|
|
290
306
|
bg: [
|
|
291
|
-
5, 18, 33, 37, 46,
|
|
292
|
-
|
|
307
|
+
5, 18, 33, 37, 46, 139, 145, 148, 151, 153, 156, 161, 162, 179, 192, 194, 207, 228, 241, 242,
|
|
308
|
+
244, 251, 253, 262, 263, 267, 268, 269, 287, 288, 290,
|
|
293
309
|
],
|
|
294
|
-
"bg-clip": [37,
|
|
310
|
+
"bg-clip": [37, 148, 153, 263],
|
|
295
311
|
"border-color": [
|
|
296
|
-
18, 37, 46,
|
|
297
|
-
|
|
312
|
+
18, 37, 46, 145, 148, 151, 153, 156, 161, 192, 194, 228, 242, 244, 262, 263, 267, 268, 269, 273,
|
|
313
|
+
287, 288,
|
|
298
314
|
],
|
|
299
|
-
"border-style": [37, 46,
|
|
300
|
-
"border-width": [37, 46,
|
|
315
|
+
"border-style": [37, 46, 145, 148, 153, 161, 192, 242, 244, 262, 263, 287, 288],
|
|
316
|
+
"border-width": [37, 46, 145, 148, 153, 161, 192, 193, 242, 244, 262, 263, 287, 288],
|
|
301
317
|
"corner-shape": [
|
|
302
|
-
5, 33, 37, 46,
|
|
303
|
-
|
|
318
|
+
5, 33, 37, 46, 116, 122, 139, 145, 148, 153, 161, 162, 179, 192, 194, 207, 228, 241, 242, 244,
|
|
319
|
+
262, 263, 273, 287, 288, 290,
|
|
304
320
|
],
|
|
305
|
-
cursor: [
|
|
306
|
-
display: [5, 21, 22, 23,
|
|
321
|
+
cursor: [194, 228, 287],
|
|
322
|
+
display: [5, 21, 22, 23, 183, 190, 194, 228],
|
|
307
323
|
flex: [21, 22],
|
|
308
|
-
"flex-wrap": [46,
|
|
309
|
-
"font-family": [
|
|
310
|
-
"font-size": [46,
|
|
311
|
-
"font-weight": [
|
|
312
|
-
gap: [5, 37, 42, 46,
|
|
313
|
-
h: [46,
|
|
314
|
-
items: [23, 46,
|
|
315
|
-
justify: [23,
|
|
316
|
-
leading: [46,
|
|
324
|
+
"flex-wrap": [46, 194, 228],
|
|
325
|
+
"font-family": [145, 148, 153, 253, 263, 290],
|
|
326
|
+
"font-size": [46, 145, 148, 153, 192, 244, 253, 262, 263, 290],
|
|
327
|
+
"font-weight": [145, 148, 153, 263],
|
|
328
|
+
gap: [5, 37, 42, 46, 71, 105, 145, 148, 153, 161, 183, 190, 194, 228, 263, 290],
|
|
329
|
+
h: [46, 148, 162, 192, 207, 241, 244, 287],
|
|
330
|
+
items: [23, 46, 190, 194, 228],
|
|
331
|
+
justify: [23, 190],
|
|
332
|
+
leading: [46, 145, 148, 153, 192, 244, 262, 263, 290],
|
|
317
333
|
m: [5],
|
|
318
|
-
"max-h": [30,
|
|
319
|
-
"max-w": [
|
|
320
|
-
"min-h": [24, 46,
|
|
321
|
-
"min-w": [46, 66,
|
|
322
|
-
mx: [
|
|
323
|
-
my: [
|
|
324
|
-
p: [5, 37,
|
|
325
|
-
pl: [46,
|
|
326
|
-
pr: [46,
|
|
327
|
-
px: [
|
|
328
|
-
py: [46,
|
|
334
|
+
"max-h": [30, 262],
|
|
335
|
+
"max-w": [145, 273],
|
|
336
|
+
"min-h": [24, 46, 153, 194, 228, 262, 263, 290],
|
|
337
|
+
"min-w": [46, 66, 107, 108, 192, 244, 262, 273, 290],
|
|
338
|
+
mx: [145, 273],
|
|
339
|
+
my: [145, 273],
|
|
340
|
+
p: [5, 37, 161, 194, 228, 273],
|
|
341
|
+
pl: [46, 192, 244],
|
|
342
|
+
pr: [46, 192, 244],
|
|
343
|
+
px: [145, 148, 153, 262, 263, 290],
|
|
344
|
+
py: [46, 145, 148, 153, 192, 244, 262, 263, 290],
|
|
329
345
|
radius: [
|
|
330
|
-
5, 33, 37, 46,
|
|
331
|
-
|
|
346
|
+
5, 33, 37, 46, 116, 122, 139, 145, 148, 153, 161, 162, 192, 194, 207, 228, 241, 242, 244, 262,
|
|
347
|
+
263, 273, 287, 288, 290,
|
|
332
348
|
],
|
|
333
|
-
"ring-color": [
|
|
334
|
-
self: [
|
|
349
|
+
"ring-color": [148, 153, 263],
|
|
350
|
+
self: [183],
|
|
335
351
|
shadow: [
|
|
336
|
-
23, 30, 37, 46,
|
|
352
|
+
23, 30, 37, 46, 107, 145, 148, 153, 161, 162, 179, 192, 194, 228, 242, 244, 262, 263, 273, 287,
|
|
353
|
+
288,
|
|
337
354
|
],
|
|
338
|
-
"shadow-angle": [7,
|
|
339
|
-
size: [
|
|
340
|
-
"template-cols": [
|
|
355
|
+
"shadow-angle": [7, 286],
|
|
356
|
+
size: [242, 288],
|
|
357
|
+
"template-cols": [183],
|
|
341
358
|
text: [
|
|
342
|
-
37, 46,
|
|
343
|
-
|
|
359
|
+
37, 46, 145, 148, 151, 153, 156, 161, 162, 179, 192, 194, 228, 244, 253, 262, 263, 267, 268,
|
|
360
|
+
269, 290,
|
|
344
361
|
],
|
|
345
|
-
w: [21, 46,
|
|
362
|
+
w: [21, 46, 108, 162, 183, 192, 194, 207, 228, 241, 244, 262, 287],
|
|
346
363
|
};
|
|
347
364
|
|
|
348
365
|
/**
|
|
@@ -351,182 +368,185 @@ export const TIER_READS: Readonly<Record<string, readonly number[]>> = {
|
|
|
351
368
|
* their own value, and a tier alone applies there only through `TIER_READS`.
|
|
352
369
|
*/
|
|
353
370
|
export const TIER_BLOCKS: Readonly<Record<string, readonly number[]>> = {
|
|
354
|
-
"anchor-name": [32, 46, 57,
|
|
355
|
-
animation: [
|
|
356
|
-
aspect: [
|
|
357
|
-
"backdrop-filter": [
|
|
358
|
-
band: [0, 1, 2,
|
|
371
|
+
"anchor-name": [32, 46, 57, 106, 113, 143, 162, 214, 217, 224, 226],
|
|
372
|
+
animation: [163, 241, 243, 286],
|
|
373
|
+
aspect: [92, 94, 152, 157, 158, 270, 271],
|
|
374
|
+
"backdrop-filter": [129],
|
|
375
|
+
band: [0, 1, 2, 73, 185, 186, 189],
|
|
359
376
|
basis: [
|
|
360
|
-
21, 22, 43, 44, 47, 63, 64,
|
|
377
|
+
21, 22, 43, 44, 47, 63, 64, 83, 97, 132, 197, 198, 203, 204, 225, 231, 232, 237, 238, 245, 292,
|
|
361
378
|
],
|
|
362
379
|
bg: [
|
|
363
|
-
5, 18, 19, 33, 37, 46, 47, 64,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
"col-
|
|
369
|
-
"col-
|
|
380
|
+
5, 18, 19, 33, 37, 46, 47, 64, 69, 90, 93, 109, 110, 116, 119, 121, 122, 123, 127, 128, 129,
|
|
381
|
+
135, 139, 144, 145, 148, 153, 161, 162, 167, 177, 179, 181, 192, 194, 203, 204, 207, 210, 211,
|
|
382
|
+
228, 237, 238, 241, 242, 244, 247, 251, 253, 256, 257, 259, 262, 263, 273, 277, 278, 280, 284,
|
|
383
|
+
285, 286, 287, 288, 290,
|
|
384
|
+
],
|
|
385
|
+
"col-end": [0, 1, 2, 73, 184, 185, 186, 189],
|
|
386
|
+
"col-span": [0, 1, 2, 73, 185, 186, 189],
|
|
387
|
+
"col-start": [0, 1, 2, 73, 184, 185, 186, 189],
|
|
370
388
|
elevation: [
|
|
371
|
-
23, 30, 31, 37, 46, 53, 54, 66,
|
|
372
|
-
|
|
389
|
+
23, 30, 31, 37, 46, 53, 54, 66, 107, 112, 119, 121, 123, 128, 129, 135, 145, 148, 153, 161, 162,
|
|
390
|
+
179, 192, 194, 203, 204, 228, 242, 244, 247, 262, 263, 273, 281, 287, 288,
|
|
373
391
|
],
|
|
374
392
|
flex: [
|
|
375
|
-
21, 22, 43, 44, 47, 55, 56, 63, 64,
|
|
376
|
-
|
|
377
|
-
|
|
393
|
+
21, 22, 43, 44, 47, 55, 56, 63, 64, 83, 97, 103, 104, 109, 130, 131, 132, 133, 148, 153, 167,
|
|
394
|
+
195, 197, 198, 202, 203, 204, 225, 229, 231, 232, 236, 237, 238, 242, 245, 246, 248, 250, 251,
|
|
395
|
+
263, 284, 287, 288, 292,
|
|
378
396
|
],
|
|
379
|
-
"flex-wrap": [46,
|
|
397
|
+
"flex-wrap": [46, 194, 210, 228],
|
|
380
398
|
gap: [
|
|
381
|
-
5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65,
|
|
382
|
-
|
|
383
|
-
|
|
399
|
+
5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65, 71, 72, 89, 95, 102, 105, 110, 112, 118, 120,
|
|
400
|
+
122, 132, 135, 145, 148, 153, 161, 167, 176, 183, 194, 195, 201, 210, 217, 224, 227, 228, 229,
|
|
401
|
+
235, 244, 245, 247, 263, 283, 290,
|
|
384
402
|
],
|
|
385
403
|
"gap-x": [
|
|
386
|
-
5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65,
|
|
387
|
-
|
|
388
|
-
|
|
404
|
+
5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65, 71, 72, 89, 95, 102, 105, 110, 112, 118, 120,
|
|
405
|
+
122, 132, 135, 145, 148, 153, 161, 167, 176, 183, 194, 195, 201, 210, 217, 224, 227, 228, 229,
|
|
406
|
+
235, 244, 245, 247, 263, 283, 290,
|
|
389
407
|
],
|
|
390
408
|
"gap-y": [
|
|
391
|
-
5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65,
|
|
392
|
-
|
|
393
|
-
|
|
409
|
+
5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65, 71, 89, 95, 102, 105, 110, 112, 118, 120, 122,
|
|
410
|
+
132, 135, 145, 148, 161, 167, 176, 183, 194, 195, 201, 210, 217, 224, 227, 228, 229, 235, 244,
|
|
411
|
+
245, 247, 283, 290,
|
|
394
412
|
],
|
|
395
|
-
"grid-cols": [37, 38, 40,
|
|
396
|
-
"grid-rows": [38, 39,
|
|
413
|
+
"grid-cols": [37, 38, 40, 72, 74, 183, 227],
|
|
414
|
+
"grid-rows": [38, 39, 77, 78, 166, 170, 171, 175, 179],
|
|
397
415
|
items: [
|
|
398
|
-
23, 25, 33, 46, 55, 56, 59, 62,
|
|
399
|
-
|
|
400
|
-
|
|
416
|
+
23, 25, 33, 46, 55, 56, 59, 62, 71, 72, 79, 80, 93, 95, 110, 116, 118, 120, 122, 123, 126, 135,
|
|
417
|
+
139, 145, 148, 149, 153, 154, 165, 190, 194, 195, 197, 198, 201, 211, 212, 217, 224, 227, 228,
|
|
418
|
+
229, 231, 232, 235, 242, 244, 245, 247, 249, 263, 265, 288, 290,
|
|
401
419
|
],
|
|
402
420
|
justify: [
|
|
403
|
-
23, 25, 37, 59,
|
|
404
|
-
|
|
421
|
+
23, 25, 37, 59, 79, 80, 86, 93, 96, 123, 125, 148, 149, 153, 154, 165, 167, 169, 176, 190, 195,
|
|
422
|
+
210, 211, 224, 229, 244, 263, 265, 290,
|
|
405
423
|
],
|
|
406
424
|
opacity: [
|
|
407
|
-
3, 4, 55,
|
|
408
|
-
|
|
425
|
+
3, 4, 55, 76, 81, 82, 94, 98, 99, 119, 124, 129, 135, 136, 137, 138, 145, 146, 147, 187, 188,
|
|
426
|
+
213, 264, 273, 281, 282, 289, 291,
|
|
409
427
|
],
|
|
410
|
-
order: [28, 51, 61,
|
|
428
|
+
order: [28, 51, 61, 196, 197, 198, 199, 200, 230, 231, 232, 233, 234],
|
|
411
429
|
p: [
|
|
412
|
-
5, 6, 8, 9, 26, 29, 37, 46, 48, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
209,
|
|
416
|
-
|
|
430
|
+
5, 6, 8, 9, 26, 29, 37, 46, 48, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 85, 86, 93, 110,
|
|
431
|
+
114, 122, 123, 127, 129, 134, 135, 145, 148, 149, 152, 153, 154, 155, 157, 158, 160, 161, 163,
|
|
432
|
+
165, 167, 168, 169, 170, 173, 176, 178, 179, 192, 194, 195, 197, 198, 201, 203, 204, 205, 206,
|
|
433
|
+
208, 209, 210, 211, 216, 224, 228, 229, 231, 232, 235, 237, 238, 239, 240, 244, 247, 254, 255,
|
|
434
|
+
258, 262, 263, 265, 266, 270, 271, 272, 273, 276, 280, 289, 290, 293, 294, 295,
|
|
417
435
|
],
|
|
418
436
|
pb: [
|
|
419
|
-
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
437
|
+
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 85, 86, 110, 114, 122, 123,
|
|
438
|
+
127, 129, 134, 135, 145, 148, 149, 152, 153, 154, 157, 158, 161, 163, 165, 167, 169, 170, 173,
|
|
439
|
+
176, 179, 194, 197, 198, 204, 208, 210, 211, 216, 224, 228, 231, 232, 238, 247, 254, 255, 258,
|
|
440
|
+
262, 263, 265, 270, 271, 273, 280, 290,
|
|
423
441
|
],
|
|
424
442
|
pl: [
|
|
425
|
-
5, 6, 8, 9, 26, 29, 37, 46, 48, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
443
|
+
5, 6, 8, 9, 26, 29, 37, 46, 48, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 93, 110, 122, 123,
|
|
444
|
+
127, 129, 134, 135, 145, 148, 149, 152, 153, 154, 155, 157, 158, 160, 161, 163, 165, 167, 168,
|
|
445
|
+
173, 176, 178, 192, 194, 195, 201, 203, 204, 205, 208, 209, 210, 211, 216, 224, 228, 229, 235,
|
|
446
|
+
237, 238, 239, 244, 247, 254, 255, 262, 263, 265, 266, 270, 271, 272, 273, 276, 280, 289, 290,
|
|
447
|
+
293, 294, 295,
|
|
429
448
|
],
|
|
430
449
|
"place-content": [
|
|
431
|
-
0, 23, 25, 37, 59,
|
|
432
|
-
|
|
450
|
+
0, 23, 25, 37, 59, 72, 79, 80, 86, 93, 96, 123, 125, 148, 149, 153, 154, 161, 163, 165, 167,
|
|
451
|
+
169, 173, 176, 190, 195, 210, 211, 224, 229, 244, 263, 265, 273, 290,
|
|
433
452
|
],
|
|
434
453
|
"place-items": [
|
|
435
|
-
23, 25, 33, 46, 55, 56, 59, 62,
|
|
436
|
-
|
|
437
|
-
|
|
454
|
+
23, 25, 33, 46, 55, 56, 59, 62, 71, 72, 79, 80, 93, 95, 110, 116, 118, 120, 122, 123, 126, 135,
|
|
455
|
+
139, 145, 148, 149, 153, 154, 165, 190, 194, 195, 197, 198, 201, 211, 212, 217, 224, 227, 228,
|
|
456
|
+
229, 231, 232, 235, 242, 244, 245, 247, 249, 263, 265, 288, 290,
|
|
438
457
|
],
|
|
439
458
|
position: [
|
|
440
|
-
16, 20, 33, 34, 41, 55,
|
|
441
|
-
|
|
442
|
-
|
|
459
|
+
16, 20, 33, 34, 41, 55, 70, 75, 76, 87, 88, 89, 92, 100, 101, 111, 115, 119, 121, 122, 123, 124,
|
|
460
|
+
129, 135, 139, 140, 144, 150, 158, 159, 164, 166, 174, 175, 177, 214, 215, 223, 242, 263, 264,
|
|
461
|
+
273, 277, 281, 287, 288, 291, 292,
|
|
443
462
|
],
|
|
444
|
-
"position-anchor": [30, 53, 67,
|
|
445
|
-
"position-area": [
|
|
463
|
+
"position-anchor": [30, 53, 67, 107, 112, 121, 145, 218, 219, 220, 221, 222],
|
|
464
|
+
"position-area": [129, 273],
|
|
446
465
|
pr: [
|
|
447
|
-
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
247,
|
|
466
|
+
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 110, 122, 123, 127, 129, 134,
|
|
467
|
+
135, 145, 148, 149, 152, 153, 154, 155, 157, 158, 160, 161, 163, 165, 167, 168, 173, 176, 178,
|
|
468
|
+
192, 194, 195, 201, 203, 204, 206, 208, 210, 211, 216, 224, 228, 229, 235, 237, 238, 240, 244,
|
|
469
|
+
247, 254, 255, 262, 263, 265, 266, 270, 271, 272, 273, 280, 289, 290,
|
|
451
470
|
],
|
|
452
471
|
pt: [
|
|
453
|
-
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
472
|
+
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 85, 86, 110, 114, 122, 123,
|
|
473
|
+
127, 129, 134, 135, 145, 148, 149, 152, 153, 154, 157, 158, 161, 163, 165, 167, 168, 173, 176,
|
|
474
|
+
178, 194, 197, 198, 204, 208, 210, 211, 216, 224, 228, 231, 232, 238, 247, 254, 255, 258, 262,
|
|
475
|
+
263, 265, 270, 271, 273, 280, 290,
|
|
457
476
|
],
|
|
458
477
|
px: [
|
|
459
|
-
5, 6, 8, 9, 26, 29, 37, 46, 48, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
478
|
+
5, 6, 8, 9, 26, 29, 37, 46, 48, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 93, 110, 122, 123,
|
|
479
|
+
127, 129, 134, 135, 145, 148, 149, 152, 153, 154, 155, 157, 158, 160, 161, 163, 165, 167, 168,
|
|
480
|
+
173, 176, 178, 192, 194, 195, 201, 203, 204, 205, 206, 208, 209, 210, 211, 216, 224, 228, 229,
|
|
481
|
+
235, 237, 238, 239, 240, 244, 247, 254, 255, 262, 263, 265, 266, 270, 271, 272, 273, 276, 280,
|
|
482
|
+
289, 290, 293, 294, 295,
|
|
464
483
|
],
|
|
465
484
|
py: [
|
|
466
|
-
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68,
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
255,
|
|
485
|
+
5, 6, 26, 29, 37, 46, 49, 52, 58, 59, 61, 62, 64, 65, 67, 68, 80, 85, 86, 110, 114, 122, 123,
|
|
486
|
+
127, 129, 134, 135, 145, 148, 149, 152, 153, 154, 157, 158, 161, 163, 165, 167, 168, 169, 170,
|
|
487
|
+
173, 176, 178, 179, 194, 197, 198, 204, 208, 210, 211, 216, 224, 228, 231, 232, 238, 247, 254,
|
|
488
|
+
255, 258, 262, 263, 265, 270, 271, 273, 280, 290,
|
|
470
489
|
],
|
|
471
490
|
radius: [
|
|
472
|
-
5, 17, 33, 35, 36, 37, 46, 55,
|
|
473
|
-
|
|
474
|
-
|
|
491
|
+
5, 17, 33, 35, 36, 37, 46, 55, 81, 84, 90, 91, 92, 97, 100, 110, 116, 121, 122, 123, 127, 128,
|
|
492
|
+
135, 139, 141, 142, 144, 145, 148, 153, 161, 162, 170, 177, 179, 192, 194, 202, 203, 204, 207,
|
|
493
|
+
216, 224, 228, 236, 237, 238, 241, 242, 244, 247, 262, 263, 273, 280, 287, 288, 289, 290,
|
|
475
494
|
],
|
|
476
495
|
"radius-b": [
|
|
477
|
-
5, 17, 33, 35, 36, 37, 46, 55,
|
|
478
|
-
|
|
479
|
-
|
|
496
|
+
5, 17, 33, 35, 36, 37, 46, 55, 81, 84, 90, 91, 92, 97, 100, 110, 116, 121, 122, 123, 127, 128,
|
|
497
|
+
135, 139, 141, 142, 144, 145, 148, 153, 161, 162, 170, 177, 179, 192, 194, 202, 203, 204, 207,
|
|
498
|
+
216, 224, 228, 236, 237, 238, 241, 242, 244, 247, 262, 263, 273, 280, 287, 288, 289, 290,
|
|
480
499
|
],
|
|
481
500
|
"radius-l": [
|
|
482
|
-
5, 17, 33, 35, 36, 37, 46, 55,
|
|
483
|
-
|
|
484
|
-
|
|
501
|
+
5, 17, 33, 35, 36, 37, 46, 55, 81, 84, 90, 91, 92, 97, 100, 110, 116, 121, 122, 123, 127, 128,
|
|
502
|
+
135, 139, 141, 142, 144, 145, 148, 153, 161, 162, 170, 177, 179, 192, 194, 202, 203, 204, 207,
|
|
503
|
+
216, 224, 228, 236, 237, 238, 241, 242, 244, 247, 262, 263, 273, 280, 287, 288, 289, 290,
|
|
485
504
|
],
|
|
486
505
|
"radius-r": [
|
|
487
|
-
5, 17, 33, 35, 36, 37, 46, 55,
|
|
488
|
-
|
|
489
|
-
|
|
506
|
+
5, 17, 33, 35, 36, 37, 46, 55, 81, 84, 90, 91, 92, 97, 100, 110, 116, 121, 122, 123, 127, 128,
|
|
507
|
+
135, 139, 141, 142, 144, 145, 148, 153, 161, 162, 170, 177, 179, 192, 194, 202, 203, 204, 207,
|
|
508
|
+
216, 224, 228, 236, 237, 238, 241, 242, 244, 247, 262, 263, 273, 280, 287, 288, 289, 290,
|
|
490
509
|
],
|
|
491
510
|
"radius-t": [
|
|
492
|
-
5, 17, 33, 35, 36, 37, 46, 55,
|
|
493
|
-
|
|
494
|
-
|
|
511
|
+
5, 17, 33, 35, 36, 37, 46, 55, 81, 84, 90, 91, 92, 97, 100, 110, 116, 121, 122, 123, 127, 128,
|
|
512
|
+
135, 139, 141, 142, 144, 145, 148, 153, 161, 162, 177, 179, 192, 194, 202, 203, 204, 207, 216,
|
|
513
|
+
224, 228, 236, 237, 238, 241, 242, 244, 247, 262, 263, 273, 280, 287, 288, 289, 290,
|
|
495
514
|
],
|
|
496
515
|
ring: [
|
|
497
|
-
23, 30, 31, 37, 46, 53, 54, 66,
|
|
498
|
-
|
|
516
|
+
23, 30, 31, 37, 46, 53, 54, 66, 107, 112, 119, 121, 123, 128, 129, 135, 145, 148, 153, 161, 162,
|
|
517
|
+
179, 192, 194, 203, 204, 228, 242, 244, 247, 262, 263, 273, 281, 287, 288,
|
|
499
518
|
],
|
|
500
519
|
"ring-color": [
|
|
501
|
-
23, 30, 31, 37, 46, 53, 54, 66,
|
|
502
|
-
|
|
520
|
+
23, 30, 31, 37, 46, 53, 54, 66, 107, 112, 119, 121, 123, 128, 129, 135, 145, 148, 153, 161, 162,
|
|
521
|
+
179, 192, 194, 203, 204, 228, 242, 244, 247, 262, 263, 273, 281, 287, 288,
|
|
503
522
|
],
|
|
504
523
|
"ring-offset": [
|
|
505
|
-
23, 30, 31, 37, 46, 53, 54, 66,
|
|
506
|
-
|
|
524
|
+
23, 30, 31, 37, 46, 53, 54, 66, 107, 112, 119, 121, 123, 128, 129, 135, 145, 148, 153, 161, 162,
|
|
525
|
+
179, 192, 194, 203, 204, 228, 242, 244, 247, 262, 263, 273, 281, 287, 288,
|
|
507
526
|
],
|
|
508
527
|
"ring-offset-color": [
|
|
509
|
-
23, 30, 31, 37, 46, 53, 54, 66,
|
|
510
|
-
|
|
511
|
-
],
|
|
512
|
-
"row-end": [0, 1, 2,
|
|
513
|
-
"row-span": [0, 1, 2,
|
|
514
|
-
"row-start": [0, 1, 2,
|
|
515
|
-
|
|
528
|
+
23, 30, 31, 37, 46, 53, 54, 66, 107, 112, 119, 121, 123, 128, 129, 135, 145, 148, 153, 161, 162,
|
|
529
|
+
179, 192, 194, 203, 204, 228, 242, 244, 247, 262, 263, 273, 281, 287, 288,
|
|
530
|
+
],
|
|
531
|
+
"row-end": [0, 1, 2, 163, 167, 168, 172, 173, 176, 177, 178, 184, 185, 186, 189],
|
|
532
|
+
"row-span": [0, 1, 2, 163, 167, 168, 172, 173, 176, 177, 178, 185, 186, 189],
|
|
533
|
+
"row-start": [0, 1, 2, 163, 167, 168, 172, 173, 176, 177, 178, 184, 185, 186, 189],
|
|
534
|
+
scale: [70, 182],
|
|
535
|
+
self: [166, 167, 183, 189, 191, 252],
|
|
516
536
|
shadow: [
|
|
517
|
-
23, 30, 31, 37, 46, 53, 54, 66,
|
|
518
|
-
|
|
537
|
+
23, 30, 31, 37, 46, 53, 54, 66, 107, 112, 119, 121, 123, 128, 129, 135, 145, 148, 153, 161, 162,
|
|
538
|
+
179, 192, 194, 203, 204, 228, 242, 244, 247, 262, 263, 273, 281, 287, 288,
|
|
519
539
|
],
|
|
520
540
|
shrink: [
|
|
521
|
-
21, 22, 43, 44, 47, 55, 56, 63, 64,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
],
|
|
525
|
-
"template-cols": [37, 38, 40,
|
|
526
|
-
"template-rows": [38, 39,
|
|
527
|
-
"text-align": [
|
|
528
|
-
"text-decoration": [
|
|
529
|
-
"text-wrap": [10, 11, 12, 13, 14, 15,
|
|
530
|
-
translate: [
|
|
531
|
-
z: [
|
|
541
|
+
21, 22, 43, 44, 47, 55, 56, 63, 64, 83, 97, 103, 104, 109, 130, 131, 132, 133, 148, 153, 167,
|
|
542
|
+
195, 202, 203, 204, 225, 229, 236, 237, 238, 242, 245, 246, 248, 250, 251, 263, 284, 287, 288,
|
|
543
|
+
292,
|
|
544
|
+
],
|
|
545
|
+
"template-cols": [37, 38, 40, 72, 74, 183, 227],
|
|
546
|
+
"template-rows": [38, 39, 77, 78, 166, 170, 171, 175, 179],
|
|
547
|
+
"text-align": [117, 125, 189, 224, 244, 253, 254, 279],
|
|
548
|
+
"text-decoration": [148, 153, 216, 261, 263, 274, 275],
|
|
549
|
+
"text-wrap": [10, 11, 12, 13, 14, 15, 123, 145, 260, 277],
|
|
550
|
+
translate: [70, 76, 180, 182, 187, 188],
|
|
551
|
+
z: [75, 87, 88, 101, 121, 123, 164, 174, 211],
|
|
532
552
|
};
|
package/src/base/navigation.d.ts
CHANGED
|
@@ -9,5 +9,16 @@
|
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
11
|
declare function swapBody(next: HTMLElement): HTMLElement;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @description Adds the stylesheets in `doc`'s `<head>` that this document
|
|
14
|
+
* doesn't have: a `<link rel="stylesheet">` by its URL (resolved against `url`),
|
|
15
|
+
* a `<style>` by its text. Resolves once every added link has loaded or failed,
|
|
16
|
+
* or after {@link STYLESHEET_WAIT}.
|
|
17
|
+
*
|
|
18
|
+
* @param doc - The destination's parsed document.
|
|
19
|
+
* @param url - The destination's URL, for resolving relative `href`s.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
declare function adoptStyles(doc: Document, url: string): Promise<void>;
|
|
23
|
+
export { adoptStyles, swapBody };
|
|
13
24
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["navigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["navigation.ts"],"names":[],"mappings":"AA8FA;;;;;;;;;GASG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAgDhD;AAKD;;;;;;;;;GASG;AACH,iBAAe,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCpE;AA6JD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC"}
|
package/src/base/navigation.js
CHANGED
|
@@ -16,6 +16,14 @@ import { refreshAll } from "./zazz-element.js";
|
|
|
16
16
|
* element keeps its scroll offsets, and its links take `aria-current` from the
|
|
17
17
|
* destination's copy, so a kept header still marks the current page.
|
|
18
18
|
*
|
|
19
|
+
* The destination's stylesheets come along: a `<link rel="stylesheet">` or
|
|
20
|
+
* `<style>` in its `<head>` that this document lacks is added (a link by its
|
|
21
|
+
* URL, a style by its text), and the swap waits for new links to load, up to
|
|
22
|
+
* three seconds, so the page never shows unstyled. A framework's per-page CSS
|
|
23
|
+
* (Astro's scoped component styles) therefore applies after a swap as it does
|
|
24
|
+
* after a full load. Nothing is removed: a stylesheet a later page doesn't list
|
|
25
|
+
* stays, so keep page-specific CSS scoped to that page's markup.
|
|
26
|
+
*
|
|
19
27
|
* An element whose content depends on the page (a section sidebar, a table of
|
|
20
28
|
* contents) should not persist; `data-ui-persist-scroll="<id>"` renders it from
|
|
21
29
|
* the destination and carries only its scroll offset. The window itself
|
|
@@ -143,6 +151,58 @@ function swapBody(next) {
|
|
|
143
151
|
el.scrollTo({ top, left, behavior: "instant" });
|
|
144
152
|
return body;
|
|
145
153
|
}
|
|
154
|
+
/** How long a swap waits for a new stylesheet before showing the page anyway. */
|
|
155
|
+
const STYLESHEET_WAIT = 3000;
|
|
156
|
+
/**
|
|
157
|
+
* @description Adds the stylesheets in `doc`'s `<head>` that this document
|
|
158
|
+
* doesn't have: a `<link rel="stylesheet">` by its URL (resolved against `url`),
|
|
159
|
+
* a `<style>` by its text. Resolves once every added link has loaded or failed,
|
|
160
|
+
* or after {@link STYLESHEET_WAIT}.
|
|
161
|
+
*
|
|
162
|
+
* @param doc - The destination's parsed document.
|
|
163
|
+
* @param url - The destination's URL, for resolving relative `href`s.
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
async function adoptStyles(doc, url) {
|
|
167
|
+
const head = document.head;
|
|
168
|
+
const hrefs = new Set();
|
|
169
|
+
for (const link of head.querySelectorAll('link[rel~="stylesheet"][href]')) {
|
|
170
|
+
hrefs.add(link.href);
|
|
171
|
+
}
|
|
172
|
+
const texts = new Set();
|
|
173
|
+
for (const style of head.querySelectorAll("style"))
|
|
174
|
+
texts.add(style.textContent ?? "");
|
|
175
|
+
const loads = [];
|
|
176
|
+
for (const el of doc.head.querySelectorAll('link[rel~="stylesheet"][href], style')) {
|
|
177
|
+
if (el.localName === "style") {
|
|
178
|
+
const text = el.textContent ?? "";
|
|
179
|
+
if (texts.has(text))
|
|
180
|
+
continue;
|
|
181
|
+
texts.add(text);
|
|
182
|
+
head.append(document.importNode(el, true));
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const href = new URL(el.getAttribute("href") ?? "", url).href;
|
|
186
|
+
if (hrefs.has(href))
|
|
187
|
+
continue;
|
|
188
|
+
hrefs.add(href);
|
|
189
|
+
const link = document.importNode(el, true);
|
|
190
|
+
link.href = href;
|
|
191
|
+
loads.push(new Promise((done) => {
|
|
192
|
+
link.addEventListener("load", () => done(), { once: true });
|
|
193
|
+
link.addEventListener("error", () => done(), { once: true });
|
|
194
|
+
}));
|
|
195
|
+
head.append(link);
|
|
196
|
+
}
|
|
197
|
+
if (loads.length === 0)
|
|
198
|
+
return;
|
|
199
|
+
let timer = 0;
|
|
200
|
+
await Promise.race([
|
|
201
|
+
Promise.all(loads),
|
|
202
|
+
new Promise((done) => (timer = window.setTimeout(done, STYLESHEET_WAIT))),
|
|
203
|
+
]);
|
|
204
|
+
window.clearTimeout(timer);
|
|
205
|
+
}
|
|
146
206
|
/**
|
|
147
207
|
* @description Moves focus to the new page's primary heading so screen readers
|
|
148
208
|
* announce the navigation.
|
|
@@ -251,6 +311,10 @@ if ("navigation" in window) {
|
|
|
251
311
|
fullLoad(e.destination.url);
|
|
252
312
|
return;
|
|
253
313
|
}
|
|
314
|
+
// The destination's own stylesheets load before it is shown.
|
|
315
|
+
await adoptStyles(doc, e.destination.url);
|
|
316
|
+
if (e.signal.aborted)
|
|
317
|
+
return;
|
|
254
318
|
let body = document.body;
|
|
255
319
|
const update = () => {
|
|
256
320
|
body = swapBody(doc.body);
|
|
@@ -291,4 +355,4 @@ if ("navigation" in window) {
|
|
|
291
355
|
else if (optedIn(document)) {
|
|
292
356
|
console.warn("Navigation API not supported: data-ui-navigation falls back to full page loads.");
|
|
293
357
|
}
|
|
294
|
-
export { swapBody };
|
|
358
|
+
export { adoptStyles, swapBody };
|