@astryx-vue/core 0.19.0 → 0.20.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.
Files changed (158) hide show
  1. package/dist/AlertDialog/index.js +1 -1
  2. package/dist/{AlertDialog-CNb0dkY9.js → AlertDialog-Dbg8L2oy.js} +1 -1
  3. package/dist/AppShell/index.js +1 -1
  4. package/dist/{AppShell-NvIT99xw.js → AppShell-zEXmJb1h.js} +116 -9
  5. package/dist/AvatarGroup/index.d.ts +1 -1
  6. package/dist/Banner/index.d.ts +1 -1
  7. package/dist/BottomSheet/index.js +2 -2
  8. package/dist/{BottomSheet-CCW58Kl3.js → BottomSheet-DNuzJPfQ.js} +2 -2
  9. package/dist/{BottomSheet-HQpcSkPH.js → BottomSheet-DV7bboru.js} +1 -1
  10. package/dist/Breadcrumbs/index.d.ts +1 -1
  11. package/dist/Breadcrumbs/index.js +1 -1
  12. package/dist/{Breadcrumbs-DXzBkpkd.js → Breadcrumbs-yB6yZCuZ.js} +1 -1
  13. package/dist/Button/index.d.ts +1 -1
  14. package/dist/ButtonGroup/index.d.ts +1 -1
  15. package/dist/Calendar/index.d.ts +1 -1
  16. package/dist/Calendar/index.js +1 -1
  17. package/dist/{Calendar-DSRNuw3y.js → Calendar-ydp0vJdO.js} +1 -1
  18. package/dist/Carousel/index.d.ts +1 -1
  19. package/dist/Center/index.d.ts +1 -1
  20. package/dist/Chat/index.d.ts +1 -1
  21. package/dist/CheckboxInput/index.d.ts +1 -1
  22. package/dist/CheckboxList/index.d.ts +1 -1
  23. package/dist/ClickableCard/index.d.ts +1 -1
  24. package/dist/Collapsible/index.js +1 -1
  25. package/dist/{Collapsible-ExzU7vC0.js → Collapsible-BG-u5nEt.js} +2 -1
  26. package/dist/CommandPalette/index.js +1 -1
  27. package/dist/{CommandPalette-CECjNvGB.js → CommandPalette-CV7t0ouM.js} +1 -1
  28. package/dist/ComplexSelector/index.d.ts +1 -1
  29. package/dist/ComplexSelector/index.js +1 -1
  30. package/dist/{ComplexSelector-Dmaag1wm.js → ComplexSelector-BOACo2vq.js} +1 -1
  31. package/dist/ContextMenu/index.d.ts +1 -1
  32. package/dist/ContextMenu/index.js +1 -1
  33. package/dist/{ContextMenu-CujLDt4e.js → ContextMenu-_cj8wRB6.js} +1 -1
  34. package/dist/DateInput/index.d.ts +1 -1
  35. package/dist/DateInput/index.js +1 -1
  36. package/dist/{DateInput-s2H0orUW.js → DateInput-DrMqXWSj.js} +3 -3
  37. package/dist/DateRangeInput/index.d.ts +1 -1
  38. package/dist/DateRangeInput/index.js +1 -1
  39. package/dist/{DateRangeInput-Dn9I2PMM.js → DateRangeInput-BZuyhf-w.js} +19 -11
  40. package/dist/DateTimeInput/index.d.ts +1 -1
  41. package/dist/DateTimeInput/index.js +1 -1
  42. package/dist/{DateTimeInput-BR_tdURg.js → DateTimeInput-DhB2gzx5.js} +3 -3
  43. package/dist/Dialog/index.js +3 -3
  44. package/dist/{Dialog-BQ5OBB1d.js → Dialog-B2pOTrnQ.js} +1 -1
  45. package/dist/{Dialog-DgdbRn2l.js → Dialog-CztWmbf8.js} +1 -1
  46. package/dist/{DialogHeader-D8234o9F.js → DialogHeader-5A5BUTTB.js} +1 -1
  47. package/dist/Divider/index.d.ts +1 -1
  48. package/dist/Drawer/index.d.ts +1 -1
  49. package/dist/Drawer/index.js +1 -1
  50. package/dist/{Drawer-Dqus7kUc.js → Drawer-Dt6paoDZ.js} +2 -2
  51. package/dist/DropdownMenu/index.js +2 -2
  52. package/dist/{DropdownMenu-LQsXd-_V.js → DropdownMenu-CFX1k1Ib.js} +1 -1
  53. package/dist/{DropdownMenu-BC_zB9le.js → DropdownMenu-D8s058G5.js} +1 -1
  54. package/dist/FileInput/index.d.ts +1 -1
  55. package/dist/InfoTip/index.d.ts +1 -1
  56. package/dist/InputGroup/index.d.ts +1 -1
  57. package/dist/Lightbox/index.js +1 -1
  58. package/dist/{Lightbox-RN_f7zRw.js → Lightbox-D8kFIbPj.js} +1 -1
  59. package/dist/Link/index.d.ts +1 -1
  60. package/dist/List/index.d.ts +1 -1
  61. package/dist/MobileNav/index.d.ts +1 -1
  62. package/dist/MobileNav/index.js +1 -1
  63. package/dist/{MobileNavToggle-DlQmYaBx.js → MobileNavToggle-CKEOroi0.js} +75 -32
  64. package/dist/MoreMenu/index.d.ts +1 -1
  65. package/dist/MultiSelector/index.d.ts +1 -1
  66. package/dist/MultiSelector/index.js +1 -1
  67. package/dist/{MultiSelector-BK6nZweN.js → MultiSelector-CkAhUYdn.js} +1 -1
  68. package/dist/{NavHeadingSurface-C17cbKn9.js → NavHeadingSurface-DZPa2px5.js} +19 -5
  69. package/dist/NavItem/index.d.ts +2 -2
  70. package/dist/NavItem/index.js +1 -1
  71. package/dist/{NavItem-BAe-tUG9.js → NavItem-CcbOJNnY.js} +18 -5
  72. package/dist/NavMenu/index.d.ts +1 -1
  73. package/dist/NumberInput/index.d.ts +1 -1
  74. package/dist/OverflowList/index.d.ts +1 -1
  75. package/dist/Overlay/index.d.ts +1 -1
  76. package/dist/Pagination/index.js +1 -1
  77. package/dist/{Pagination-DFQNX_Mb.js → Pagination-C0oI5FRP.js} +1 -1
  78. package/dist/Popover/index.d.ts +1 -1
  79. package/dist/Popover/index.js +1 -1
  80. package/dist/{Popover-CmAEizH-.js → Popover-Cl4gQQZq.js} +2 -1
  81. package/dist/PowerSearch/index.d.ts +1 -1
  82. package/dist/PowerSearch/index.js +1 -1
  83. package/dist/{PowerSearch-CDEn08Pe.js → PowerSearch-CPgbhvEL.js} +6 -6
  84. package/dist/Radio/index.d.ts +1 -1
  85. package/dist/RadioList/index.d.ts +1 -1
  86. package/dist/ScrollableArea/index.d.ts +1 -1
  87. package/dist/SelectableCard/index.d.ts +1 -1
  88. package/dist/Selector/index.d.ts +1 -1
  89. package/dist/Selector/index.js +1 -1
  90. package/dist/{Selector-Bo7qkt1P.js → Selector-CUTnAjq-.js} +1 -1
  91. package/dist/SideNav/index.d.ts +1 -1
  92. package/dist/SideNav/index.js +2 -2
  93. package/dist/{SideNav-CcZLUd7G.js → SideNav-5yLlEOdD.js} +511 -57
  94. package/dist/Switch/index.d.ts +1 -1
  95. package/dist/TabList/index.d.ts +1 -1
  96. package/dist/Table/index.d.ts +1 -1
  97. package/dist/Table/index.js +1 -1
  98. package/dist/{Table-WukSceMV.js → Table-Eok91IcO.js} +8 -6
  99. package/dist/TextArea/index.d.ts +1 -1
  100. package/dist/TextInput/index.d.ts +1 -1
  101. package/dist/{TimeField-BM-rVFhC.js → TimeField-jfhGVEyI.js} +1 -1
  102. package/dist/TimeInput/index.d.ts +1 -1
  103. package/dist/TimeInput/index.js +1 -1
  104. package/dist/{TimeInput-CkZfhhAr.js → TimeInput-CvFcN4nl.js} +1 -1
  105. package/dist/Timestamp/index.d.ts +1 -1
  106. package/dist/ToggleButton/index.d.ts +1 -1
  107. package/dist/Token/index.d.ts +1 -1
  108. package/dist/Tokenizer/index.d.ts +1 -1
  109. package/dist/Toolbar/index.d.ts +1 -1
  110. package/dist/TopNav/index.d.ts +1 -1
  111. package/dist/TopNav/index.js +1 -1
  112. package/dist/{TopNav-CFkThrKq.js → TopNav-CSFUTuyI.js} +3 -3
  113. package/dist/TreeList/index.js +1 -1
  114. package/dist/{TreeList-ugSF9DWj.js → TreeList-B33huihx.js} +2 -1
  115. package/dist/{landing-Bs0aMIsR.js → batch-BJD6Bt-O.js} +42 -740
  116. package/dist/composables/index.d.ts +1 -1
  117. package/dist/composables/index.js +4 -4
  118. package/dist/{composables-BgfubKnk.js → composables-CDrwFX0l.js} +2 -19
  119. package/dist/context-Cj_zItu2.js +729 -0
  120. package/dist/edge-DIlkB7vS.js +164 -0
  121. package/dist/edgeRide-D0oC2JEB.js +499 -0
  122. package/dist/focusRegion-CmDg7_4b.js +81 -0
  123. package/dist/{handle-BPXdHbkr.js → handle-ChN2TMKH.js} +1 -1
  124. package/dist/{index-CuW4AQ7M.d.ts → index--kbwaSXW.d.ts} +1 -1
  125. package/dist/{index-CryFtTT6.d.ts → index-BIQZa2BD.d.ts} +1 -1
  126. package/dist/{index-ZbNwGVkS.d.ts → index-BKnyTWPM.d.ts} +1 -1
  127. package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
  128. package/dist/{index-CEjvYAUZ.d.ts → index-BvWBeoa8.d.ts} +1 -1
  129. package/dist/{index-BeR-1LgF.d.ts → index-C5fbwY7Y.d.ts} +4 -3
  130. package/dist/{index-D05JGsT3.d.ts → index-C8wfe0Mr.d.ts} +1 -1
  131. package/dist/{index-CyMStZq4.d.ts → index-CHLLk77c.d.ts} +6 -6
  132. package/dist/{index-BLnvQ4Oj.d.ts → index-DBu-H-vB.d.ts} +5 -1
  133. package/dist/{index-QnlWyUxN.d.ts → index-DE1genab.d.ts} +2 -2
  134. package/dist/{index-t27MvEzT.d.ts → index-DbfcTFO6.d.ts} +47 -43
  135. package/dist/{index-lmd9LZKB.d.ts → index-Djf0M7PH.d.ts} +1 -1
  136. package/dist/{index-9tZJgo0R.d.ts → index-DoSTYXsP.d.ts} +1 -1
  137. package/dist/{index-CH-xSiJz.d.ts → index-DtZUOyCy.d.ts} +2 -2
  138. package/dist/{index-CfXW4km8.d.ts → index-GgHVkJtB.d.ts} +1 -1
  139. package/dist/{index-BapQGST1.d.ts → index-Xhq1E7WZ.d.ts} +3 -3
  140. package/dist/{index-C1zwvxPH.d.ts → index-ZKBj_1nu.d.ts} +2 -1
  141. package/dist/{index-CULdl3Dg.d.ts → index-gxuXI7KD.d.ts} +3 -3
  142. package/dist/{index-dWlCpnua.d.ts → index-mK1ICsVg.d.ts} +1 -1
  143. package/dist/{index-C9OzEvE_.d.ts → index-mPBIdznc.d.ts} +5 -5
  144. package/dist/index.d.ts +22 -22
  145. package/dist/index.js +37 -37
  146. package/dist/landing-C7nc9JHm.js +104 -0
  147. package/dist/quietFinished-CKZXgsPM.js +19 -0
  148. package/dist/{types-BG23kC3S.d.ts → types-C2ZuV4jf.d.ts} +7 -1
  149. package/dist/{useDateRange-CIXoE_8k.js → useDateRange-D1Szw54e.js} +7 -3
  150. package/dist/{useFocusTrap-BUd-fvUH.js → useFocusTrap-DsYtRdmV.js} +2 -81
  151. package/dist/{useMonthGrid-fGHSSrFc.js → useMonthGrid-Bzvlstgc.js} +1 -1
  152. package/package.json +1 -1
  153. package/styles/date-range-input.css +19 -2
  154. package/styles/mobile-nav.css +4 -2
  155. package/styles/nav-item.css +3 -3
  156. package/styles/side-nav.css +36 -8
  157. package/dist/context-ZsDEkhSF.js +0 -24
  158. package/dist/{index-J6YRJ7Ul.d.ts → index-CHx33xGa.d.ts} +1 -1
@@ -1,4 +1,4 @@
1
- import { _ as sharedMap, b as sharedWeakSet, c as parseCssEasing, g as writePresentedResolve, h as registerPresentedOffset, i as reducedMotionCrossFade, l as parseMotionRoleValue, m as clearPresentedResolve, p as batchPresented, r as cubicBezier, t as areaOf, v as sharedState, x as themeReducesMotion, y as sharedWeakMap } from "./handle-BPXdHbkr.js";
1
+ import { S as themeReducesMotion, _ as writePresentedResolve, a as reducedMotionCrossFade, b as sharedWeakMap, g as registerPresentedOffset, h as clearPresentedResolve, i as cubicBezier, l as parseCssEasing, m as batchPresented, u as parseMotionRoleValue, v as sharedMap, x as sharedWeakSet, y as sharedState } from "./handle-ChN2TMKH.js";
2
2
  import { n as easeDefaults, t as durationDefaults } from "./motionTokenDefaults-EFzpiAF5.js";
3
3
  import { n as normalizeTokenName } from "./tokenName-0U-WEH09.js";
4
4
  //#region src/motion/linearEasing.ts
@@ -24,6 +24,24 @@ function sampleCount(durationMs) {
24
24
  /** Every animation this module started, so it can tell the app's apart. */
25
25
  const ours = sharedWeakSet("motion/animated-layout/ours", 1);
26
26
  const glides = sharedWeakMap("motion/animated-layout/glides", 1);
27
+ /**
28
+ * Where `element` shows at the timeline's time `at`: its layout box, moved by
29
+ * its glide's offset then. After a block, WebKit evaluates a running
30
+ * translate on the live clock. The timeline still reads the frame before the
31
+ * block, as every glide here does, so the evaluated box would sit ahead.
32
+ * Glides write px; a translate in percent is not ours, so the box stays.
33
+ */
34
+ function shownBoxAt(element, at) {
35
+ const box = element.getBoundingClientRect();
36
+ const glide = glides.get(element);
37
+ const startTime = glide?.animation.startTime;
38
+ if (glide == null || startTime == null) return box;
39
+ const translate = element.ownerDocument.defaultView?.getComputedStyle(element).translate ?? "";
40
+ if (translate.includes("%")) return box;
41
+ const [appliedX = 0, appliedY = 0] = numbersIn(translate);
42
+ const offset = glide.offsetAt(Math.max(0, at - Number(startTime)));
43
+ return new DOMRect(box.x + (offset.x - appliedX) * glide.scale.x, box.y + (offset.y - appliedY) * glide.scale.y, box.width, box.height);
44
+ }
27
45
  const TRANSFORM_PROPERTIES = [
28
46
  "transform",
29
47
  "translate",
@@ -571,6 +589,17 @@ function beginChange(doc) {
571
589
  const held = changeStarts.get(doc);
572
590
  if (held != null && clockOf(doc) - held.last > 34) changeStarts.delete(doc);
573
591
  }
592
+ /**
593
+ * When the animations of the layout change being made start. Code that
594
+ * follows the change on its own clock reads it, such as a rail's width or a
595
+ * swap's fade. It is the document timeline's current time. After a block
596
+ * since that frame, it is the moment the change made its first animation.
597
+ * Until the timeline reaches it, the change has not started.
598
+ */
599
+ function layoutStartFor(document) {
600
+ const now = document.timeline?.currentTime;
601
+ return now == null ? 0 : startFor(document, Number(now)).at;
602
+ }
574
603
  //#endregion
575
604
  //#region src/Theme/tokenReferences.ts
576
605
  /**
@@ -1173,6 +1202,17 @@ function changeStartOf(batch) {
1173
1202
  if (batch.start == null || batch.start.frame !== Number(now)) batch.start = startFor(doc, Number(now));
1174
1203
  return batch.start;
1175
1204
  }
1205
+ /**
1206
+ * The start of the change being made in `area`, captured now for animations
1207
+ * made later in the task, such as the parts riding a glide. It is its batch's
1208
+ * when one is open there, otherwise the document's.
1209
+ */
1210
+ function changeStartIn(area, doc) {
1211
+ const batch = area == null ? void 0 : batches.get(area);
1212
+ if (batch != null) return changeStartOf(batch);
1213
+ const now = doc.timeline?.currentTime;
1214
+ return now == null ? void 0 : startFor(doc, Number(now));
1215
+ }
1176
1216
  function flush(batch) {
1177
1217
  batches.delete(batch.area);
1178
1218
  const notify = (candidates) => {
@@ -1308,742 +1348,4 @@ function flush(batch) {
1308
1348
  }
1309
1349
  }
1310
1350
  //#endregion
1311
- //#region src/motion/layout/edge.ts
1312
- /** Whether `element` lays its inline axis out right to left. */
1313
- function isRtl(element) {
1314
- return element.ownerDocument.defaultView?.getComputedStyle(element).direction === "rtl";
1315
- }
1316
- /**
1317
- * The `clip-path` that hides `side` of an element from `edge`: `inset()`'s
1318
- * sides are physical (top, right, bottom, left), so an inline edge is
1319
- * mirrored right to left. `zero` is how the other three are written.
1320
- */
1321
- function edgeClip(edge, side, zero, rtl) {
1322
- const sides = [
1323
- zero,
1324
- zero,
1325
- zero,
1326
- zero
1327
- ];
1328
- const index = edge === "block-start" ? 0 : edge === "block-end" ? 2 : edge === "inline-end" !== rtl ? 1 : 3;
1329
- sides[index] = side;
1330
- return `inset(${sides.join(" ")})`;
1331
- }
1332
- /** A hidden fraction of the element, as a percentage clip on `edge`. */
1333
- function fractionClip(edge, hidden, rtl) {
1334
- return edgeClip(edge, `${round(hidden * 100)}%`, "0", rtl);
1335
- }
1336
- /** A hidden length of the element, in its own px, as a clip on `edge`. */
1337
- function pxClip(edge, hidden, rtl) {
1338
- return edgeClip(edge, `${hidden}px`, "0px", rtl);
1339
- }
1340
- /**
1341
- * The element's size along `edge`'s axis, in its own px (a scaled ancestor
1342
- * divided out), read from the layout the caller already laid out.
1343
- */
1344
- function extentOf(element, edge) {
1345
- const rect = element.getBoundingClientRect();
1346
- const scale = scaleOf(element, rect);
1347
- return edge.startsWith("inline") ? rect.width / scale.x : rect.height / scale.y;
1348
- }
1349
- /**
1350
- * The parts that slide inside an element revealed or concealed from a block
1351
- * edge by `extent` px. They are its child elements that the band can show:
1352
- * the area's visible part plus one viewport, or `extent` if larger, above and
1353
- * below. A part past the band cannot come into view while it moves, so it
1354
- * stays. The walk stops at the first child below the band, so its cost grows
1355
- * with the changed size, never with the length of a list. A translation
1356
- * cannot move text on its own, so an element with text of its own keeps the
1357
- * clip (null).
1358
- */
1359
- function slidingParts(element, edge, area, extent) {
1360
- if (!edge.startsWith("block") || !(extent > 0)) return null;
1361
- const view = element.ownerDocument.defaultView;
1362
- const style = view?.getComputedStyle(element);
1363
- if (view == null || style == null || paintsOwnBox(style) || ["::before", "::after"].some((pseudo) => {
1364
- const { content } = view.getComputedStyle(element, pseudo);
1365
- return content !== "" && content !== "none" && content !== "normal";
1366
- })) return null;
1367
- const band = bandFor(visibleRect(area), Math.max(view.innerHeight, extent));
1368
- const parts = [];
1369
- const scales = [];
1370
- for (let node = element.firstChild; node != null; node = node.nextSibling) {
1371
- if (node.nodeType === Node.TEXT_NODE) {
1372
- if ((node.textContent ?? "").trim() !== "") return null;
1373
- continue;
1374
- }
1375
- if (node.nodeType !== Node.ELEMENT_NODE) continue;
1376
- const { display } = view.getComputedStyle(node);
1377
- if (display === "inline" || display === "contents") return null;
1378
- const box = node.getBoundingClientRect();
1379
- if (box.top > band.end) break;
1380
- if (box.bottom >= band.start) {
1381
- if (glides.has(node)) return null;
1382
- parts.push(node);
1383
- scales.push(scaleOf(node, box, ownScaleOf(node)));
1384
- }
1385
- }
1386
- if (parts.length === 0) return null;
1387
- const inner = (side) => (Number.parseFloat(style.getPropertyValue(`border-${side}-width`)) || 0) + (Number.parseFloat(style.getPropertyValue(`padding-${side}`)) || 0);
1388
- return {
1389
- parts,
1390
- scales,
1391
- clip: edge === "block-end" ? `inset(${inner("top")}px 0px 0px 0px)` : `inset(0px 0px ${inner("bottom")}px 0px)`
1392
- };
1393
- }
1394
- /**
1395
- * Whether a style paints a box of its own: a fill, a border, a shadow, an
1396
- * outline or a filter.
1397
- */
1398
- function paintsOwnBox(style) {
1399
- const isClear = (color) => color === "" || color === "transparent" || /^rgba\(.*,\s*0\)$/.test(color);
1400
- return !isClear(style.backgroundColor) || style.backgroundImage !== "" && style.backgroundImage !== "none" || [
1401
- "Top",
1402
- "Right",
1403
- "Bottom",
1404
- "Left"
1405
- ].some((side) => style.getPropertyValue(`border-${side.toLowerCase()}-style`) !== "none" && Number.parseFloat(style.getPropertyValue(`border-${side.toLowerCase()}-width`)) > 0) || style.boxShadow !== "" && style.boxShadow !== "none" || style.borderImageSource !== "" && style.borderImageSource !== "none" || style.filter !== "" && style.filter !== "none" || style.outlineStyle !== "" && style.outlineStyle !== "none" && Number.parseFloat(style.outlineWidth) > 0;
1406
- }
1407
- /**
1408
- * Where the parts sit when the element hides `hidden` px from `edge`. They
1409
- * move that far towards it, so their far edge meets the content that rides
1410
- * the same edge.
1411
- */
1412
- function slideFrame(edge, hidden) {
1413
- return { translate: `0px ${edge === "block-end" ? -hidden : hidden}px` };
1414
- }
1415
- /**
1416
- * Clips `element` with `clip` while its parts slide, and returns what puts
1417
- * its own `clip-path` back. The clip does not move, so it stays in step with
1418
- * the parts and the content beside them on every engine.
1419
- */
1420
- function holdSlideClip(element, clip) {
1421
- const { style } = element;
1422
- const value = style.getPropertyValue("clip-path");
1423
- const priority = style.getPropertyPriority("clip-path");
1424
- style.setProperty("clip-path", clip);
1425
- return () => {
1426
- if (value === "") style.removeProperty("clip-path");
1427
- else style.setProperty("clip-path", value, priority);
1428
- };
1429
- }
1430
- /**
1431
- * The last element before `element` in the area that takes part in layout:
1432
- * its previous sibling, or its nearest ancestor's below the area (the mirror
1433
- * of `nextInFlow`, for a start edge).
1434
- */
1435
- function previousInFlow(element, area) {
1436
- const view = element.ownerDocument.defaultView;
1437
- const lastBox = (from) => {
1438
- const style = view?.getComputedStyle(from);
1439
- if (style == null) return from;
1440
- if (style.display === "contents") {
1441
- for (let child = from.lastElementChild; child != null; child = child.previousElementSibling) {
1442
- const box = lastBox(child);
1443
- if (box != null) return box;
1444
- }
1445
- return null;
1446
- }
1447
- return takesPart(from, style) ? from : null;
1448
- };
1449
- let node = element;
1450
- while (node != null && node !== area) {
1451
- for (let sibling = node.previousElementSibling; sibling != null; sibling = sibling.previousElementSibling) {
1452
- const box = lastBox(sibling);
1453
- if (box != null) return box;
1454
- }
1455
- node = node.parentElement;
1456
- }
1457
- return null;
1458
- }
1459
- /**
1460
- * The glide that moves `neighbour`: its own, or that of its nearest gliding
1461
- * ancestor below the area that does not also hold `element` (one that holds
1462
- * both moves the two together, so the edge does not ride it).
1463
- */
1464
- function glideMoving(neighbour, element, area) {
1465
- for (let node = neighbour; node != null && node !== area && !node.contains(element); node = node.parentElement) {
1466
- const glide = glides.get(node);
1467
- if (glide != null) return glide;
1468
- }
1469
- return null;
1470
- }
1471
- //#endregion
1472
- //#region src/motion/layout/playChange.ts
1473
- /** Each part's slide, by its motion: a stopped slide is no glide. */
1474
- const slideTargets = sharedWeakMap("motion/animated-layout/slide-targets", 1);
1475
- /**
1476
- * The changed element's own animation, on the same motion as the content
1477
- * after it (`spec:AST-105` FR4): content that appears reveals from its
1478
- * block-end edge downward, or from the `edge` it is given (FR9), and its edge
1479
- * rides the glide of the content on that side once it starts. A reveal that
1480
- * reverses a running conceal (an adopter opens it again mid-exit, after
1481
- * `releaseLayoutExit`) starts from what the element shows. Plays only with a
1482
- * handle, inside its area and in the area's visible part. Returns the
1483
- * entrance it started, or null when it played none.
1484
- */
1485
- function playLayoutChange(handle, element, { edge = "block-end" } = {}) {
1486
- if (handle == null) return null;
1487
- const area = areaOf(handle, element);
1488
- if (area == null) return null;
1489
- if (!intersects(element.getBoundingClientRect(), visibleRect(area))) return null;
1490
- const motion = layoutMotion(area);
1491
- if (motion.kind === "instant") return null;
1492
- const from = shownAtStart(element, 0);
1493
- const batch = batches.get(area);
1494
- const change = batch != null && [...batch.changed].some((changed) => changed === element || changed.contains(element)) ? changeStartOf(batch) : void 0;
1495
- if (motion.kind === "fade") return safeAnimate(element, [{ opacity: from }, { opacity: 1 }], {
1496
- duration: motion.durationMs,
1497
- easing: motion.easing
1498
- }, change);
1499
- const { progress } = motion;
1500
- const rtl = edge.startsWith("inline") && isRtl(element);
1501
- const extent = edge.startsWith("block") ? extentOf(element, edge) : 0;
1502
- const sliding = slidingParts(element, edge, area, extent);
1503
- const partMotions = slideParts(sliding, progress, change, (remaining) => slideFrame(edge, (1 - from) * remaining * extent));
1504
- const animation = safeAnimate(element, sampleKeyframes(progress, (remaining) => {
1505
- const hidden = (1 - from) * remaining;
1506
- return partMotions.length > 0 ? { opacity: 1 - hidden } : {
1507
- opacity: 1 - hidden,
1508
- clipPath: fractionClip(edge, hidden, rtl)
1509
- };
1510
- }), {
1511
- duration: progress.durationMs,
1512
- easing: "linear"
1513
- }, change);
1514
- if (animation == null) for (const part of partMotions) part.cancel();
1515
- else rideEdge(element, area, edge, rtl, trackEdgeMotion(element, animation, (t) => 1 - (1 - from) * progress.remaining(t), partMotions, partMotions.length > 0 && sliding != null ? holdSlideClip(element, sliding.clip) : void 0), false);
1516
- return animation;
1517
- }
1518
- /**
1519
- * Plays each part's slide on the change's start, sampled like the glide.
1520
- * `frame` turns the share of the motion still to come into a keyframe.
1521
- */
1522
- function slideParts(sliding, progress, change, frame, fill) {
1523
- const motions = [];
1524
- for (const [index, part] of (sliding?.parts ?? []).entries()) {
1525
- const motion = safeAnimate(part, sampleKeyframes(progress, frame), {
1526
- duration: progress.durationMs,
1527
- easing: "linear",
1528
- fill
1529
- }, change);
1530
- if (motion != null) {
1531
- motions.push(motion);
1532
- const glide = {
1533
- animation: motion,
1534
- offsetAt: (t) => drawnOffset(motion, t),
1535
- get durationMs() {
1536
- return liveDuration(motion, progress.durationMs);
1537
- },
1538
- shownBefore: {
1539
- x: 0,
1540
- y: 0
1541
- },
1542
- scale: sliding?.scales[index] ?? {
1543
- x: 1,
1544
- y: 1
1545
- }
1546
- };
1547
- glides.set(part, glide);
1548
- slideTargets.set(motion, part);
1549
- motion.addEventListener?.("finish", () => {
1550
- if (glides.get(part) === glide) glides.delete(part);
1551
- });
1552
- }
1553
- }
1554
- return motions;
1555
- }
1556
- /**
1557
- * The offset `animation` draws `t` ms in, read off its keyframes, a straight
1558
- * line between each two. A slide that rides another glide reads that glide's
1559
- * frames, so this follows it.
1560
- */
1561
- function drawnOffset(animation, t) {
1562
- const effect = animation.effect;
1563
- if (effect == null || typeof effect.getKeyframes !== "function") return {
1564
- x: 0,
1565
- y: 0
1566
- };
1567
- const frames = effect.getKeyframes();
1568
- const duration = Number(effect.getTiming().duration);
1569
- const at = duration > 0 ? Math.min(1, Math.max(0, t / duration)) : 1;
1570
- const offsetOf = (frame) => {
1571
- const [x = 0, y = 0] = numbersIn(String(frame?.translate ?? ""));
1572
- return {
1573
- x,
1574
- y,
1575
- offset: frame?.computedOffset ?? 0
1576
- };
1577
- };
1578
- let from = offsetOf(frames[0]);
1579
- let to = offsetOf(frames[frames.length - 1]);
1580
- for (const frame of frames) {
1581
- const point = offsetOf(frame);
1582
- if (point.offset <= at) from = point;
1583
- if (point.offset >= at) {
1584
- to = point;
1585
- break;
1586
- }
1587
- }
1588
- const span = to.offset - from.offset;
1589
- const k = span > 0 ? (at - from.offset) / span : 0;
1590
- return {
1591
- x: from.x + (to.x - from.x) * k,
1592
- y: from.y + (to.y - from.y) * k
1593
- };
1594
- }
1595
- /** How many ms before `animation` started `glide` started: 0 in one change. */
1596
- function startedBefore(glide, animation) {
1597
- const shift = Number(animation.startTime) - Number(glide.animation.startTime);
1598
- return Number.isFinite(shift) ? Math.max(0, shift) : 0;
1599
- }
1600
- /** `animation`'s length now, in ms, or `fallback` if it has none. */
1601
- function liveDuration(animation, fallback) {
1602
- const effect = animation.effect;
1603
- const duration = Number(effect?.getTiming?.().duration);
1604
- return duration > 0 ? duration : fallback;
1605
- }
1606
- /** Cancels a part's slide, and forgets it as the part's glide. */
1607
- function stopGlideOf(animation) {
1608
- const part = slideTargets.get(animation);
1609
- if (part != null && glides.get(part)?.animation === animation) glides.delete(part);
1610
- animation.cancel();
1611
- }
1612
- //#endregion
1613
- //#region src/motion/layout/exit.ts
1614
- /** The inline properties an exit sets, so a release removes exactly them. */
1615
- const EXIT_PROPERTIES = [
1616
- "margin-block-end",
1617
- "margin-inline-end",
1618
- "margin-block-start",
1619
- "margin-inline-start",
1620
- "pointer-events"
1621
- ];
1622
- /**
1623
- * The first element after `element` in the area that takes part in layout:
1624
- * its next sibling, or its nearest ancestor's below the area. A wrapper's
1625
- * edge is not used: a negative end margin can collapse through it.
1626
- */
1627
- function nextInFlow(element, area) {
1628
- const view = element.ownerDocument.defaultView;
1629
- const firstBox = (from) => {
1630
- const style = view?.getComputedStyle(from);
1631
- if (style == null) return from;
1632
- if (style.display === "contents") {
1633
- for (let child = from.firstElementChild; child != null; child = child.nextElementSibling) {
1634
- const box = firstBox(child);
1635
- if (box != null) return box;
1636
- }
1637
- return null;
1638
- }
1639
- return takesPart(from, style) ? from : null;
1640
- };
1641
- let node = element;
1642
- while (node != null && node !== area) {
1643
- for (let sibling = node.nextElementSibling; sibling != null; sibling = sibling.nextElementSibling) {
1644
- const box = firstBox(sibling);
1645
- if (box != null) return box;
1646
- }
1647
- node = node.parentElement;
1648
- }
1649
- return null;
1650
- }
1651
- /**
1652
- * An element's place: its block start, and its inline start (RTL read right
1653
- * to left).
1654
- */
1655
- function placeOf(element, rtl) {
1656
- const rect = element.getBoundingClientRect();
1657
- return {
1658
- block: rect.top,
1659
- inline: rtl ? -rect.right : rect.left
1660
- };
1661
- }
1662
- /**
1663
- * Keeps `element` where it is, in flow (so it scrolls and clips with its
1664
- * container), while the content after it takes the place it takes once the
1665
- * element is hidden: a negative end margin measured against that content,
1666
- * so a gap or collapsing margins come out exact. Returns false, setting
1667
- * nothing, when no margin reaches that place.
1668
- */
1669
- function giveUpSpace(element, area, edge = "block-end") {
1670
- const view = element.ownerDocument.defaultView;
1671
- const parent = element.parentElement == null ? void 0 : view?.getComputedStyle(element.parentElement);
1672
- const isRow = parent != null && parent.display.includes("flex") && parent.flexDirection.startsWith("row");
1673
- const rtl = view?.getComputedStyle(element).direction === "rtl";
1674
- const isStart = edge.endsWith("start");
1675
- const property = edge === "block-end" ? isRow ? "margin-inline-end" : "margin-block-end" : `margin-${edge}`;
1676
- const isInline = property.includes("inline");
1677
- const size = isInline ? element.offsetWidth : element.offsetHeight;
1678
- const next = nextInFlow(element, area);
1679
- if (next == null && !isStart) {
1680
- element.style.setProperty(property, `${-size}px`);
1681
- return true;
1682
- }
1683
- const own = element.style.getPropertyValue(property);
1684
- const ownPriority = element.style.getPropertyPriority(property);
1685
- const axis = isInline ? "inline" : "block";
1686
- const checked = [
1687
- next,
1688
- element.parentElement == null || element.parentElement === area ? null : nextInFlow(element.parentElement, area),
1689
- isStart ? previousInFlow(element, area) : null,
1690
- isStart ? element : null
1691
- ].filter((box) => box != null);
1692
- if (checked.length === 0) return false;
1693
- const scale = scaleOf(element, element.getBoundingClientRect());
1694
- const position = element.style.getPropertyValue("position");
1695
- const positionPriority = element.style.getPropertyPriority("position");
1696
- const shown = isStart ? placeOf(element, rtl) : null;
1697
- element.style.setProperty("position", "absolute", "important");
1698
- const targets = checked.map((box) => box === element && shown != null ? shown : placeOf(box, rtl));
1699
- const target = targets[0];
1700
- if (position === "") element.style.removeProperty("position");
1701
- else element.style.setProperty("position", position, positionPriority);
1702
- const perPx = isRow ? scale.x : scale.y;
1703
- element.style.setProperty(property, `${-size}px`);
1704
- const guess = placeOf(checked[0], rtl)[axis];
1705
- const correction = (target[axis] - guess) / perPx;
1706
- element.style.setProperty(property, `${-size + correction}px`);
1707
- if (checked.some((box, index) => {
1708
- const landed = placeOf(box, rtl);
1709
- return Math.abs(landed.block - targets[index].block) > 1 || Math.abs(landed.inline - targets[index].inline) > 1;
1710
- })) {
1711
- if (own === "") element.style.removeProperty(property);
1712
- else element.style.setProperty(property, own, ownPriority);
1713
- return false;
1714
- }
1715
- return true;
1716
- }
1717
- /** Exits holding an element back, so a release can stop one. */
1718
- const exits = sharedWeakMap("motion/animated-layout/exits", 1);
1719
- const replaced = sharedWeakMap("motion/animated-layout/replaced", 1);
1720
- /**
1721
- * The changed element's exit (`spec:AST-105` FR4): content that disappears
1722
- * keeps its place on screen but gives up its space (a negative end margin
1723
- * measured against the layout without it, so the content after it glides up
1724
- * at once to exactly where it ends, and it still scrolls and clips with its
1725
- * container), is inert (no focus, no pointer, nothing read), conceals upward
1726
- * from its bottom edge on the same motion, and then `done` runs, when the
1727
- * component hides or unmounts it. Under Reduce Motion with a coarse primary pointer it
1728
- * fades instead. Call it in the layout effect of the commit that closes the
1729
- * element, after the change's `animate()` reported it measured, in the same
1730
- * task: the glide reads the layout once the element has given up its space.
1731
- *
1732
- * It conceals to its block-end edge by default, or to the `edge` it is given
1733
- * (`spec:AST-105` FR9), and its edge rides the glide of the content on that
1734
- * side once it starts; a conceal that reverses a running reveal (a close
1735
- * while it opens) starts from what the element shows.
1736
- *
1737
- * Returns false, holding nothing, when the exit lands at once: no handle, a
1738
- * close no change in the area measured, outside the area or its visible part,
1739
- * Reduce Motion with a fine pointer, or a layout no end margin can free (a
1740
- * grid track and its gap, a flex-row item that sets its row's height); in
1741
- * that last case the content after it takes its final place at once too.
1742
- * The component then hides the element itself.
1743
- */
1744
- function holdLayoutExit(handle, element, done, { edge = "block-end" } = {}) {
1745
- if (handle == null) return false;
1746
- const area = areaOf(handle, element);
1747
- if (area == null || !intersects(element.getBoundingClientRect(), visibleRect(area))) return false;
1748
- const batch = batches.get(area);
1749
- if (batch == null || ![...batch.changed].some((changed) => changed === element || changed.contains(element))) return false;
1750
- const motion = layoutMotion(area);
1751
- if (motion.kind === "instant") return false;
1752
- releaseLayoutExit(element);
1753
- const prior = {
1754
- inert: element.hasAttribute("inert"),
1755
- styles: EXIT_PROPERTIES.map((property) => [
1756
- property,
1757
- element.style.getPropertyValue(property),
1758
- element.style.getPropertyPriority(property)
1759
- ])
1760
- };
1761
- if (!giveUpSpace(element, area, edge)) {
1762
- for (const changed of [...batch.changed]) if (changed === element || changed.contains(element)) batch.changed.delete(changed);
1763
- return false;
1764
- }
1765
- replaced.set(element, prior);
1766
- element.setAttribute("inert", "");
1767
- element.style.setProperty("pointer-events", "none");
1768
- const from = shownAtStart(element, 1);
1769
- const rtl = edge.startsWith("inline") && isRtl(element);
1770
- const change = changeStartOf(batch);
1771
- let animation;
1772
- if (motion.kind === "fade") animation = safeAnimate(element, [{ opacity: from }, { opacity: 0 }], {
1773
- duration: motion.durationMs,
1774
- easing: motion.easing,
1775
- fill: "forwards"
1776
- }, change);
1777
- else {
1778
- const { progress } = motion;
1779
- const extent = edge.startsWith("block") ? extentOf(element, edge) : 0;
1780
- const sliding = slidingParts(element, edge, area, extent);
1781
- const partMotions = slideParts(sliding, progress, change, (remaining) => slideFrame(edge, (1 - from * remaining) * extent), "forwards");
1782
- animation = safeAnimate(element, sampleKeyframes(progress, (remaining) => {
1783
- const shown = from * remaining;
1784
- return partMotions.length > 0 ? { opacity: shown } : {
1785
- opacity: shown,
1786
- clipPath: fractionClip(edge, 1 - shown, rtl)
1787
- };
1788
- }), {
1789
- duration: progress.durationMs,
1790
- easing: "linear",
1791
- fill: "forwards"
1792
- }, change);
1793
- if (animation == null) for (const part of partMotions) part.cancel();
1794
- else rideEdge(element, area, edge, rtl, trackEdgeMotion(element, animation, (t) => from * progress.remaining(t), partMotions, partMotions.length > 0 && sliding != null ? holdSlideClip(element, sliding.clip) : void 0, true), true);
1795
- }
1796
- exits.set(element, animation);
1797
- if (animation == null) {
1798
- done();
1799
- return true;
1800
- }
1801
- animation.addEventListener?.("finish", () => {
1802
- if (exits.get(element) === animation) done();
1803
- });
1804
- return true;
1805
- }
1806
- /**
1807
- * Puts an element `holdLayoutExit` held back: stops its exit and puts back
1808
- * what the exit replaced (its `inert` and inline values as they were). Called
1809
- * once the component has hidden the element, or when the element opens again
1810
- * mid-exit.
1811
- */
1812
- function releaseLayoutExit(element) {
1813
- if (!exits.has(element)) return;
1814
- const running = edgeMotions.get(element);
1815
- if (running != null) {
1816
- edgeMotions.delete(element);
1817
- stoppedShown.set(element, {
1818
- fraction: shownNow(running),
1819
- at: timelineNow(element)
1820
- });
1821
- stopSlides(running);
1822
- }
1823
- const held = heldSlides.get(element);
1824
- heldSlides.delete(element);
1825
- if (held != null) stopSlides(held);
1826
- exits.get(element)?.cancel();
1827
- exits.delete(element);
1828
- const prior = replaced.get(element);
1829
- replaced.delete(element);
1830
- if (prior?.inert !== true) element.removeAttribute("inert");
1831
- for (const [property, value, priority] of prior?.styles ?? []) if (value === "") element.style.removeProperty(property);
1832
- else element.style.setProperty(property, value, priority);
1833
- }
1834
- //#endregion
1835
- //#region src/motion/layout/edgeRide.ts
1836
- /** Each exit's motion, whose parts hold their slides until its release. */
1837
- const heldSlides = sharedWeakMap("motion/animated-layout/held-slides", 1);
1838
- /** Each element's running one-state reveal or conceal. */
1839
- const edgeMotions = sharedWeakMap("motion/animated-layout/edge-motions", 1);
1840
- /**
1841
- * What a one-state motion an adopter stopped (`releaseLayoutExit`) showed,
1842
- * and the timeline time it stopped at: a reveal started in the same frame,
1843
- * the reversal that stopped it, starts there.
1844
- */
1845
- const stoppedShown = sharedWeakMap("motion/animated-layout/stopped-shown", 1);
1846
- function timelineNow(element) {
1847
- return Number(element.ownerDocument.timeline?.currentTime ?? NaN);
1848
- }
1849
- /** What `motion` shows now, by its animation's own clock. */
1850
- function shownNow(motion) {
1851
- const time = Number(motion.animation.currentTime);
1852
- return motion.shownAt(Number.isFinite(time) ? Math.max(0, time) : 0);
1853
- }
1854
- /**
1855
- * What `element` shows as a reveal or conceal starts: where the one-state
1856
- * motion this one reverses had got to (it stops there), or `atRest`, all of
1857
- * it for a conceal and nothing for a reveal.
1858
- */
1859
- function shownAtStart(element, atRest) {
1860
- const running = edgeMotions.get(element);
1861
- if (running != null) {
1862
- edgeMotions.delete(element);
1863
- const fraction = shownNow(running);
1864
- running.animation.cancel();
1865
- stopSlides(running);
1866
- return fraction;
1867
- }
1868
- const stopped = stoppedShown.get(element);
1869
- stoppedShown.delete(element);
1870
- if (stopped != null && stopped.at === timelineNow(element)) return stopped.fraction;
1871
- return atRest;
1872
- }
1873
- /** Stops `motion`'s sliding parts and puts back the element's clip, once. */
1874
- function stopSlides(motion) {
1875
- motion.release();
1876
- }
1877
- /** Records `animation` as `element`'s running one-state motion. */
1878
- function trackEdgeMotion(element, animation, shownAt, slides = [], release = () => {}, isHeldToRelease = false) {
1879
- let isReleased = false;
1880
- const motion = {
1881
- animation,
1882
- shownAt,
1883
- slides,
1884
- release: () => {
1885
- if (!isReleased) {
1886
- isReleased = true;
1887
- for (const slide of slides) stopGlideOf(slide);
1888
- release();
1889
- }
1890
- }
1891
- };
1892
- edgeMotions.set(element, motion);
1893
- if (isHeldToRelease) heldSlides.set(element, motion);
1894
- animation.addEventListener?.("finish", () => {
1895
- if (edgeMotions.get(element) === motion) {
1896
- edgeMotions.delete(element);
1897
- if (!isHeldToRelease) motion.release();
1898
- }
1899
- });
1900
- return motion;
1901
- }
1902
- /**
1903
- * After this commit's glides start (the batch flushes in a microtask queued
1904
- * before this one), before the frame paints: once the content on `edge`'s
1905
- * side glides, the moving edge rides that glide, frame by frame, so the two
1906
- * never part, a reversal included (the glide carries its running motion).
1907
- * `hiddenAt` turns that content's offset towards the edge's side into the
1908
- * length the element hides; `frame` turns that length into a keyframe.
1909
- * Without that glide (nothing on that side in the area, or nothing that
1910
- * moves) the motion keeps its own curve. The animation is kept, its frames
1911
- * replaced; `onRide` hears the ridden hidden length over time.
1912
- */
1913
- function rideNeighbour(element, area, edge, rtl, animation, isCurrent, hiddenAt, frame, onRide) {
1914
- const effect = animation.effect;
1915
- if (effect == null || typeof effect.setKeyframes !== "function") return;
1916
- queueMicrotask(() => {
1917
- if (!isCurrent()) return;
1918
- const isEnd = edge.endsWith("end");
1919
- const neighbour = isEnd ? nextInFlow(element, area) : previousInFlow(element, area);
1920
- const glide = neighbour == null ? null : glideMoving(neighbour, element, area);
1921
- if (neighbour == null || glide == null) return;
1922
- const own = glideMoving(element, neighbour, area);
1923
- const glideAt = startedBefore(glide, animation);
1924
- const ownAt = own == null ? 0 : startedBefore(own, animation);
1925
- const durationMs = Math.max(glide.durationMs - glideAt, own == null ? 0 : own.durationMs - ownAt);
1926
- const sign = isEnd ? 1 : -1;
1927
- const hidden = (t) => {
1928
- const offset = glide.offsetAt(glideAt + t);
1929
- const moved = own?.offsetAt(ownAt + t) ?? {
1930
- x: 0,
1931
- y: 0
1932
- };
1933
- return hiddenAt(sign * (edge.startsWith("inline") ? (rtl ? -1 : 1) * (offset.x - moved.x) : offset.y - moved.y));
1934
- };
1935
- const frames = sampleOver(durationMs, (t) => frame(hidden(t)));
1936
- effect.setKeyframes(frames);
1937
- effect.updateTiming?.({ duration: durationMs });
1938
- retimeSettle(animation, frames, durationMs);
1939
- onRide(hidden, durationMs);
1940
- });
1941
- }
1942
- /**
1943
- * The one-state reveal or conceal rides the content on its edge's side: the
1944
- * element shows what lies between its fixed edge and that content, a reveal
1945
- * less by however far the content still is from its place towards it, a
1946
- * conceal all of it less however far the content has come, fading with what
1947
- * it hides.
1948
- */
1949
- function rideEdge(element, area, edge, rtl, motion, isConceal) {
1950
- const extent = extentOf(element, edge);
1951
- if (!(extent > 0)) return;
1952
- rideNeighbour(element, area, edge, rtl, motion.animation, () => edgeMotions.get(element) === motion, (towards) => Math.min(extent, Math.max(0, isConceal ? extent - towards : -towards)), (hidden) => motion.slides.length > 0 ? { opacity: 1 - hidden / extent } : {
1953
- opacity: 1 - hidden / extent,
1954
- clipPath: pxClip(edge, hidden, rtl)
1955
- }, (hiddenAt, durationMs) => {
1956
- motion.shownAt = (t) => 1 - hiddenAt(t) / extent;
1957
- for (const slide of motion.slides) {
1958
- const effect = slide.effect;
1959
- const frames = sampleOver(durationMs, (t) => slideFrame(edge, hiddenAt(t)));
1960
- effect?.setKeyframes?.(frames);
1961
- effect?.updateTiming?.({ duration: durationMs });
1962
- retimeSettle(slide, frames, durationMs);
1963
- }
1964
- });
1965
- }
1966
- //#endregion
1967
- //#region src/motion/layout/reportChange.ts
1968
- function resolve(target) {
1969
- return typeof target === "function" ? target() : target.current;
1970
- }
1971
- /**
1972
- * Report a size change of `target` to the handle's area. Call
1973
- * `measureBefore()` before the change commits and `animate()` after it; the
1974
- * content after `target`, up to the area, glides from its old place.
1975
- * Changes in one area in one frame move together. Without a handle, or
1976
- * outside its container, nothing moves.
1977
- */
1978
- function reportLayoutChange(handle, target) {
1979
- return {
1980
- measureBefore() {
1981
- const element = resolve(target);
1982
- if (element == null || handle == null) return;
1983
- const area = areaOf(handle, element);
1984
- if (area == null) return;
1985
- beginChange(element.ownerDocument);
1986
- const batch = batchFor(area);
1987
- if (batch.changed.has(element)) return;
1988
- batch.changed.add(element);
1989
- batch.changedSize += rectOf(element, batch.cache).height;
1990
- batch.visible ??= visibleRect(area);
1991
- batch.originBefore ??= originOf(area);
1992
- batch.walksToBand ??= area.ownerDocument.defaultView?.getComputedStyle(area).getPropertyValue("overflow-anchor") === "none";
1993
- const needed = Math.max(batch.visible.height, batch.changedSize);
1994
- const walks = needed > batch.reach ? [...batch.changed] : [element];
1995
- if (needed > batch.reach) batch.reach = Math.max(needed, batch.reach * 2);
1996
- const band = bandFor(batch.visible, batch.reach);
1997
- for (const changed of walks) {
1998
- const candidates = collectCandidates(changed, area, band, batch.cache, batch.walksToBand, batch.ancestors, batch.befores);
1999
- for (const [candidate, rect] of candidates) if (!batch.before.has(candidate)) batch.before.set(candidate, onGlideClock(candidate, rect, area));
2000
- batch.candidates.set(changed, [...candidates.keys()]);
2001
- }
2002
- },
2003
- animate(beforeMove) {
2004
- const element = resolve(target);
2005
- if (element == null || handle == null) return false;
2006
- const area = areaOf(handle, element);
2007
- const batch = area == null ? void 0 : batches.get(area);
2008
- if (batch == null || !batch.changed.has(element)) return false;
2009
- if (beforeMove != null) batch.beforeMove.push(beforeMove);
2010
- if (!batch.scheduled) {
2011
- batch.scheduled = true;
2012
- queueMicrotask(() => batchPresented(() => flush(batch)));
2013
- }
2014
- return true;
2015
- }
2016
- };
2017
- }
2018
- //#endregion
2019
- //#region src/motion/layout/landing.ts
2020
- /**
2021
- * A disclosure's indicator (its chevron) turns on the same motion as the
2022
- * glide. Its CSS transition takes the theme's move curve and duration as the
2023
- * glide reads them where the area is, and is immediate under Reduce Motion.
2024
- * Without a handle the inline values are cleared, so the component's own
2025
- * transition applies.
2026
- */
2027
- function applyLayoutChangeTransition(handle, element) {
2028
- if (element == null) return;
2029
- const area = handle == null ? null : areaOf(handle, element);
2030
- if (area == null) {
2031
- transitionSettles.get(element)?.();
2032
- element.style.removeProperty("transition-duration");
2033
- element.style.removeProperty("transition-timing-function");
2034
- return;
2035
- }
2036
- const motion = layoutMotion(area);
2037
- if (motion.kind !== "glide") {
2038
- transitionSettles.get(element)?.();
2039
- element.style.setProperty("transition-duration", "0s");
2040
- element.style.removeProperty("transition-timing-function");
2041
- return;
2042
- }
2043
- const ms = Math.round(motion.progress.durationMs * 1e3) / 1e3;
2044
- element.style.setProperty("transition-duration", `${ms}ms`);
2045
- element.style.setProperty("transition-timing-function", motion.progress.easing);
2046
- settleTransition(element, motion.progress);
2047
- }
2048
- //#endregion
2049
- export { playLayoutChange as a, releaseLayoutExit as i, reportLayoutChange as n, glideOf as o, holdLayoutExit as r, applyLayoutChangeTransition as t };
1351
+ export { ownScaleOf as C, glides as D, glideOf as E, numbersIn as O, originOf as S, visibleRect as T, safeAnimate as _, flush as a, transitionSettles as b, onGlideClock as c, layoutMotion as d, round as f, layoutStartFor as g, beginChange as h, changeStartOf as i, shownBoxAt as k, rectOf as l, sampleOver as m, batches as n, bandFor as o, sampleKeyframes as p, changeStartIn as r, collectCandidates as s, batchFor as t, takesPart as u, retimeSettle as v, scaleOf as w, intersects as x, settleTransition as y };