actual-css 0.9.1 → 0.10.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 (107) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +67 -45
  3. package/components.json +33 -13
  4. package/dist/actual.full.css +607 -502
  5. package/dist/actual.full.js +1 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/app-ui.md +1 -1
  8. package/docs/design-notes/column-layout.md +103 -520
  9. package/docs/design-notes/forced-colors.md +12 -1
  10. package/docs/design-notes/naming.md +1 -1
  11. package/docs/design-notes/surface-reparenting.md +8 -9
  12. package/docs/navigation.json +2 -0
  13. package/docs/pages/components/accordion.md +55 -1
  14. package/docs/pages/components/alert.md +9 -15
  15. package/docs/pages/components/badge.md +6 -7
  16. package/docs/pages/components/bleed.md +42 -0
  17. package/docs/pages/components/button.md +30 -4
  18. package/docs/pages/components/card.md +21 -86
  19. package/docs/pages/components/close.md +48 -0
  20. package/docs/pages/components/data-list.md +26 -1
  21. package/docs/pages/components/dialog.md +16 -16
  22. package/docs/pages/components/drawer.md +9 -9
  23. package/docs/pages/components/navbar.md +5 -5
  24. package/docs/pages/components/spinner.md +3 -3
  25. package/docs/pages/components/table.md +3 -2
  26. package/docs/pages/enhancements/overview.md +5 -0
  27. package/docs/pages/enhancements/tooltip.md +3 -1
  28. package/docs/pages/examples/overview.md +3 -1
  29. package/docs/pages/forms/choice-cards.md +39 -0
  30. package/docs/pages/forms/combobox.md +23 -11
  31. package/docs/pages/forms/input-policy.md +59 -0
  32. package/docs/pages/forms/joined-controls.md +2 -5
  33. package/docs/pages/forms/overview.md +6 -0
  34. package/docs/pages/forms/validation.md +37 -1
  35. package/docs/pages/foundations/theming.md +64 -18
  36. package/docs/pages/foundations/tokens.md +50 -13
  37. package/docs/pages/foundations/typography.md +10 -0
  38. package/docs/pages/guides/introduction.md +17 -24
  39. package/docs/pages/guides/modular-import.md +53 -6
  40. package/docs/pages/guides/progressive-enhancement.md +9 -5
  41. package/docs/pages/guides/tailwind.md +17 -5
  42. package/docs/pages/layout/column-layout.md +92 -54
  43. package/docs/pages/layout/media.md +1 -1
  44. package/docs/pages/layout/overview.md +1 -1
  45. package/docs/pages/utilities/overview.md +1 -1
  46. package/docs/pages/utilities/sizing-wrapping.md +5 -3
  47. package/llms.txt +24 -4
  48. package/package.json +7 -6
  49. package/reserved-classes.json +5 -30
  50. package/skills/actual-css/PROJECT.md.example +65 -0
  51. package/skills/actual-css/README.md +64 -0
  52. package/skills/actual-css/SKILL.md +234 -0
  53. package/skills/actual-css/references/accessibility.md +44 -0
  54. package/skills/actual-css/references/api-and-vocabulary.md +94 -0
  55. package/skills/actual-css/references/enhancements.md +59 -0
  56. package/skills/actual-css/references/forms.md +49 -0
  57. package/skills/actual-css/references/layout-and-theming.md +82 -0
  58. package/skills/actual-css/references/review-checklist.md +51 -0
  59. package/skills/actual-css/scripts/inspect-actual-css.mjs +171 -0
  60. package/src/css/components/accordion.css +44 -7
  61. package/src/css/components/alert.css +23 -43
  62. package/src/css/components/app-nav.css +9 -0
  63. package/src/css/components/badge.css +11 -39
  64. package/src/css/components/bleed.css +79 -0
  65. package/src/css/components/button.css +6 -17
  66. package/src/css/components/card.css +7 -40
  67. package/src/css/components/close.css +91 -0
  68. package/src/css/components/data-list.css +18 -0
  69. package/src/css/components/drawer.css +15 -56
  70. package/src/css/components/fab.css +10 -0
  71. package/src/css/components/flyout.css +1 -0
  72. package/src/css/components/index.css +2 -0
  73. package/src/css/components/join.css +36 -20
  74. package/src/css/components/menu.css +12 -0
  75. package/src/css/components/modal.css +10 -57
  76. package/src/css/components/navbar.css +27 -0
  77. package/src/css/core/base.css +2 -0
  78. package/src/css/core/focus.css +9 -3
  79. package/src/css/core/theme.css +25 -43
  80. package/src/css/core/tokens.css +3 -1
  81. package/src/css/core/variants.css +15 -36
  82. package/src/css/forms/choice-card.css +74 -4
  83. package/src/css/forms/choice.css +2 -3
  84. package/src/css/forms/control.css +15 -8
  85. package/src/css/forms/custom-select.css +4 -4
  86. package/src/css/forms/form.css +6 -0
  87. package/src/css/forms/native.css +4 -4
  88. package/src/css/forms/range.css +23 -8
  89. package/src/css/forms/switch.css +2 -3
  90. package/src/css/layout/app-layout.css +1 -1
  91. package/src/css/layout/column-layout.css +26 -111
  92. package/src/css/utilities/extra.css +7 -6
  93. package/src/js/dialog.js +95 -24
  94. package/src/js/enhance.js +7 -3
  95. package/src/js/escape.js +1 -0
  96. package/src/js/flyout.js +10 -1
  97. package/src/js/focus-group.js +2 -1
  98. package/src/js/keys.js +14 -0
  99. package/src/js/menu.js +2 -1
  100. package/src/js/status.js +19 -0
  101. package/src/js/surface.js +12 -8
  102. package/src/js/tab.js +2 -1
  103. package/src/js/tooltip.js +18 -1
  104. package/src/js/validation.js +36 -6
  105. package/dist/actual.css +0 -863
  106. package/dist/actual.js +0 -1
  107. package/dist/actual.min.css +0 -1
package/src/js/tooltip.js CHANGED
@@ -23,6 +23,12 @@
23
23
  * for tooltips that are never triggered. AJAX-loaded triggers
24
24
  * work automatically via bubbling delegated listeners.
25
25
  *
26
+ * Snapshot, not reactive: generated tooltip text is synchronized when
27
+ * the tooltip is shown. Changes to data-tooltip do not rewrite
28
+ * a tooltip that is already shown. Always-visible generated
29
+ * tooltips therefore keep their initial text; use an explicit
30
+ * tooltip when its content must update dynamically.
31
+ *
26
32
  * Show: hover + focus (150ms delay), click toggle, or always visible
27
33
  * Hide: focus leaving the trigger (focusout), pointer leave, Escape
28
34
  *
@@ -367,7 +373,10 @@ function ensureTip(trigger) {
367
373
  const text = trigger.getAttribute("data-tooltip");
368
374
  const doc = trigger.ownerDocument;
369
375
 
370
- // shorthand: data-tooltip="text" → create element lazily
376
+ // shorthand: data-tooltip="text" → create element lazily.
377
+ // Shorthand content is always text. Never use innerHTML here:
378
+ // data-tooltip may hold application/user-provided strings. Rich content
379
+ // belongs in an explicit author-owned tooltip.
371
380
  if (text) {
372
381
  tip = doc.createElement("div");
373
382
  tip.className = CLASSES.tooltip;
@@ -467,6 +476,14 @@ function show(tip, ref, immediate = false) {
467
476
  const state = tipStates.get(tip);
468
477
  if (!state) return;
469
478
 
479
+ // Shorthand tips copy data-tooltip text at creation; re-read it on every
480
+ // show so a "Copy" → "Copied!" update is reflected without rewiring.
481
+ // Text only, never innerHTML — see the note at creation above.
482
+ if (state.generated) {
483
+ const text = ref.getAttribute("data-tooltip");
484
+ if (text && tip.textContent !== text) tip.textContent = text;
485
+ }
486
+
470
487
  state.activeRef = ref;
471
488
  const mode = positionModeFor(ref);
472
489
  state.space = mode.space;
@@ -17,7 +17,7 @@
17
17
  * DOM tears down everything, including the managed novalidate attribute.
18
18
  */
19
19
 
20
- import enhance, { enhancementSelector } from "./enhance.js";
20
+ import { enhancementSelector, registerEnhancement } from "./enhance.js";
21
21
  import { EVENTS } from "./events.js";
22
22
  import { CLASSES } from "./selectors.js";
23
23
 
@@ -86,9 +86,40 @@ const rules = {
86
86
  alnum(v) {
87
87
  return /^[a-z0-9]+$/i.test(v);
88
88
  },
89
+ // Options are literal tokens: no quoting, no escaping, no whitespace. A
90
+ // missing option is a configuration error and fails rather than passing
91
+ // silently. Comparison is case-sensitive; the value is trimmed to compare.
92
+ "starts-with"(v, _el, ...prefixes) {
93
+ const value = v.trim();
94
+ return prefixes.length > 0 && prefixes.some((prefix) => value.startsWith(prefix));
95
+ },
96
+ "ends-with"(v, _el, ...suffixes) {
97
+ const value = v.trim();
98
+ return suffixes.length > 0 && suffixes.some((suffix) => value.endsWith(suffix));
99
+ },
89
100
  date(v) {
90
101
  return isValidDate(v);
91
102
  },
103
+ // Telephone origin policy, not telephone validation. A local number carries
104
+ // nothing but its digits after the usual separators are ignored, so a value
105
+ // with letters or stray symbols is not a number and fails instead of reading
106
+ // as local. Local numbering still belongs to the application and the server;
107
+ // an explicit international number must match an allowed prefix. No prefixes
108
+ // means local-only: local input passes, any explicit international notation
109
+ // fails. The entered value is analyzed, never rewritten.
110
+ "tel-prefix"(value, _el, ...prefixes) {
111
+ let v = value.trim().replace(/[\s()./-]+/g, "");
112
+ if (v.startsWith("00")) {
113
+ v = `+${v.slice(2)}`;
114
+ }
115
+ if (!/^\+?\d+$/.test(v)) {
116
+ return false;
117
+ }
118
+ if (!v.startsWith("+")) {
119
+ return true;
120
+ }
121
+ return prefixes.some((prefix) => v.startsWith(prefix));
122
+ },
92
123
  };
93
124
 
94
125
  function isFormElement(el) {
@@ -404,10 +435,9 @@ export class FormValidator {
404
435
  }
405
436
  }
406
437
 
407
- if (typeof document !== "undefined") {
408
- enhance({
409
- [`form${VALIDATION_SELECTOR}`]: (form) => connectForm(form),
410
- });
411
- }
438
+ // Registered by name, not through a bare enhance(), so applyEnhancement()
439
+ // refreshes it like the other token behaviors. The token only means
440
+ // something on a form.
441
+ registerEnhancement("validation", (el) => (isFormElement(el) ? connectForm(el) : undefined));
412
442
 
413
443
  export default FormValidator;