@hanzo/ui 8.0.70 → 8.0.72

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/glass.css CHANGED
@@ -230,7 +230,18 @@
230
230
 
231
231
  :root {
232
232
  /* One sweep, closing on the stop it opened with — a conic gradient whose
233
- first and last stop differ shows a hard seam. */
233
+ first and last stop differ shows a hard seam.
234
+
235
+ LUMINANCE, NOT HUE. Four saturated stops at 0.40-0.48 alpha, swept around
236
+ a rounded RECTANGLE, do not distribute evenly: the long top and bottom
237
+ edges each take a wide angular slice and the short sides almost none, so
238
+ one edge wore a bright blue while the opposite wore a burnt orange — a
239
+ ring that highlights half the box and reads as sitting off-centre. White
240
+ at two close alphas removes the bright arc entirely, drops the peak from
241
+ 0.48 to 0.18, and keeps the slow drift as a sheen. hanzo.chat and
242
+ hanzo.app both declare exactly these stops; this is the package catching
243
+ up to its consumers — the copies must not drift again, and this file is
244
+ the home. */
234
245
  --hz-spectrum: rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.18),
235
246
  rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.18),
236
247
  rgba(255, 255, 255, 0.1);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.monochrome = exports.config = void 0;
4
+ exports.css = css;
4
5
  const v5_1 = require("@hanzogui/config/v5");
5
6
  const gui_1 = require("@hanzo/gui");
6
7
  // ─────────────────────────────────────────────────────────────────────────────
@@ -154,13 +155,33 @@ const STEP = {
154
155
  '19': 192,
155
156
  '20': 208,
156
157
  };
158
+ /**
159
+ * Every step carries `--density`, the same way every type rung carries
160
+ * `--type-scale`.
161
+ *
162
+ * Spacing is the axis a density control actually moves — design's own
163
+ * `tokens/spacing.css` multiplies each `--space-*` by `var(--density, 1)`, but
164
+ * that reaches only CSS consumers. gui resolves `padding="$4"` in JS and writes
165
+ * it into an atomic class as `var(--c-space-4)`, so the ramp gui compiles is a
166
+ * SECOND ramp, and until it carried the knob a density preference moved the
167
+ * stylesheet and left every gui-rendered gap exactly where it was.
168
+ *
169
+ * The px literal stays the source of truth and stays visible in the number
170
+ * above; `calc()` multiplies it. At density 1 that is a byte-for-byte no-op —
171
+ * `calc(16px * 1)` computes to `16px` — so this changes nothing until somebody
172
+ * asks it to.
173
+ *
174
+ * Zero is left as the number `0`: `calc(0px * n)` is still zero, and a token
175
+ * whose whole meaning is "no space" does not need a knob to say so.
176
+ */
177
+ const step = (px) => (px === 0 ? 0 : `calc(${px}px * var(--density, 1))`);
157
178
  const space = {};
158
179
  for (const [k, v] of Object.entries(STEP)) {
159
- space[`$${k}`] = v;
160
- space[`-${k}`] = -v;
180
+ space[`$${k}`] = step(v);
181
+ space[`-${k}`] = step(-v);
161
182
  }
162
- space.$true = STEP['4'];
163
- space['-true'] = -STEP['4'];
183
+ space.$true = step(STEP['4']);
184
+ space['-true'] = step(-STEP['4']);
164
185
  /**
165
186
  * THREE RUNGS OF THE NUMBERED RAMP UNDID A TOKEN DECISION, so they are re-based.
166
187
  *
@@ -208,6 +229,54 @@ space['-true'] = -STEP['4'];
208
229
  const EDGE = { dark: 'rgb(255 255 255 / .10)', light: 'rgb(0 0 0 / .10)' };
209
230
  const LABEL = { dark: '#fafafa', light: '#0a0a0a' };
210
231
  const RING = { dark: 'rgb(255 255 255 / .40)', light: 'rgb(0 0 0 / .5)' };
232
+ /**
233
+ * The ground, the placeholder, and the one loud fill — the rest of what a brand
234
+ * owns, on the same terms as the three rungs above.
235
+ *
236
+ * `color`, `placeholderColor` and the accent pair are plain references, because
237
+ * design spells them `--foreground`, `--text-tertiary`, `--primary` and
238
+ * `--primary-foreground` while gui's keys are `color`, `placeholderColor`,
239
+ * `accentBackground` and `accentColor`. Those names never meet, so the reference
240
+ * is live and that is the end of it.
241
+ *
242
+ * `background` is the ONE name that cannot be referenced, and it is worth being
243
+ * exact about why. gui publishes each THEME key as a bare `--<key>` on
244
+ * `:root.t_dark` — specificity (0,2,0) against design's (0,1,0) `:root` — so
245
+ * gui's copy wins for the whole document, not merely for gui's own components.
246
+ * Point it back at the name it shadows and `--background: var(--background)` is
247
+ * a self-reference; CSS drops BOTH sides of a cycle and the property computes
248
+ * EMPTY. Not theory: an empty `--border` is what left `border-border` falling
249
+ * back to `currentColor`, a white hairline on every pricing card on hanzo.ai.
250
+ *
251
+ * Three things that look like fixes are not, each measured in a browser:
252
+ * · a fallback — `var(--background, #0a0a0a)` computes empty too, because the
253
+ * fallback is inside the dependency graph the cycle is found in;
254
+ * · routing through design's `--surface-page`, which is itself declared as
255
+ * `var(--background)` — a two-hop cycle, equally empty;
256
+ * · deleting the key here, which stops `$background` resolving at all and so
257
+ * emits no class rather than the wrong one.
258
+ *
259
+ * So the value stays design's published literal — `gui-config.test.ts` reads it
260
+ * out of design's own stylesheet, so it cannot drift — and the DECLARATION is
261
+ * dropped from the root theme blocks by `css()` below. The literal never reaches
262
+ * a browser; `var(--background)` resolves through design, live and rebrandable.
263
+ * Keeping a true literal rather than a reference is deliberate: if a consumer
264
+ * ever emits this sheet without `css()`, it renders design's colour frozen
265
+ * instead of rendering nothing, and a frozen ground is a far cheaper failure
266
+ * than an empty one.
267
+ *
268
+ * `accentBackground`/`accentColor` are gui's loud control pair, and design's
269
+ * `--primary`/`--primary-foreground` are the same idea under this system's own
270
+ * name. Binding them is what puts an ACCENT within reach: `@hanzo/appearance`
271
+ * writes `--primary` (and `--accent`) for a person, `themeToTokens()` writes the
272
+ * same names for an org, and both now land on the same components. Before this
273
+ * the accent knob reached nothing gui rendered — nothing in this package
274
+ * referenced `--primary` at all.
275
+ */
276
+ const GROUND = { dark: '#0a0a0a', light: '#f7f7f7' };
277
+ const MUTED = { dark: 'rgb(255 255 255 / .55)', light: 'rgb(10 10 10 / .55)' };
278
+ const LOUD = { dark: '#fafafa', light: '#0a0a0a' };
279
+ const LOUD_LABEL = { dark: '#0a0a0a', light: '#fafafa' };
211
280
  /**
212
281
  * The edge and the label are re-based on the two ROOT themes; the ring is
213
282
  * re-based on ALL of them, and the asymmetry is the point.
@@ -240,6 +309,11 @@ const themes = Object.fromEntries(Object.entries(v5_1.defaultConfig.themes).map(
240
309
  color4: `var(--border, ${EDGE[s]})`,
241
310
  borderColor: `var(--border, ${EDGE[s]})`,
242
311
  color12: `var(--foreground, ${LABEL[s]})`,
312
+ background: GROUND[s],
313
+ color: `var(--foreground, ${LABEL[s]})`,
314
+ placeholderColor: `var(--text-tertiary, ${MUTED[s]})`,
315
+ accentBackground: `var(--primary, ${LOUD[s]})`,
316
+ accentColor: `var(--primary-foreground, ${LOUD_LABEL[s]})`,
243
317
  }
244
318
  : ringed,
245
319
  ];
@@ -280,6 +354,70 @@ const base = {
280
354
  };
281
355
  exports.config = (0, gui_1.createGui)({ ...base, themes });
282
356
  exports.default = exports.config;
357
+ /**
358
+ * The three names design owns that gui also publishes as theme keys.
359
+ *
360
+ * `background` is the ground; `black` and `white` are constants, and they are
361
+ * not harmless — design publishes `--white: #fafafa` in dark because pure white
362
+ * halates on near-black, and gui's ramp overwrites it with `#ffffff`. That is
363
+ * design's own decision being undone by a name collision.
364
+ */
365
+ const OWNED = ['background', 'black', 'white'];
366
+ /** Exactly `:root`, `:root.t_dark` or `:root.t_light` — a ROOT theme. Anything
367
+ * carrying a further `.t_*` is a NESTED theme, and a nested theme scoping its
368
+ * own ground is what a nested theme IS. ~248 of them legitimately do. */
369
+ const ROOT_THEME = /^:root(\.t_(dark|light))?$/;
370
+ /**
371
+ * gui's stylesheet, with the declarations that shadow @hanzo/design removed.
372
+ *
373
+ * THIS is what a consumer emits — never `config.getCSS()` directly. gui builds
374
+ * its atomic CSS as components render, so every app runs a generator of its own;
375
+ * that is why this cannot be a step inside one package's build script and has to
376
+ * be the function apps call. It was one, in `scripts/gen-css.mjs`, and it
377
+ * therefore fixed @hanzo/ui's own sheet and nothing else — hanzo.ai generates
378
+ * its sheet with its own script and still ships gui's grey over design's black.
379
+ *
380
+ * gui shadows TWICE, by two different mechanisms, and fixing one leaves the page
381
+ * just as wrong:
382
+ * · `:root.t_dark` / `:root.t_light` — (0,2,0), beats design on SPECIFICITY,
383
+ * so re-importing design's colours last cannot win. That workaround only
384
+ * appears to work where the theme class never reaches <html>, and reverts
385
+ * the day someone wires themes properly — a fix that expires on being fixed.
386
+ * · plain `:root { --background: … }` — (0,1,0), TIES design and wins on
387
+ * SOURCE ORDER, because gui's block is appended after design's.
388
+ *
389
+ * Removing the declaration does not remove the token: `$background` still
390
+ * resolves to `var(--background)` and still emits its class, and that `var()`
391
+ * now reads design's value from the cascade. So the ground follows the brand,
392
+ * the theme and any runtime retune, which is the whole point.
393
+ */
394
+ function css() {
395
+ const source = exports.config.getCSS();
396
+ let out = '';
397
+ let i = 0;
398
+ while (i < source.length) {
399
+ const open = source.indexOf('{', i);
400
+ if (open === -1) {
401
+ out += source.slice(i);
402
+ break;
403
+ }
404
+ const close = source.indexOf('}', open);
405
+ if (close === -1) {
406
+ out += source.slice(i);
407
+ break;
408
+ }
409
+ const selector = source.slice(i, open);
410
+ let body = source.slice(open + 1, close);
411
+ if (selector.split(',').some((s) => ROOT_THEME.test(s.trim()))) {
412
+ for (const name of OWNED) {
413
+ body = body.replace(new RegExp(`(^|;)\\s*--${name}\\s*:[^;}]*;?`, 'g'), '$1');
414
+ }
415
+ }
416
+ out += selector + '{' + body + '}';
417
+ i = close + 1;
418
+ }
419
+ return out;
420
+ }
283
421
  /**
284
422
  * The eight chromatic families. Everything else a sub-theme name can carry —
285
423
  * `accent`, `black`, `white`, `gray`, `neutral`, `surface1`, `surface2` — is a
@@ -15,7 +15,7 @@ export declare const config: import("@hanzogui/web").GuiInternalConfig<{
15
15
  readonly 12: 9999;
16
16
  readonly true: 8;
17
17
  };
18
- space: Record<string, number>;
18
+ space: Record<string, string | number>;
19
19
  zIndex: {
20
20
  0: number;
21
21
  1: number;
@@ -766,6 +766,31 @@ export declare const config: import("@hanzogui/web").GuiInternalConfig<{
766
766
  styleCompat: "web";
767
767
  }, "default">;
768
768
  export default config;
769
+ /**
770
+ * gui's stylesheet, with the declarations that shadow @hanzo/design removed.
771
+ *
772
+ * THIS is what a consumer emits — never `config.getCSS()` directly. gui builds
773
+ * its atomic CSS as components render, so every app runs a generator of its own;
774
+ * that is why this cannot be a step inside one package's build script and has to
775
+ * be the function apps call. It was one, in `scripts/gen-css.mjs`, and it
776
+ * therefore fixed @hanzo/ui's own sheet and nothing else — hanzo.ai generates
777
+ * its sheet with its own script and still ships gui's grey over design's black.
778
+ *
779
+ * gui shadows TWICE, by two different mechanisms, and fixing one leaves the page
780
+ * just as wrong:
781
+ * · `:root.t_dark` / `:root.t_light` — (0,2,0), beats design on SPECIFICITY,
782
+ * so re-importing design's colours last cannot win. That workaround only
783
+ * appears to work where the theme class never reaches <html>, and reverts
784
+ * the day someone wires themes properly — a fix that expires on being fixed.
785
+ * · plain `:root { --background: … }` — (0,1,0), TIES design and wins on
786
+ * SOURCE ORDER, because gui's block is appended after design's.
787
+ *
788
+ * Removing the declaration does not remove the token: `$background` still
789
+ * resolves to `var(--background)` and still emits its class, and that `var()`
790
+ * now reads design's value from the cascade. So the ground follows the brand,
791
+ * the theme and any runtime retune, which is the whole point.
792
+ */
793
+ export declare function css(): string;
769
794
  /**
770
795
  * The same system with the chromatic sub-themes omitted — 150 themes instead of
771
796
  * 390, and 62% less theme table.
@@ -799,7 +824,7 @@ export declare const monochrome: import("@hanzogui/web").GuiInternalConfig<{
799
824
  readonly 12: 9999;
800
825
  readonly true: 8;
801
826
  };
802
- space: Record<string, number>;
827
+ space: Record<string, string | number>;
803
828
  zIndex: {
804
829
  0: number;
805
830
  1: number;
@@ -1 +1 @@
1
- {"version":3,"file":"gui-config.d.ts","sourceRoot":"","sources":["../src/gui-config.ts"],"names":[],"mappings":"AAqSA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAKrB,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,OAAO,MAAM,CAAA"}
@@ -151,13 +151,33 @@ const STEP = {
151
151
  '19': 192,
152
152
  '20': 208,
153
153
  };
154
+ /**
155
+ * Every step carries `--density`, the same way every type rung carries
156
+ * `--type-scale`.
157
+ *
158
+ * Spacing is the axis a density control actually moves — design's own
159
+ * `tokens/spacing.css` multiplies each `--space-*` by `var(--density, 1)`, but
160
+ * that reaches only CSS consumers. gui resolves `padding="$4"` in JS and writes
161
+ * it into an atomic class as `var(--c-space-4)`, so the ramp gui compiles is a
162
+ * SECOND ramp, and until it carried the knob a density preference moved the
163
+ * stylesheet and left every gui-rendered gap exactly where it was.
164
+ *
165
+ * The px literal stays the source of truth and stays visible in the number
166
+ * above; `calc()` multiplies it. At density 1 that is a byte-for-byte no-op —
167
+ * `calc(16px * 1)` computes to `16px` — so this changes nothing until somebody
168
+ * asks it to.
169
+ *
170
+ * Zero is left as the number `0`: `calc(0px * n)` is still zero, and a token
171
+ * whose whole meaning is "no space" does not need a knob to say so.
172
+ */
173
+ const step = (px) => (px === 0 ? 0 : `calc(${px}px * var(--density, 1))`);
154
174
  const space = {};
155
175
  for (const [k, v] of Object.entries(STEP)) {
156
- space[`$${k}`] = v;
157
- space[`-${k}`] = -v;
176
+ space[`$${k}`] = step(v);
177
+ space[`-${k}`] = step(-v);
158
178
  }
159
- space.$true = STEP['4'];
160
- space['-true'] = -STEP['4'];
179
+ space.$true = step(STEP['4']);
180
+ space['-true'] = step(-STEP['4']);
161
181
  /**
162
182
  * THREE RUNGS OF THE NUMBERED RAMP UNDID A TOKEN DECISION, so they are re-based.
163
183
  *
@@ -205,6 +225,54 @@ space['-true'] = -STEP['4'];
205
225
  const EDGE = { dark: 'rgb(255 255 255 / .10)', light: 'rgb(0 0 0 / .10)' };
206
226
  const LABEL = { dark: '#fafafa', light: '#0a0a0a' };
207
227
  const RING = { dark: 'rgb(255 255 255 / .40)', light: 'rgb(0 0 0 / .5)' };
228
+ /**
229
+ * The ground, the placeholder, and the one loud fill — the rest of what a brand
230
+ * owns, on the same terms as the three rungs above.
231
+ *
232
+ * `color`, `placeholderColor` and the accent pair are plain references, because
233
+ * design spells them `--foreground`, `--text-tertiary`, `--primary` and
234
+ * `--primary-foreground` while gui's keys are `color`, `placeholderColor`,
235
+ * `accentBackground` and `accentColor`. Those names never meet, so the reference
236
+ * is live and that is the end of it.
237
+ *
238
+ * `background` is the ONE name that cannot be referenced, and it is worth being
239
+ * exact about why. gui publishes each THEME key as a bare `--<key>` on
240
+ * `:root.t_dark` — specificity (0,2,0) against design's (0,1,0) `:root` — so
241
+ * gui's copy wins for the whole document, not merely for gui's own components.
242
+ * Point it back at the name it shadows and `--background: var(--background)` is
243
+ * a self-reference; CSS drops BOTH sides of a cycle and the property computes
244
+ * EMPTY. Not theory: an empty `--border` is what left `border-border` falling
245
+ * back to `currentColor`, a white hairline on every pricing card on hanzo.ai.
246
+ *
247
+ * Three things that look like fixes are not, each measured in a browser:
248
+ * · a fallback — `var(--background, #0a0a0a)` computes empty too, because the
249
+ * fallback is inside the dependency graph the cycle is found in;
250
+ * · routing through design's `--surface-page`, which is itself declared as
251
+ * `var(--background)` — a two-hop cycle, equally empty;
252
+ * · deleting the key here, which stops `$background` resolving at all and so
253
+ * emits no class rather than the wrong one.
254
+ *
255
+ * So the value stays design's published literal — `gui-config.test.ts` reads it
256
+ * out of design's own stylesheet, so it cannot drift — and the DECLARATION is
257
+ * dropped from the root theme blocks by `css()` below. The literal never reaches
258
+ * a browser; `var(--background)` resolves through design, live and rebrandable.
259
+ * Keeping a true literal rather than a reference is deliberate: if a consumer
260
+ * ever emits this sheet without `css()`, it renders design's colour frozen
261
+ * instead of rendering nothing, and a frozen ground is a far cheaper failure
262
+ * than an empty one.
263
+ *
264
+ * `accentBackground`/`accentColor` are gui's loud control pair, and design's
265
+ * `--primary`/`--primary-foreground` are the same idea under this system's own
266
+ * name. Binding them is what puts an ACCENT within reach: `@hanzo/appearance`
267
+ * writes `--primary` (and `--accent`) for a person, `themeToTokens()` writes the
268
+ * same names for an org, and both now land on the same components. Before this
269
+ * the accent knob reached nothing gui rendered — nothing in this package
270
+ * referenced `--primary` at all.
271
+ */
272
+ const GROUND = { dark: '#0a0a0a', light: '#f7f7f7' };
273
+ const MUTED = { dark: 'rgb(255 255 255 / .55)', light: 'rgb(10 10 10 / .55)' };
274
+ const LOUD = { dark: '#fafafa', light: '#0a0a0a' };
275
+ const LOUD_LABEL = { dark: '#0a0a0a', light: '#fafafa' };
208
276
  /**
209
277
  * The edge and the label are re-based on the two ROOT themes; the ring is
210
278
  * re-based on ALL of them, and the asymmetry is the point.
@@ -237,6 +305,11 @@ const themes = Object.fromEntries(Object.entries(defaultConfig.themes).map(([nam
237
305
  color4: `var(--border, ${EDGE[s]})`,
238
306
  borderColor: `var(--border, ${EDGE[s]})`,
239
307
  color12: `var(--foreground, ${LABEL[s]})`,
308
+ background: GROUND[s],
309
+ color: `var(--foreground, ${LABEL[s]})`,
310
+ placeholderColor: `var(--text-tertiary, ${MUTED[s]})`,
311
+ accentBackground: `var(--primary, ${LOUD[s]})`,
312
+ accentColor: `var(--primary-foreground, ${LOUD_LABEL[s]})`,
240
313
  }
241
314
  : ringed,
242
315
  ];
@@ -277,6 +350,70 @@ const base = {
277
350
  };
278
351
  export const config = createGui({ ...base, themes });
279
352
  export default config;
353
+ /**
354
+ * The three names design owns that gui also publishes as theme keys.
355
+ *
356
+ * `background` is the ground; `black` and `white` are constants, and they are
357
+ * not harmless — design publishes `--white: #fafafa` in dark because pure white
358
+ * halates on near-black, and gui's ramp overwrites it with `#ffffff`. That is
359
+ * design's own decision being undone by a name collision.
360
+ */
361
+ const OWNED = ['background', 'black', 'white'];
362
+ /** Exactly `:root`, `:root.t_dark` or `:root.t_light` — a ROOT theme. Anything
363
+ * carrying a further `.t_*` is a NESTED theme, and a nested theme scoping its
364
+ * own ground is what a nested theme IS. ~248 of them legitimately do. */
365
+ const ROOT_THEME = /^:root(\.t_(dark|light))?$/;
366
+ /**
367
+ * gui's stylesheet, with the declarations that shadow @hanzo/design removed.
368
+ *
369
+ * THIS is what a consumer emits — never `config.getCSS()` directly. gui builds
370
+ * its atomic CSS as components render, so every app runs a generator of its own;
371
+ * that is why this cannot be a step inside one package's build script and has to
372
+ * be the function apps call. It was one, in `scripts/gen-css.mjs`, and it
373
+ * therefore fixed @hanzo/ui's own sheet and nothing else — hanzo.ai generates
374
+ * its sheet with its own script and still ships gui's grey over design's black.
375
+ *
376
+ * gui shadows TWICE, by two different mechanisms, and fixing one leaves the page
377
+ * just as wrong:
378
+ * · `:root.t_dark` / `:root.t_light` — (0,2,0), beats design on SPECIFICITY,
379
+ * so re-importing design's colours last cannot win. That workaround only
380
+ * appears to work where the theme class never reaches <html>, and reverts
381
+ * the day someone wires themes properly — a fix that expires on being fixed.
382
+ * · plain `:root { --background: … }` — (0,1,0), TIES design and wins on
383
+ * SOURCE ORDER, because gui's block is appended after design's.
384
+ *
385
+ * Removing the declaration does not remove the token: `$background` still
386
+ * resolves to `var(--background)` and still emits its class, and that `var()`
387
+ * now reads design's value from the cascade. So the ground follows the brand,
388
+ * the theme and any runtime retune, which is the whole point.
389
+ */
390
+ export function css() {
391
+ const source = config.getCSS();
392
+ let out = '';
393
+ let i = 0;
394
+ while (i < source.length) {
395
+ const open = source.indexOf('{', i);
396
+ if (open === -1) {
397
+ out += source.slice(i);
398
+ break;
399
+ }
400
+ const close = source.indexOf('}', open);
401
+ if (close === -1) {
402
+ out += source.slice(i);
403
+ break;
404
+ }
405
+ const selector = source.slice(i, open);
406
+ let body = source.slice(open + 1, close);
407
+ if (selector.split(',').some((s) => ROOT_THEME.test(s.trim()))) {
408
+ for (const name of OWNED) {
409
+ body = body.replace(new RegExp(`(^|;)\\s*--${name}\\s*:[^;}]*;?`, 'g'), '$1');
410
+ }
411
+ }
412
+ out += selector + '{' + body + '}';
413
+ i = close + 1;
414
+ }
415
+ return out;
416
+ }
280
417
  /**
281
418
  * The eight chromatic families. Everything else a sub-theme name can carry —
282
419
  * `accent`, `black`, `white`, `gray`, `neutral`, `surface1`, `surface2` — is a
@@ -1 +1 @@
1
- {"version":3,"file":"gui-config.js","sourceRoot":"","sources":["../src/gui-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,gFAAgF;AAChF,6EAA6E;AAC7E,EAAE;AACF,iFAAiF;AACjF,mFAAmF;AACnF,iFAAiF;AACjF,6DAA6D;AAC7D,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,gFAAgF;AAChF,6CAA6C;AAC7C,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,oEAAoE;AACpE,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,cAAc;AACd,gFAAgF;AAEhF,MAAM,KAAK,GAAG,+CAA+C,CAAA;AAE7D;;;yCAGyC;AACzC,MAAM,UAAU,GAAG,wEAAwE,CAAA;AAE3F;;;;;;;;;;;;;;;;;;;;;4EAqB4E;AAC5E,MAAM,SAAS,GAAG;IAChB,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,wBAAwB;IAC3B,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,sBAAsB;IACz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,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAC3C;CACnB,CAAC,CAAA"}
@@ -25,6 +25,7 @@ exports.useAccent = useAccent;
25
25
  * from a stable default snapshot so the server render and first client paint agree.
26
26
  */
27
27
  const react_1 = require("react");
28
+ const design_1 = require("@hanzo/design");
28
29
  /** True for a 3- or 6-digit CSS hex color (`#RGB` / `#RRGGBB`). */
29
30
  function isHexColor(v) {
30
31
  return typeof v === 'string' && /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(v.trim());
@@ -82,9 +83,43 @@ function setOrgAccent(theme) {
82
83
  if (next.accent === current.accent)
83
84
  return;
84
85
  current = next.accent ? next : DEFAULT;
86
+ publish(current.accent);
85
87
  for (const l of listeners)
86
88
  l();
87
89
  }
90
+ /**
91
+ * The org's accent as CSS custom properties, so it reaches the whole product
92
+ * rather than the components that happen to call `useAccent()`.
93
+ *
94
+ * An org accent and a person's accent are the SAME adjustment at two scopes, so
95
+ * they are the same two properties — `--primary` and `--accent`, produced by
96
+ * @hanzo/design's own `vars()`. `@hanzo/appearance` writes them for a person and
97
+ * this writes them for an org; nothing here restates what an accent means.
98
+ *
99
+ * PRECEDENCE FALLS OUT OF CSS AND IS NOT COORDINATED IN CODE. This writes a
100
+ * `:root` STYLESHEET; a person's preference is written INLINE on <html>, which
101
+ * outranks any stylesheet. So a person who chose an accent keeps it, an org that
102
+ * sets one gets it for everybody who did not, and neither module has to know the
103
+ * other exists. Writing both inline would have made it a race decided by load
104
+ * order — the org fetch resolving after mount would silently overwrite the
105
+ * person's choice on every reload.
106
+ */
107
+ function publish(accent) {
108
+ if (typeof document === 'undefined')
109
+ return;
110
+ const ID = 'hanzo-org-accent';
111
+ let el = document.getElementById(ID);
112
+ if (!accent) {
113
+ el?.remove();
114
+ return;
115
+ }
116
+ if (!el) {
117
+ el = document.createElement('style');
118
+ el.id = ID;
119
+ document.head.appendChild(el);
120
+ }
121
+ el.textContent = (0, design_1.css)({ accent }, ':root');
122
+ }
88
123
  function subscribe(cb) {
89
124
  listeners.add(cb);
90
125
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"accent.d.ts","sourceRoot":"","sources":["../../src/product/accent.ts"],"names":[],"mappings":"AAqBA,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,2FAA2F;AAC3F,MAAM,MAAM,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhE,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAEhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAInF;AASD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAS/D;AAED,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGxE;AAUD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAKzE;AASD,oGAAoG;AACpG,wBAAgB,SAAS,IAAI,MAAM,CAMlC"}
1
+ {"version":3,"file":"accent.d.ts","sourceRoot":"","sources":["../../src/product/accent.ts"],"names":[],"mappings":"AAuBA,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,2FAA2F;AAC3F,MAAM,MAAM,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhE,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAEhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAInF;AASD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAS/D;AAED,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGxE;AAUD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAMzE;AAuCD,oGAAoG;AACpG,wBAAgB,SAAS,IAAI,MAAM,CAMlC"}
@@ -17,6 +17,7 @@
17
17
  * from a stable default snapshot so the server render and first client paint agree.
18
18
  */
19
19
  import { useSyncExternalStore } from 'react';
20
+ import { css } from '@hanzo/design';
20
21
  /** True for a 3- or 6-digit CSS hex color (`#RGB` / `#RRGGBB`). */
21
22
  export function isHexColor(v) {
22
23
  return typeof v === 'string' && /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(v.trim());
@@ -74,9 +75,43 @@ export function setOrgAccent(theme) {
74
75
  if (next.accent === current.accent)
75
76
  return;
76
77
  current = next.accent ? next : DEFAULT;
78
+ publish(current.accent);
77
79
  for (const l of listeners)
78
80
  l();
79
81
  }
82
+ /**
83
+ * The org's accent as CSS custom properties, so it reaches the whole product
84
+ * rather than the components that happen to call `useAccent()`.
85
+ *
86
+ * An org accent and a person's accent are the SAME adjustment at two scopes, so
87
+ * they are the same two properties — `--primary` and `--accent`, produced by
88
+ * @hanzo/design's own `vars()`. `@hanzo/appearance` writes them for a person and
89
+ * this writes them for an org; nothing here restates what an accent means.
90
+ *
91
+ * PRECEDENCE FALLS OUT OF CSS AND IS NOT COORDINATED IN CODE. This writes a
92
+ * `:root` STYLESHEET; a person's preference is written INLINE on <html>, which
93
+ * outranks any stylesheet. So a person who chose an accent keeps it, an org that
94
+ * sets one gets it for everybody who did not, and neither module has to know the
95
+ * other exists. Writing both inline would have made it a race decided by load
96
+ * order — the org fetch resolving after mount would silently overwrite the
97
+ * person's choice on every reload.
98
+ */
99
+ function publish(accent) {
100
+ if (typeof document === 'undefined')
101
+ return;
102
+ const ID = 'hanzo-org-accent';
103
+ let el = document.getElementById(ID);
104
+ if (!accent) {
105
+ el?.remove();
106
+ return;
107
+ }
108
+ if (!el) {
109
+ el = document.createElement('style');
110
+ el.id = ID;
111
+ document.head.appendChild(el);
112
+ }
113
+ el.textContent = css({ accent }, ':root');
114
+ }
80
115
  function subscribe(cb) {
81
116
  listeners.add(cb);
82
117
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"accent.js","sourceRoot":"","sources":["../../src/product/accent.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAW5C,mEAAmE;AACnE,MAAM,UAAU,UAAU,CAAC,CAA4B;IACrD,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,oCAAoC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAsC;IAClE,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3C,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,EA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AG,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,SAAS,CAAC,EAAc;IAC/B,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACjB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC,CAAA;AACH,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,SAAS;IACvB,OAAO,oBAAoB,CACzB,SAAS,EACT,GAAG,EAAE,CAAC,OAAO,EACb,GAAG,EAAE,CAAC,OAAO,CACd,CAAA;AACH,CAAC"}
package/dist/root.cjs CHANGED
@@ -39,6 +39,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
39
39
  */
40
40
  const gui_1 = require("@hanzo/gui");
41
41
  const telemetry_1 = require("@hanzogui/telemetry");
42
+ const react_1 = require("react");
43
+ const state_1 = require("@hanzo/appearance/state");
42
44
  const gui_config_1 = require("./gui-config.cjs");
43
45
  require("./styles.css");
44
46
  /** A stylesheet that did not reach the document is invisible until someone opens
@@ -62,6 +64,24 @@ const assertStylesheet = () => {
62
64
  const Hanzo = ({ children, theme = 'dark', analytics }) => {
63
65
  if (process.env.NODE_ENV !== 'production')
64
66
  assertStylesheet();
67
+ // A person's stored type size, density and accent, put on the document.
68
+ //
69
+ // Unconditional, unlike `analytics`, and the difference is the whole reason
70
+ // that one is a prop. Analytics starts a conversation with a server the app
71
+ // did not ask for; this reads a preference the PERSON already set on this
72
+ // device and honours it. An app that has to opt in is an app that forgets to,
73
+ // and then the setting silently does nothing on that surface — which is worse
74
+ // than not offering it.
75
+ //
76
+ // Costs nothing when unused: an axis nobody set is absent rather than
77
+ // neutral, so `apply()` removes the property instead of stamping a `1` that
78
+ // would outrank a brand's own scale.
79
+ //
80
+ // This is the MOUNT half only. First paint still wants `bootScript()` in
81
+ // <head>, because no component can run before the document exists.
82
+ (0, react_1.useEffect)(() => {
83
+ (0, state_1.apply)((0, state_1.read)());
84
+ }, []);
65
85
  const tree = ((0, jsx_runtime_1.jsx)(gui_1.GuiProvider, { config: gui_config_1.config, defaultTheme: theme, disableInjectCSS: true, children: children }));
66
86
  // OUTSIDE the gui provider: capture is delegated at the document, so it does
67
87
  // not need to be inside the styled tree, and an app that renders its own
package/dist/root.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type TelemetryConfig } from '@hanzogui/telemetry';
2
- import type { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import './styles.css';
4
4
  export type HanzoProps = {
5
5
  children?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../src/root.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAA;CACtC,CAAA;AAqBD,eAAO,MAAM,KAAK,GAAI,gCAAyC,UAAU,4CAaxE,CAAA;AAED,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../src/root.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjD,OAAO,cAAc,CAAA;AAErB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAA;CACtC,CAAA;AAqBD,eAAO,MAAM,KAAK,GAAI,gCAAyC,UAAU,4CA+BxE,CAAA;AAED,eAAe,KAAK,CAAA"}