@mistriwork/ui 1.0.0-rc.57 → 1.0.0-rc.59

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 (122) hide show
  1. package/README.md +46 -12
  2. package/dist/Avatar.js +3 -3
  3. package/dist/Button.d.ts +4 -14
  4. package/dist/Button.js +26 -13
  5. package/dist/Carousel.d.ts +6 -5
  6. package/dist/Carousel.js +58 -67
  7. package/dist/Choices.d.ts +2 -9
  8. package/dist/Choices.js +127 -64
  9. package/dist/DateField.d.ts +9 -4
  10. package/dist/DateField.js +102 -119
  11. package/dist/Drawer.d.ts +1 -19
  12. package/dist/Drawer.js +8 -9
  13. package/dist/DropMenu.d.ts +8 -21
  14. package/dist/DropMenu.js +84 -30
  15. package/dist/Dropdown.d.ts +9 -8
  16. package/dist/Dropdown.js +69 -65
  17. package/dist/Field.d.ts +2 -1
  18. package/dist/Field.js +12 -18
  19. package/dist/FileField.d.ts +3 -10
  20. package/dist/FileField.js +12 -9
  21. package/dist/FormParts.d.ts +17 -10
  22. package/dist/FormParts.js +26 -41
  23. package/dist/HeroBlocks.d.ts +7 -3
  24. package/dist/HeroBlocks.js +11 -6
  25. package/dist/Modal.d.ts +6 -17
  26. package/dist/Modal.js +90 -21
  27. package/dist/Pagination.d.ts +1 -12
  28. package/dist/Pagination.js +17 -3
  29. package/dist/Popover.d.ts +1 -15
  30. package/dist/Popover.js +10 -15
  31. package/dist/Resizable.d.ts +3 -21
  32. package/dist/Resizable.js +14 -91
  33. package/dist/ScrollArea.d.ts +4 -2
  34. package/dist/ScrollArea.js +11 -11
  35. package/dist/Select.d.ts +1 -6
  36. package/dist/Select.js +16 -7
  37. package/dist/SensitiveField.d.ts +1 -8
  38. package/dist/SensitiveField.js +6 -4
  39. package/dist/Slider.d.ts +1 -5
  40. package/dist/Slider.js +13 -5
  41. package/dist/Switch.d.ts +1 -11
  42. package/dist/Switch.js +10 -9
  43. package/dist/Tabs.d.ts +3 -3
  44. package/dist/Tabs.js +3 -3
  45. package/dist/TextArea.d.ts +4 -6
  46. package/dist/TextArea.js +14 -5
  47. package/dist/TextField.d.ts +5 -9
  48. package/dist/TextField.js +67 -9
  49. package/dist/Tooltip.d.ts +1 -21
  50. package/dist/Tooltip.js +13 -31
  51. package/dist/Typeahead.d.ts +15 -18
  52. package/dist/Typeahead.js +151 -86
  53. package/dist/UiKit.d.ts +63 -4
  54. package/dist/UiKit.js +46 -5
  55. package/dist/behaviors/DaysParts.js +28 -0
  56. package/dist/behaviors/EditableParts.js +21 -0
  57. package/dist/behaviors/PickParts.js +30 -0
  58. package/dist/behaviors/ScrubParts.js +21 -0
  59. package/dist/behaviors/SortableParts.js +32 -0
  60. package/dist/behaviors/SpansParts.js +12 -0
  61. package/dist/behaviors/TransferParts.js +37 -0
  62. package/dist/behaviors/TurnsParts.js +31 -0
  63. package/dist/behaviors/WidthsParts.js +27 -0
  64. package/dist/behaviors/days.js +216 -0
  65. package/dist/behaviors/dress.js +86 -0
  66. package/dist/behaviors/editable.js +104 -0
  67. package/dist/behaviors/heard.js +22 -0
  68. package/dist/behaviors/index.d.ts +310 -0
  69. package/dist/behaviors/index.js +44 -0
  70. package/dist/behaviors/pick.js +158 -0
  71. package/dist/behaviors/scrub.js +152 -0
  72. package/dist/behaviors/sortable.js +170 -0
  73. package/dist/behaviors/spans.js +240 -0
  74. package/dist/behaviors/testing.js +48 -0
  75. package/dist/behaviors/transfer.js +202 -0
  76. package/dist/behaviors/turns.js +106 -0
  77. package/dist/behaviors/widths.js +150 -0
  78. package/dist/behaviors.css +309 -0
  79. package/dist/changeDetails.d.ts +4 -8
  80. package/dist/changeDetails.js +0 -6
  81. package/dist/conformance.js +107 -1
  82. package/dist/controls.css +36 -0
  83. package/dist/fieldFrame.d.ts +2 -15
  84. package/dist/fieldFrame.js +1 -17
  85. package/dist/index.d.ts +6 -5
  86. package/dist/index.js +6 -5
  87. package/dist/internal/Frame.d.ts +6 -0
  88. package/dist/internal/Frame.js +25 -0
  89. package/dist/internal/HelpTip.d.ts +5 -0
  90. package/dist/internal/HelpTip.js +37 -0
  91. package/dist/internal/layers.d.ts +21 -0
  92. package/dist/internal/layers.js +66 -0
  93. package/dist/internal/popups.d.ts +12 -10
  94. package/dist/internal/popups.js +18 -14
  95. package/dist/internal/told.d.ts +14 -0
  96. package/dist/internal/told.js +20 -0
  97. package/dist/internal/uiKitContext.js +6 -4
  98. package/dist/preferences.css +2 -3
  99. package/dist/style.css +5 -16
  100. package/dist/styles/extras.css +461 -0
  101. package/dist/styles/forms.css +346 -0
  102. package/dist/styles/guard.css +114 -0
  103. package/dist/styles/kit-fields.css +181 -0
  104. package/dist/styles/kit-parts.css +130 -0
  105. package/dist/styles/kit.css +558 -0
  106. package/dist/styles/layers.css +4 -0
  107. package/dist/styles/looks.css +374 -0
  108. package/dist/styles/m-tokens.css +173 -0
  109. package/dist/styles/overlays.css +107 -0
  110. package/dist/styles/parts.css +456 -0
  111. package/dist/styles/screens.css +76 -0
  112. package/dist/styles/ui-sdk.css +1635 -0
  113. package/dist/tokens.css +15 -4
  114. package/dist/uiKitSlots.d.ts +1 -1
  115. package/dist/uiKitSlots.js +18 -2
  116. package/package.json +13 -11
  117. package/dist/forms.css +0 -225
  118. package/dist/hero.css +0 -23
  119. package/dist/internal/anchor.d.ts +0 -19
  120. package/dist/internal/anchor.js +0 -52
  121. package/dist/primitives.css +0 -200
  122. package/dist/standalone.css +0 -478
@@ -0,0 +1,374 @@
1
+ /* The recipes. A theme in mistri picks one treatment a part from a closed menu (`recipes: { tabs: 'pill', status:
2
+ 'dot' }`), and wears each as an attribute (`data-look-tabs="pill"`). These are UI SDK's answers, on its own
3
+ parts, to that same menu: the names and values are mistri's (packages/engine/src/shared/themeRecipes.ts), so a
4
+ built-in look, a palette and an App's own `defineTheme` dress these components as they dress mistri's, and an
5
+ App writes no CSS.
6
+
7
+ A value answered here is one of mistri's; where UI SDK's own drawing already is that treatment (its tabs are
8
+ underlined, its status is a dot and a word) the value needs no rule and has none. Past mistri's menu there are values of
9
+ UI SDK's own (RECIPES in ../theme.ts), at the end. An attribute is read from
10
+ whatever wears it, the root or any part of the page, and a part answers the nearest: every rule is a scope
11
+ that starts at the attribute and ends at the next theme inside it (`@scope … to`), so a theme worn by a part
12
+ of a page is not also dressed by the page's. kit/theme.test.tsx holds this sheet to the menu: every value it
13
+ answers is on it. */
14
+ @layer m-looks {
15
+ /* ---------- tabs: pill, inverted, underline (UI SDK's own), rule, chosen, segment ---------- */
16
+ @scope (:is([data-look-tabs='pill'], [data-look-tabs='inverted'], [data-look-tabs='tint'])) to ([data-custom-theme], [data-look-tabs]) {
17
+ :scope {
18
+ & [data-slot='tabs-list'] {
19
+ gap: var(--m-space-2);
20
+ padding-block-end: var(--m-space-3);
21
+ }
22
+
23
+ & [data-slot='tabs-tab'] {
24
+ height: calc(var(--m-unit) * 8);
25
+ padding-inline: var(--m-space-4);
26
+ }
27
+
28
+ & [data-slot='tabs-indicator'] {
29
+ display: none;
30
+ }
31
+ }
32
+ }
33
+
34
+ @scope ([data-look-tabs='pill']) to ([data-custom-theme], [data-look-tabs]) {
35
+ [data-slot='tabs-tab'] {
36
+ border-radius: var(--m-radius-pill, 999px);
37
+
38
+ &:hover {
39
+ background: var(--m-raised);
40
+ }
41
+
42
+ &[data-selected] {
43
+ background: var(--m-raised);
44
+ box-shadow: inset 0 0 0 1px var(--m-line-strong);
45
+ }
46
+ }
47
+ }
48
+
49
+ @scope ([data-look-tabs='inverted']) to ([data-custom-theme], [data-look-tabs]) {
50
+ [data-slot='tabs-tab'] {
51
+ border-radius: var(--m-radius);
52
+
53
+ &[data-selected] {
54
+ background: var(--m-ink);
55
+ color: var(--m-surface)
56
+ }
57
+ }
58
+ }
59
+
60
+ @scope ([data-look-tabs='tint']) to ([data-custom-theme], [data-look-tabs]) {
61
+ [data-slot='tabs-tab'] {
62
+ border-radius: var(--m-radius);
63
+
64
+ &[data-selected] {
65
+ background: var(--m-accent-soft);
66
+ color: var(--m-accent-ink);
67
+ font-weight: var(--m-weight-bold);
68
+ }
69
+ }
70
+ }
71
+
72
+ /* segment: the tabs stand in a sunken track and the chosen one is a key lifted out of it, so no rule runs under
73
+ them (the kit's own tabs are drawn so in tilesLook.css). */
74
+ @scope ([data-look-tabs='lifted']) to ([data-custom-theme], [data-look-tabs]) {
75
+ [data-slot='tabs-list'] {
76
+ display: inline-flex;
77
+ gap: var(--m-space-1);
78
+ width: fit-content;
79
+ max-width: 100%;
80
+ padding: var(--m-space-1h);
81
+ border: 0;
82
+ border-radius: calc(var(--m-radius) + 3px);
83
+ background: var(--m-raised);
84
+ box-shadow: inset 0 0 0 1px var(--m-line);
85
+ }
86
+
87
+ [data-slot='tabs-tab'] {
88
+ height: calc(var(--m-unit) * 7);
89
+ padding-inline: var(--m-space-4);
90
+ border-radius: var(--m-radius);
91
+
92
+ &[data-selected] {
93
+ background: var(--m-surface);
94
+ box-shadow: var(--m-shadow-control);
95
+ }
96
+ }
97
+
98
+ [data-slot='tabs-indicator'] {
99
+ display: none;
100
+ }
101
+
102
+ /* The track is not a rule across the page, so what is under it needs its own room. */
103
+ [data-slot='tabs-panel'] {
104
+ padding-block-start: var(--m-space-5);
105
+ }
106
+ }
107
+
108
+ @scope ([data-look-tabs='rule']) to ([data-custom-theme], [data-look-tabs]) {
109
+ :scope {
110
+ & [data-slot='tabs-list'] {
111
+ border-block-end: var(--m-rule-weight, 2px) solid var(--m-rule-section, var(--m-ink));
112
+ }
113
+
114
+ & [data-slot='tabs-indicator'] {
115
+ inset-block-end: calc(var(--m-rule-weight, 2px) * -1);
116
+ height: 4px;
117
+ background: var(--m-accent);
118
+ }
119
+ }
120
+ }
121
+
122
+ /* ---------- board and its lanes: ruled, soft (UI SDK's own), strip; tint, tag, plain ---------- */
123
+ @scope ([data-look-board='ruled']) to ([data-custom-theme], [data-look-board]) {
124
+ [data-kind='board-lane'] {
125
+ padding-inline: 0;
126
+ border-radius: 0;
127
+ background: none;
128
+
129
+ & > header {
130
+ padding: 0 0 var(--m-space-3);
131
+ border-block-end: var(--m-rule-weight, 2px) solid var(--m-rule-section, var(--m-ink));
132
+ }
133
+ }
134
+ }
135
+
136
+ @scope ([data-look-board='strip']) to ([data-custom-theme], [data-look-board]) {
137
+ [data-kind='board-lane'] {
138
+ background: none;
139
+
140
+ & > header {
141
+ padding: var(--m-space-2h) var(--m-space-3h);
142
+ border-radius: calc(var(--m-radius) - 2px);
143
+ background: var(--m-raised);
144
+ }
145
+ }
146
+ }
147
+
148
+ /* ---------- buttons: accent, raised, keyed ----------
149
+ `accent` is the filled primary as the part draws it (./parts.css): in the look's primary, which is its accent
150
+ where it names none. A rule here that filled it in the accent gave a look whose primary is its ink (Atelier,
151
+ Graphite) two leading buttons, the list's New in the ink and a record's and a form's in the hue. */
152
+ @scope ([data-look-buttons='raised']) to ([data-custom-theme], [data-look-buttons]) {
153
+ [data-slot='button']:not([data-variant='quiet'], [data-variant='bare']) {
154
+ box-shadow:
155
+ 0 1px 0 light-dark(rgb(255 255 255 / 0.5), rgb(255 255 255 / 0.06)) inset,
156
+ 0 1px 2px light-dark(rgb(23 23 26 / 0.12), rgb(0 0 0 / 0.5));
157
+ }
158
+ }
159
+
160
+ /* A key: a hard edge under it, which goes when it is pressed. */
161
+ @scope ([data-look-buttons='keyed']) to ([data-custom-theme], [data-look-buttons]) {
162
+ [data-slot='button']:not([data-variant='quiet'], [data-variant='bare']) {
163
+ border-radius: calc(var(--m-radius) - 2px);
164
+ box-shadow: 0 2px 0 var(--m-ink);
165
+ translate: 0 -1px;
166
+
167
+ &:active {
168
+ box-shadow: 0 0 0 var(--m-ink);
169
+ translate: 0 1px;
170
+ }
171
+ }
172
+ }
173
+
174
+ /* ---------- links: plain (UI SDK's own), underline ---------- */
175
+ @scope ([data-look-links='underline']) to ([data-custom-theme], [data-look-links]) {
176
+ :is([data-slot='more-link'], [data-slot='prose'] a, td[data-primary] a) {
177
+ text-decoration: underline;
178
+ text-underline-offset: 2px;
179
+ text-decoration-thickness: 1px;
180
+ }
181
+ }
182
+
183
+ /* ---------- filters: dashed (UI SDK's own), solid, quiet ---------- */
184
+ @scope ([data-look-filters='solid']) to ([data-custom-theme], [data-look-filters]) {
185
+ [data-kind='filter-chip'] {
186
+ border-style: solid;
187
+ border-color: var(--m-ink);
188
+ color: var(--m-ink);
189
+ }
190
+ }
191
+
192
+ @scope ([data-look-filters='quiet']) to ([data-custom-theme], [data-look-filters]) {
193
+ [data-kind='filter-chip'] {
194
+ border-color: transparent;
195
+ background: var(--m-raised);
196
+ }
197
+ }
198
+
199
+ /* ---------- avatar: plain, large, round (UI SDK's own) ---------- */
200
+ @scope ([data-look-avatar='plain']) to ([data-custom-theme], [data-look-avatar]) {
201
+ [data-slot='avatar'] {
202
+ border-radius: calc(var(--m-radius) - 2px);
203
+ }
204
+ }
205
+
206
+ @scope ([data-look-avatar='large']) to ([data-custom-theme], [data-look-avatar]) {
207
+ [data-slot='avatar']:not([data-size='sm']) {
208
+ width: 2.5rem;
209
+ height: 2.5rem;
210
+ }
211
+ }
212
+
213
+ /* ---------- rhythm: house (UI SDK's own), tight, airy ----------
214
+ How far apart things stand. As in mistri, it moves the page's air (the steps from 16px up, and the seam
215
+ between sections) a quarter closer or wider, and never a control's own padding or a row's height. A box's
216
+ padding is made from a step, so it is made again here: a token that names another is settled where it is
217
+ written. */
218
+ @scope ([data-look-rhythm='tight']) to ([data-custom-theme], [data-look-rhythm]) {
219
+ :scope {
220
+ --m-space-5: 0.75rem;
221
+ --m-space-5h: 0.9375rem;
222
+ --m-space-6: 1.125rem;
223
+ --m-space-7: 1.5rem;
224
+ --m-space-8: 2.25rem;
225
+ --m-seam: 1.875rem;
226
+ --m-pad-box: var(--m-space-5);
227
+ }
228
+ }
229
+
230
+ @scope ([data-look-rhythm='airy']) to ([data-custom-theme], [data-look-rhythm]) {
231
+ :scope {
232
+ --m-space-5: 1.25rem;
233
+ --m-space-5h: 1.5625rem;
234
+ --m-space-6: 1.875rem;
235
+ --m-space-7: 2.5rem;
236
+ --m-space-8: 3.75rem;
237
+ --m-seam: 3.125rem;
238
+ --m-pad-box: var(--m-space-5);
239
+ }
240
+ }
241
+
242
+ /* A rhythm goes down into a theme worn inside this one, as any token does: the house's says its own. */
243
+ @scope ([data-look-rhythm='house']) to ([data-custom-theme], [data-look-rhythm]) {
244
+ :scope:not(:root, body) {
245
+ --m-space-5: 1rem;
246
+ --m-space-5h: 1.25rem;
247
+ --m-space-6: 1.5rem;
248
+ --m-space-7: 2rem;
249
+ --m-space-8: 3rem;
250
+ --m-seam: 2.5rem;
251
+ --m-pad-box: var(--m-space-5);
252
+ }
253
+ }
254
+
255
+ /* ---------- how far things are lifted: hairline (UI SDK's own), flat, soft, raised ---------- */
256
+ /* The lift is a token, and a token goes down into a theme worn inside this one: the hairline says its own. */
257
+ @scope ([data-look-elevation='hairline']) to ([data-custom-theme], [data-look-elevation]) {
258
+ :scope {
259
+ --m-lift-card: initial;
260
+ }
261
+ }
262
+
263
+ @scope ([data-look-elevation='flat']) to ([data-custom-theme], [data-look-elevation]) {
264
+ :scope {
265
+ --m-shadow-control: none;
266
+ --m-shadow-pop: 0 0 0 1px var(--m-ink);
267
+ --ui-shadow: var(--m-shadow-pop);
268
+ --m-lift-card: 0 0 0 1px var(--m-line-strong);
269
+ }
270
+ }
271
+
272
+ @scope ([data-look-elevation='soft']) to ([data-custom-theme], [data-look-elevation]) {
273
+ :scope {
274
+ --m-lift-card:
275
+ 0 1px 2px light-dark(rgb(23 23 26 / 0.05), rgb(0 0 0 / 0.4)), 0 6px 20px -8px light-dark(rgb(23 23 26 / 0.12), rgb(0 0 0 / 0.6));
276
+ }
277
+ }
278
+
279
+ @scope ([data-look-elevation='raised']) to ([data-custom-theme], [data-look-elevation]) {
280
+ :scope {
281
+ --m-lift-card:
282
+ 0 1px 2px light-dark(rgb(23 23 26 / 0.06), rgb(0 0 0 / 0.4)), 0 10px 28px -10px light-dark(rgb(23 23 26 / 0.18), rgb(0 0 0 / 0.7));
283
+ }
284
+ }
285
+
286
+ /* ---------- a theme's faces ---------- */
287
+ @scope ([data-custom-theme]) to ([data-custom-theme]) {
288
+ /* Headings, but not the small caption over a record's fields: that is a label that happens to be an h2. */
289
+ :is(h1, h2:not([data-slot='properties'] > h2), [data-slot='chart-title'], [data-slot='shell-brand']) {
290
+ font-family: var(--m-font-heading, inherit);
291
+ font-weight: var(--m-heading-weight, revert-layer);
292
+ }
293
+
294
+ /* What stands in a heading and is not its words (a status, a count) keeps the interface's face. */
295
+ :is(h1, h2) :is([data-slot='status'], [data-slot='list-count'], [data-slot='badge']) {
296
+ font-family: var(--m-sans);
297
+ letter-spacing: 0;
298
+ }
299
+ }
300
+
301
+ /* A field's label takes the role's weight and nothing else of it: it is text over a control, not a caption, and
302
+ a theme that sets its captions in small capitals does not mean its forms. */
303
+ @scope ([data-type-label~='weight']) to ([data-custom-theme]) {
304
+ :is(
305
+ [data-slot='data-table'] thead :is(th, th button),
306
+ [data-slot='stats'] dt,
307
+ [data-slot='metric-label'],
308
+ [data-slot='properties'] dt,
309
+ [data-slot='field-label']
310
+ ) {
311
+ font-weight: var(--type-label-weight);
312
+ }
313
+ }
314
+
315
+ /* ---------- required: star (UI SDK's own), optional-word ---------- */
316
+ /* The fields that need not be answered are the ones marked; the ones that must are left bare. */
317
+ @scope ([data-look-required='optional-word']) to ([data-custom-theme], [data-look-required]) {
318
+ [data-slot='field-required'] {
319
+ display: none;
320
+ }
321
+
322
+ [data-slot='field-optional']:not([data-said]) {
323
+ display: inline;
324
+ }
325
+ }
326
+
327
+ /* ---------- formStep: plain (UI SDK's own), ruled ---------- */
328
+ /* The bar a form's actions stand on, lifted off the page under it instead of ruled off: the package's own bar,
329
+ and the one a form draws by hand for the same purpose. A popup's foot (a calendar's Clear and Today) is not
330
+ one: nothing scrolls under it, and lifted it was a white slab with a shadow inside the popup. */
331
+ @scope ([data-look-action-bar='raised']) to ([data-custom-theme], [data-look-action-bar]) {
332
+ :is([data-slot='action-bar'], .intake-actions):not([data-slot='popover-content'] *) {
333
+ border-block-start-color: transparent;
334
+ background: var(--m-surface);
335
+ box-shadow: 0 -6px 18px color-mix(in oklab, var(--m-ink) 12%, transparent);
336
+ }
337
+ }
338
+
339
+ @scope ([data-look-form-step='ruled']) to ([data-custom-theme], [data-look-form-step]) {
340
+ [data-slot='step-header'] {
341
+ padding-block-end: var(--m-space-4);
342
+ border-block-end: 1px solid var(--m-line);
343
+ }
344
+ }
345
+
346
+ /* ---------- a theme's corners ----------
347
+ mistri says four: a control's, a field's, a pill's and a panel's. A field's and a control's are their own
348
+ where a theme says them (Ledger squares its fields and softens its buttons), and the one corner every box
349
+ follows where it does not; a pill's is read wherever a word stands in a rounded box (`--m-radius-pill`). */
350
+ :is(
351
+ [data-slot='input'],
352
+ [data-slot='textarea'],
353
+ [data-slot='select-trigger'],
354
+ [data-slot='autocomplete-input'],
355
+ [data-slot='date-field'],
356
+ [data-slot='file-field'],
357
+ [data-slot='check-cards-card'],
358
+ [data-slot='choice']
359
+ ) {
360
+ border-radius: var(--m-radius-field, var(--m-radius));
361
+ }
362
+
363
+ /* A box to tick is a box whatever the theme's corners: rounded past a third of its side it reads as a radio. */
364
+ [data-slot='checkbox'] {
365
+ border-radius: min(var(--m-radius), 5px);
366
+ }
367
+
368
+ :is(
369
+ [data-slot='button'],
370
+ [data-slot$='-trigger']:not([data-slot='select-trigger'], [data-slot='accordion-trigger'], [data-kind='filter-chip'], [data-kind='help-tip'])
371
+ ) {
372
+ border-radius: var(--m-radius-control, var(--m-radius));
373
+ }
374
+ }
@@ -0,0 +1,173 @@
1
+ /* The scales and names the UI SDK drawings are dressed by (the `--m-*` tokens), and what UI SDK's own stylesheet
2
+ reads (`--ui-*`). The colours, the faces and the corner are this package's tokens (../tokens.css), which a look
3
+ and a theme write. What only a theme says (a field's corner, a rule's colour, a heading's face) is nothing where
4
+ no theme says it, and the rule that reads it says what stands in.
5
+
6
+ They are said on the root and again on the body. A name that reads another is worked out where it is written,
7
+ not where it is used, and the package's tokens are written in both places: a look and the reader's density on
8
+ the root, an App's brand (its accent, its corner) and the reader's typeface on the body. Said on the root alone,
9
+ a button under a branded body would still be the look's colour.
10
+
11
+ The reader's own settings need no sheet of their own for the same reason: more contrast and less transparency
12
+ are answered on the package's tokens (../preferences.css), the muted inks, the lines, the focus ring and the
13
+ scrim, and every name here reads one of those.
14
+
15
+ No colour scheme is said here: ../tokens.css owns it (`data-theme`, and the system's where that is not set), and
16
+ every `light-dark()` in these sheets follows what it says. */
17
+ @layer m-tokens {
18
+ :root,
19
+ body {
20
+ /* Paper, ink, the accent and the four statuses are this package's tokens (../tokens.css), under the names the
21
+ parts read. A look and a palette write those, light and dark, so nothing here is a colour of its own. The
22
+ page stands on the ground; controls, popups and the content pane on the surface. */
23
+ --m-ground: var(--ground);
24
+ --m-surface: var(--surface);
25
+ --m-raised: var(--raised);
26
+ --m-line: var(--line);
27
+ --m-line-strong: var(--line-strong);
28
+ --m-line-control: var(--line-control);
29
+ --m-ink: var(--ink);
30
+ --m-ink-muted: var(--ink-muted);
31
+ --m-ink-subtle: var(--ink-subtle);
32
+
33
+ /* The accent says what is current, selected, focused or followable. A look says which colour its primary
34
+ fills in; where it says none, the accent. */
35
+ --m-accent: var(--accent);
36
+ --m-on-accent: var(--on-accent);
37
+ --m-accent-ink: var(--accent-ink);
38
+ --m-accent-soft: var(--accent-soft);
39
+ --m-primary: var(--primary, var(--accent));
40
+ --m-on-primary: var(--on-primary, var(--on-accent));
41
+
42
+ --m-good: var(--status-good);
43
+ --m-warning: var(--status-warning);
44
+ --m-critical: var(--status-critical);
45
+ --m-info: var(--status-info);
46
+
47
+ /* The corner every box follows, and the four a theme may say apart from it: a field's, a button's, a pill's
48
+ and a panel's. */
49
+ --m-radius: var(--radius);
50
+ --m-radius-field: var(--field-radius);
51
+ --m-radius-control: var(--control-radius);
52
+ --m-radius-pill: var(--pill-radius);
53
+ --m-radius-panel: var(--panel-radius);
54
+ /* A theme's rules and its headings' face, read by the recipes (./looks.css). */
55
+ --m-rule-section: var(--rules-section);
56
+ --m-rule-weight: var(--rules-weight);
57
+ --m-font-heading: var(--heading-font);
58
+ --m-heading-weight: var(--heading-weight);
59
+ --m-unit: 0.25rem;
60
+ /* The base size, on the step a theme's type moves (`--type-k`, ../tokens.css). */
61
+ --m-text: calc(0.8125rem * var(--type-k, 1));
62
+ /* A list's row, in units, so density moves it with every control. */
63
+ --m-row: calc(var(--m-unit) * 10);
64
+
65
+ /* The space scale: every gap, margin and padding in the components' sheets is one of these. The steps are
66
+ mistri's (docs/design.md, Space and text), in rem, with one it has not (5h, 20px). Under 16px a step is a
67
+ control's own: an icon and its word, a field's inside. From 16px up it is the page's air, how far apart
68
+ things stand, and those steps and the seam between sections are what a theme's rhythm moves
69
+ (theme/looks.css). */
70
+ --m-space-1: 0.125rem;
71
+ --m-space-1h: 0.1875rem;
72
+ --m-space-2: 0.25rem;
73
+ --m-space-2h: 0.375rem;
74
+ --m-space-3: 0.5rem;
75
+ --m-space-3h: 0.625rem;
76
+ --m-space-4: 0.75rem;
77
+ --m-space-4h: 0.875rem;
78
+ --m-space-5: 1rem;
79
+ --m-space-5h: 1.25rem;
80
+ --m-space-6: 1.5rem;
81
+ --m-space-7: 2rem;
82
+ --m-space-8: 3rem;
83
+ --m-seam: 2.5rem;
84
+ /* Between two boxes that stand together (cards, panels, tiles), and from a box's edge to what is in it. A
85
+ look that draws a thing as a box gives it both, so nothing that becomes a box is left touching the next. */
86
+ /* The room an icon or a key takes at a field's side. A control's own, so no rhythm moves it: a field whose
87
+ words slid under its icon is what a tighter page must not cost. */
88
+ --m-inset-icon: 2rem;
89
+ --m-gap-box: var(--m-space-4);
90
+ --m-pad-box: var(--m-space-5);
91
+
92
+ /* The weights words are set in: five, by what they are for, so a theme whose face has no weight between the
93
+ regular and the bold (Barlow, Helvetica, most faces a machine has) can say which of its own stands for
94
+ each, and no sheet names a number. `strong` is a row's name, a label, a button; `bold` a heading; `heavy`
95
+ a figure and a title. */
96
+ --m-weight-regular: 400;
97
+ --m-weight-medium: 500;
98
+ --m-weight-strong: 550;
99
+ --m-weight-bold: 600;
100
+ --m-weight-heavy: 650;
101
+
102
+ /* The type scale. Every size has its own line height and each is a whole number of pixels, so a line of
103
+ text, and the box around it, and everything under that, lands on the pixel grid: a height of 19.5 puts
104
+ every edge below it on a half pixel, where a hairline is drawn as two grey ones. A theme moves the scale
105
+ here; nothing in the components' sheets names a size. */
106
+ --m-size-2xs: 0.6875rem;
107
+ --m-lead-2xs: 1rem;
108
+ --m-size-xs: 0.75rem;
109
+ --m-lead-xs: 1.125rem;
110
+ --m-size-sm: var(--m-text);
111
+ --m-lead-sm: 1.25rem;
112
+ --m-size-md: 0.875rem;
113
+ --m-lead-md: 1.25rem;
114
+ --m-size-lg: 0.9375rem;
115
+ --m-lead-lg: 1.375rem;
116
+ --m-size-xl: 1rem;
117
+ --m-lead-xl: 1.5rem;
118
+ --m-size-2xl: 1.125rem;
119
+ --m-lead-2xl: 1.5rem;
120
+ --m-size-3xl: 1.25rem;
121
+ --m-lead-3xl: 1.75rem;
122
+ --m-size-4xl: 1.375rem;
123
+ --m-lead-4xl: 1.75rem;
124
+ --m-size-5xl: 1.5rem;
125
+ --m-lead-5xl: 2rem;
126
+ --m-size-6xl: 1.75rem;
127
+ --m-lead-6xl: 2.25rem;
128
+ /* What running text is set at where nothing says otherwise: a host puts it on its page. */
129
+ --m-leading: var(--m-lead-sm);
130
+
131
+ /* The package's `--mono` is the face values are set in, which most looks leave as the interface's own; its
132
+ monospace is `--code`. */
133
+ --m-sans: var(--sans);
134
+ --m-mono: var(--code);
135
+
136
+ /* Tracking by size: display type closes up, a title a little (packages/ui/src/tokens.css). */
137
+ --m-track-display: -0.024em;
138
+ --m-track-title: -0.014em;
139
+
140
+ /* Enter with ease-out, leave at once (docs/design.md, Motion). */
141
+ --m-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
142
+ --m-fast: 120ms;
143
+ --m-enter: 160ms;
144
+
145
+ --m-shadow-control: 0 1px 1px light-dark(rgb(23 23 26 / 0.05), rgb(0 0 0 / 0.3));
146
+ /* What floats casts the package's own shadow (../tokens.css), which a theme's lift and shadow colour move: a
147
+ listbox under Sage is lifted as Sage's menus are. */
148
+ --m-shadow-pop: var(--shadow-pop);
149
+
150
+ /* What UI SDK's web.css reads. Its primary fills checked and selected states, which here are the accent's. */
151
+ --ui-background: var(--m-surface);
152
+ --ui-foreground: var(--m-ink);
153
+ --ui-muted: var(--m-raised);
154
+ --ui-muted-foreground: var(--m-ink-muted);
155
+ --ui-border: var(--m-line);
156
+ /* A control's edge is the theme's own where it names one (`field.edge`), and the reader's under more contrast. */
157
+ --ui-input: var(--field-edge, var(--m-line-control));
158
+ --ui-primary: var(--m-accent);
159
+ --ui-primary-foreground: var(--m-on-accent);
160
+ --ui-destructive: var(--m-critical);
161
+ --ui-ring: color-mix(in oklab, var(--focus, var(--m-accent)) 72%, var(--m-surface));
162
+ --ui-ring-border: var(--focus, var(--m-accent));
163
+ --ui-overlay: var(--scrim);
164
+ --ui-shadow: var(--m-shadow-pop);
165
+ --ui-radius: var(--m-radius);
166
+ --ui-spacing: var(--m-unit);
167
+ --ui-font-size: var(--m-text);
168
+ /* UI SDK's own parts are set at this leading too: its 1.5 put a 13px line at 19.5. */
169
+ --ui-line-height: var(--m-leading);
170
+ --ui-font-sans: var(--m-sans);
171
+ --ui-font-mono: var(--m-mono);
172
+ }
173
+ }
@@ -0,0 +1,107 @@
1
+ /* A modal and a side panel are one sheet: a head, a body that scrolls, a foot that does not. */
2
+ @layer m-components {
3
+ :is([data-slot='dialog-content'], [data-slot='drawer-content'])[data-kind='sheet'] {
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: 0;
7
+ padding: 0;
8
+ overflow: hidden;
9
+ }
10
+
11
+ [data-slot='dialog-content'][data-kind='sheet'] {
12
+ width: min(30rem, calc(100% - 2rem));
13
+ max-height: min(44rem, calc(100dvh - 4rem));
14
+ border-radius: calc(var(--m-radius) + 4px);
15
+
16
+ &[data-size='lg'] {
17
+ width: min(42rem, calc(100% - 2rem));
18
+ }
19
+ }
20
+
21
+ /* The panel floats a little off the window's edge, on the same corner as the content pane behind it. */
22
+ [data-slot='drawer-content'][data-kind='sheet']:is([data-side='right'], [data-side='left']) {
23
+ width: min(30rem, calc(100vw - 1rem));
24
+ height: calc(100dvh - 1rem);
25
+ max-height: none;
26
+ margin-block: var(--m-space-3);
27
+ margin-inline-end: var(--m-space-3);
28
+ border-radius: calc(var(--m-radius) + 4px);
29
+ }
30
+
31
+ [data-slot='sheet-head'] {
32
+ display: flex;
33
+ align-items: flex-start;
34
+ justify-content: space-between;
35
+ gap: var(--m-space-5);
36
+ padding: var(--m-space-5) var(--m-space-5h) var(--m-space-5);
37
+
38
+ & :is([data-slot='dialog-title'], [data-slot='drawer-title']) {
39
+ margin: 0;
40
+ }
41
+
42
+ & :is([data-slot='dialog-description'], [data-slot='drawer-description']) {
43
+ margin: var(--m-space-1h) 0 0;
44
+ color: var(--m-ink-muted);
45
+ }
46
+
47
+ & :is([data-slot='dialog-close'], [data-slot='drawer-close']) {
48
+ flex: none;
49
+ width: calc(var(--ui-spacing) * 7);
50
+ height: calc(var(--ui-spacing) * 7);
51
+ margin: calc(var(--m-space-1) * -1) calc(var(--m-space-2h) * -1) 0 0;
52
+ padding: 0;
53
+ }
54
+ }
55
+
56
+ [data-slot='sheet-body'] {
57
+ flex: 1;
58
+ min-height: 0;
59
+ padding: var(--m-space-2) var(--m-space-5h) var(--m-space-6);
60
+ overflow-y: auto;
61
+ overscroll-behavior: contain;
62
+ }
63
+
64
+ /* The one filled critical button: the answer that destroys, and only inside its confirmation. */
65
+ [data-slot][data-variant='danger-solid'] {
66
+ border-color: var(--m-critical);
67
+ background: var(--m-critical);
68
+ color: var(--m-surface);
69
+
70
+ &:hover:not([data-disabled]) {
71
+ background: color-mix(in oklab, var(--m-critical) 88%, var(--m-ink));
72
+ }
73
+ }
74
+
75
+ [data-slot='menu-item'][data-tone='critical'] {
76
+ color: var(--m-critical);
77
+ }
78
+
79
+ /* A panel beside the page it describes: it dims nothing, so its own edge and shadow are what set it off. */
80
+ [data-slot='drawer-content'][data-kind='sheet'][data-beside] {
81
+ border: 1px solid var(--m-line);
82
+ box-shadow: var(--m-shadow-pop);
83
+ }
84
+
85
+ /* What stands under a panel beside the page steps aside by the panel's width, less the page's own gutter (a page
86
+ says how far its content already stands from the window's edge in --m-gutter). */
87
+ :root {
88
+ --m-beside: 31.25rem;
89
+ }
90
+
91
+ [data-slot='button'][data-kind='sheet-close'] {
92
+ width: calc(var(--ui-spacing) * 8);
93
+ padding: 0;
94
+ }
95
+ }
96
+
97
+ /* A plain dialog is the caller's box and nothing else: the panel beside a list, the picture viewer and the file
98
+ preview are placed, sized and painted by their own class. The dialog's default dress, UI SDK's and the
99
+ browser's own for what sits in the top layer are all taken off, so what the caller does not say is nothing and
100
+ not a centred card. In the last of the controls' layers, which is still under the caller's rules. */
101
+ @layer m-looks {
102
+ [data-slot='dialog-content'][data-kind='plain'],
103
+ [data-slot='dialog-backdrop'][data-kind='plain'] {
104
+ all: unset;
105
+ display: block;
106
+ }
107
+ }