@igne-agency/react-web-ui 0.4.0 → 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.
package/dist/base.css CHANGED
@@ -112,6 +112,9 @@
112
112
  transition: background-color var(--sys-motion-medium) var(--sys-motion-standard), color var(--sys-motion-medium) var(--sys-motion-standard);
113
113
  }
114
114
  }
115
+ [data-theme] {
116
+ color: var(--sys-color-text);
117
+ }
115
118
  button,
116
119
  select,
117
120
  summary,
@@ -26,9 +26,10 @@ export declare const variableNameOf: (id: string) => string;
26
26
  export declare const fontFamilyPropertyOf: (id: string) => string;
27
27
  /**
28
28
  * A Terrazzo plugin that builds a resolver's tokens into the custom properties
29
- * the kit's components read: `--ref-*` and `--sys-*`, the `light` theme on
30
- * `:root` and the `dark` theme's `sys` roles on `html[data-theme="dark"]`, and
31
- * under `prefers-color-scheme: dark` unless `data-theme="light"`, all in the
29
+ * the kit's components read: the `ref` ramps on `:root`, the `light` theme's
30
+ * `sys` roles on `:root` and any `[data-theme="light"]` element, and the `dark`
31
+ * theme's on any `[data-theme="dark"]` element and on `<html>` under
32
+ * `prefers-color-scheme: dark` unless `data-theme="light"`, all in the
32
33
  * `kit.base` cascade layer after the kit's layer order. A shadow
33
34
  * tagged `$extensions["nl.igne.css"].property: "filter"` is written as
34
35
  * `drop-shadow()` filters.
@@ -120,15 +120,17 @@ const dropShadows = (token, { tokensSet, transformAlias }) => {
120
120
  })
121
121
  .join(" ");
122
122
  };
123
- const light = (contents) => `:root {\n\tcolor-scheme: light;\n${families}${contents}\n}`;
123
+ const ramps = (contents) => `:root {\n${families}${contents}\n}`;
124
+ const light = (contents) => `:root,\n[data-theme="light"] {\n\tcolor-scheme: light;\n${contents}\n}`;
124
125
  const LAYER_ORDER = "@layer kit.reset, kit.base, kit.components;";
125
126
  const layered = (contents) => `${LAYER_ORDER}\n\n@layer kit.base {\n${contents.trimEnd()}\n}\n`;
126
- const dark = (contents) => `html[data-theme="dark"] {\n\tcolor-scheme: dark;\n${contents}\n}\n\n@media (prefers-color-scheme: dark) {\n\thtml:not([data-theme="light"]) {\n\t\tcolor-scheme: dark;\n${contents}\n\t}\n}`;
127
+ const dark = (contents) => `[data-theme="dark"] {\n\tcolor-scheme: dark;\n${contents}\n}\n\n@media (prefers-color-scheme: dark) {\n\thtml:not([data-theme="light"]) {\n\t\tcolor-scheme: dark;\n${contents}\n\t}\n}`;
127
128
  /**
128
129
  * A Terrazzo plugin that builds a resolver's tokens into the custom properties
129
- * the kit's components read: `--ref-*` and `--sys-*`, the `light` theme on
130
- * `:root` and the `dark` theme's `sys` roles on `html[data-theme="dark"]`, and
131
- * under `prefers-color-scheme: dark` unless `data-theme="light"`, all in the
130
+ * the kit's components read: the `ref` ramps on `:root`, the `light` theme's
131
+ * `sys` roles on `:root` and any `[data-theme="light"]` element, and the `dark`
132
+ * theme's on any `[data-theme="dark"]` element and on `<html>` under
133
+ * `prefers-color-scheme: dark` unless `data-theme="light"`, all in the
132
134
  * `kit.base` cascade layer after the kit's layer order. A shadow
133
135
  * tagged `$extensions["nl.igne.css"].property: "filter"` is written as
134
136
  * `drop-shadow()` filters.
@@ -158,7 +160,16 @@ const kitTokens = (options = {}) => {
158
160
  transform: (token, transformOptions) => typography(token, transformOptions) ??
159
161
  dropShadows(token, transformOptions),
160
162
  permutations: [
161
- { input: { theme: "light" }, prepare: light },
163
+ {
164
+ input: { theme: "light" },
165
+ include: ["ref.**"],
166
+ prepare: ramps,
167
+ },
168
+ {
169
+ input: { theme: "light" },
170
+ include: ["sys.**"],
171
+ prepare: light,
172
+ },
162
173
  {
163
174
  input: { theme: "dark" },
164
175
  include: ["sys.**"],
package/dist/tokens.css CHANGED
@@ -6,7 +6,6 @@
6
6
  * ------------------------------------------- */
7
7
 
8
8
  :root {
9
- color-scheme: light;
10
9
  --sys-font-family-body: system-ui, sans-serif;
11
10
  --sys-font-family-heading: var(--sys-font-family-body);
12
11
  --ref-blue-0: oklch(100% 0 234.03);
@@ -339,14 +338,24 @@
339
338
  --ref-sand-975: oklch(2.83% 0.0012 17.89);
340
339
  --ref-sand-990: oklch(1.13% 0.0005 17.89);
341
340
  --ref-sand-1000: oklch(0% 0 17.89);
341
+ }
342
+
343
+ :root,
344
+ [data-theme="light"] {
345
+ color-scheme: light;
346
+ /* The page behind everything */
342
347
  --sys-color-bg: var(--ref-neutral-25);
348
+ /* The quiet hairline that separation rations */
343
349
  --sys-color-border: var(--ref-neutral-150);
350
+ /* The fill of a control or button that cannot be used */
344
351
  --sys-color-disabled-bg: var(--ref-neutral-100);
352
+ /* The ink of a control that cannot be used: its text, icons and the marks of its choice */
345
353
  --sys-color-disabled-fg: var(--ref-neutral-300);
346
354
  --sys-color-error-bg: var(--ref-red-50);
347
355
  --sys-color-error-border: var(--ref-red-200);
348
356
  --sys-color-error-fg: var(--ref-red-700);
349
357
  --sys-color-error-outline: var(--ref-red-250);
358
+ /* Keyboard focus, on every focusable element */
350
359
  --sys-color-focus-ring: var(--sys-color-primary);
351
360
  --sys-color-identity-1-bg: oklch(96.02% 0.0119 84);
352
361
  --sys-color-identity-1-fg: oklch(24.08% 0.0472 84);
@@ -364,23 +373,35 @@
364
373
  --sys-color-neutral-fg: var(--ref-neutral-700);
365
374
  --sys-color-on-primary: var(--ref-neutral-0);
366
375
  --sys-color-on-primary-container: var(--ref-neutral-800);
376
+ /* A mark that has to be found: grab bars, scroll thumbs, control outlines */
367
377
  --sys-color-outline: var(--ref-neutral-200);
378
+ /* Primary buttons and links */
368
379
  --sys-color-primary: var(--ref-neutral-750);
380
+ /* Avatar fallbacks, mention pills, brand tints */
369
381
  --sys-color-primary-container: var(--ref-neutral-50);
370
382
  --sys-color-selection-bg: var(--ref-neutral-100);
371
383
  --sys-color-selection-fg: var(--ref-neutral-800);
372
384
  --sys-color-success-bg: var(--ref-green-50);
373
385
  --sys-color-success-border: var(--ref-green-200);
374
386
  --sys-color-success-fg: var(--ref-green-700);
387
+ /* The default card */
375
388
  --sys-color-surface: var(--ref-neutral-0);
389
+ /* A fill nested in a card */
376
390
  --sys-color-surface-high: var(--ref-neutral-50);
391
+ /* The deepest recess: fields, placeholders */
377
392
  --sys-color-surface-highest: var(--ref-neutral-100);
393
+ /* The dimmest card: a table's sub-rows */
378
394
  --sys-color-surface-lowest: var(--ref-neutral-10);
395
+ /* Popups and tooltips */
379
396
  --sys-color-surface-overlay: var(--ref-neutral-0);
397
+ /* Toasts */
380
398
  --sys-color-surface-overlay-high: var(--ref-neutral-0);
399
+ /* Body copy and headings */
381
400
  --sys-color-text: var(--ref-neutral-500);
382
401
  --sys-color-text-inverse: var(--ref-neutral-0);
402
+ /* Captions, help text and anything passive */
383
403
  --sys-color-text-muted: var(--ref-neutral-450);
404
+ /* The hint text an empty field shows */
384
405
  --sys-color-text-placeholder: var(--ref-neutral-400);
385
406
  --sys-color-warning-bg: var(--ref-orange-50);
386
407
  --sys-color-warning-border: var(--ref-orange-200);
@@ -580,7 +601,7 @@
580
601
  --sys-unit-64: 8rem;
581
602
  }
582
603
 
583
- html[data-theme="dark"] {
604
+ [data-theme="dark"] {
584
605
  color-scheme: dark;
585
606
  /* The page behind everything */
586
607
  --sys-color-bg: var(--ref-neutral-800);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igne-agency/react-web-ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "IGNE's React web component kit: primitives and the presets over them, form controls in three tiers with a TanStack Form bridge, and DTCG tokens themed per app.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -330,7 +330,7 @@
330
330
  },
331
331
  "scripts": {
332
332
  "fix": "bun run tokens && oxfmt . && oxlint --fix .",
333
- "check": "bun run tokens && oxfmt --check . && oxlint .",
333
+ "check": "bun run tokens && oxfmt --check . && oxlint . && bun tools/check-docs-tokens.ts",
334
334
  "tokens": "tz build",
335
335
  "build": "bun run tokens && vite build && tsc -p tsconfig.build.json && tsc -p tsconfig.terrazzo.json",
336
336
  "check:exports": "bun tools/check-exports.ts",