@oxyhq/bloom 0.74.5 → 0.76.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.
Files changed (59) hide show
  1. package/lib/commonjs/design-tokens/theme.css +0 -4
  2. package/lib/commonjs/fab/Fab.js +4 -4
  3. package/lib/commonjs/fab/Fab.js.map +1 -1
  4. package/lib/commonjs/fab/Fab.web.js +6 -6
  5. package/lib/commonjs/fab/Fab.web.js.map +1 -1
  6. package/lib/commonjs/theme/adaptive-colors.js +0 -10
  7. package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
  8. package/lib/commonjs/theme/build-theme-from-seed.js +0 -4
  9. package/lib/commonjs/theme/build-theme-from-seed.js.map +1 -1
  10. package/lib/commonjs/theme/build-theme.js +0 -4
  11. package/lib/commonjs/theme/build-theme.js.map +1 -1
  12. package/lib/commonjs/theme/color-policy.js +19 -30
  13. package/lib/commonjs/theme/color-policy.js.map +1 -1
  14. package/lib/commonjs/theme/token-registry.js +1 -1
  15. package/lib/commonjs/theme/token-registry.js.map +1 -1
  16. package/lib/module/design-tokens/theme.css +0 -4
  17. package/lib/module/fab/Fab.js +4 -4
  18. package/lib/module/fab/Fab.js.map +1 -1
  19. package/lib/module/fab/Fab.web.js +6 -6
  20. package/lib/module/fab/Fab.web.js.map +1 -1
  21. package/lib/module/theme/adaptive-colors.js +0 -10
  22. package/lib/module/theme/adaptive-colors.js.map +1 -1
  23. package/lib/module/theme/build-theme-from-seed.js +0 -4
  24. package/lib/module/theme/build-theme-from-seed.js.map +1 -1
  25. package/lib/module/theme/build-theme.js +0 -4
  26. package/lib/module/theme/build-theme.js.map +1 -1
  27. package/lib/module/theme/color-policy.js +19 -30
  28. package/lib/module/theme/color-policy.js.map +1 -1
  29. package/lib/module/theme/token-registry.js +1 -1
  30. package/lib/module/theme/token-registry.js.map +1 -1
  31. package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/theme/build-theme-from-seed.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/theme/build-theme.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/theme/color-policy.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/theme/token-registry.d.ts +1 -1
  36. package/lib/typescript/commonjs/theme/token-registry.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/theme/types.d.ts +0 -9
  38. package/lib/typescript/commonjs/theme/types.d.ts.map +1 -1
  39. package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
  40. package/lib/typescript/module/theme/build-theme-from-seed.d.ts.map +1 -1
  41. package/lib/typescript/module/theme/build-theme.d.ts.map +1 -1
  42. package/lib/typescript/module/theme/color-policy.d.ts.map +1 -1
  43. package/lib/typescript/module/theme/token-registry.d.ts +1 -1
  44. package/lib/typescript/module/theme/token-registry.d.ts.map +1 -1
  45. package/lib/typescript/module/theme/types.d.ts +0 -9
  46. package/lib/typescript/module/theme/types.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/src/__tests__/theme.test.ts +0 -4
  49. package/src/design-tokens/theme.css +0 -4
  50. package/src/fab/Fab.tsx +2 -2
  51. package/src/fab/Fab.web.tsx +2 -2
  52. package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +130 -234
  53. package/src/theme/__tests__/__snapshots__/visual-gallery.test.tsx.snap +104 -208
  54. package/src/theme/adaptive-colors.ts +0 -10
  55. package/src/theme/build-theme-from-seed.ts +0 -4
  56. package/src/theme/build-theme.ts +0 -4
  57. package/src/theme/color-policy.ts +19 -35
  58. package/src/theme/token-registry.ts +0 -4
  59. package/src/theme/types.ts +0 -9
@@ -43,12 +43,6 @@ function getAndroidColors(): ThemeColors | null {
43
43
  secondaryForeground: c(d.onSecondary),
44
44
  tertiary: c(d.tertiary),
45
45
  tertiaryForeground: c(d.onTertiary),
46
- // Adaptive palettes come from the OS, which has no peak-tone accent to
47
- // deepen, so the solid-button member is the accent itself.
48
- secondaryStrong: c(d.secondary),
49
- secondaryStrongForeground: c(d.onSecondary),
50
- tertiaryStrong: c(d.tertiary),
51
- tertiaryStrongForeground: c(d.onTertiary),
52
46
  tint: c(d.primary),
53
47
  icon: c(d.onSurfaceVariant),
54
48
  iconActive: c(d.primary),
@@ -94,10 +88,6 @@ function getIOSColors(): ThemeColors | null {
94
88
  secondaryForeground: '#FFFFFF',
95
89
  tertiary: c(i.systemTeal),
96
90
  tertiaryForeground: '#FFFFFF',
97
- secondaryStrong: c(i.systemPurple),
98
- secondaryStrongForeground: '#FFFFFF',
99
- tertiaryStrong: c(i.systemTeal),
100
- tertiaryStrongForeground: '#FFFFFF',
101
91
  tint: c(i.systemBlue),
102
92
  icon: c(i.secondaryLabel),
103
93
  iconActive: c(i.systemBlue),
@@ -79,10 +79,6 @@ export function buildColorsFromSeed(
79
79
  secondaryForeground: g('secondary-foreground'),
80
80
  tertiary: g('tertiary'),
81
81
  tertiaryForeground: g('tertiary-foreground'),
82
- secondaryStrong: g('secondary-strong'),
83
- secondaryStrongForeground: g('secondary-strong-foreground'),
84
- tertiaryStrong: g('tertiary-strong'),
85
- tertiaryStrongForeground: g('tertiary-strong-foreground'),
86
82
 
87
83
  tint: g('primary'),
88
84
  icon: g('muted-foreground'),
@@ -78,10 +78,6 @@ function buildColorsFromPreset(
78
78
  secondaryForeground: g('secondary-foreground'),
79
79
  tertiary: g('tertiary'),
80
80
  tertiaryForeground: g('tertiary-foreground'),
81
- secondaryStrong: g('secondary-strong'),
82
- secondaryStrongForeground: g('secondary-strong-foreground'),
83
- tertiaryStrong: g('tertiary-strong'),
84
- tertiaryStrongForeground: g('tertiary-strong-foreground'),
85
81
 
86
82
  tint: g('primary'),
87
83
  icon: g('muted-foreground'),
@@ -94,8 +94,14 @@ const noLegibleForeground = (argb: number): boolean =>
94
94
  /** The tone a white-label fill sits at in LIGHT mode. */
95
95
  const LIGHT_FILL_TONE = 45;
96
96
 
97
- /** No dark-mode BRAND fill sits below this: under it a colour goes heavy on black. */
98
- const DARK_FLOOR = 58;
97
+ /** The tone a white-label fill sits at in DARK: the ceiling white text allows. */
98
+ const DARK_FILL_TONE = 49;
99
+
100
+ /**
101
+ * No dark-mode ACCENT sits below this. Some hues peak dark — violet at tone 33 —
102
+ * and rendering one there gives a slab rather than a highlight.
103
+ */
104
+ const DARK_ACCENT_FLOOR = 58;
99
105
 
100
106
  /**
101
107
  * Accent fills sit at their hue's PEAK tone in dark — where the hue is most
@@ -115,18 +121,6 @@ const ACCENT_CHROMA = 80;
115
121
  const TEXT_TONE = { light: 40, dark: 80 } as const;
116
122
  const TEXT_CHROMA = 60;
117
123
 
118
- /**
119
- * The tone a `-strong` accent sits at: deep enough to carry a WHITE label.
120
- *
121
- * `--tertiary` is the vivid accent — a tile, a chip, a block of colour — and it
122
- * sits at its hue's peak tone so a lime reads as lime. A solid BUTTON is a
123
- * different job: it wants the same hue with white on it, which needs tone <= 49.
124
- * One token cannot do both, exactly as `--primary` could not be both the fill
125
- * and the legible text accent. Capping `--tertiary` itself to win the label back
126
- * dulls every other use of it, so the button gets its own member instead.
127
- */
128
- const STRONG_TONE = 49;
129
-
130
124
  /** The `-subtle` tint is mixed from a BRIGHT tone at low alpha, never a dark one at high alpha. */
131
125
  const SUBTLE_SOURCE_TONE = 60;
132
126
  const SUBTLE_ALPHA = { light: 0.13, dark: 0.24 } as const;
@@ -258,19 +252,15 @@ export function buildPolicyTokens(
258
252
  ): PolicyTokens {
259
253
  const seed = Hct.fromInt(argbFromHex(seedHex));
260
254
 
261
- // LIGHT takes the max-chroma palette at a deep tone: on a near-white page the
262
- // fill has to go deep to read calm, and max chroma is what keeps it from going
263
- // pastel there. DARK takes the SEED'S OWN palette its own chroma and its own
264
- // tone, floored so a dark seed still lifts off the ground. At a fixed dark tone
265
- // every mid-tone preset read dull on black, and the ones that looked right were
266
- // exactly those whose seed tone escaped it.
267
- const brandPalette = isDark
268
- ? TonalPalette.fromInt(argbFromHex(seedHex))
269
- : TonalPalette.fromHueAndChroma(seed.hue, 200);
270
- const primary = fillPair(
271
- brandPalette,
272
- isDark ? Math.max(seed.tone, DARK_FLOOR) : LIGHT_FILL_TONE,
273
- );
255
+ // Max chroma at a tone that carries a WHITE label, in both modes.
256
+ //
257
+ // The brand fill is what a compose button, a Follow button, an avatar and the
258
+ // user's own chat bubble paint with, and those carry white text. White needs
259
+ // tone <= 49, so that is the ceiling in dark as much as in light. Letting the
260
+ // dark fill sit at the seed's own tone instead makes it brighter, but every one
261
+ // of those labels turns black, which costs more than the brightness buys.
262
+ const brandPalette = TonalPalette.fromHueAndChroma(seed.hue, 200);
263
+ const primary = fillPair(brandPalette, isDark ? DARK_FILL_TONE : LIGHT_FILL_TONE);
274
264
 
275
265
  const tokens: PolicyTokens = {
276
266
  '--primary': primary.fill,
@@ -321,7 +311,7 @@ export function buildPolicyTokens(
321
311
  // black. The accent chroma cap already keeps these hues out of neon territory,
322
312
  // and the hue itself is the caller's brand rather than ours to move. The
323
313
  // analyzer still runs where it was designed to, inside `color-roles`.
324
- const tone = isDark ? Math.max(peakTone(hue), DARK_FLOOR) : LIGHT_FILL_TONE;
314
+ const tone = isDark ? Math.max(peakTone(hue), DARK_ACCENT_FLOOR) : LIGHT_FILL_TONE;
325
315
  const pair = fillPair(fillPalette, tone);
326
316
  tokens[`--${role}`] = pair.fill;
327
317
  tokens[`--${role}-foreground`] = pair.foreground;
@@ -330,12 +320,6 @@ export function buildPolicyTokens(
330
320
  vividPalette.tone(SUBTLE_SOURCE_TONE),
331
321
  isDark ? SUBTLE_ALPHA.dark : SUBTLE_ALPHA.light,
332
322
  );
333
- // The solid-button member: same hue, deep enough for a white label in both
334
- // modes. In light it lands on the ordinary fill tone, so a button that uses
335
- // it there is identical to one that used the accent.
336
- const strong = fillPair(fillPalette, isDark ? STRONG_TONE : LIGHT_FILL_TONE);
337
- tokens[`--${role}-strong`] = strong.fill;
338
- tokens[`--${role}-strong-foreground`] = strong.foreground;
339
323
  }
340
324
 
341
325
  // Categorical chart ramp: five hues spread evenly from the seed at one tone.
@@ -354,7 +338,7 @@ export function buildPolicyTokens(
354
338
  for (const [role, hex] of Object.entries(STATUS_SEEDS)) {
355
339
  const status = Hct.fromInt(argbFromHex(hex));
356
340
  const palette = TonalPalette.fromHueAndChroma(status.hue, status.chroma);
357
- const pair = fillPair(palette, isDark ? Math.max(status.tone, DARK_FLOOR) : LIGHT_FILL_TONE);
341
+ const pair = fillPair(palette, isDark ? DARK_FILL_TONE : LIGHT_FILL_TONE);
358
342
  tokens[`--${role}`] = pair.fill;
359
343
  tokens[`--${role}-foreground`] = pair.foreground;
360
344
  tokens[`--${role}-text`] = rgb(
@@ -61,12 +61,8 @@ export const CANONICAL_TOKENS = [
61
61
  'primary-subtle',
62
62
  'secondary-text',
63
63
  'secondary-subtle',
64
- 'secondary-strong',
65
- 'secondary-strong-foreground',
66
64
  'tertiary-text',
67
65
  'tertiary-subtle',
68
- 'tertiary-strong',
69
- 'tertiary-strong-foreground',
70
66
 
71
67
  // --- semantic status, themed per mode ---
72
68
  // Replaces four frozen hexes that all FAILED AA under white text (warning at
@@ -25,15 +25,6 @@ export interface ThemeColors {
25
25
  /** The M3 tertiary accent, completing the primary/secondary/tertiary trio. */
26
26
  tertiary: string;
27
27
  tertiaryForeground: string;
28
- /**
29
- * The solid-BUTTON member of each accent: the same hue, deep enough to carry a
30
- * white label. The accent itself sits at its hue's peak tone, where nothing but
31
- * black survives — fine for a tile or a chip, wrong for a FAB.
32
- */
33
- secondaryStrong: string;
34
- secondaryStrongForeground: string;
35
- tertiaryStrong: string;
36
- tertiaryStrongForeground: string;
37
28
 
38
29
  tint: string;
39
30
  icon: string;