@oxyhq/bloom 0.8.4 → 0.8.6

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 (31) hide show
  1. package/lib/commonjs/theme/color-scope/index.web.js +6 -7
  2. package/lib/commonjs/theme/color-scope/index.web.js.map +1 -1
  3. package/lib/commonjs/theme/color-scope/style-builder.js +18 -6
  4. package/lib/commonjs/theme/color-scope/style-builder.js.map +1 -1
  5. package/lib/commonjs/theme/native-root-vars.js +1 -2
  6. package/lib/commonjs/theme/native-root-vars.js.map +1 -1
  7. package/lib/commonjs/theme/native-root-vars.native.js +5 -5
  8. package/lib/module/theme/color-scope/index.web.js +6 -7
  9. package/lib/module/theme/color-scope/index.web.js.map +1 -1
  10. package/lib/module/theme/color-scope/style-builder.js +19 -7
  11. package/lib/module/theme/color-scope/style-builder.js.map +1 -1
  12. package/lib/module/theme/native-root-vars.js +1 -2
  13. package/lib/module/theme/native-root-vars.js.map +1 -1
  14. package/lib/module/theme/native-root-vars.native.js +5 -5
  15. package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts.map +1 -1
  16. package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts +7 -5
  17. package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts.map +1 -1
  18. package/lib/typescript/commonjs/theme/native-root-vars.d.ts +1 -2
  19. package/lib/typescript/commonjs/theme/native-root-vars.d.ts.map +1 -1
  20. package/lib/typescript/module/theme/color-scope/index.web.d.ts.map +1 -1
  21. package/lib/typescript/module/theme/color-scope/style-builder.d.ts +7 -5
  22. package/lib/typescript/module/theme/color-scope/style-builder.d.ts.map +1 -1
  23. package/lib/typescript/module/theme/native-root-vars.d.ts +1 -2
  24. package/lib/typescript/module/theme/native-root-vars.d.ts.map +1 -1
  25. package/package.json +2 -1
  26. package/src/__tests__/BloomColorScope.test.tsx +12 -4
  27. package/src/react-native-css.d.ts +12 -13
  28. package/src/theme/color-scope/index.web.tsx +6 -7
  29. package/src/theme/color-scope/style-builder.ts +19 -7
  30. package/src/theme/native-root-vars.native.ts +5 -5
  31. package/src/theme/native-root-vars.ts +1 -2
@@ -8,17 +8,16 @@ exports.useColorScopeStyle = useColorScopeStyle;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _BloomThemeProvider = require("../BloomThemeProvider.js");
10
10
  var _buildTheme = require("../build-theme.js");
11
- var _tokenRegistry = require("../token-registry.js");
11
+ var _styleBuilder = require("./style-builder.js");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
14
  /**
15
- * `getResolvedTokens` returns every canonical token already resolved to an sRGB
16
- * `rgb(...)` string the SAME pipeline the document-root web writer and the
17
- * native writer use. Scoped onto an element's inline `style`, Tailwind v4's
18
- * compiled utilities read these as `var(--x)` directly, so each base token is a
19
- * full CSS color with no per-value wrapping needed.
15
+ * `buildScopeVars` returns every canonical token already resolved to an sRGB
16
+ * `rgb(...)` string, plus the `--color-*` aliases consumed by Tailwind v4
17
+ * utilities. Scoped onto an element's inline `style`, profile-level NativeWind
18
+ * classes resolve against the subtree preset instead of the document root.
20
19
  */function buildWebScopeVars(colorPreset, mode) {
21
- return (0, _tokenRegistry.getResolvedTokens)(colorPreset, mode);
20
+ return (0, _styleBuilder.buildScopeVars)(colorPreset, mode);
22
21
  }
23
22
 
24
23
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_BloomThemeProvider","_buildTheme","_tokenRegistry","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","buildWebScopeVars","colorPreset","mode","getResolvedTokens","BloomColorScope","asChild","style","children","parent","useContext","BloomThemeContext","Error","jsx","Fragment","resolvedMode","theme","contextValue","useMemo","buildTheme","varsStyle","content","child","Children","only","isValidElement","childStyle","props","mergedStyle","cloneElement","Provider","value","useColorScopeStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/index.web.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AAAsD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,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AW,EAAEa,YAAY,CAAC,EAClD,CAACb,WAAW,EAAEa,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_BloomThemeProvider","_buildTheme","_styleBuilder","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","buildWebScopeVars","colorPreset","mode","buildScopeVars","BloomColorScope","asChild","style","children","parent","useContext","BloomThemeContext","Error","jsx","Fragment","resolvedMode","theme","contextValue","useMemo","buildTheme","varsStyle","content","child","Children","only","isValidElement","childStyle","props","mergedStyle","cloneElement","Provider","value","useColorScopeStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/index.web.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAAiD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAA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CAAC;EAClF;EACA,MAAMG,YAAY,GAAGN,MAAM,CAACO,KAAK,CAACb,IAAI;EACtC,OAAO,IAAAe,cAAO,EACZ,MAAMjB,iBAAiB,CAACC,WAAW,EAAEa,YAAY,CAAC,EAClD,CAACb,WAAW,EAAEa,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
@@ -20,14 +20,26 @@ const getNativeWindVars = (0, _lazyRequire.lazyRequire)('nativewind');
20
20
 
21
21
  /**
22
22
  * Build the CSS custom-property map for a preset, ready to be applied to a
23
- * subtree. Every token is resolved to an sRGB `rgb(...)` string via
24
- * `getResolvedTokens` — the single canonical token pipeline shared by web and
25
- * native — so Tailwind v4 `@theme` utilities (e.g. `bg-background`) and
26
- * `color-mix`-based alpha utilities (`bg-primary/10`) both resolve against the
27
- * same color values. Keys retain the leading `--`.
23
+ * subtree. Every canonical `--x` token is resolved to an sRGB `rgb(...)` string
24
+ * via `getResolvedTokens` — the single token pipeline shared by web and native.
25
+ *
26
+ * The returned map also includes Tailwind v4 `--color-x` aliases generated from
27
+ * those same canonical values. Scoped aliases are required on web because
28
+ * inherited custom properties like `--color-primary: var(--primary)` compute at
29
+ * the document root and would otherwise keep pointing at the app-wide preset.
28
30
  */
29
31
  function buildScopeVars(colorPreset, mode) {
30
- return (0, _tokenRegistry.getResolvedTokens)(colorPreset, mode);
32
+ const tokens = (0, _tokenRegistry.getResolvedTokens)(colorPreset, mode);
33
+ const vars = {
34
+ ...tokens
35
+ };
36
+ for (const token of _tokenRegistry.CANONICAL_TOKENS) {
37
+ const value = tokens[`--${token}`];
38
+ if (value !== undefined) {
39
+ vars[`--color-${token}`] = value;
40
+ }
41
+ }
42
+ return vars;
31
43
  }
32
44
 
33
45
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_tokenRegistry","_lazyRequire","getNativeWindVars","lazyRequire","buildScopeVars","colorPreset","mode","getResolvedTokens","getVariableContextProvider","Platform","OS","module","VariableContextProvider","buildNativePresetStyle","undefined","vars"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMG,iBAAiB,GAAG,IAAAC,wBAAW,EAAuB,YAAY,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,OAAO,IAAAC,gCAAiB,EAACF,WAAW,EAAEC,IAAI,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,0BAA0BA,CAAA,EAA4C;EACpF,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EACtC,MAAMC,MAAM,GAAGT,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACS,MAAM,IAAI,OAAOA,MAAM,CAACC,uBAAuB,KAAK,UAAU,EAAE,OAAO,IAAI;EAChF,OAAOD,MAAM,CAACC,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpCR,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAIG,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAOI,SAAS;EAC3C,MAAMH,MAAM,GAAGT,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACS,MAAM,IAAI,OAAOA,MAAM,CAACI,IAAI,KAAK,UAAU,EAAE,OAAOD,SAAS;EAClE,OAAOH,MAAM,CAACI,IAAI,CAACX,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_tokenRegistry","_lazyRequire","getNativeWindVars","lazyRequire","buildScopeVars","colorPreset","mode","tokens","getResolvedTokens","vars","token","CANONICAL_TOKENS","value","undefined","getVariableContextProvider","Platform","OS","module","VariableContextProvider","buildNativePresetStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMG,iBAAiB,GAAG,IAAAC,wBAAW,EAAuB,YAAY,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,MAAMC,MAAM,GAAG,IAAAC,gCAAiB,EAACH,WAAW,EAAEC,IAAI,CAAC;EACnD,MAAMG,IAA4B,GAAG;IAAE,GAAGF;EAAO,CAAC;EAElD,KAAK,MAAMG,KAAK,IAAIC,+BAAgB,EAAE;IACpC,MAAMC,KAAK,GAAGL,MAAM,CAAC,KAAKG,KAAK,EAAE,CAAC;IAClC,IAAIE,KAAK,KAAKC,SAAS,EAAE;MACvBJ,IAAI,CAAC,WAAWC,KAAK,EAAE,CAAC,GAAGE,KAAK;IAClC;EACF;EAEA,OAAOH,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,0BAA0BA,CAAA,EAA4C;EACpF,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EACtC,MAAMC,MAAM,GAAGf,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACe,MAAM,IAAI,OAAOA,MAAM,CAACC,uBAAuB,KAAK,UAAU,EAAE,OAAO,IAAI;EAChF,OAAOD,MAAM,CAACC,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpCd,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAIS,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAOH,SAAS;EAC3C,MAAMI,MAAM,GAAGf,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACe,MAAM,IAAI,OAAOA,MAAM,CAACR,IAAI,KAAK,UAAU,EAAE,OAAOI,SAAS;EAClE,OAAOI,MAAM,CAACR,IAAI,CAACL,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
@@ -15,8 +15,7 @@ exports.applyNativeRootVars = applyNativeRootVars;
15
15
  * `exports` `import`/`require` conditions to `lib/.../native-root-vars.js`.
16
16
  *
17
17
  * It deliberately does NOT import `react-native-css/native-internal`. That subpath
18
- * is native-only: it has no web build, and react-native-css is not even a Bloom
19
- * dependency. Statically importing it from a file a web bundler resolves breaks
18
+ * is native-only. Statically importing it from a file a web bundler resolves breaks
20
19
  * module resolution outright (the original report: `Rolldown failed to resolve
21
20
  * import "react-native-css/native-internal" from .../native-root-vars.js`).
22
21
  * Importing it from a file a consumer's `tsc` resolves breaks type-check (TS2307).
@@ -1 +1 @@
1
- {"version":3,"names":["applyNativeRootVars","_colorPreset","_mode"],"sourceRoot":"../../../src","sources":["theme/native-root-vars.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAACC,YAA0B,EAAEC,KAAuB,EAAQ;EAC7F;EACA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["applyNativeRootVars","_colorPreset","_mode"],"sourceRoot":"../../../src","sources":["theme/native-root-vars.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAACC,YAA0B,EAAEC,KAAuB,EAAQ;EAC7F;EACA;AAAA","ignoreList":[]}
@@ -17,11 +17,11 @@ var _tokenRegistry = require("./token-registry.js");
17
17
  // `node_modules/@oxyhq/bloom/src/**`, and TypeScript does NOT auto-pick-up
18
18
  // ambient `.d.ts` files that live under `node_modules`, so
19
19
  // `react-native-css/native-internal` is unresolved (TS2307) unless the reference
20
- // travels with the source. react-native-css is intentionally NOT a Bloom
21
- // dependency it arrives transitively via a host's NativeWind 5 install, or is
22
- // absent entirely for NativeWind 4 consumers so the ambient declaration is the
23
- // only thing that can type this import, and it MUST reach the consumer. The
24
- // directive ships raw in `src/` (Bloom publishes `files: ["src", "lib"]`).
20
+ // travels with the source. Bloom now declares react-native-css directly because
21
+ // this native source imports it; the ambient declaration still travels with
22
+ // `src/` so consumer TypeScript programs that read Bloom source see the exact
23
+ // subpath shape. The directive ships raw in `src/` (Bloom publishes
24
+ // `files: ["src", "lib"]`).
25
25
 
26
26
  /**
27
27
  * Publish the active color preset's CSS custom properties into react-native-css's
@@ -3,18 +3,17 @@
3
3
  import React, { Children, cloneElement, isValidElement, useContext, useMemo } from 'react';
4
4
  import { BloomThemeContext } from "../BloomThemeProvider.js";
5
5
  import { buildTheme } from "../build-theme.js";
6
- import { getResolvedTokens } from "../token-registry.js";
6
+ import { buildScopeVars } from "./style-builder.js";
7
7
 
8
8
  /**
9
- * `getResolvedTokens` returns every canonical token already resolved to an sRGB
10
- * `rgb(...)` string the SAME pipeline the document-root web writer and the
11
- * native writer use. Scoped onto an element's inline `style`, Tailwind v4's
12
- * compiled utilities read these as `var(--x)` directly, so each base token is a
13
- * full CSS color with no per-value wrapping needed.
9
+ * `buildScopeVars` returns every canonical token already resolved to an sRGB
10
+ * `rgb(...)` string, plus the `--color-*` aliases consumed by Tailwind v4
11
+ * utilities. Scoped onto an element's inline `style`, profile-level NativeWind
12
+ * classes resolve against the subtree preset instead of the document root.
14
13
  */
15
14
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
16
15
  function buildWebScopeVars(colorPreset, mode) {
17
- return getResolvedTokens(colorPreset, mode);
16
+ return buildScopeVars(colorPreset, mode);
18
17
  }
19
18
 
20
19
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["React","Children","cloneElement","isValidElement","useContext","useMemo","BloomThemeContext","buildTheme","getResolvedTokens","Fragment","_Fragment","jsx","_jsx","buildWebScopeVars","colorPreset","mode","BloomColorScope","asChild","style","children","parent","Error","resolvedMode","theme","contextValue","varsStyle","content","child","only","childStyle","props","mergedStyle","Provider","value","useColorScopeStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/index.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,YAAY,EAAEC,cAAc,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAE1F,SAASC,iBAAiB,QAAqC,0BAAuB;AACtF,SAASC,UAAU,QAAQ,mBAAgB;AAE3C,SAASC,iBAAiB,QAAQ,sBAAmB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAOA,SAASC,iBAAiBA,CACxBC,WAAyB,EACzBC,IAAsB,EACD;EACrB,OAAOP,iBAAiB,CAACM,WAAW,EAAEC,IAAI,CAAC;AAC7C;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,SAASC,eAAeA,CAAC;EAC9BF,WAAW;EACXG,OAAO,GAAG,KAAK;EACfC,KAAK;EACLC;AACoB,CAAC,EAAE;EACvB,MAAMC,MAAM,GAAGhB,UAAU,CAACE,iBAAiB,CAAC;EAC5C,IAAI,CAACc,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,4DAA4D,CAAC;EAC/E;EAEA,IAA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IAACC,KAAK,EAAET,YAAa;IAAAL,QAAA,EAAEO;EAAO,CAA6B,CAAC;AAChG;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASQ,kBAAkBA,CAACpB,WAAyB,EAAuB;EACjF,MAAMM,MAAM,GAAGhB,UAAU,CAACE,iBAAiB,CAAC;EAC5C,IAAI,CAACc,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,+DAA+D,CAAC;EAClF;EACA,MAAMC,YAAY,GAAGF,MAAM,CAACG,KAAK,CAACR,IAAI;EACtC,OAAOV,OAAO,CACZ,MAAMQ,iBAAiB,CAACC,WAAW,EAAEQ,YAAY,CAAC,EAClD,CAACR,WAAW,EAAEQ,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["React","Children","cloneElement","isValidElement","useContext","useMemo","BloomThemeContext","buildTheme","buildScopeVars","Fragment","_Fragment","jsx","_jsx","buildWebScopeVars","colorPreset","mode","BloomColorScope","asChild","style","children","parent","Error","resolvedMode","theme","contextValue","varsStyle","content","child","only","childStyle","props","mergedStyle","Provider","value","useColorScopeStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/index.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,YAAY,EAAEC,cAAc,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAE1F,SAASC,iBAAiB,QAAqC,0BAAuB;AACtF,SAASC,UAAU,QAAQ,mBAAgB;AAE3C,SAASC,cAAc,QAAQ,oBAAiB;;AAEhD;AACA;AACA;AACA;AACA;AACA;AALA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAMA,SAASC,iBAAiBA,CACxBC,WAAyB,EACzBC,IAAsB,EACD;EACrB,OAAOP,cAAc,CAACM,WAAW,EAAEC,IAAI,CAAC;AAC1C;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,SAASC,eAAeA,CAAC;EAC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MAAMA,WAAgC,GAAG;MAAE,GAAGN,SAAS;MAAE,GAAGP;IAAM,CAAC;IACnEQ,OAAO,gBAAGd,IAAA;MAAKM,KAAK,EAAEa,WAAY;MAAAZ,QAAA,EAAEA;IAAQ,CAAM,CAAC;EACrD;EAEA,oBAAOP,IAAA,CAACN,iBAAiB,CAAC0B,QAAQ;IAACC,KAAK,EAAET,YAAa;IAAAL,QAAA,EAAEO;EAAO,CAA6B,CAAC;AAChG;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASQ,kBAAkBA,CAACpB,WAAyB,EAAuB;EACjF,MAAMM,MAAM,GAAGhB,UAAU,CAACE,iBAAiB,CAAC;EAC5C,IAAI,CAACc,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,+DAA+D,CAAC;EAClF;EACA,MAAMC,YAAY,GAAGF,MAAM,CAACG,KAAK,CAACR,IAAI;EACtC,OAAOV,OAAO,CACZ,MAAMQ,iBAAiB,CAACC,WAAW,EAAEQ,YAAY,CAAC,EAClD,CAACR,WAAW,EAAEQ,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { Platform } from 'react-native';
4
- import { getResolvedTokens } from "../token-registry.js";
4
+ import { CANONICAL_TOKENS, getResolvedTokens } from "../token-registry.js";
5
5
  import { lazyRequire } from "../../utils/lazy-require.js";
6
6
 
7
7
  /**
@@ -15,14 +15,26 @@ const getNativeWindVars = lazyRequire('nativewind');
15
15
 
16
16
  /**
17
17
  * Build the CSS custom-property map for a preset, ready to be applied to a
18
- * subtree. Every token is resolved to an sRGB `rgb(...)` string via
19
- * `getResolvedTokens` — the single canonical token pipeline shared by web and
20
- * native — so Tailwind v4 `@theme` utilities (e.g. `bg-background`) and
21
- * `color-mix`-based alpha utilities (`bg-primary/10`) both resolve against the
22
- * same color values. Keys retain the leading `--`.
18
+ * subtree. Every canonical `--x` token is resolved to an sRGB `rgb(...)` string
19
+ * via `getResolvedTokens` — the single token pipeline shared by web and native.
20
+ *
21
+ * The returned map also includes Tailwind v4 `--color-x` aliases generated from
22
+ * those same canonical values. Scoped aliases are required on web because
23
+ * inherited custom properties like `--color-primary: var(--primary)` compute at
24
+ * the document root and would otherwise keep pointing at the app-wide preset.
23
25
  */
24
26
  export function buildScopeVars(colorPreset, mode) {
25
- return getResolvedTokens(colorPreset, mode);
27
+ const tokens = getResolvedTokens(colorPreset, mode);
28
+ const vars = {
29
+ ...tokens
30
+ };
31
+ for (const token of CANONICAL_TOKENS) {
32
+ const value = tokens[`--${token}`];
33
+ if (value !== undefined) {
34
+ vars[`--color-${token}`] = value;
35
+ }
36
+ }
37
+ return vars;
26
38
  }
27
39
 
28
40
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","getResolvedTokens","lazyRequire","getNativeWindVars","buildScopeVars","colorPreset","mode","getVariableContextProvider","OS","module","VariableContextProvider","buildNativePresetStyle","undefined","vars"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAwC,cAAc;AAEvE,SAASC,iBAAiB,QAAQ,sBAAmB;AAErD,SAASC,WAAW,QAAQ,6BAA0B;;AAEtD;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMC,iBAAiB,GAAGD,WAAW,CAAuB,YAAY,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,OAAOL,iBAAiB,CAACI,WAAW,EAAEC,IAAI,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CAAA,EAA4C;EACpF,IAAIP,QAAQ,CAACQ,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EACtC,MAAMC,MAAM,GAAGN,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACM,MAAM,IAAI,OAAOA,MAAM,CAACC,uBAAuB,KAAK,UAAU,EAAE,OAAO,IAAI;EAChF,OAAOD,MAAM,CAACC,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCN,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAIN,QAAQ,CAACQ,EAAE,KAAK,KAAK,EAAE,OAAOI,SAAS;EAC3C,MAAMH,MAAM,GAAGN,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACM,MAAM,IAAI,OAAOA,MAAM,CAACI,IAAI,KAAK,UAAU,EAAE,OAAOD,SAAS;EAClE,OAAOH,MAAM,CAACI,IAAI,CAACT,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
1
+ {"version":3,"names":["Platform","CANONICAL_TOKENS","getResolvedTokens","lazyRequire","getNativeWindVars","buildScopeVars","colorPreset","mode","tokens","vars","token","value","undefined","getVariableContextProvider","OS","module","VariableContextProvider","buildNativePresetStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAwC,cAAc;AAEvE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,sBAAmB;AAEvE,SAASC,WAAW,QAAQ,6BAA0B;;AAEtD;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMC,iBAAiB,GAAGD,WAAW,CAAuB,YAAY,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,MAAMC,MAAM,GAAGN,iBAAiB,CAACI,WAAW,EAAEC,IAAI,CAAC;EACnD,MAAME,IAA4B,GAAG;IAAE,GAAGD;EAAO,CAAC;EAElD,KAAK,MAAME,KAAK,IAAIT,gBAAgB,EAAE;IACpC,MAAMU,KAAK,GAAGH,MAAM,CAAC,KAAKE,KAAK,EAAE,CAAC;IAClC,IAAIC,KAAK,KAAKC,SAAS,EAAE;MACvBH,IAAI,CAAC,WAAWC,KAAK,EAAE,CAAC,GAAGC,KAAK;IAClC;EACF;EAEA,OAAOF,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,0BAA0BA,CAAA,EAA4C;EACpF,IAAIb,QAAQ,CAACc,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EACtC,MAAMC,MAAM,GAAGX,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACW,MAAM,IAAI,OAAOA,MAAM,CAACC,uBAAuB,KAAK,UAAU,EAAE,OAAO,IAAI;EAChF,OAAOD,MAAM,CAACC,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCX,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAIP,QAAQ,CAACc,EAAE,KAAK,KAAK,EAAE,OAAOF,SAAS;EAC3C,MAAMG,MAAM,GAAGX,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACW,MAAM,IAAI,OAAOA,MAAM,CAACN,IAAI,KAAK,UAAU,EAAE,OAAOG,SAAS;EAClE,OAAOG,MAAM,CAACN,IAAI,CAACJ,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
@@ -11,8 +11,7 @@
11
11
  * `exports` `import`/`require` conditions to `lib/.../native-root-vars.js`.
12
12
  *
13
13
  * It deliberately does NOT import `react-native-css/native-internal`. That subpath
14
- * is native-only: it has no web build, and react-native-css is not even a Bloom
15
- * dependency. Statically importing it from a file a web bundler resolves breaks
14
+ * is native-only. Statically importing it from a file a web bundler resolves breaks
16
15
  * module resolution outright (the original report: `Rolldown failed to resolve
17
16
  * import "react-native-css/native-internal" from .../native-root-vars.js`).
18
17
  * Importing it from a file a consumer's `tsc` resolves breaks type-check (TS2307).
@@ -1 +1 @@
1
- {"version":3,"names":["applyNativeRootVars","_colorPreset","_mode"],"sourceRoot":"../../../src","sources":["theme/native-root-vars.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAACC,YAA0B,EAAEC,KAAuB,EAAQ;EAC7F;EACA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["applyNativeRootVars","_colorPreset","_mode"],"sourceRoot":"../../../src","sources":["theme/native-root-vars.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAACC,YAA0B,EAAEC,KAAuB,EAAQ;EAC7F;EACA;AAAA","ignoreList":[]}
@@ -11,11 +11,11 @@
11
11
  // `node_modules/@oxyhq/bloom/src/**`, and TypeScript does NOT auto-pick-up
12
12
  // ambient `.d.ts` files that live under `node_modules`, so
13
13
  // `react-native-css/native-internal` is unresolved (TS2307) unless the reference
14
- // travels with the source. react-native-css is intentionally NOT a Bloom
15
- // dependency it arrives transitively via a host's NativeWind 5 install, or is
16
- // absent entirely for NativeWind 4 consumers so the ambient declaration is the
17
- // only thing that can type this import, and it MUST reach the consumer. The
18
- // directive ships raw in `src/` (Bloom publishes `files: ["src", "lib"]`).
14
+ // travels with the source. Bloom now declares react-native-css directly because
15
+ // this native source imports it; the ambient declaration still travels with
16
+ // `src/` so consumer TypeScript programs that read Bloom source see the exact
17
+ // subpath shape. The directive ships raw in `src/` (Bloom publishes
18
+ // `files: ["src", "lib"]`).
19
19
  import { rootVariables } from 'react-native-css/native-internal';
20
20
  import { getResolvedTokens } from "./token-registry.js";
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAiBrD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuBD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CA4CtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgBrD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuBD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CA4CtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
@@ -13,11 +13,13 @@ export type VariableContextProviderComponent = React.ComponentType<{
13
13
  }>;
14
14
  /**
15
15
  * Build the CSS custom-property map for a preset, ready to be applied to a
16
- * subtree. Every token is resolved to an sRGB `rgb(...)` string via
17
- * `getResolvedTokens` — the single canonical token pipeline shared by web and
18
- * native — so Tailwind v4 `@theme` utilities (e.g. `bg-background`) and
19
- * `color-mix`-based alpha utilities (`bg-primary/10`) both resolve against the
20
- * same color values. Keys retain the leading `--`.
16
+ * subtree. Every canonical `--x` token is resolved to an sRGB `rgb(...)` string
17
+ * via `getResolvedTokens` — the single token pipeline shared by web and native.
18
+ *
19
+ * The returned map also includes Tailwind v4 `--color-x` aliases generated from
20
+ * those same canonical values. Scoped aliases are required on web because
21
+ * inherited custom properties like `--color-primary: var(--primary)` compute at
22
+ * the document root and would otherwise keep pointing at the app-wide preset.
21
23
  */
22
24
  export declare function buildScopeVars(colorPreset: AppColorName, mode: 'light' | 'dark'): Record<string, string>;
23
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,KAAK,CAAC,aAAa,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AASH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,IAAI,gCAAgC,GAAG,IAAI,CAKpF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,SAAS,CAAC,SAAS,CAAC,CAKtB"}
1
+ {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,KAAK,CAAC,aAAa,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AASH;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,IAAI,gCAAgC,GAAG,IAAI,CAKpF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,SAAS,CAAC,SAAS,CAAC,CAKtB"}
@@ -10,8 +10,7 @@ import { type AppColorName } from './color-presets';
10
10
  * `exports` `import`/`require` conditions to `lib/.../native-root-vars.js`.
11
11
  *
12
12
  * It deliberately does NOT import `react-native-css/native-internal`. That subpath
13
- * is native-only: it has no web build, and react-native-css is not even a Bloom
14
- * dependency. Statically importing it from a file a web bundler resolves breaks
13
+ * is native-only. Statically importing it from a file a web bundler resolves breaks
15
14
  * module resolution outright (the original report: `Rolldown failed to resolve
16
15
  * import "react-native-css/native-internal" from .../native-root-vars.js`).
17
16
  * Importing it from a file a consumer's `tsc` resolves breaks type-check (TS2307).
@@ -1 +1 @@
1
- {"version":3,"file":"native-root-vars.d.ts","sourceRoot":"","sources":["../../../../src/theme/native-root-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAG7F"}
1
+ {"version":3,"file":"native-root-vars.d.ts","sourceRoot":"","sources":["../../../../src/theme/native-root-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAG7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAiBrD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuBD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CA4CtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgBrD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuBD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CA4CtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
@@ -13,11 +13,13 @@ export type VariableContextProviderComponent = React.ComponentType<{
13
13
  }>;
14
14
  /**
15
15
  * Build the CSS custom-property map for a preset, ready to be applied to a
16
- * subtree. Every token is resolved to an sRGB `rgb(...)` string via
17
- * `getResolvedTokens` — the single canonical token pipeline shared by web and
18
- * native — so Tailwind v4 `@theme` utilities (e.g. `bg-background`) and
19
- * `color-mix`-based alpha utilities (`bg-primary/10`) both resolve against the
20
- * same color values. Keys retain the leading `--`.
16
+ * subtree. Every canonical `--x` token is resolved to an sRGB `rgb(...)` string
17
+ * via `getResolvedTokens` — the single token pipeline shared by web and native.
18
+ *
19
+ * The returned map also includes Tailwind v4 `--color-x` aliases generated from
20
+ * those same canonical values. Scoped aliases are required on web because
21
+ * inherited custom properties like `--color-primary: var(--primary)` compute at
22
+ * the document root and would otherwise keep pointing at the app-wide preset.
21
23
  */
22
24
  export declare function buildScopeVars(colorPreset: AppColorName, mode: 'light' | 'dark'): Record<string, string>;
23
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,KAAK,CAAC,aAAa,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AASH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,IAAI,gCAAgC,GAAG,IAAI,CAKpF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,SAAS,CAAC,SAAS,CAAC,CAKtB"}
1
+ {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,KAAK,CAAC,aAAa,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC;AASH;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,IAAI,gCAAgC,GAAG,IAAI,CAKpF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,SAAS,CAAC,SAAS,CAAC,CAKtB"}
@@ -10,8 +10,7 @@ import { type AppColorName } from './color-presets';
10
10
  * `exports` `import`/`require` conditions to `lib/.../native-root-vars.js`.
11
11
  *
12
12
  * It deliberately does NOT import `react-native-css/native-internal`. That subpath
13
- * is native-only: it has no web build, and react-native-css is not even a Bloom
14
- * dependency. Statically importing it from a file a web bundler resolves breaks
13
+ * is native-only. Statically importing it from a file a web bundler resolves breaks
15
14
  * module resolution outright (the original report: `Rolldown failed to resolve
16
15
  * import "react-native-css/native-internal" from .../native-root-vars.js`).
17
16
  * Importing it from a file a consumer's `tsc` resolves breaks type-check (TS2307).
@@ -1 +1 @@
1
- {"version":3,"file":"native-root-vars.d.ts","sourceRoot":"","sources":["../../../../src/theme/native-root-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAG7F"}
1
+ {"version":3,"file":"native-root-vars.d.ts","sourceRoot":"","sources":["../../../../src/theme/native-root-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAG7F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/bloom",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -871,6 +871,7 @@
871
871
  },
872
872
  "dependencies": {
873
873
  "nanoid": "^5.1.5",
874
+ "react-native-css": "3.0.7",
874
875
  "react-remove-scroll-bar": "^2.3.8"
875
876
  }
876
877
  }
@@ -153,17 +153,25 @@ describe('BloomColorScope', () => {
153
153
  );
154
154
 
155
155
  // Web var contract: the scoped base tokens (`--background`, `--primary`)
156
- // must be full `rgb(...)` colors from the single canonical pipeline
157
- // never bare HSL triples so the web apps' `var(--x)` color utilities
158
- // resolve. (The production incident was a bare triple here too.)
156
+ // must be full `rgb(...)` colors from the single canonical pipeline, and
157
+ // the scoped Tailwind v4 aliases (`--color-primary`) must be generated
158
+ // from those same values so NativeWind utilities resolve inside the
159
+ // subtree instead of inheriting the app-wide preset.
159
160
  const vars = Object.assign(
160
161
  {},
161
- ...flat.filter((entry) => '--background' in entry || '--primary' in entry),
162
+ ...flat.filter(
163
+ (entry) =>
164
+ '--background' in entry ||
165
+ '--primary' in entry ||
166
+ '--color-primary' in entry,
167
+ ),
162
168
  ) as Record<string, unknown>;
163
169
  const background = String(vars['--background'] ?? '');
164
170
  const primary = String(vars['--primary'] ?? '');
171
+ const colorPrimary = String(vars['--color-primary'] ?? '');
165
172
  expect(background.startsWith('rgb(')).toBe(true);
166
173
  expect(primary.startsWith('rgb(')).toBe(true);
174
+ expect(colorPrimary).toBe(primary);
167
175
  expect(/^-?\d[\d.]*\s+[\d.]+%/.test(background)).toBe(false);
168
176
  });
169
177
  });
@@ -1,21 +1,20 @@
1
1
  /**
2
2
  * Ambient declaration for `react-native-css/native-internal`.
3
3
  *
4
- * react-native-css is NOT a Bloom dependency it arrives transitively via the
5
- * host app's NativeWind install (NativeWind 5 is built on react-native-css@3).
6
- * Bloom's `native-root-vars.native.ts` statically imports `rootVariables` from
7
- * this subpath so Metro resolves the `import` export condition to the package's
4
+ * Bloom's native theme bridge statically imports `rootVariables` from this
5
+ * subpath so Metro resolves the `import` export condition to the package's
8
6
  * `module` build — the SAME family instance the react-native-css renderer
9
- * (`varResolver`) subscribes to. A runtime `require()` would resolve the
10
- * `require` condition to the separate `commonjs` build, whose `rootVariables`
11
- * is a distinct, un-observed family instance (see the file-level comment in
12
- * `native-root-vars.native.ts`).
7
+ * (`varResolver`) subscribes to. `react-native-css` is a direct Bloom dependency
8
+ * because this subpath is imported from published native source, including
9
+ * NativeWind 4 consumers whose test/native resolvers still select `.native.ts`.
10
+ * A runtime `require()` would resolve the `require` condition to the separate
11
+ * `commonjs` build, whose `rootVariables` is a distinct, un-observed family
12
+ * instance (see the file-level comment in `native-root-vars.native.ts`).
13
13
  *
14
- * Because the package isn't installed in Bloom, `tsc` can't see its published
15
- * types, so we declare the slice we use here — typed to match react-native-css
16
- * @3.0.7's `dist/typescript/.../native-internal/root.d.ts` exactly (no `any`,
17
- * no shims). This file is `.native`-only in spirit; the web fork never imports
18
- * the subpath, so on web bundlers the static import is never reached.
14
+ * We declare the slice we use here typed to match react-native-css @3.0.7's
15
+ * `dist/typescript/.../native-internal/root.d.ts` exactly (no `any`, no shims).
16
+ * This file is `.native`-only in spirit; the web fork never imports the subpath,
17
+ * so on web bundlers the static import is never reached.
19
18
  */
20
19
  declare module 'react-native-css/native-internal' {
21
20
  /**
@@ -3,20 +3,19 @@ import React, { Children, cloneElement, isValidElement, useContext, useMemo } fr
3
3
  import { BloomThemeContext, type BloomThemeContextValue } from '../BloomThemeProvider';
4
4
  import { buildTheme } from '../build-theme';
5
5
  import type { AppColorName } from '../color-presets';
6
- import { getResolvedTokens } from '../token-registry';
6
+ import { buildScopeVars } from './style-builder';
7
7
 
8
8
  /**
9
- * `getResolvedTokens` returns every canonical token already resolved to an sRGB
10
- * `rgb(...)` string the SAME pipeline the document-root web writer and the
11
- * native writer use. Scoped onto an element's inline `style`, Tailwind v4's
12
- * compiled utilities read these as `var(--x)` directly, so each base token is a
13
- * full CSS color with no per-value wrapping needed.
9
+ * `buildScopeVars` returns every canonical token already resolved to an sRGB
10
+ * `rgb(...)` string, plus the `--color-*` aliases consumed by Tailwind v4
11
+ * utilities. Scoped onto an element's inline `style`, profile-level NativeWind
12
+ * classes resolve against the subtree preset instead of the document root.
14
13
  */
15
14
  function buildWebScopeVars(
16
15
  colorPreset: AppColorName,
17
16
  mode: 'light' | 'dark',
18
17
  ): React.CSSProperties {
19
- return getResolvedTokens(colorPreset, mode) as React.CSSProperties;
18
+ return buildScopeVars(colorPreset, mode) as React.CSSProperties;
20
19
  }
21
20
 
22
21
  export interface BloomColorScopeProps {
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import { Platform, type StyleProp, type ViewStyle } from 'react-native';
3
3
 
4
- import { getResolvedTokens } from '../token-registry';
4
+ import { CANONICAL_TOKENS, getResolvedTokens } from '../token-registry';
5
5
  import type { AppColorName } from '../color-presets';
6
6
  import { lazyRequire } from '../../utils/lazy-require';
7
7
 
@@ -25,17 +25,29 @@ const getNativeWindVars = lazyRequire<NativeWindVarsModule>('nativewind');
25
25
 
26
26
  /**
27
27
  * Build the CSS custom-property map for a preset, ready to be applied to a
28
- * subtree. Every token is resolved to an sRGB `rgb(...)` string via
29
- * `getResolvedTokens` — the single canonical token pipeline shared by web and
30
- * native — so Tailwind v4 `@theme` utilities (e.g. `bg-background`) and
31
- * `color-mix`-based alpha utilities (`bg-primary/10`) both resolve against the
32
- * same color values. Keys retain the leading `--`.
28
+ * subtree. Every canonical `--x` token is resolved to an sRGB `rgb(...)` string
29
+ * via `getResolvedTokens` — the single token pipeline shared by web and native.
30
+ *
31
+ * The returned map also includes Tailwind v4 `--color-x` aliases generated from
32
+ * those same canonical values. Scoped aliases are required on web because
33
+ * inherited custom properties like `--color-primary: var(--primary)` compute at
34
+ * the document root and would otherwise keep pointing at the app-wide preset.
33
35
  */
34
36
  export function buildScopeVars(
35
37
  colorPreset: AppColorName,
36
38
  mode: 'light' | 'dark',
37
39
  ): Record<string, string> {
38
- return getResolvedTokens(colorPreset, mode);
40
+ const tokens = getResolvedTokens(colorPreset, mode);
41
+ const vars: Record<string, string> = { ...tokens };
42
+
43
+ for (const token of CANONICAL_TOKENS) {
44
+ const value = tokens[`--${token}`];
45
+ if (value !== undefined) {
46
+ vars[`--color-${token}`] = value;
47
+ }
48
+ }
49
+
50
+ return vars;
39
51
  }
40
52
 
41
53
  /**
@@ -9,11 +9,11 @@
9
9
  // `node_modules/@oxyhq/bloom/src/**`, and TypeScript does NOT auto-pick-up
10
10
  // ambient `.d.ts` files that live under `node_modules`, so
11
11
  // `react-native-css/native-internal` is unresolved (TS2307) unless the reference
12
- // travels with the source. react-native-css is intentionally NOT a Bloom
13
- // dependency it arrives transitively via a host's NativeWind 5 install, or is
14
- // absent entirely for NativeWind 4 consumers so the ambient declaration is the
15
- // only thing that can type this import, and it MUST reach the consumer. The
16
- // directive ships raw in `src/` (Bloom publishes `files: ["src", "lib"]`).
12
+ // travels with the source. Bloom now declares react-native-css directly because
13
+ // this native source imports it; the ambient declaration still travels with
14
+ // `src/` so consumer TypeScript programs that read Bloom source see the exact
15
+ // subpath shape. The directive ships raw in `src/` (Bloom publishes
16
+ // `files: ["src", "lib"]`).
17
17
  import { rootVariables } from 'react-native-css/native-internal';
18
18
 
19
19
  import { type AppColorName } from './color-presets';
@@ -11,8 +11,7 @@ import { type AppColorName } from './color-presets';
11
11
  * `exports` `import`/`require` conditions to `lib/.../native-root-vars.js`.
12
12
  *
13
13
  * It deliberately does NOT import `react-native-css/native-internal`. That subpath
14
- * is native-only: it has no web build, and react-native-css is not even a Bloom
15
- * dependency. Statically importing it from a file a web bundler resolves breaks
14
+ * is native-only. Statically importing it from a file a web bundler resolves breaks
16
15
  * module resolution outright (the original report: `Rolldown failed to resolve
17
16
  * import "react-native-css/native-internal" from .../native-root-vars.js`).
18
17
  * Importing it from a file a consumer's `tsc` resolves breaks type-check (TS2307).