@mlola-ui/engine 1.1.26 → 1.2.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.
@@ -117,7 +117,11 @@
117
117
  "--ml-space-10",
118
118
  "--ml-space-12",
119
119
  "--ml-space-14",
120
- "--ml-space-16"
120
+ "--ml-space-16",
121
+ "--ml-space-fluid-sm",
122
+ "--ml-space-fluid-md",
123
+ "--ml-space-fluid-lg",
124
+ "--ml-space-fluid-xl"
121
125
  ]
122
126
  },
123
127
  {
@@ -132,6 +136,10 @@
132
136
  "--ml-type-lg",
133
137
  "--ml-type-xl",
134
138
  "--ml-type-2xl",
139
+ "--ml-type-display-sm",
140
+ "--ml-type-display-md",
141
+ "--ml-type-display-lg",
142
+ "--ml-type-display-xl",
135
143
  "--ml-leading-tight",
136
144
  "--ml-leading-snug",
137
145
  "--ml-leading-normal",
@@ -221,7 +229,7 @@
221
229
  ]
222
230
  }
223
231
  ],
224
- "rules": "## Designing new UI in the Mlola language\n\nWhen the elements above do not cover what you need, build it the way they are\nbuilt, and it will look like it belongs.\n\n1. **Compose first.** Reach for a component, then a layout primitive, and\n write CSS only for what neither covers. Put it in a layer of your own,\n declared before `mlola.accessibility` so the accessibility guarantees\n still win:\n `@layer mlola.tokens, mlola.foundations, mlola.materials, mlola.recipes, mlola.motion, app, mlola.accessibility;`\n2. **Name what it is, not how it looks.** One class per element role, with\n your own prefix (not `ml-`, so a later Mlola element never collides).\n State and variant go in `data-*` and `aria-*`, never in a second class.\n Reuse the shared words: `data-tone` is `neutral primary info success\n warning danger`; `data-size` is `xs sm md lg xl`; work that went\n wrong is `error`.\n3. **Color by role, never by value.** Planes are `background`,\n `background-subtle`, `surface`, `surface-elevated`. Ink is `text`,\n `text-muted`, `text-faint`. A colored fill (`primary`, `danger`, …)\n always carries its `-foreground`. Colored text, icons, lines and status\n marks on the page use the `-text` role: fills are only kept 1.5:1 from the\n page, enough for an area, not for meaning. Series use `chart-1`…`chart-6`.\n4. **Measure with the scales.** Spacing from `--ml-space-*`, type from\n `--ml-type-*` with `--ml-leading-*`, control heights from\n `--ml-control-*`, panel padding from `--ml-panel-padding`. A `clamp()`\n between two steps is fine; a value invented between them is not.\n5. **Shape and depth come from the theme.** Radii by the size of the thing\n (`xs` a tag, `sm` a small control, `md` a control or card, `lg` a panel\n or dialog, `pill`). Elevation from `--ml-shadow-*`; a floating surface\n also takes the material: `--ml-surface-alpha`, `--ml-surface-blur`,\n `--ml-surface-highlight`.\n6. **Move with the theme.** Durations from `--ml-duration-*`, easing from\n `--ml-ease-*`. Reduced motion is handled by the engine.\n7. **Stack with the layers.** `--ml-layer-*`, never a raw z-index above 9.\n8. **Keep it usable by hand.** Never remove an outline without a\n `:focus-visible` style in its place. Targets are at least 24px; a smaller\n control adds `data-hit=\"expand\"` for touch. Text is never under\n `--ml-type-2xs`.\n9. **Leave the theme alone.** `data-theme` and `data-mode` belong to the\n engine; never set them for a component's own meaning, and never style a\n theme or mode by name. If something must differ by theme, it is a token.\n",
232
+ "rules": "## Designing new UI in the Mlola language\n\nWhen the elements above do not cover what you need, build it the way they are\nbuilt, and it will look like it belongs.\n\n1. **Compose first.** Reach for a component, then a layout primitive, and\n write CSS only for what neither covers. Put it in a layer of your own,\n declared before `mlola.accessibility` so the accessibility guarantees\n still win:\n `@layer mlola.tokens, mlola.foundations, mlola.materials, mlola.recipes, mlola.motion, app, mlola.accessibility;`\n2. **Name what it is, not how it looks.** One class per element role, with\n your own prefix (not `ml-`, so a later Mlola element never collides).\n State and variant go in `data-*` and `aria-*`, never in a second class.\n Reuse the shared words: `data-tone` is `neutral primary info success\n warning danger`; `data-size` is `xs sm md lg xl`; work that went\n wrong is `error`.\n3. **Color by role, never by value.** Planes are `background`,\n `background-subtle`, `surface`, `surface-elevated`. Ink is `text`,\n `text-muted`, `text-faint`. A colored fill (`primary`, `danger`, …)\n always carries its `-foreground`. Colored text, icons, lines and status\n marks on the page use the `-text` role: fills are only kept 1.5:1 from the\n page, enough for an area, not for meaning. Series use `chart-1`…`chart-6`.\n4. **Measure with the scales.** Spacing from `--ml-space-*`, type from\n `--ml-type-*` with `--ml-leading-*`, control heights from\n `--ml-control-*`, panel padding from `--ml-panel-padding`. Space and\n headings that grow with the window read the fluid steps\n (`--ml-space-fluid-sm`…`-xl`, `--ml-type-display-sm`…`-xl`) instead of\n a `clamp()` of their own; a length invented between the steps is not.\n5. **Shape and depth come from the theme.** Radii by the size of the thing\n (`xs` a tag, `sm` a small control, `md` a control or card, `lg` a panel\n or dialog, `pill`). Elevation from `--ml-shadow-*`; a floating surface\n also takes the material: `--ml-surface-alpha`, `--ml-surface-blur`,\n `--ml-surface-highlight`.\n6. **Move with the theme.** Durations from `--ml-duration-*`, easing from\n `--ml-ease-*`. Reduced motion is handled by the engine.\n7. **Stack with the layers.** `--ml-layer-*`, never a raw z-index above 9.\n8. **Keep it usable by hand.** Never remove an outline without a\n `:focus-visible` style in its place. Targets are at least 24px; a smaller\n control adds `data-hit=\"expand\"` for touch. Text is never under\n `--ml-type-2xs`.\n9. **Leave the theme alone.** `data-theme` and `data-mode` belong to the\n engine; never set them for a component's own meaning, and never style a\n theme or mode by name. If something must differ by theme, it is a token.\n",
225
233
  "primitives": [
226
234
  {
227
235
  "name": "ml-actions",
@@ -64,9 +64,9 @@ Values change with the theme and the mode, the names never do.
64
64
  - **Interaction and light.** Focus, hover and pressed fills, tracks, the veil behind overlays, light and knobs.
65
65
  `--ml-focus` `--ml-fill-hover` `--ml-fill-active` `--ml-track` `--ml-control-border` `--ml-ring` `--ml-scrim` `--ml-highlight` `--ml-knob` `--ml-knob-shadow` `--ml-sheen`
66
66
  - **Spacing.** The only spacing: gaps, padding, margins, offsets.
67
- `--ml-space-px` `--ml-space-0-5` `--ml-space-1` `--ml-space-1-5` `--ml-space-2` `--ml-space-2-5` `--ml-space-3` `--ml-space-3-5` `--ml-space-4` `--ml-space-4-5` `--ml-space-5` `--ml-space-6` `--ml-space-7` `--ml-space-8` `--ml-space-9` `--ml-space-10` `--ml-space-12` `--ml-space-14` `--ml-space-16`
67
+ `--ml-space-px` `--ml-space-0-5` `--ml-space-1` `--ml-space-1-5` `--ml-space-2` `--ml-space-2-5` `--ml-space-3` `--ml-space-3-5` `--ml-space-4` `--ml-space-4-5` `--ml-space-5` `--ml-space-6` `--ml-space-7` `--ml-space-8` `--ml-space-9` `--ml-space-10` `--ml-space-12` `--ml-space-14` `--ml-space-16` `--ml-space-fluid-sm` `--ml-space-fluid-md` `--ml-space-fluid-lg` `--ml-space-fluid-xl`
68
68
  - **Type.** The only type sizes, line heights, families and weights.
69
- `--ml-type-2xs` `--ml-type-xs` `--ml-type-sm` `--ml-type-base` `--ml-type-md` `--ml-type-lg` `--ml-type-xl` `--ml-type-2xl` `--ml-leading-tight` `--ml-leading-snug` `--ml-leading-normal` `--ml-font-sans` `--ml-font-display` `--ml-font-mono` `--ml-display-weight` `--ml-body-leading` `--ml-tracking`
69
+ `--ml-type-2xs` `--ml-type-xs` `--ml-type-sm` `--ml-type-base` `--ml-type-md` `--ml-type-lg` `--ml-type-xl` `--ml-type-2xl` `--ml-type-display-sm` `--ml-type-display-md` `--ml-type-display-lg` `--ml-type-display-xl` `--ml-leading-tight` `--ml-leading-snug` `--ml-leading-normal` `--ml-font-sans` `--ml-font-display` `--ml-font-mono` `--ml-display-weight` `--ml-body-leading` `--ml-tracking`
70
70
  - **Density.** Control heights, panel padding, the touch target.
71
71
  `--ml-control-sm` `--ml-control-md` `--ml-control-lg` `--ml-panel-padding` `--ml-target-min`
72
72
  - **Shape.** Corner radii by the size of the thing, and the border weight.
@@ -104,8 +104,10 @@ built, and it will look like it belongs.
104
104
  page, enough for an area, not for meaning. Series use `chart-1`…`chart-6`.
105
105
  4. **Measure with the scales.** Spacing from `--ml-space-*`, type from
106
106
  `--ml-type-*` with `--ml-leading-*`, control heights from
107
- `--ml-control-*`, panel padding from `--ml-panel-padding`. A `clamp()`
108
- between two steps is fine; a value invented between them is not.
107
+ `--ml-control-*`, panel padding from `--ml-panel-padding`. Space and
108
+ headings that grow with the window read the fluid steps
109
+ (`--ml-space-fluid-sm`…`-xl`, `--ml-type-display-sm`…`-xl`) instead of
110
+ a `clamp()` of their own; a length invented between the steps is not.
109
111
  5. **Shape and depth come from the theme.** Radii by the size of the thing
110
112
  (`xs` a tag, `sm` a small control, `md` a control or card, `lg` a panel
111
113
  or dialog, `pill`). Elevation from `--ml-shadow-*`; a floating surface
@@ -82,15 +82,15 @@ body {
82
82
  }
83
83
 
84
84
  h1 {
85
- font-size: clamp(2.25rem,5vw,4.75rem);
85
+ font-size: var(--ml-type-display-lg);
86
86
  }
87
87
 
88
88
  h2 {
89
- font-size: clamp(1.75rem,3.2vw,3rem);
89
+ font-size: var(--ml-type-display-md);
90
90
  }
91
91
 
92
92
  h3 {
93
- font-size: clamp(1.25rem,2vw,1.75rem);
93
+ font-size: var(--ml-type-display-sm);
94
94
  }
95
95
 
96
96
  :where(code,kbd,samp,pre) {
@@ -101,7 +101,7 @@
101
101
 
102
102
  .ml-display {
103
103
  font-family: var(--ml-font-display);
104
- font-size: clamp(2.5rem,6vw,4.5rem);
104
+ font-size: var(--ml-type-display-lg);
105
105
  font-weight: var(--ml-display-weight);
106
106
  line-height: 1.05;
107
107
  letter-spacing: -.03em;
@@ -175,7 +175,7 @@
175
175
  }
176
176
 
177
177
  .ml-section {
178
- padding-block: clamp(3.5rem,8vw,6.5rem);
178
+ padding-block: var(--ml-space-fluid-xl);
179
179
  /* A section is a grid or flex item in a page shell; without this, a wide
180
180
  table inside it widens the whole page instead of scrolling in place. */
181
181
  min-width: 0;
@@ -197,7 +197,7 @@
197
197
  .ml-section-header {
198
198
  display: grid;
199
199
  gap: var(--ml-space-3);
200
- margin-block-end: clamp(2rem,5vw,3rem);
200
+ margin-block-end: var(--ml-space-fluid-md);
201
201
  max-width: 42rem;
202
202
  }
203
203
 
@@ -224,7 +224,7 @@
224
224
 
225
225
  .ml-heading {
226
226
  font-family: var(--ml-font-display);
227
- font-size: clamp(1.75rem,3.2vw,2.75rem);
227
+ font-size: var(--ml-type-display-md);
228
228
  font-weight: var(--ml-display-weight);
229
229
  line-height: 1.1;
230
230
  letter-spacing: -.025em;
@@ -501,7 +501,7 @@
501
501
  flex-wrap: wrap;
502
502
  align-items: baseline;
503
503
  gap: var(--ml-space-1-5);
504
- font-size: clamp(2rem,4vw,2.75rem);
504
+ font-size: var(--ml-type-display-md);
505
505
  font-weight: 800;
506
506
  letter-spacing: -.03em;
507
507
  }
@@ -1665,6 +1665,17 @@ button.ml-breadcrumb-link {
1665
1665
  color: var(--ml-primary-text);
1666
1666
  }
1667
1667
 
1668
+ /* A link button is drawn as text, a line tall. On touch it keeps that look
1669
+ and gains an invisible target around it, as a control marked
1670
+ data-hit="expand" does, so a finger reaches it (WCAG 2.5.8). */
1671
+ @media (pointer: coarse) {
1672
+ .ml-button[data-variant="link"]::after {
1673
+ position: absolute;
1674
+ inset: min(calc(var(--ml-space-1-5) * -1), calc((var(--ml-target-min) - 100%) / -2));
1675
+ content: "";
1676
+ }
1677
+ }
1678
+
1668
1679
  .ml-button[data-size="sm"] {
1669
1680
  min-height: var(--ml-control-sm);
1670
1681
  gap: var(--ml-space-1-5);
@@ -19,6 +19,10 @@
19
19
  --ml-space-12: 3rem;
20
20
  --ml-space-14: 3.5rem;
21
21
  --ml-space-16: 4rem;
22
+ --ml-space-fluid-sm: clamp(1.25rem, 3vw, 2.5rem);
23
+ --ml-space-fluid-md: clamp(2rem, 5vw, 3rem);
24
+ --ml-space-fluid-lg: clamp(2rem, 5vw, 4rem);
25
+ --ml-space-fluid-xl: clamp(3.5rem, 8vw, 6.5rem);
22
26
  --ml-type-2xs: 0.6875rem;
23
27
  --ml-type-xs: 0.75rem;
24
28
  --ml-type-sm: 0.8125rem;
@@ -27,6 +31,10 @@
27
31
  --ml-type-lg: 1.125rem;
28
32
  --ml-type-xl: 1.25rem;
29
33
  --ml-type-2xl: 1.5rem;
34
+ --ml-type-display-sm: clamp(1.375rem, 2.5vw, 1.875rem);
35
+ --ml-type-display-md: clamp(1.75rem, 3.5vw, 2.75rem);
36
+ --ml-type-display-lg: clamp(2.5rem, 6vw, 4.5rem);
37
+ --ml-type-display-xl: clamp(4rem, 14vw, 8rem);
30
38
  --ml-leading-tight: 1.25;
31
39
  --ml-leading-snug: 1.4;
32
40
  --ml-leading-normal: 1.55;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlola-ui/engine",
3
- "version": "1.1.26",
3
+ "version": "1.2.0",
4
4
  "description": "Framework-free CSS, spring easings, and the machine-readable contract for Mlola UI",
5
5
  "type": "module",
6
6
  "sideEffects": [
package/src/render.mjs CHANGED
@@ -12,7 +12,13 @@ const round = (value, places = 3) => Number(value.toFixed(places));
12
12
  * The one spacing and type scale every recipe draws from. Theme-invariant on
13
13
  * purpose: theme varies radius, density of ink, motion and depth, while
14
14
  * the rhythm of the grid stays constant so composed pages line up. Recipes must
15
- * not invent values between these steps. Layers are the one stacking order
15
+ * not invent values between these steps. The fluid steps grow with the window,
16
+ * each between two ends of the scale: space inside a large panel (sm), between
17
+ * groups in a section (md), between a section's columns or blocks (lg) and
18
+ * between sections (xl); display type for a card or step title (sm), a
19
+ * section title (md), a page title (lg) and a numeral that is the picture
20
+ * (xl, a 404). A page or block reads these instead of writing a clamp() of its
21
+ * own, so every section and heading follows one curve. Layers are the one stacking order
16
22
  * for everything that floats: raised content, sticky headers, menus, dialogs,
17
23
  * popovers, toasts and tooltips, and the few layers that sit above them all.
18
24
  */
@@ -37,6 +43,10 @@ export function renderScaleCss() {
37
43
  --ml-space-12: 3rem;
38
44
  --ml-space-14: 3.5rem;
39
45
  --ml-space-16: 4rem;
46
+ --ml-space-fluid-sm: clamp(1.25rem, 3vw, 2.5rem);
47
+ --ml-space-fluid-md: clamp(2rem, 5vw, 3rem);
48
+ --ml-space-fluid-lg: clamp(2rem, 5vw, 4rem);
49
+ --ml-space-fluid-xl: clamp(3.5rem, 8vw, 6.5rem);
40
50
  --ml-type-2xs: 0.6875rem;
41
51
  --ml-type-xs: 0.75rem;
42
52
  --ml-type-sm: 0.8125rem;
@@ -45,6 +55,10 @@ export function renderScaleCss() {
45
55
  --ml-type-lg: 1.125rem;
46
56
  --ml-type-xl: 1.25rem;
47
57
  --ml-type-2xl: 1.5rem;
58
+ --ml-type-display-sm: clamp(1.375rem, 2.5vw, 1.875rem);
59
+ --ml-type-display-md: clamp(1.75rem, 3.5vw, 2.75rem);
60
+ --ml-type-display-lg: clamp(2.5rem, 6vw, 4.5rem);
61
+ --ml-type-display-xl: clamp(4rem, 14vw, 8rem);
48
62
  --ml-leading-tight: 1.25;
49
63
  --ml-leading-snug: 1.4;
50
64
  --ml-leading-normal: 1.55;