actual-css 0.19.3 → 0.19.5

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 (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/dist/actual.full.css +8 -4
  4. package/dist/actual.full.js +2 -2
  5. package/dist/actual.full.min.css +1 -1
  6. package/dist/types/surface-focus.d.ts +2 -0
  7. package/docs/pages/components/dialog.md +3 -0
  8. package/docs/pages/components/list.md +1 -1
  9. package/docs/pages/components/timeline.md +4 -2
  10. package/docs/pages/enhancements/flyout.md +26 -8
  11. package/docs/pages/forms/joined-controls.md +1 -1
  12. package/docs/pages/forms/switch.md +4 -2
  13. package/docs/pages/foundations/theming.md +3 -0
  14. package/docs/pages/foundations/tokens.md +13 -13
  15. package/llms.txt +3 -3
  16. package/package.json +4 -5
  17. package/src/cli/actual-css.js +3 -3
  18. package/src/css/components/menu.css +2 -2
  19. package/src/css/forms/switch.css +6 -2
  20. package/src/js/dialog.js +30 -11
  21. package/src/js/surface-focus.js +14 -0
  22. package/src/js/surface.js +8 -3
  23. package/src/tooling/theme-contrast.js +6 -2
  24. package/docs/design-notes/accessibility-decisions.md +0 -65
  25. package/docs/design-notes/app-ui.md +0 -67
  26. package/docs/design-notes/architecture.md +0 -70
  27. package/docs/design-notes/browser-support.md +0 -239
  28. package/docs/design-notes/cascade-layer.md +0 -74
  29. package/docs/design-notes/column-layout.md +0 -260
  30. package/docs/design-notes/css-anchor.md +0 -87
  31. package/docs/design-notes/enhancement-contract.md +0 -193
  32. package/docs/design-notes/forced-colors.md +0 -123
  33. package/docs/design-notes/grid.md +0 -785
  34. package/docs/design-notes/motion-cost.md +0 -62
  35. package/docs/design-notes/naming.md +0 -71
  36. package/docs/design-notes/platform-alignment.md +0 -602
  37. package/docs/design-notes/popover-manual-poc.md +0 -328
  38. package/docs/design-notes/references.md +0 -336
  39. package/docs/design-notes/rich-text.md +0 -61
  40. package/docs/design-notes/spacing-units.md +0 -286
  41. package/docs/design-notes/steps.md +0 -776
  42. package/docs/design-notes/surface-reparenting.md +0 -130
  43. package/docs/design-notes/tokens.md +0 -166
  44. package/docs/design-notes/tooltip-coordinate-space.md +0 -130
  45. package/docs/design-notes/widget-primitives.md +0 -144
  46. package/docs/navigation.json +0 -176
@@ -1,61 +0,0 @@
1
- # Rich text: three levels and why a package demos level 2
2
-
3
- Editing text and editing a document are different problems with different
4
- costs. Actual draws the line at the document boundary, in three levels:
5
-
6
- ```text
7
- 1. TEXTAREA (native)
8
- text, autosize, actions row, plain-text caret helpers
9
- → the composer pattern: demo/templates/composer.html
10
-
11
- 2. HOSTED RICH-TEXT PACKAGE (integration)
12
- bold / italic / lists / links / quote, undo, paste cleanup,
13
- structured @mentions, / snippets
14
- → the rich-text recipe: demo/templates/rich-text.html + @lekoala/rich-text
15
-
16
- 3. STRUCTURED DOCUMENT ENGINE (integration, heavier)
17
- custom document nodes, annotations, collaborative state
18
- → no demo; the bridge contract from level 2 applies unchanged
19
- ```
20
-
21
- Level 1 stays a real `<textarea>`: form value, IME, undo, mobile,
22
- accessibility, validation. `contenteditable="plaintext-only"` buys nothing over
23
- it and loses the native form control, so the framework does not use it. The
24
- Markdown round-trip some engines offer is still beta upstream and is not the
25
- storage contract.
26
-
27
- ## Why a package for the level-2 demo
28
-
29
- The demo exists to prove the bridge (tokens, pressed states, focus, invalid,
30
- composer chrome), not the engine. Owning the toolbar, sanitizer, roving focus
31
- and lifecycle inside the demo meant Actual did involuntarily much of the
32
- editor's job. Extracting that into `@lekoala/rich-text` restored the boundary:
33
-
34
- ```text
35
- Actual CSS presentation, tokens, composer chrome, dialogs, validation
36
- @lekoala/rich-text textarea enhancement, Squire, sanitization, toolbar
37
- semantics + keyboard, links, mentions, suggestions,
38
- form/reset/readonly/disabled, lifecycle
39
- application people lookup, templates, attachments, dictation, send
40
- ```
41
-
42
- `@lekoala/rich-text` owns the editor UI semantics; Actual owns its visual
43
- language. Squire is an implementation detail of the integration package: it
44
- owns selection, editing, paste normalisation and undo/redo, while the package
45
- owns the product-facing contract around it (progressive enhancement of a real
46
- `<textarea>`, mandatory sanitization, accessible generated UI, lifecycle and
47
- cleanup). HTML stays the source of truth, which keeps the storage decoupled
48
- and the engine choice reversible.
49
-
50
- ## What was deliberately not demoed
51
-
52
- - A second engine demo would prove nothing more about the bridge, and one
53
- candidate changes fundamental choices between minor versions — a pinned demo
54
- would rot. Spikes belong in `tmp/`, not `demo/`.
55
- - Plain-text caret helpers stay a textarea-level improvement at level 1.
56
- Structured `@mentions` live at level 2 because they are sanitized, atomic
57
- entities inserted as HTML — the demo's Snippet/Mention buttons reuse the
58
- same suggestion seam as `/` and `@`, so one capability keeps two surfaces
59
- without duplicating its logic.
60
- - Syntax highlighting inside inputs is a search-DSL concern, not a composer
61
- concern; layering it onto a textarea rebuilds a fake rich editor.
@@ -1,286 +0,0 @@
1
- # Spacing Units: When to Use `em`, `rem`, `ch`, `lh`, or `--space-*`
2
-
3
- Actual does not require every relative length to come from a design token.
4
-
5
- CSS relative units already carry useful semantics. A literal `0.5em`, `1lh`, `20rem`, or `65ch` can be more meaningful than replacing it with an unrelated spacing token.
6
-
7
- The goal is not to eliminate literal values. The goal is to choose the unit that best expresses the relationship.
8
-
9
- ## Core rule
10
-
11
- Use `--space-*` when the value belongs to the **shared interface rhythm**.
12
-
13
- Use a CSS relative unit when the value belongs to the **intrinsic geometry or typography of the component**.
14
-
15
- A useful question is:
16
-
17
- > If this value changes, is that a design-system decision or a local relationship inside the component?
18
-
19
- If it is a design-system decision, prefer a token.
20
-
21
- If it is a local relationship, prefer the appropriate CSS unit.
22
-
23
- ## `--space-*`: interface rhythm
24
-
25
- Use spacing tokens for layout distances that should remain consistent across components and respond to Actual's density system.
26
-
27
- Typical cases:
28
-
29
- ```css
30
- .card {
31
- padding: var(--space-40);
32
- }
33
-
34
- .cluster {
35
- gap: var(--space-20);
36
- }
37
-
38
- .data-list {
39
- gap: var(--space-20) var(--space-40);
40
- }
41
- ```
42
-
43
- Good candidates include:
44
-
45
- * component padding
46
- * gaps between peer controls
47
- * spacing between sections
48
- * list and grid gaps
49
- * toolbar spacing
50
- * application layout rhythm
51
-
52
- Using a spacing token also communicates that the value is expected to participate in density changes.
53
-
54
- Do not use `--space-*` merely to avoid writing a literal relative unit.
55
-
56
- ## `em`: relative to the local text
57
-
58
- Use `em` when a dimension should scale with the font size of the element or component.
59
-
60
- Typical cases:
61
-
62
- ```css
63
- .prose dd {
64
- margin-inline-start: 1.5em;
65
- }
66
-
67
- .inline-icon {
68
- margin-inline-end: 0.4em;
69
- }
70
- ```
71
-
72
- Good candidates include:
73
-
74
- * typographic indentation
75
- * small offsets around inline icons
76
- * decorative elements sized relative to text
77
- * local relationships that should scale when the component font size changes
78
-
79
- `em` is especially useful when the relationship is best understood as:
80
-
81
- > some fraction or multiple of this text size
82
-
83
- Do not use `em` for general application spacing when local font-size changes should not affect the layout.
84
-
85
- ## `rem`: relative to the root scale
86
-
87
- Use `rem` when a dimension should follow the user's/root font size but remain independent of a component's local typography.
88
-
89
- Typical cases:
90
-
91
- ```css
92
- .sidebar {
93
- inline-size: 18rem;
94
- }
95
-
96
- .dialog {
97
- max-inline-size: 36rem;
98
- }
99
- ```
100
-
101
- Good candidates include:
102
-
103
- * component size constraints
104
- * layout thresholds
105
- * widths and heights tied to the overall UI scale
106
- * values that should remain stable when nested inside differently sized text
107
-
108
- A literal `18rem` does not need a custom property unless the value itself is part of the public API, reused significantly, or expected to be configured.
109
-
110
- ## `ch`: text-measure relationships
111
-
112
- Use `ch` when a dimension is naturally related to the approximate width of characters.
113
-
114
- Typical cases:
115
-
116
- ```css
117
- .prose {
118
- max-inline-size: 65ch;
119
- }
120
-
121
- .search-field {
122
- inline-size: 24ch;
123
- }
124
- ```
125
-
126
- Good candidates include:
127
-
128
- * readable text measures
129
- * text-oriented input widths
130
- * content regions whose useful size is determined by expected text length
131
-
132
- Do not use `ch` as a generic substitute for `rem`; its value depends on font metrics.
133
-
134
- ## `lh`: line-height relationships
135
-
136
- Use `lh` when a dimension should be directly related to the computed line height.
137
-
138
- Typical cases:
139
-
140
- ```css
141
- .floating-label {
142
- inset-block-start: calc(0.5lh + var(--border-width));
143
- }
144
- ```
145
-
146
- Good candidates include:
147
-
148
- * vertical positioning relative to a line of text
149
- * text-area or field geometry
150
- * offsets that conceptually represent one or part of one line
151
-
152
- `lh` is preferable to reconstructing line height indirectly from font size when line height is the actual relationship being expressed.
153
-
154
- ## Choosing between them
155
-
156
- | Intent | Prefer |
157
- | --------------------------------------- | ---------------- |
158
- | Shared application spacing | `var(--space-*)` |
159
- | Density-aware spacing | `var(--space-*)` |
160
- | Local relationship to component text | `em` |
161
- | Stable size relative to root typography | `rem` |
162
- | Width related to text length | `ch` |
163
- | Geometry related to line height | `lh` |
164
-
165
- ## Examples
166
-
167
- ### System rhythm
168
-
169
- ```css
170
- .alert {
171
- padding: var(--space-30) var(--space-40);
172
- gap: var(--space-30);
173
- }
174
- ```
175
-
176
- The spacing is part of the visual density and should stay aligned with other components.
177
-
178
- ### Intrinsic typography
179
-
180
- ```css
181
- .prose dd {
182
- margin-inline-start: 1.5em;
183
- }
184
- ```
185
-
186
- The indentation belongs to the description text itself. A spacing token would add no useful meaning.
187
-
188
- ### Stable component width
189
-
190
- ```css
191
- .sidebar {
192
- flex-basis: 18rem;
193
- }
194
- ```
195
-
196
- The width belongs to the component geometry, not to the spacing scale.
197
-
198
- ### Readable prose
199
-
200
- ```css
201
- .prose {
202
- max-inline-size: 65ch;
203
- }
204
- ```
205
-
206
- The width exists to control line length, so `ch` expresses the intention directly.
207
-
208
- ### Line-relative positioning
209
-
210
- ```css
211
- .field-label {
212
- inset-block-start: 0.5lh;
213
- }
214
- ```
215
-
216
- The position is defined relative to the text line, not to global spacing.
217
-
218
- ## Avoid token laundering
219
-
220
- Do not replace meaningful CSS units with spacing tokens simply to make a stylesheet appear more tokenized.
221
-
222
- Avoid patterns such as:
223
-
224
- ```css
225
- .icon {
226
- translate: 0 var(--space-10);
227
- }
228
-
229
- .prose {
230
- max-inline-size: var(--space-900);
231
- }
232
-
233
- .label {
234
- margin-inline-end: var(--space-20);
235
- }
236
- ```
237
-
238
- when the real relationships would be better expressed as:
239
-
240
- ```css
241
- .icon {
242
- translate: 0 -0.1em;
243
- }
244
-
245
- .prose {
246
- max-inline-size: 65ch;
247
- }
248
-
249
- .label {
250
- margin-inline-end: 0.5em;
251
- }
252
- ```
253
-
254
- Tokens should add meaning, not hide it.
255
-
256
- ## Literal relative values are not a code smell
257
-
258
- A well-chosen literal relative value is valid framework CSS.
259
-
260
- Values such as:
261
-
262
- ```css
263
- 0.25em
264
- 1.5em
265
- 1lh
266
- 18rem
267
- 65ch
268
- ```
269
-
270
- can be more stable and understandable than introducing a custom property or mapping them artificially onto the spacing scale.
271
-
272
- Promote a value to a token when at least one of these becomes true:
273
-
274
- * it represents a shared design decision
275
- * multiple components need the same semantic value
276
- * themes or density modes should modify it
277
- * users are expected to configure it
278
- * naming the value improves understanding of the API
279
-
280
- Otherwise, keep the direct CSS unit.
281
-
282
- ## Guideline
283
-
284
- > Use tokens for shared design rhythm. Use CSS relative units for intrinsic relationships.
285
-
286
- Actual favors semantic CSS over tokenization for its own sake.