@oxyhq/bloom 0.19.1 → 0.21.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 (188) hide show
  1. package/lib/commonjs/benefit-list/index.js +119 -0
  2. package/lib/commonjs/benefit-list/index.js.map +1 -0
  3. package/lib/commonjs/benefit-list/types.js +6 -0
  4. package/lib/commonjs/benefit-list/types.js.map +1 -0
  5. package/lib/commonjs/connection-dots/ConnectionDots.js +112 -0
  6. package/lib/commonjs/connection-dots/ConnectionDots.js.map +1 -0
  7. package/lib/commonjs/connection-dots/ConnectionDots.web.js +116 -0
  8. package/lib/commonjs/connection-dots/ConnectionDots.web.js.map +1 -0
  9. package/lib/commonjs/connection-dots/ConnectionDotsBase.js +55 -0
  10. package/lib/commonjs/connection-dots/ConnectionDotsBase.js.map +1 -0
  11. package/lib/commonjs/connection-dots/index.js +13 -0
  12. package/lib/commonjs/connection-dots/index.js.map +1 -0
  13. package/lib/commonjs/connection-dots/index.web.js +13 -0
  14. package/lib/commonjs/connection-dots/index.web.js.map +1 -0
  15. package/lib/commonjs/connection-dots/types.js +6 -0
  16. package/lib/commonjs/connection-dots/types.js.map +1 -0
  17. package/lib/commonjs/content-panel/index.js +64 -0
  18. package/lib/commonjs/content-panel/index.js.map +1 -0
  19. package/lib/commonjs/content-panel/index.web.js +99 -0
  20. package/lib/commonjs/content-panel/index.web.js.map +1 -0
  21. package/lib/commonjs/design-tokens/color-roles.js +112 -0
  22. package/lib/commonjs/design-tokens/color-roles.js.map +1 -0
  23. package/lib/commonjs/design-tokens/index.js +89 -0
  24. package/lib/commonjs/design-tokens/index.js.map +1 -0
  25. package/lib/commonjs/design-tokens/scales.js +168 -0
  26. package/lib/commonjs/design-tokens/scales.js.map +1 -0
  27. package/lib/commonjs/design-tokens/shadows.js +48 -0
  28. package/lib/commonjs/design-tokens/shadows.js.map +1 -0
  29. package/lib/commonjs/design-tokens/shadows.native.js +53 -0
  30. package/lib/commonjs/design-tokens/shadows.native.js.map +1 -0
  31. package/lib/commonjs/design-tokens/tailwind-preset.js +139 -0
  32. package/lib/commonjs/design-tokens/tailwind-preset.js.map +1 -0
  33. package/lib/commonjs/design-tokens/theme-css.js +98 -0
  34. package/lib/commonjs/design-tokens/theme-css.js.map +1 -0
  35. package/lib/commonjs/index.js +208 -93
  36. package/lib/commonjs/index.js.map +1 -1
  37. package/lib/commonjs/index.web.js +223 -108
  38. package/lib/commonjs/index.web.js.map +1 -1
  39. package/lib/commonjs/text-field/index.js +156 -0
  40. package/lib/commonjs/text-field/index.js.map +1 -1
  41. package/lib/module/benefit-list/index.js +114 -0
  42. package/lib/module/benefit-list/index.js.map +1 -0
  43. package/lib/module/benefit-list/types.js +4 -0
  44. package/lib/module/benefit-list/types.js.map +1 -0
  45. package/lib/module/connection-dots/ConnectionDots.js +107 -0
  46. package/lib/module/connection-dots/ConnectionDots.js.map +1 -0
  47. package/lib/module/connection-dots/ConnectionDots.web.js +111 -0
  48. package/lib/module/connection-dots/ConnectionDots.web.js.map +1 -0
  49. package/lib/module/connection-dots/ConnectionDotsBase.js +50 -0
  50. package/lib/module/connection-dots/ConnectionDotsBase.js.map +1 -0
  51. package/lib/module/connection-dots/index.js +4 -0
  52. package/lib/module/connection-dots/index.js.map +1 -0
  53. package/lib/module/connection-dots/index.web.js +4 -0
  54. package/lib/module/connection-dots/index.web.js.map +1 -0
  55. package/lib/module/connection-dots/types.js +4 -0
  56. package/lib/module/connection-dots/types.js.map +1 -0
  57. package/lib/module/content-panel/index.js +59 -0
  58. package/lib/module/content-panel/index.js.map +1 -0
  59. package/lib/module/content-panel/index.web.js +94 -0
  60. package/lib/module/content-panel/index.web.js.map +1 -0
  61. package/lib/module/design-tokens/color-roles.js +108 -0
  62. package/lib/module/design-tokens/color-roles.js.map +1 -0
  63. package/lib/module/design-tokens/index.js +27 -0
  64. package/lib/module/design-tokens/index.js.map +1 -0
  65. package/lib/module/design-tokens/scales.js +164 -0
  66. package/lib/module/design-tokens/scales.js.map +1 -0
  67. package/lib/module/design-tokens/shadows.js +43 -0
  68. package/lib/module/design-tokens/shadows.js.map +1 -0
  69. package/lib/module/design-tokens/shadows.native.js +48 -0
  70. package/lib/module/design-tokens/shadows.native.js.map +1 -0
  71. package/lib/module/design-tokens/tailwind-preset.js +136 -0
  72. package/lib/module/design-tokens/tailwind-preset.js.map +1 -0
  73. package/lib/module/design-tokens/theme-css.js +94 -0
  74. package/lib/module/design-tokens/theme-css.js.map +1 -0
  75. package/lib/module/index.js +6 -1
  76. package/lib/module/index.js.map +1 -1
  77. package/lib/module/index.web.js +6 -1
  78. package/lib/module/index.web.js.map +1 -1
  79. package/lib/module/text-field/index.js +158 -2
  80. package/lib/module/text-field/index.js.map +1 -1
  81. package/lib/typescript/commonjs/benefit-list/index.d.ts +6 -0
  82. package/lib/typescript/commonjs/benefit-list/index.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/benefit-list/types.d.ts +35 -0
  84. package/lib/typescript/commonjs/benefit-list/types.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/connection-dots/ConnectionDots.d.ts +4 -0
  86. package/lib/typescript/commonjs/connection-dots/ConnectionDots.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/connection-dots/ConnectionDots.web.d.ts +14 -0
  88. package/lib/typescript/commonjs/connection-dots/ConnectionDots.web.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/connection-dots/ConnectionDotsBase.d.ts +18 -0
  90. package/lib/typescript/commonjs/connection-dots/ConnectionDotsBase.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/connection-dots/index.d.ts +3 -0
  92. package/lib/typescript/commonjs/connection-dots/index.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/connection-dots/index.web.d.ts +3 -0
  94. package/lib/typescript/commonjs/connection-dots/index.web.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/connection-dots/types.d.ts +41 -0
  96. package/lib/typescript/commonjs/connection-dots/types.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/content-panel/index.d.ts +54 -0
  98. package/lib/typescript/commonjs/content-panel/index.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/content-panel/index.web.d.ts +59 -0
  100. package/lib/typescript/commonjs/content-panel/index.web.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/design-tokens/color-roles.d.ts +102 -0
  102. package/lib/typescript/commonjs/design-tokens/color-roles.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/design-tokens/index.d.ts +28 -0
  104. package/lib/typescript/commonjs/design-tokens/index.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/design-tokens/scales.d.ts +152 -0
  106. package/lib/typescript/commonjs/design-tokens/scales.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/design-tokens/shadows.d.ts +34 -0
  108. package/lib/typescript/commonjs/design-tokens/shadows.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/design-tokens/shadows.native.d.ts +19 -0
  110. package/lib/typescript/commonjs/design-tokens/shadows.native.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/design-tokens/tailwind-preset.d.ts +59 -0
  112. package/lib/typescript/commonjs/design-tokens/tailwind-preset.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/design-tokens/theme-css.d.ts +39 -0
  114. package/lib/typescript/commonjs/design-tokens/theme-css.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/index.d.ts +6 -0
  116. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/index.web.d.ts +6 -0
  118. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/text-field/index.d.ts +14 -1
  120. package/lib/typescript/commonjs/text-field/index.d.ts.map +1 -1
  121. package/lib/typescript/module/benefit-list/index.d.ts +6 -0
  122. package/lib/typescript/module/benefit-list/index.d.ts.map +1 -0
  123. package/lib/typescript/module/benefit-list/types.d.ts +35 -0
  124. package/lib/typescript/module/benefit-list/types.d.ts.map +1 -0
  125. package/lib/typescript/module/connection-dots/ConnectionDots.d.ts +4 -0
  126. package/lib/typescript/module/connection-dots/ConnectionDots.d.ts.map +1 -0
  127. package/lib/typescript/module/connection-dots/ConnectionDots.web.d.ts +14 -0
  128. package/lib/typescript/module/connection-dots/ConnectionDots.web.d.ts.map +1 -0
  129. package/lib/typescript/module/connection-dots/ConnectionDotsBase.d.ts +18 -0
  130. package/lib/typescript/module/connection-dots/ConnectionDotsBase.d.ts.map +1 -0
  131. package/lib/typescript/module/connection-dots/index.d.ts +3 -0
  132. package/lib/typescript/module/connection-dots/index.d.ts.map +1 -0
  133. package/lib/typescript/module/connection-dots/index.web.d.ts +3 -0
  134. package/lib/typescript/module/connection-dots/index.web.d.ts.map +1 -0
  135. package/lib/typescript/module/connection-dots/types.d.ts +41 -0
  136. package/lib/typescript/module/connection-dots/types.d.ts.map +1 -0
  137. package/lib/typescript/module/content-panel/index.d.ts +54 -0
  138. package/lib/typescript/module/content-panel/index.d.ts.map +1 -0
  139. package/lib/typescript/module/content-panel/index.web.d.ts +59 -0
  140. package/lib/typescript/module/content-panel/index.web.d.ts.map +1 -0
  141. package/lib/typescript/module/design-tokens/color-roles.d.ts +102 -0
  142. package/lib/typescript/module/design-tokens/color-roles.d.ts.map +1 -0
  143. package/lib/typescript/module/design-tokens/index.d.ts +28 -0
  144. package/lib/typescript/module/design-tokens/index.d.ts.map +1 -0
  145. package/lib/typescript/module/design-tokens/scales.d.ts +152 -0
  146. package/lib/typescript/module/design-tokens/scales.d.ts.map +1 -0
  147. package/lib/typescript/module/design-tokens/shadows.d.ts +34 -0
  148. package/lib/typescript/module/design-tokens/shadows.d.ts.map +1 -0
  149. package/lib/typescript/module/design-tokens/shadows.native.d.ts +19 -0
  150. package/lib/typescript/module/design-tokens/shadows.native.d.ts.map +1 -0
  151. package/lib/typescript/module/design-tokens/tailwind-preset.d.ts +59 -0
  152. package/lib/typescript/module/design-tokens/tailwind-preset.d.ts.map +1 -0
  153. package/lib/typescript/module/design-tokens/theme-css.d.ts +39 -0
  154. package/lib/typescript/module/design-tokens/theme-css.d.ts.map +1 -0
  155. package/lib/typescript/module/index.d.ts +6 -0
  156. package/lib/typescript/module/index.d.ts.map +1 -1
  157. package/lib/typescript/module/index.web.d.ts +6 -0
  158. package/lib/typescript/module/index.web.d.ts.map +1 -1
  159. package/lib/typescript/module/text-field/index.d.ts +14 -1
  160. package/lib/typescript/module/text-field/index.d.ts.map +1 -1
  161. package/package.json +66 -1
  162. package/src/__tests__/BenefitList.test.tsx +108 -0
  163. package/src/__tests__/ConnectionDots.test.tsx +86 -0
  164. package/src/__tests__/TextFieldFloatingLabel.test.tsx +93 -0
  165. package/src/__tests__/design-tokens.test.ts +169 -0
  166. package/src/benefit-list/BenefitList.stories.tsx +50 -0
  167. package/src/benefit-list/index.tsx +133 -0
  168. package/src/benefit-list/types.ts +36 -0
  169. package/src/connection-dots/ConnectionDots.stories.tsx +54 -0
  170. package/src/connection-dots/ConnectionDots.tsx +139 -0
  171. package/src/connection-dots/ConnectionDots.web.tsx +122 -0
  172. package/src/connection-dots/ConnectionDotsBase.tsx +62 -0
  173. package/src/connection-dots/index.ts +2 -0
  174. package/src/connection-dots/index.web.ts +2 -0
  175. package/src/connection-dots/types.ts +41 -0
  176. package/src/content-panel/index.tsx +87 -0
  177. package/src/content-panel/index.web.tsx +134 -0
  178. package/src/design-tokens/color-roles.ts +110 -0
  179. package/src/design-tokens/index.ts +45 -0
  180. package/src/design-tokens/scales.ts +134 -0
  181. package/src/design-tokens/shadows.native.ts +44 -0
  182. package/src/design-tokens/shadows.ts +42 -0
  183. package/src/design-tokens/tailwind-preset.ts +139 -0
  184. package/src/design-tokens/theme-css.ts +99 -0
  185. package/src/index.ts +33 -0
  186. package/src/index.web.ts +33 -0
  187. package/src/text-field/TextField.stories.tsx +46 -0
  188. package/src/text-field/index.tsx +212 -1
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.bloomTailwindPreset = void 0;
7
+ var _colorRoles = require("./color-roles.js");
8
+ var _scales = require("./scales.js");
9
+ var _shadows = require("./shadows");
10
+ /**
11
+ * The Bloom Tailwind / NativeWind preset — the SINGLE opt-in that gives every
12
+ * Oxy app the same semantic design-token utility classes.
13
+ *
14
+ * Consumers add it to their Tailwind config:
15
+ *
16
+ * // tailwind.config.js (web Tailwind v3/v4 AND native NativeWind)
17
+ * const { bloomTailwindPreset } = require('@oxyhq/bloom/tailwind-preset');
18
+ * module.exports = {
19
+ * presets: [bloomTailwindPreset],
20
+ * content: [ ...existing globs ],
21
+ * theme: { extend: { ...existing app overrides } },
22
+ * };
23
+ *
24
+ * The preset only EXTENDS `theme` (everything lives under `theme.extend`), so it
25
+ * is purely additive: existing Tailwind built-ins (`p-4`, `rounded-lg`,
26
+ * `text-sm`) and the app's own `var(--x)`-backed color utilities keep working.
27
+ *
28
+ * Cross-platform: NativeWind reads the same `tailwind.config.js`, so the SAME
29
+ * class names (`bg-fill`, `text-text-tertiary`, `p-space-8`, `rounded-radius-20`,
30
+ * `text-body`, `font-body`, `shadow-s`) resolve on web (Tailwind → CSS) and
31
+ * native (NativeWind → react-native-css). Color roles are `var(--x)` references
32
+ * that Bloom's `BloomThemeProvider` populates at runtime on both platforms.
33
+ *
34
+ * Type: returned as a `TailwindPreset` (a structural subset of Tailwind's
35
+ * `Config`) so Bloom does not need to depend on `tailwindcss` types.
36
+ */
37
+
38
+ /** A Tailwind `fontSize` value: `[size, { lineHeight }]`. */
39
+
40
+ /** A Tailwind `fontFamily` value: `[family, { fontWeight }]`. */
41
+
42
+ const px = n => `${n}px`;
43
+
44
+ /** `{ 'space-8': 8 }` → `{ 'space-8': '8px' }`. */
45
+ function toPxMap(scale) {
46
+ const out = {};
47
+ for (const [key, value] of Object.entries(scale)) {
48
+ // 9999 (radius-max) and large values are still valid px; pill shapes clamp.
49
+ out[key] = px(value);
50
+ }
51
+ return out;
52
+ }
53
+
54
+ /** Build the `fontSize` extension: `text-<role>` → `[size, { lineHeight }]`. */
55
+ function buildFontSize() {
56
+ const out = {};
57
+ for (const name of Object.keys(_scales.TYPOGRAPHY)) {
58
+ const role = _scales.TYPOGRAPHY[name];
59
+ out[name] = [px(role.size), {
60
+ lineHeight: px(role.lineHeight)
61
+ }];
62
+ }
63
+ return out;
64
+ }
65
+
66
+ /** Build the `fontFamily` extension: `font-<role>` → `[family, { fontWeight }]`. */
67
+ function buildFontFamily() {
68
+ const out = {};
69
+ for (const name of Object.keys(_scales.TYPOGRAPHY)) {
70
+ const role = _scales.TYPOGRAPHY[name];
71
+ out[name] = [_scales.FONT_FAMILY_VARS[role.family], {
72
+ fontWeight: role.weight
73
+ }];
74
+ }
75
+ // Also expose the raw Bloom families directly: `font-bloom-sans`, etc.
76
+ out['bloom-sans'] = [_scales.FONT_FAMILY_VARS.sans, {
77
+ fontWeight: '400'
78
+ }];
79
+ out['bloom-display'] = [_scales.FONT_FAMILY_VARS.display, {
80
+ fontWeight: '700'
81
+ }];
82
+ out['bloom-mono'] = [_scales.FONT_FAMILY_VARS.mono, {
83
+ fontWeight: '400'
84
+ }];
85
+ return out;
86
+ }
87
+ const SPACING_PX = toPxMap(_scales.SPACING);
88
+ const RADIUS_PX = toPxMap({
89
+ ..._scales.RADIUS
90
+ });
91
+ const BORDER_WIDTH_PX = toPxMap(_scales.BORDER_WIDTH);
92
+
93
+ /**
94
+ * Color roles are exposed via `colors` (so they reach `bg-*`, `text-*`,
95
+ * `border-*`, `ring-*`, `divide-*`, `fill-*` …) AND via the dedicated
96
+ * `backgroundColor` / `textColor` / `borderColor` maps (so the namespaced roles
97
+ * land on exactly the intended utility families even where the role name would
98
+ * otherwise be ambiguous). All values are `var(--canonical)` references.
99
+ */
100
+ const COLOR_ROLES = {
101
+ ..._colorRoles.FILL_ROLES,
102
+ ..._colorRoles.TEXT_ROLES,
103
+ ..._colorRoles.BORDER_ROLES
104
+ };
105
+
106
+ /**
107
+ * The Bloom Tailwind/NativeWind preset. Frozen so accidental mutation by a
108
+ * consumer's config merge cannot corrupt the shared vocabulary.
109
+ */
110
+ const bloomTailwindPreset = exports.bloomTailwindPreset = Object.freeze({
111
+ theme: {
112
+ extend: {
113
+ // Generic color bucket — feeds every color utility family.
114
+ colors: {
115
+ ...COLOR_ROLES
116
+ },
117
+ // Targeted buckets so the namespaced roles resolve on the right utility.
118
+ backgroundColor: {
119
+ ..._colorRoles.FILL_ROLES
120
+ },
121
+ textColor: {
122
+ ..._colorRoles.TEXT_ROLES
123
+ },
124
+ borderColor: {
125
+ ..._colorRoles.BORDER_ROLES
126
+ },
127
+ spacing: SPACING_PX,
128
+ borderRadius: RADIUS_PX,
129
+ borderWidth: BORDER_WIDTH_PX,
130
+ fontSize: buildFontSize(),
131
+ fontFamily: buildFontFamily(),
132
+ boxShadow: {
133
+ s: _shadows.SHADOW_BOX.s,
134
+ m: _shadows.SHADOW_BOX.m
135
+ }
136
+ }
137
+ }
138
+ });
139
+ //# sourceMappingURL=tailwind-preset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_colorRoles","require","_scales","_shadows","px","n","toPxMap","scale","out","key","value","Object","entries","buildFontSize","name","keys","TYPOGRAPHY","role","size","lineHeight","buildFontFamily","FONT_FAMILY_VARS","family","fontWeight","weight","sans","display","mono","SPACING_PX","SPACING","RADIUS_PX","RADIUS","BORDER_WIDTH_PX","BORDER_WIDTH","COLOR_ROLES","FILL_ROLES","TEXT_ROLES","BORDER_ROLES","bloomTailwindPreset","exports","freeze","theme","extend","colors","backgroundColor","textColor","borderColor","spacing","borderRadius","borderWidth","fontSize","fontFamily","boxShadow","s","SHADOW_BOX","m"],"sourceRoot":"../../../src","sources":["design-tokens/tailwind-preset.ts"],"mappings":";;;;;;AA4BA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,IAAAE,QAAA,GAAAF,OAAA;AArCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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@@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.bloomThemeBlock = bloomThemeBlock;
7
+ exports.bloomThemeCss = bloomThemeCss;
8
+ var _colorRoles = require("./color-roles.js");
9
+ var _scales = require("./scales.js");
10
+ var _shadows = require("./shadows");
11
+ /**
12
+ * Tailwind v4 `@theme` block generator for the Oxy Unified Design Language.
13
+ *
14
+ * Tailwind v4 web apps (auth, console, website) configure their design tokens in
15
+ * CSS via `@theme { --color-X: var(--X); … }` rather than a JS preset. This
16
+ * module produces the exact `@theme` body that mirrors `bloomTailwindPreset`, so
17
+ * a v4 app gets the SAME semantic utilities (`bg-fill`, `text-text-tertiary`,
18
+ * `p-space-8`, `rounded-radius-20`, `text-body`, `font-body`, `shadow-s`) as the
19
+ * NativeWind/Tailwind-v3 apps that consume the JS preset.
20
+ *
21
+ * Each color role is emitted as a `--color-<role>: var(--canonical)` alias.
22
+ * Per Bloom's web CSS-var contract, the canonical `--x` token already resolves
23
+ * to a full `rgb(...)` color at runtime, so the alias is a direct `var(--x)`
24
+ * reference — NEVER `hsl(var(--x))`.
25
+ *
26
+ * Usage (web Tailwind v4, in the app's global stylesheet):
27
+ *
28
+ * import { bloomThemeCss } from '@oxyhq/bloom/design-tokens';
29
+ * // build-time: write `@theme { ${bloomThemeCss()} }` into global.css, OR
30
+ * // paste the generated block once (see docs/design-tokens.md).
31
+ *
32
+ * A consumer that prefers a static stylesheet can copy the output of
33
+ * `bloomThemeCss()` directly into their `@theme { … }` — the values are stable.
34
+ */
35
+
36
+ /**
37
+ * Produce the BODY of a Tailwind v4 `@theme` block (no surrounding braces) that
38
+ * registers the full Bloom semantic vocabulary.
39
+ *
40
+ * - Colors → `--color-<role>: var(--canonical);`
41
+ * - Spacing → `--spacing-<key>: <px>;`
42
+ * - Radius → `--radius-<key>: <px>;`
43
+ * - Type → `--text-<role>: <size>; --text-<role>--line-height: <lh>;`
44
+ * `--font-<role>: var(--bloom-font-*);` (+ weight via utility doc)
45
+ * - Shadow → `--shadow-<s|m>: <box-shadow>;`
46
+ */
47
+ function bloomThemeCss() {
48
+ const lines = [];
49
+
50
+ // Color roles.
51
+ for (const [role, value] of Object.entries({
52
+ ..._colorRoles.FILL_ROLES,
53
+ ..._colorRoles.TEXT_ROLES,
54
+ ..._colorRoles.BORDER_ROLES
55
+ })) {
56
+ lines.push(` --color-${role}: ${value};`);
57
+ }
58
+
59
+ // Spacing.
60
+ for (const [key, value] of Object.entries(_scales.SPACING)) {
61
+ lines.push(` --spacing-${key}: ${value}px;`);
62
+ }
63
+
64
+ // Radius.
65
+ for (const [key, value] of Object.entries(_scales.RADIUS)) {
66
+ lines.push(` --radius-${key}: ${value}px;`);
67
+ }
68
+
69
+ // Hairline border width.
70
+ for (const [key, value] of Object.entries(_scales.BORDER_WIDTH)) {
71
+ lines.push(` --border-width-${key}: ${value}px;`);
72
+ }
73
+
74
+ // Typography: size + line-height + family per role.
75
+ for (const name of Object.keys(_scales.TYPOGRAPHY)) {
76
+ const role = _scales.TYPOGRAPHY[name];
77
+ lines.push(` --text-${name}: ${role.size}px;`);
78
+ lines.push(` --text-${name}--line-height: ${role.lineHeight}px;`);
79
+ lines.push(` --text-${name}--font-weight: ${role.weight};`);
80
+ lines.push(` --font-${name}: ${_scales.FONT_FAMILY_VARS[role.family]};`);
81
+ }
82
+
83
+ // Bloom raw families.
84
+ lines.push(` --font-bloom-sans: ${_scales.FONT_FAMILY_VARS.sans};`);
85
+ lines.push(` --font-bloom-display: ${_scales.FONT_FAMILY_VARS.display};`);
86
+ lines.push(` --font-bloom-mono: ${_scales.FONT_FAMILY_VARS.mono};`);
87
+
88
+ // Shadows.
89
+ lines.push(` --shadow-s: ${_shadows.SHADOW_BOX.s};`);
90
+ lines.push(` --shadow-m: ${_shadows.SHADOW_BOX.m};`);
91
+ return lines.join('\n');
92
+ }
93
+
94
+ /** The full `@theme { … }` block, ready to inject into a v4 stylesheet. */
95
+ function bloomThemeBlock() {
96
+ return `@theme {\n${bloomThemeCss()}\n}`;
97
+ }
98
+ //# sourceMappingURL=theme-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_colorRoles","require","_scales","_shadows","bloomThemeCss","lines","role","value","Object","entries","FILL_ROLES","TEXT_ROLES","BORDER_ROLES","push","key","SPACING","RADIUS","BORDER_WIDTH","name","keys","TYPOGRAPHY","size","lineHeight","weight","FONT_FAMILY_VARS","family","sans","display","mono","SHADOW_BOX","s","m","join","bloomThemeBlock"],"sourceRoot":"../../../src","sources":["design-tokens/theme-css.ts"],"mappings":";;;;;;;AAyBA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,IAAAE,QAAA,GAAAF,OAAA;AAlCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,aAAaA,CAAA,EAAW;EACtC,MAAMC,KAAe,GAAG,EAAE;;EAE1B;EACA,KAAK,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAAC;IACzC,GAAGC,sBAAU;IACb,GAAGC,sBAAU;IACb,GAAGC;EACL,CAAC,CAAC,EAAE;IACFP,KAAK,CAACQ,IAAI,CAAC,aAAaP,IAAI,KAAKC,KAAK,GAAG,CAAC;EAC5C;;EAEA;EACA,KAAK,MAAM,CAACO,GAAG,EAAEP,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACM,eAAO,CAAC,EAAE;IAClDV,KAAK,CAACQ,IAAI,CAAC,eAAeC,GAAG,KAAKP,KAAK,KAAK,CAAC;EAC/C;;EAEA;EACA,KAAK,MAAM,CAACO,GAAG,EAAEP,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACO,cAAM,CAAC,EAAE;IACjDX,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