actual-css 0.4.2 → 0.5.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 (63) hide show
  1. package/CHANGELOG.md +49 -2
  2. package/README.md +2 -2
  3. package/dist/actual.css +53 -14
  4. package/dist/actual.full.css +287 -91
  5. package/dist/actual.full.js +1 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/dist/actual.min.css +1 -1
  8. package/docs/design-notes/spacing-units.md +286 -0
  9. package/docs/navigation.json +1 -0
  10. package/docs/pages/components/alert.md +1 -1
  11. package/docs/pages/components/app-navigation.md +2 -0
  12. package/docs/pages/components/badge.md +17 -3
  13. package/docs/pages/components/button.md +9 -2
  14. package/docs/pages/components/card.md +13 -0
  15. package/docs/pages/components/data-list.md +72 -0
  16. package/docs/pages/components/dialog.md +2 -0
  17. package/docs/pages/components/drawer.md +2 -0
  18. package/docs/pages/components/fab.md +2 -0
  19. package/docs/pages/components/meter.md +56 -1
  20. package/docs/pages/components/progress.md +10 -0
  21. package/docs/pages/components/skeleton.md +2 -0
  22. package/docs/pages/components/steps.md +10 -2
  23. package/docs/pages/components/table.md +1 -0
  24. package/docs/pages/enhancements/flyout.md +2 -0
  25. package/docs/pages/enhancements/status-bar.md +10 -1
  26. package/docs/pages/examples/overview.md +2 -1
  27. package/docs/pages/forms/joined-controls.md +2 -0
  28. package/docs/pages/forms/overview.md +1 -1
  29. package/docs/pages/forms/range.md +2 -0
  30. package/docs/pages/forms/states-and-sizes.md +1 -1
  31. package/docs/pages/forms/validation.md +2 -0
  32. package/docs/pages/foundations/philosophy.md +11 -1
  33. package/docs/pages/foundations/tokens.md +7 -3
  34. package/docs/pages/foundations/typography.md +10 -2
  35. package/docs/pages/guides/introduction.md +1 -1
  36. package/docs/pages/layout/scroll-snap.md +2 -0
  37. package/docs/pages/layout/sidebar-layout.md +2 -0
  38. package/docs/pages/layout/topbar.md +2 -0
  39. package/docs/pages/utilities/accessibility.md +18 -0
  40. package/package.json +1 -1
  41. package/scripts/reserved-classes.json +4 -0
  42. package/src/css/components/data-list.css +27 -0
  43. package/src/css/components/drawer.css +30 -11
  44. package/src/css/components/flyout.css +17 -12
  45. package/src/css/components/index.css +1 -0
  46. package/src/css/components/meter.css +28 -1
  47. package/src/css/components/modal.css +28 -11
  48. package/src/css/components/progress.css +5 -0
  49. package/src/css/components/status-bar.css +31 -15
  50. package/src/css/components/steps.css +35 -9
  51. package/src/css/components/surface.css +5 -3
  52. package/src/css/components/tooltip.css +5 -8
  53. package/src/css/core/base.css +7 -1
  54. package/src/css/core/intents.css +6 -0
  55. package/src/css/core/tokens.css +23 -9
  56. package/src/css/core/variants.css +17 -4
  57. package/src/css/forms/form.css +4 -4
  58. package/src/css/typography/prose.css +2 -3
  59. package/src/css/utilities/base.css +16 -0
  60. package/src/js/selectors.js +1 -0
  61. package/src/js/status.js +88 -7
  62. package/src/js/surface.js +2 -11
  63. package/src/js/transition.js +20 -0
package/src/js/surface.js CHANGED
@@ -4,6 +4,7 @@ import { EVENTS } from "./events.js";
4
4
  import { autoUpdate, reposition, repositionAt } from "./floating.js";
5
5
 
6
6
  import { CLASSES } from "./selectors.js";
7
+ import { waitForTransitions } from "./transition.js";
7
8
 
8
9
  const openSurfaces = new Set();
9
10
  const surfaceMap = new WeakMap();
@@ -46,16 +47,6 @@ function reaperFor(menu) {
46
47
  return reaper;
47
48
  }
48
49
 
49
- function waitForAnimations(...elements) {
50
- const animations = elements
51
- .filter(Boolean)
52
- .flatMap((el) =>
53
- typeof el.getAnimations === "function" ? el.getAnimations({ subtree: true }) : [],
54
- );
55
-
56
- return Promise.allSettled(animations.map((animation) => animation.finished));
57
- }
58
-
59
50
  function getSurfaceRoot(menu, anchor) {
60
51
  return anchor?.closest("dialog") || menu.closest("dialog") || menu.ownerDocument.body;
61
52
  }
@@ -360,7 +351,7 @@ export function closeSurface(menu, opts = {}) {
360
351
  state.restoreFocusTo.focus({ preventScroll: true });
361
352
  }
362
353
 
363
- waitForAnimations(menu, backdrop).then(() => {
354
+ waitForTransitions(menu, backdrop).then(() => {
364
355
  if (!state || state.closeId !== closeId) return;
365
356
  state.isSheet = false;
366
357
  menu.classList.remove(CLASSES.sheet);
@@ -0,0 +1,20 @@
1
+ /*
2
+ * CSS transition lifecycle.
3
+ *
4
+ * getAnimations() exposes both CSS transitions and keyframe animations.
5
+ * Cleanup that belongs to a state transition must not wait for arbitrary
6
+ * author animations, which may be infinite. CSSTransition instances expose
7
+ * transitionProperty; using that structural contract avoids a global check
8
+ * and keeps component JavaScript independent from the properties CSS owns.
9
+ */
10
+
11
+ export function waitForTransitions(...elements) {
12
+ const transitions = elements
13
+ .filter(Boolean)
14
+ .flatMap((element) =>
15
+ typeof element.getAnimations === "function" ? element.getAnimations({ subtree: true }) : [],
16
+ )
17
+ .filter((animation) => typeof animation.transitionProperty === "string");
18
+
19
+ return Promise.allSettled(transitions.map((transition) => transition.finished));
20
+ }