@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.
Files changed (88) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +5 -9
  3. package/dist/sri.json +35 -31
  4. package/dist/zazz.css +1 -1
  5. package/dist/zazz.js +1 -1
  6. package/editor/zazz.css-data.json +173 -3
  7. package/editor/zazz.html-data.json +138 -0
  8. package/editor/zazz.language-data.json +313 -125
  9. package/editor/zazz.lint-data.json +1501 -1383
  10. package/package.json +1 -5
  11. package/src/base/_defaults.css +1 -1
  12. package/src/base/_reset.css +16 -2
  13. package/src/base/_variables.css +43 -31
  14. package/src/base/carousel-scroll.d.ts +161 -0
  15. package/src/base/carousel-scroll.d.ts.map +1 -0
  16. package/src/base/carousel-scroll.js +1035 -0
  17. package/src/base/carousel-scroll.ts +1227 -0
  18. package/src/base/carousel.d.ts +34 -0
  19. package/src/base/carousel.d.ts.map +1 -0
  20. package/src/base/carousel.js +279 -0
  21. package/src/base/carousel.ts +292 -0
  22. package/src/base/dialog-lifecycle.js +1 -1
  23. package/src/base/dialog-lifecycle.ts +1 -1
  24. package/src/base/gesture.d.ts +201 -0
  25. package/src/base/gesture.d.ts.map +1 -0
  26. package/src/base/gesture.js +317 -0
  27. package/src/base/gesture.ts +494 -0
  28. package/src/base/kit-styling.d.ts.map +1 -1
  29. package/src/base/kit-styling.js +182 -162
  30. package/src/base/kit-styling.ts +182 -162
  31. package/src/base/navigation.d.ts +12 -1
  32. package/src/base/navigation.d.ts.map +1 -1
  33. package/src/base/navigation.js +65 -1
  34. package/src/base/navigation.ts +66 -1
  35. package/src/base/utils.d.ts +1 -1
  36. package/src/base/utils.js +2 -2
  37. package/src/base/utils.ts +2 -2
  38. package/src/globals.d.ts +7 -30
  39. package/src/head.d.ts.map +1 -1
  40. package/src/head.js +1 -25
  41. package/src/head.ts +1 -25
  42. package/src/index.css +1 -0
  43. package/src/index.d.ts +6 -5
  44. package/src/index.d.ts.map +1 -1
  45. package/src/index.js +6 -5
  46. package/src/index.ts +6 -5
  47. package/src/manifest.d.ts +1 -1
  48. package/src/manifest.d.ts.map +1 -1
  49. package/src/manifest.js +25 -13
  50. package/src/manifest.ts +26 -14
  51. package/src/primitives/button/button.css +1 -1
  52. package/src/primitives/carousel/carousel.css +103 -20
  53. package/src/primitives/carousel/carousel.d.ts +4 -32
  54. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  55. package/src/primitives/carousel/carousel.js +39 -14
  56. package/src/primitives/carousel/carousel.ts +21 -25
  57. package/src/primitives/dialog/dialog.css +14 -8
  58. package/src/primitives/drawer/drawer-indent.html +27 -0
  59. package/src/primitives/drawer/drawer-nested.html +72 -0
  60. package/src/primitives/drawer/drawer-responsive-dialog.html +44 -0
  61. package/src/primitives/drawer/drawer-snap.html +26 -0
  62. package/src/primitives/drawer/drawer.css +528 -0
  63. package/src/primitives/drawer/drawer.d.ts +24 -0
  64. package/src/primitives/drawer/drawer.d.ts.map +1 -0
  65. package/src/primitives/drawer/drawer.html +42 -0
  66. package/src/primitives/drawer/drawer.js +765 -0
  67. package/src/primitives/drawer/drawer.ts +823 -0
  68. package/src/primitives/fields/fields.css +4 -2
  69. package/src/primitives/input/input.css +1 -1
  70. package/src/primitives/input-group/input-group.css +5 -5
  71. package/src/primitives/lightbox/lightbox.css +2 -2
  72. package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
  73. package/src/primitives/lightbox/lightbox.js +9 -8
  74. package/src/primitives/lightbox/lightbox.ts +9 -8
  75. package/src/primitives/password-group/password-group.css +5 -5
  76. package/src/primitives/radio/radio.css +15 -10
  77. package/src/primitives/slider/slider.css +2 -2
  78. package/src/primitives/switch/switch.css +6 -6
  79. package/src/primitives/tabs/tabs.css +10 -10
  80. package/src/primitives/toaster/toaster.css +29 -1
  81. package/src/primitives/toaster/toaster.d.ts.map +1 -1
  82. package/src/primitives/toaster/toaster.js +117 -9
  83. package/src/primitives/toaster/toaster.ts +136 -9
  84. package/src/primitives/tooltip/tooltip.css +93 -10
  85. package/src/base/embla.d.ts +0 -90
  86. package/src/base/embla.d.ts.map +0 -1
  87. package/src/base/embla.js +0 -878
  88. package/src/base/embla.ts +0 -1066
@@ -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: [71],
305
+ band: [73],
290
306
  bg: [
291
- 5, 18, 33, 37, 46, 137, 143, 146, 149, 151, 154, 159, 160, 177, 179, 192, 213, 226, 227, 229,
292
- 236, 238, 247, 248, 252, 253, 254, 271, 272, 274,
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, 146, 151, 248],
310
+ "bg-clip": [37, 148, 153, 263],
295
311
  "border-color": [
296
- 18, 37, 46, 143, 146, 149, 151, 154, 159, 177, 179, 213, 227, 229, 247, 248, 252, 253, 254, 258,
297
- 271, 272,
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, 146, 151, 159, 177, 227, 229, 247, 248, 271, 272],
300
- "border-width": [37, 46, 146, 151, 159, 177, 178, 227, 229, 247, 248, 271, 272],
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, 114, 120, 137, 143, 146, 151, 159, 160, 177, 179, 192, 213, 226, 227, 229, 247,
303
- 248, 258, 271, 272, 274,
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: [179, 213, 271],
306
- display: [5, 21, 22, 23, 168, 175, 179, 213],
321
+ cursor: [194, 228, 287],
322
+ display: [5, 21, 22, 23, 183, 190, 194, 228],
307
323
  flex: [21, 22],
308
- "flex-wrap": [46, 179, 213],
309
- "font-family": [143, 146, 151, 238, 248, 274],
310
- "font-size": [46, 143, 146, 151, 177, 229, 238, 247, 248, 274],
311
- "font-weight": [143, 146, 151, 248],
312
- gap: [5, 37, 42, 46, 69, 103, 143, 146, 151, 159, 168, 175, 179, 213, 248, 274],
313
- h: [46, 146, 160, 177, 192, 226, 229, 271],
314
- items: [23, 46, 175, 179, 213],
315
- justify: [23, 175],
316
- leading: [46, 143, 146, 151, 177, 229, 247, 248, 274],
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, 247],
319
- "max-w": [143, 258],
320
- "min-h": [24, 46, 151, 179, 213, 247, 248, 274],
321
- "min-w": [46, 66, 105, 106, 177, 229, 247, 258, 274],
322
- mx: [143, 258],
323
- my: [143, 258],
324
- p: [5, 37, 159, 179, 213, 258],
325
- pl: [46, 177, 229],
326
- pr: [46, 177, 229],
327
- px: [143, 146, 151, 247, 248, 274],
328
- py: [46, 143, 146, 151, 177, 229, 247, 248, 274],
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, 114, 120, 137, 143, 146, 151, 159, 160, 177, 179, 192, 213, 226, 227, 229, 247,
331
- 248, 258, 271, 272, 274,
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": [146, 151, 248],
334
- self: [168],
349
+ "ring-color": [148, 153, 263],
350
+ self: [183],
335
351
  shadow: [
336
- 23, 30, 37, 46, 105, 143, 146, 151, 159, 160, 177, 179, 213, 227, 229, 247, 248, 258, 271, 272,
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, 270],
339
- size: [227, 272],
340
- "template-cols": [168],
355
+ "shadow-angle": [7, 286],
356
+ size: [242, 288],
357
+ "template-cols": [183],
341
358
  text: [
342
- 37, 46, 143, 146, 149, 151, 154, 159, 160, 177, 179, 213, 229, 238, 247, 248, 252, 253, 254,
343
- 274,
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, 106, 160, 168, 177, 179, 192, 213, 226, 229, 247, 271],
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, 104, 111, 141, 160, 199, 202, 209, 211],
355
- animation: [161, 226, 228, 270],
356
- aspect: [90, 92, 150, 155, 156, 255, 256],
357
- "backdrop-filter": [127],
358
- band: [0, 1, 2, 71, 170, 171, 174],
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, 81, 95, 130, 182, 183, 188, 189, 210, 216, 217, 222, 223, 230, 276,
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, 88, 91, 107, 108, 114, 117, 119, 120, 121, 125, 126, 127, 133,
364
- 137, 142, 143, 146, 151, 159, 160, 165, 177, 179, 188, 189, 192, 195, 196, 213, 222, 223, 226,
365
- 227, 229, 232, 236, 238, 241, 242, 244, 247, 248, 258, 262, 264, 268, 269, 270, 271, 272, 274,
366
- ],
367
- "col-end": [0, 1, 2, 71, 169, 170, 171, 174],
368
- "col-span": [0, 1, 2, 71, 170, 171, 174],
369
- "col-start": [0, 1, 2, 71, 169, 170, 171, 174],
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, 105, 110, 117, 119, 121, 126, 127, 133, 143, 146, 151, 159, 160,
372
- 177, 179, 188, 189, 213, 227, 229, 232, 247, 248, 258, 265, 271, 272,
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, 81, 95, 101, 102, 107, 128, 129, 130, 131, 146, 151, 165,
376
- 180, 182, 183, 187, 188, 189, 210, 214, 216, 217, 221, 222, 223, 227, 230, 231, 233, 235, 236,
377
- 248, 268, 271, 272, 276,
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, 179, 195, 213],
397
+ "flex-wrap": [46, 194, 210, 228],
380
398
  gap: [
381
- 5, 27, 29, 37, 42, 45, 46, 50, 52, 59, 60, 65, 69, 70, 87, 93, 100, 103, 108, 110, 116, 118,
382
- 120, 130, 133, 143, 146, 151, 159, 165, 168, 179, 180, 186, 195, 202, 209, 212, 213, 214, 220,
383
- 229, 230, 232, 248, 267, 274,
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, 69, 70, 87, 93, 100, 103, 108, 110, 116, 118,
387
- 120, 130, 133, 143, 146, 151, 159, 165, 168, 179, 180, 186, 195, 202, 209, 212, 213, 214, 220,
388
- 229, 230, 232, 248, 267, 274,
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, 69, 87, 93, 100, 103, 108, 110, 116, 118, 120,
392
- 130, 133, 143, 146, 159, 165, 168, 179, 180, 186, 195, 202, 209, 212, 213, 214, 220, 229, 230,
393
- 232, 267, 274,
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, 70, 72, 168, 212],
396
- "grid-rows": [38, 39, 75, 76, 164, 167],
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, 69, 70, 77, 78, 91, 93, 108, 114, 116, 118, 120, 121, 124, 133,
399
- 137, 143, 146, 147, 151, 152, 163, 175, 179, 180, 182, 183, 186, 196, 197, 202, 209, 212, 213,
400
- 214, 216, 217, 220, 227, 229, 230, 232, 234, 248, 250, 272, 274,
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, 77, 78, 84, 91, 94, 121, 123, 146, 147, 151, 152, 163, 164, 165, 175, 180, 195,
404
- 196, 209, 214, 229, 248, 250, 274,
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, 74, 79, 80, 92, 96, 97, 117, 122, 127, 133, 134, 135, 136, 143, 144, 145, 172, 173,
408
- 198, 249, 258, 265, 266, 273, 275,
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, 181, 182, 183, 184, 185, 215, 216, 217, 218, 219],
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, 78, 83, 84, 91, 108,
413
- 112, 120, 121, 125, 127, 132, 133, 143, 146, 147, 150, 151, 152, 153, 155, 156, 158, 159, 161,
414
- 163, 164, 165, 166, 177, 179, 180, 182, 183, 186, 188, 189, 190, 191, 193, 194, 195, 196, 201,
415
- 209, 213, 214, 216, 217, 220, 222, 223, 224, 225, 229, 232, 239, 240, 243, 247, 248, 250, 251,
416
- 255, 256, 257, 258, 261, 264, 273, 274, 277, 278, 279,
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, 78, 83, 84, 108, 112, 120, 121,
420
- 125, 127, 132, 133, 143, 146, 147, 150, 151, 152, 155, 156, 159, 161, 163, 164, 165, 179, 182,
421
- 183, 189, 193, 195, 196, 201, 209, 213, 216, 217, 223, 232, 239, 240, 243, 247, 248, 250, 255,
422
- 256, 258, 264, 274,
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, 78, 91, 108, 120, 121,
426
- 125, 127, 132, 133, 143, 146, 147, 150, 151, 152, 153, 155, 156, 158, 159, 161, 163, 165, 166,
427
- 177, 179, 180, 186, 188, 189, 190, 193, 194, 195, 196, 201, 209, 213, 214, 220, 222, 223, 224,
428
- 229, 232, 239, 240, 247, 248, 250, 251, 255, 256, 257, 258, 261, 264, 273, 274, 277, 278, 279,
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, 70, 77, 78, 84, 91, 94, 121, 123, 146, 147, 151, 152, 159, 161, 163, 164,
432
- 165, 175, 180, 195, 196, 209, 214, 229, 248, 250, 258, 274,
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, 69, 70, 77, 78, 91, 93, 108, 114, 116, 118, 120, 121, 124, 133,
436
- 137, 143, 146, 147, 151, 152, 163, 175, 179, 180, 182, 183, 186, 196, 197, 202, 209, 212, 213,
437
- 214, 216, 217, 220, 227, 229, 230, 232, 234, 248, 250, 272, 274,
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, 73, 74, 85, 86, 87, 90, 98, 99, 109, 113, 117, 119, 120, 121, 122, 127,
441
- 133, 137, 138, 142, 148, 156, 157, 162, 164, 199, 200, 208, 227, 248, 249, 258, 262, 265, 271,
442
- 272, 275, 276,
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, 105, 110, 119, 143, 203, 204, 205, 206, 207],
445
- "position-area": [127, 258],
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, 78, 108, 120, 121, 125, 127, 132,
448
- 133, 143, 146, 147, 150, 151, 152, 153, 155, 156, 158, 159, 161, 163, 165, 166, 177, 179, 180,
449
- 186, 188, 189, 191, 193, 195, 196, 201, 209, 213, 214, 220, 222, 223, 225, 229, 232, 239, 240,
450
- 247, 248, 250, 251, 255, 256, 257, 258, 264, 273, 274,
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, 78, 83, 84, 108, 112, 120, 121,
454
- 125, 127, 132, 133, 143, 146, 147, 150, 151, 152, 155, 156, 159, 161, 163, 165, 166, 179, 182,
455
- 183, 189, 193, 195, 196, 201, 209, 213, 216, 217, 223, 232, 239, 240, 243, 247, 248, 250, 255,
456
- 256, 258, 264, 274,
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, 78, 91, 108, 120, 121,
460
- 125, 127, 132, 133, 143, 146, 147, 150, 151, 152, 153, 155, 156, 158, 159, 161, 163, 165, 166,
461
- 177, 179, 180, 186, 188, 189, 190, 191, 193, 194, 195, 196, 201, 209, 213, 214, 220, 222, 223,
462
- 224, 225, 229, 232, 239, 240, 247, 248, 250, 251, 255, 256, 257, 258, 261, 264, 273, 274, 277,
463
- 278, 279,
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, 78, 83, 84, 108, 112, 120, 121,
467
- 125, 127, 132, 133, 143, 146, 147, 150, 151, 152, 155, 156, 159, 161, 163, 164, 165, 166, 179,
468
- 182, 183, 189, 193, 195, 196, 201, 209, 213, 216, 217, 223, 232, 239, 240, 243, 247, 248, 250,
469
- 255, 256, 258, 264, 274,
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, 79, 82, 88, 89, 90, 95, 98, 108, 114, 119, 120, 121, 125, 126,
473
- 133, 137, 139, 140, 142, 143, 146, 151, 159, 160, 177, 179, 187, 188, 189, 192, 201, 209, 213,
474
- 221, 222, 223, 226, 227, 229, 232, 247, 248, 258, 264, 271, 272, 273, 274,
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, 79, 82, 88, 89, 90, 95, 98, 108, 114, 119, 120, 121, 125, 126,
478
- 133, 137, 139, 140, 142, 143, 146, 151, 159, 160, 177, 179, 187, 188, 189, 192, 201, 209, 213,
479
- 221, 222, 223, 226, 227, 229, 232, 247, 248, 258, 264, 271, 272, 273, 274,
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, 79, 82, 88, 89, 90, 95, 98, 108, 114, 119, 120, 121, 125, 126,
483
- 133, 137, 139, 140, 142, 143, 146, 151, 159, 160, 177, 179, 187, 188, 189, 192, 201, 209, 213,
484
- 221, 222, 223, 226, 227, 229, 232, 247, 248, 258, 264, 271, 272, 273, 274,
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, 79, 82, 88, 89, 90, 95, 98, 108, 114, 119, 120, 121, 125, 126,
488
- 133, 137, 139, 140, 142, 143, 146, 151, 159, 160, 177, 179, 187, 188, 189, 192, 201, 209, 213,
489
- 221, 222, 223, 226, 227, 229, 232, 247, 248, 258, 264, 271, 272, 273, 274,
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, 79, 82, 88, 89, 90, 95, 98, 108, 114, 119, 120, 121, 125, 126,
493
- 133, 137, 139, 140, 142, 143, 146, 151, 159, 160, 177, 179, 187, 188, 189, 192, 201, 209, 213,
494
- 221, 222, 223, 226, 227, 229, 232, 247, 248, 258, 264, 271, 272, 273, 274,
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, 105, 110, 117, 119, 121, 126, 127, 133, 143, 146, 151, 159, 160,
498
- 177, 179, 188, 189, 213, 227, 229, 232, 247, 248, 258, 265, 271, 272,
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, 105, 110, 117, 119, 121, 126, 127, 133, 143, 146, 151, 159, 160,
502
- 177, 179, 188, 189, 213, 227, 229, 232, 247, 248, 258, 265, 271, 272,
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, 105, 110, 117, 119, 121, 126, 127, 133, 143, 146, 151, 159, 160,
506
- 177, 179, 188, 189, 213, 227, 229, 232, 247, 248, 258, 265, 271, 272,
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, 105, 110, 117, 119, 121, 126, 127, 133, 143, 146, 151, 159, 160,
510
- 177, 179, 188, 189, 213, 227, 229, 232, 247, 248, 258, 265, 271, 272,
511
- ],
512
- "row-end": [0, 1, 2, 161, 165, 166, 169, 170, 171, 174],
513
- "row-span": [0, 1, 2, 161, 165, 166, 170, 171, 174],
514
- "row-start": [0, 1, 2, 161, 165, 166, 169, 170, 171, 174],
515
- self: [164, 165, 168, 174, 176, 237],
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, 105, 110, 117, 119, 121, 126, 127, 133, 143, 146, 151, 159, 160,
518
- 177, 179, 188, 189, 213, 227, 229, 232, 247, 248, 258, 265, 271, 272,
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, 81, 95, 101, 102, 107, 128, 129, 130, 131, 146, 151, 165,
522
- 180, 187, 188, 189, 210, 214, 221, 222, 223, 227, 230, 231, 233, 235, 236, 248, 268, 271, 272,
523
- 276,
524
- ],
525
- "template-cols": [37, 38, 40, 70, 72, 168, 212],
526
- "template-rows": [38, 39, 75, 76, 164, 167],
527
- "text-align": [115, 123, 174, 209, 229, 238, 239, 263],
528
- "text-decoration": [146, 151, 201, 246, 248, 259, 260],
529
- "text-wrap": [10, 11, 12, 13, 14, 15, 121, 143, 245, 262],
530
- translate: [74, 172, 173],
531
- z: [73, 85, 86, 99, 119, 121, 162, 196],
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
  };
@@ -9,5 +9,16 @@
9
9
  * @private
10
10
  */
11
11
  declare function swapBody(next: HTMLElement): HTMLElement;
12
- export { swapBody };
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":"AAsFA;;;;;;;;;GASG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAgDhD;AAyJD,OAAO,EAAE,QAAQ,EAAE,CAAC"}
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"}
@@ -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 };