@oxyhq/bloom 0.6.17 → 0.6.19

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 (49) hide show
  1. package/lib/commonjs/theme/BloomThemeProvider.js +13 -4
  2. package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
  3. package/lib/commonjs/theme/apply-dark-class.js +10 -7
  4. package/lib/commonjs/theme/apply-dark-class.js.map +1 -1
  5. package/lib/commonjs/theme/color-scope/index.js +21 -14
  6. package/lib/commonjs/theme/color-scope/index.js.map +1 -1
  7. package/lib/commonjs/theme/color-scope/index.web.js +29 -8
  8. package/lib/commonjs/theme/color-scope/index.web.js.map +1 -1
  9. package/lib/commonjs/theme/color-scope/style-builder.js +18 -0
  10. package/lib/commonjs/theme/color-scope/style-builder.js.map +1 -1
  11. package/lib/module/theme/BloomThemeProvider.js +14 -5
  12. package/lib/module/theme/BloomThemeProvider.js.map +1 -1
  13. package/lib/module/theme/apply-dark-class.js +10 -7
  14. package/lib/module/theme/apply-dark-class.js.map +1 -1
  15. package/lib/module/theme/color-scope/index.js +23 -16
  16. package/lib/module/theme/color-scope/index.js.map +1 -1
  17. package/lib/module/theme/color-scope/index.web.js +30 -9
  18. package/lib/module/theme/color-scope/index.web.js.map +1 -1
  19. package/lib/module/theme/color-scope/style-builder.js +17 -0
  20. package/lib/module/theme/color-scope/style-builder.js.map +1 -1
  21. package/lib/typescript/commonjs/icons/common.d.ts +8 -8
  22. package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts +8 -1
  23. package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/theme/apply-dark-class.d.ts +5 -4
  25. package/lib/typescript/commonjs/theme/apply-dark-class.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/theme/color-scope/index.d.ts +4 -4
  27. package/lib/typescript/commonjs/theme/color-scope/index.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts +6 -7
  29. package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts +8 -0
  31. package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts.map +1 -1
  32. package/lib/typescript/module/icons/common.d.ts +8 -8
  33. package/lib/typescript/module/theme/BloomThemeProvider.d.ts +8 -1
  34. package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
  35. package/lib/typescript/module/theme/apply-dark-class.d.ts +5 -4
  36. package/lib/typescript/module/theme/apply-dark-class.d.ts.map +1 -1
  37. package/lib/typescript/module/theme/color-scope/index.d.ts +4 -4
  38. package/lib/typescript/module/theme/color-scope/index.d.ts.map +1 -1
  39. package/lib/typescript/module/theme/color-scope/index.web.d.ts +6 -7
  40. package/lib/typescript/module/theme/color-scope/index.web.d.ts.map +1 -1
  41. package/lib/typescript/module/theme/color-scope/style-builder.d.ts +8 -0
  42. package/lib/typescript/module/theme/color-scope/style-builder.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/src/__tests__/BloomColorScope.test.tsx +27 -3
  45. package/src/theme/BloomThemeProvider.tsx +32 -4
  46. package/src/theme/apply-dark-class.ts +8 -8
  47. package/src/theme/color-scope/index.tsx +28 -26
  48. package/src/theme/color-scope/index.web.tsx +35 -16
  49. package/src/theme/color-scope/style-builder.ts +25 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import React, { useContext, useMemo } from 'react';
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
6
  import { buildScopeVars } from "./style-builder.js";
@@ -8,6 +8,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export function BloomColorScope({
9
9
  colorPreset,
10
10
  asChild = false,
11
+ style,
11
12
  children
12
13
  }) {
13
14
  const parent = useContext(BloomThemeContext);
@@ -23,21 +24,41 @@ export function BloomColorScope({
23
24
  colorPreset
24
25
  };
25
26
  }, [colorPreset, resolvedMode, parent]);
26
- const style = useMemo(() => buildScopeVars(colorPreset, resolvedMode), [colorPreset, resolvedMode]);
27
+ const varsStyle = useMemo(() => buildScopeVars(colorPreset, resolvedMode), [colorPreset, resolvedMode]);
28
+ let content;
29
+ if (asChild) {
30
+ const child = Children.only(children);
31
+ if (! /*#__PURE__*/isValidElement(child)) {
32
+ throw new Error('BloomColorScope with `asChild` requires a single React element child that accepts a `style` prop.');
33
+ }
34
+ const childStyle = child.props.style;
35
+ const mergedStyle = {
36
+ ...varsStyle,
37
+ ...style,
38
+ ...childStyle
39
+ };
40
+ content = /*#__PURE__*/cloneElement(child, {
41
+ style: mergedStyle
42
+ });
43
+ } else {
44
+ const mergedStyle = {
45
+ ...varsStyle,
46
+ ...style
47
+ };
48
+ content = /*#__PURE__*/_jsx("div", {
49
+ style: mergedStyle,
50
+ children: children
51
+ });
52
+ }
27
53
  return /*#__PURE__*/_jsx(BloomThemeContext.Provider, {
28
54
  value: contextValue,
29
- children: asChild ? children : /*#__PURE__*/_jsx("div", {
30
- style: style,
31
- children: children
32
- })
55
+ children: content
33
56
  });
34
57
  }
35
58
 
36
59
  /**
37
60
  * Escape hatch for advanced cases where the wrapping element is owned by the
38
- * caller (e.g. a Pressable, a NativeWind-styled View that already has a style
39
- * prop). Returns a stable React `style` object carrying every CSS custom
40
- * property of the preset.
61
+ * caller. Returns a stable React style object carrying the preset's CSS vars.
41
62
  */
42
63
  export function useColorScopeStyle(colorPreset) {
43
64
  const parent = useContext(BloomThemeContext);
@@ -1 +1 @@
1
- {"version":3,"names":["React","useContext","useMemo","BloomThemeContext","buildTheme","buildScopeVars","jsx","_jsx","BloomColorScope","colorPreset","asChild","children","parent","Error","resolvedMode","theme","mode","contextValue","style","Provider","value","useColorScopeStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/index.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC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IC,KAAK,CAAC,+DAA+D,CAAC;EAClF;EACA,MAAMC,YAAY,GAAGF,MAAM,CAACG,KAAK,CAACC,IAAI;EACtC,OAAOd,OAAO,CACZ,MAAMG,cAAc,CAACI,WAAW,EAAEK,YAAY,CAAwB,EACtE,CAACL,WAAW,EAAEK,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["React","Children","cloneElement","isValidElement","useContext","useMemo","BloomThemeContext","buildTheme","buildScopeVars","jsx","_jsx","BloomColorScope","colorPreset","asChild","style","children","parent","Error","resolvedMode","theme","mode","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;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAmBjD,OAAO,SAASC,eAAeA,CAAC;EAC9BC,WAAW;EACXC,OAAO,GAAG,KAAK;EACfC,KAAK;EACLC;AACoB,CAAC,EAAE;EACvB,MAAMC,MAAM,GAAGZ,UAAU,CAACE,iBAAiB,CAAC;EAC5C,IAAI,CAACU,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,4DAA4D,CAAC;EAC/E;EAEA,MAAMC,YAAY,GAAGF,MAAM,CAACG,KAAK,CAACC,IAAI;EAEtC,MAAMC,YAAY,GAAGhB,OAAO,CAAyB,MAAM;IACzD,MAAMc,KAAK,GAAGZ,UAAU,CAACK,WAAW,EAAEM,YAAY,CAAC;IACnD,OAAO;MAAE,GAAGF,MAAM;MAAEG,KAAK;MAAEP;IAAY,CAAC;EAC1C,CAAC,EAAE,CAACA,WAAW,EAAEM,YAAY,E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Y,CAAwB,EACtE,CAACN,WAAW,EAAEM,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ import { Platform } from 'react-native';
3
4
  import { getPresetVars } from "../preset-vars.js";
5
+ import { lazyRequire } from "../../utils/lazy-require.js";
6
+ const getNativeWindVars = lazyRequire('nativewind');
7
+
4
8
  /**
5
9
  * Build the CSS custom-property map for a preset, ready to be applied to a
6
10
  * subtree. Always includes the resolved `--color-*` vars so Tailwind v4
@@ -11,4 +15,17 @@ export function buildScopeVars(colorPreset, mode) {
11
15
  includeResolvedColorVars: true
12
16
  });
13
17
  }
18
+
19
+ /**
20
+ * Build a native style object carrying every CSS var of the preset, using
21
+ * NativeWind's `vars()` when available. Returns `undefined` on web (where the
22
+ * provider writes vars to `documentElement` instead) or when `nativewind` is
23
+ * not installed.
24
+ */
25
+ export function buildNativePresetStyle(colorPreset, mode) {
26
+ if (Platform.OS === 'web') return undefined;
27
+ const module = getNativeWindVars();
28
+ if (!module || typeof module.vars !== 'function') return undefined;
29
+ return module.vars(buildScopeVars(colorPreset, mode));
30
+ }
14
31
  //# sourceMappingURL=style-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPresetVars","buildScopeVars","colorPreset","mode","includeResolvedColorVars"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,mBAAgB;AAG9C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,OAAOH,aAAa,CAACE,WAAW,EAAEC,IAAI,EAAE;IAAEC,wBAAwB,EAAE;EAAK,CAAC,CAAC;AAC7E","ignoreList":[]}
1
+ {"version":3,"names":["Platform","getPresetVars","lazyRequire","getNativeWindVars","buildScopeVars","colorPreset","mode","includeResolvedColorVars","buildNativePresetStyle","OS","undefined","module","vars"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAwC,cAAc;AAEvE,SAASC,aAAa,QAAQ,mBAAgB;AAE9C,SAASC,WAAW,QAAQ,6BAA0B;AAMtD,MAAMC,iBAAiB,GAAGD,WAAW,CAAuB,YAAY,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,OAAOL,aAAa,CAACI,WAAW,EAAEC,IAAI,EAAE;IAAEC,wBAAwB,EAAE;EAAK,CAAC,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCH,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAIN,QAAQ,CAACS,EAAE,KAAK,KAAK,EAAE,OAAOC,SAAS;EAC3C,MAAMC,MAAM,GAAGR,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACQ,MAAM,IAAI,OAAOA,MAAM,CAACC,IAAI,KAAK,UAAU,EAAE,OAAOF,SAAS;EAClE,OAAOC,MAAM,CAACC,IAAI,CAACR,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
@@ -37,6 +37,14 @@ export declare function useCommonSVGProps(props: Props): {
37
37
  title?: string | undefined;
38
38
  children?: React.ReactNode;
39
39
  filter?: string | undefined;
40
+ color?: ColorValue | undefined;
41
+ scale?: import("react-native-svg").NumberArray | undefined;
42
+ scaleX?: import("react-native-svg").NumberProp | undefined;
43
+ scaleY?: import("react-native-svg").NumberProp | undefined;
44
+ translateX?: import("react-native-svg").NumberProp | undefined;
45
+ translateY?: import("react-native-svg").NumberProp | undefined;
46
+ skewX?: import("react-native-svg").NumberProp | undefined;
47
+ skewY?: import("react-native-svg").NumberProp | undefined;
40
48
  hitSlop?: number | import("react-native").Insets | undefined;
41
49
  id?: string | undefined;
42
50
  needsOffscreenAlphaCompositing?: boolean | undefined | undefined;
@@ -128,14 +136,6 @@ export declare function useCommonSVGProps(props: Props): {
128
136
  accessibilityShowsLargeContentViewer?: boolean | undefined | undefined;
129
137
  accessibilityLargeContentTitle?: string | undefined | undefined;
130
138
  accessibilityRespondsToUserInteraction?: boolean | undefined | undefined;
131
- color?: ColorValue | undefined;
132
- scale?: import("react-native-svg").NumberArray | undefined;
133
- scaleX?: import("react-native-svg").NumberProp | undefined;
134
- scaleY?: import("react-native-svg").NumberProp | undefined;
135
- translateX?: import("react-native-svg").NumberProp | undefined;
136
- translateY?: import("react-native-svg").NumberProp | undefined;
137
- skewX?: import("react-native-svg").NumberProp | undefined;
138
- skewY?: import("react-native-svg").NumberProp | undefined;
139
139
  fontSize?: import("react-native-svg").NumberProp | undefined;
140
140
  fontWeight?: import("react-native-svg").FontWeight | undefined;
141
141
  fontStyle?: import("react-native-svg").FontStyle | undefined;
@@ -1,5 +1,6 @@
1
1
  import './init-css-interop';
2
2
  import React from 'react';
3
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
4
  import { type AppColorName } from './color-presets';
4
5
  import { type BloomThemeStorage } from './persistence';
5
6
  import type { Theme, ThemeMode } from './types';
@@ -52,7 +53,13 @@ export interface BloomThemeProviderProps {
52
53
  fonts?: boolean;
53
54
  /** Rendered while native fonts load. Ignored on web. */
54
55
  onFontsLoading?: React.ReactNode;
56
+ /**
57
+ * Style applied to the native `<View>` wrapper that carries the preset's
58
+ * CSS vars. Defaults to `{ flex: 1 }`. Ignored on web (the provider writes
59
+ * vars to `document.documentElement` instead of using a wrapper).
60
+ */
61
+ nativeWrapperStyle?: StyleProp<ViewStyle>;
55
62
  children: React.ReactNode;
56
63
  }
57
- export declare function BloomThemeProvider({ mode: controlledMode, colorPreset: controlledPreset, defaultMode, defaultColorPreset, onModeChange, onColorPresetChange, persistKey, storage, awaitHydration, onHydrating, fonts, onFontsLoading, children, }: BloomThemeProviderProps): import("react/jsx-runtime").JSX.Element;
64
+ export declare function BloomThemeProvider({ mode: controlledMode, colorPreset: controlledPreset, defaultMode, defaultColorPreset, onModeChange, onColorPresetChange, persistKey, storage, awaitHydration, onHydrating, fonts, onFontsLoading, nativeWrapperStyle, children, }: BloomThemeProviderProps): import("react/jsx-runtime").JSX.Element;
58
65
  //# sourceMappingURL=BloomThemeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BloomThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/theme/BloomThemeProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAQN,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAKL,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKhD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,YAAY,CAAC;IAC1B,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACnC,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/C;;;;OAIG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,8CAAqD,CAAC;AAEpF,MAAM,WAAW,uBAAuB;IACtC,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mEAAmE;IACnE,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,mEAAmE;IACnE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAElC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAErD;;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4,10 +4,11 @@ export declare function applyDarkClass(resolved: 'light' | 'dark'): void;
4
4
  * Apply a color preset's CSS custom properties to the document root.
5
5
  * No-op on native — only affects web.
6
6
  *
7
- * Values are written as raw HSL triples (e.g. `185 100% 20%`), matching the
8
- * shadcn/Tailwind convention where stylesheets wrap them themselves with
9
- * `hsl(var(--primary))`. Writing pre-resolved `hsl(...)` values here would
10
- * produce invalid `hsl(hsl(...))` in consuming stylesheets and break theming.
7
+ * Writes both the raw HSL triples (e.g. `--primary: 185 100% 20%`) and the
8
+ * resolved `--color-*` vars (`--color-primary: hsl(185 100% 20%)`) so both
9
+ * shadcn-style `hsl(var(--primary))` plumbing and Tailwind v4 `@theme`
10
+ * utilities resolve consistently. Includes extended tokens (card, chart-*,
11
+ * content-area, sidebar-*) so consumer apps don't need to synthesize them.
11
12
  */
12
13
  export declare function applyColorPresetVars(preset: AppColorName, resolved: 'light' | 'dark'): void;
13
14
  //# sourceMappingURL=apply-dark-class.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,QAIxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,QAYpF"}
1
+ {"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,QAIxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,QAUpF"}
@@ -5,11 +5,11 @@ export interface BloomColorScopeProps {
5
5
  /** Preset to apply within this subtree. */
6
6
  colorPreset: AppColorName;
7
7
  /**
8
- * When `true`, do not render a wrapping `<View>`. The caller owns the
9
- * element that receives the CSS vars (via `useColorScopeStyle`).
8
+ * When `true`, do not render a wrapping `<View>`. The single child is cloned
9
+ * with the scope's CSS vars merged into its `style` prop (Radix-style).
10
10
  */
11
11
  asChild?: boolean;
12
- /** Additional style applied to the wrapping `<View>`. Ignored with `asChild`. */
12
+ /** Additional style applied to the wrapping `<View>` (or merged into the cloned child with `asChild`). */
13
13
  style?: StyleProp<ViewStyle>;
14
14
  children: React.ReactNode;
15
15
  }
@@ -17,7 +17,7 @@ export declare function BloomColorScope({ colorPreset, asChild, style, children,
17
17
  /**
18
18
  * Escape hatch for advanced cases where the wrapping element is owned by the
19
19
  * caller. Returns a stable native style object carrying the preset's CSS vars.
20
- * Returns `undefined` when nativewind is not installed.
20
+ * Returns `undefined` on web or when `nativewind` is not installed.
21
21
  */
22
22
  export declare function useColorScopeStyle(colorPreset: AppColorName): StyleProp<ViewStyle>;
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgBrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAuBtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,CAUlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAC3F,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0GAA0G;IAC1G,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAMD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAkCtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,CAUlF"}
@@ -4,19 +4,18 @@ export interface BloomColorScopeProps {
4
4
  /** Preset to apply within this subtree. */
5
5
  colorPreset: AppColorName;
6
6
  /**
7
- * When `true`, do not render a wrapping element. The caller is responsible
8
- * for placing the returned context provider over a DOM node that owns the
9
- * CSS vars (via `useColorScopeStyle`).
7
+ * When `true`, do not render a wrapping `<div>`. The single child is cloned
8
+ * with the scope's CSS vars merged into its `style` prop (Radix-style).
10
9
  */
11
10
  asChild?: boolean;
11
+ /** Additional style applied to the wrapping `<div>` (or merged into the cloned child with `asChild`). */
12
+ style?: React.CSSProperties;
12
13
  children: React.ReactNode;
13
14
  }
14
- export declare function BloomColorScope({ colorPreset, asChild, children }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function BloomColorScope({ colorPreset, asChild, style, children, }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
15
16
  /**
16
17
  * Escape hatch for advanced cases where the wrapping element is owned by the
17
- * caller (e.g. a Pressable, a NativeWind-styled View that already has a style
18
- * prop). Returns a stable React `style` object carrying every CSS custom
19
- * property of the preset.
18
+ * caller. Returns a stable React style object carrying the preset's CSS vars.
20
19
  */
21
20
  export declare function useColorScopeStyle(colorPreset: AppColorName): React.CSSProperties;
22
21
  //# sourceMappingURL=index.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAAE,WAAW,EAAE,OAAe,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAuB/F;AAED;;;;;GAKG;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;AAGrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;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;AAMD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAmCtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
@@ -1,3 +1,4 @@
1
+ import { type StyleProp, type ViewStyle } from 'react-native';
1
2
  import type { AppColorName } from '../color-presets';
2
3
  /**
3
4
  * Build the CSS custom-property map for a preset, ready to be applied to a
@@ -5,4 +6,11 @@ import type { AppColorName } from '../color-presets';
5
6
  * `@theme` utilities (e.g. `bg-background`) honour the scope.
6
7
  */
7
8
  export declare function buildScopeVars(colorPreset: AppColorName, mode: 'light' | 'dark'): Record<string, string>;
9
+ /**
10
+ * Build a native style object carrying every CSS var of the preset, using
11
+ * NativeWind's `vars()` when available. Returns `undefined` on web (where the
12
+ * provider writes vars to `documentElement` instead) or when `nativewind` is
13
+ * not installed.
14
+ */
15
+ export declare function buildNativePresetStyle(colorPreset: AppColorName, mode: 'light' | 'dark'): StyleProp<ViewStyle>;
8
16
  //# sourceMappingURL=style-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB"}
1
+ {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,SAAS,CAAC,SAAS,CAAC,CAKtB"}
@@ -37,6 +37,14 @@ export declare function useCommonSVGProps(props: Props): {
37
37
  title?: string | undefined;
38
38
  children?: React.ReactNode;
39
39
  filter?: string | undefined;
40
+ color?: ColorValue | undefined;
41
+ scale?: import("react-native-svg").NumberArray | undefined;
42
+ scaleX?: import("react-native-svg").NumberProp | undefined;
43
+ scaleY?: import("react-native-svg").NumberProp | undefined;
44
+ translateX?: import("react-native-svg").NumberProp | undefined;
45
+ translateY?: import("react-native-svg").NumberProp | undefined;
46
+ skewX?: import("react-native-svg").NumberProp | undefined;
47
+ skewY?: import("react-native-svg").NumberProp | undefined;
40
48
  hitSlop?: number | import("react-native").Insets | undefined;
41
49
  id?: string | undefined;
42
50
  needsOffscreenAlphaCompositing?: boolean | undefined | undefined;
@@ -128,14 +136,6 @@ export declare function useCommonSVGProps(props: Props): {
128
136
  accessibilityShowsLargeContentViewer?: boolean | undefined | undefined;
129
137
  accessibilityLargeContentTitle?: string | undefined | undefined;
130
138
  accessibilityRespondsToUserInteraction?: boolean | undefined | undefined;
131
- color?: ColorValue | undefined;
132
- scale?: import("react-native-svg").NumberArray | undefined;
133
- scaleX?: import("react-native-svg").NumberProp | undefined;
134
- scaleY?: import("react-native-svg").NumberProp | undefined;
135
- translateX?: import("react-native-svg").NumberProp | undefined;
136
- translateY?: import("react-native-svg").NumberProp | undefined;
137
- skewX?: import("react-native-svg").NumberProp | undefined;
138
- skewY?: import("react-native-svg").NumberProp | undefined;
139
139
  fontSize?: import("react-native-svg").NumberProp | undefined;
140
140
  fontWeight?: import("react-native-svg").FontWeight | undefined;
141
141
  fontStyle?: import("react-native-svg").FontStyle | undefined;
@@ -1,5 +1,6 @@
1
1
  import './init-css-interop';
2
2
  import React from 'react';
3
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
4
  import { type AppColorName } from './color-presets';
4
5
  import { type BloomThemeStorage } from './persistence';
5
6
  import type { Theme, ThemeMode } from './types';
@@ -52,7 +53,13 @@ export interface BloomThemeProviderProps {
52
53
  fonts?: boolean;
53
54
  /** Rendered while native fonts load. Ignored on web. */
54
55
  onFontsLoading?: React.ReactNode;
56
+ /**
57
+ * Style applied to the native `<View>` wrapper that carries the preset's
58
+ * CSS vars. Defaults to `{ flex: 1 }`. Ignored on web (the provider writes
59
+ * vars to `document.documentElement` instead of using a wrapper).
60
+ */
61
+ nativeWrapperStyle?: StyleProp<ViewStyle>;
55
62
  children: React.ReactNode;
56
63
  }
57
- export declare function BloomThemeProvider({ mode: controlledMode, colorPreset: controlledPreset, defaultMode, defaultColorPreset, onModeChange, onColorPresetChange, persistKey, storage, awaitHydration, onHydrating, fonts, onFontsLoading, children, }: BloomThemeProviderProps): import("react/jsx-runtime").JSX.Element;
64
+ export declare function BloomThemeProvider({ mode: controlledMode, colorPreset: controlledPreset, defaultMode, defaultColorPreset, onModeChange, onColorPresetChange, persistKey, storage, awaitHydration, onHydrating, fonts, onFontsLoading, nativeWrapperStyle, children, }: BloomThemeProviderProps): import("react/jsx-runtime").JSX.Element;
58
65
  //# sourceMappingURL=BloomThemeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BloomThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/the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W,CAAC,EAAE,YAAY,CAAC;IAC3B,mEAAmE;IACnE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAElC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAErD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iDAAiD;IACjD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wDAAwD;IACxD,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEjC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAkJD,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EAAE,cAAc,EACpB,WAAW,EAAE,gBAAgB,EAC7B,WAA0B,EAC1B,kBAAmC,EACnC,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACX,KAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,QAAQ,GACT,EAAE,uBAAuB,2CA+DzB"}
@@ -4,10 +4,11 @@ export declare function applyDarkClass(resolved: 'light' | 'dark'): void;
4
4
  * Apply a color preset's CSS custom properties to the document root.
5
5
  * No-op on native — only affects web.
6
6
  *
7
- * Values are written as raw HSL triples (e.g. `185 100% 20%`), matching the
8
- * shadcn/Tailwind convention where stylesheets wrap them themselves with
9
- * `hsl(var(--primary))`. Writing pre-resolved `hsl(...)` values here would
10
- * produce invalid `hsl(hsl(...))` in consuming stylesheets and break theming.
7
+ * Writes both the raw HSL triples (e.g. `--primary: 185 100% 20%`) and the
8
+ * resolved `--color-*` vars (`--color-primary: hsl(185 100% 20%)`) so both
9
+ * shadcn-style `hsl(var(--primary))` plumbing and Tailwind v4 `@theme`
10
+ * utilities resolve consistently. Includes extended tokens (card, chart-*,
11
+ * content-area, sidebar-*) so consumer apps don't need to synthesize them.
11
12
  */
12
13
  export declare function applyColorPresetVars(preset: AppColorName, resolved: 'light' | 'dark'): void;
13
14
  //# sourceMappingURL=apply-dark-class.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,QAIxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,QAYpF"}
1
+ {"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,QAIxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,QAUpF"}
@@ -5,11 +5,11 @@ export interface BloomColorScopeProps {
5
5
  /** Preset to apply within this subtree. */
6
6
  colorPreset: AppColorName;
7
7
  /**
8
- * When `true`, do not render a wrapping `<View>`. The caller owns the
9
- * element that receives the CSS vars (via `useColorScopeStyle`).
8
+ * When `true`, do not render a wrapping `<View>`. The single child is cloned
9
+ * with the scope's CSS vars merged into its `style` prop (Radix-style).
10
10
  */
11
11
  asChild?: boolean;
12
- /** Additional style applied to the wrapping `<View>`. Ignored with `asChild`. */
12
+ /** Additional style applied to the wrapping `<View>` (or merged into the cloned child with `asChild`). */
13
13
  style?: StyleProp<ViewStyle>;
14
14
  children: React.ReactNode;
15
15
  }
@@ -17,7 +17,7 @@ export declare function BloomColorScope({ colorPreset, asChild, style, children,
17
17
  /**
18
18
  * Escape hatch for advanced cases where the wrapping element is owned by the
19
19
  * caller. Returns a stable native style object carrying the preset's CSS vars.
20
- * Returns `undefined` when nativewind is not installed.
20
+ * Returns `undefined` on web or when `nativewind` is not installed.
21
21
  */
22
22
  export declare function useColorScopeStyle(colorPreset: AppColorName): StyleProp<ViewStyle>;
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgBrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAuBtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,CAUlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAC3F,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0GAA0G;IAC1G,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAMD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAkCtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,CAUlF"}
@@ -4,19 +4,18 @@ export interface BloomColorScopeProps {
4
4
  /** Preset to apply within this subtree. */
5
5
  colorPreset: AppColorName;
6
6
  /**
7
- * When `true`, do not render a wrapping element. The caller is responsible
8
- * for placing the returned context provider over a DOM node that owns the
9
- * CSS vars (via `useColorScopeStyle`).
7
+ * When `true`, do not render a wrapping `<div>`. The single child is cloned
8
+ * with the scope's CSS vars merged into its `style` prop (Radix-style).
10
9
  */
11
10
  asChild?: boolean;
11
+ /** Additional style applied to the wrapping `<div>` (or merged into the cloned child with `asChild`). */
12
+ style?: React.CSSProperties;
12
13
  children: React.ReactNode;
13
14
  }
14
- export declare function BloomColorScope({ colorPreset, asChild, children }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function BloomColorScope({ colorPreset, asChild, style, children, }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
15
16
  /**
16
17
  * Escape hatch for advanced cases where the wrapping element is owned by the
17
- * caller (e.g. a Pressable, a NativeWind-styled View that already has a style
18
- * prop). Returns a stable React `style` object carrying every CSS custom
19
- * property of the preset.
18
+ * caller. Returns a stable React style object carrying the preset's CSS vars.
20
19
  */
21
20
  export declare function useColorScopeStyle(colorPreset: AppColorName): React.CSSProperties;
22
21
  //# sourceMappingURL=index.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAAE,WAAW,EAAE,OAAe,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAuB/F;AAED;;;;;GAKG;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;AAGrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;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;AAMD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAmCtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
@@ -1,3 +1,4 @@
1
+ import { type StyleProp, type ViewStyle } from 'react-native';
1
2
  import type { AppColorName } from '../color-presets';
2
3
  /**
3
4
  * Build the CSS custom-property map for a preset, ready to be applied to a
@@ -5,4 +6,11 @@ import type { AppColorName } from '../color-presets';
5
6
  * `@theme` utilities (e.g. `bg-background`) honour the scope.
6
7
  */
7
8
  export declare function buildScopeVars(colorPreset: AppColorName, mode: 'light' | 'dark'): Record<string, string>;
9
+ /**
10
+ * Build a native style object carrying every CSS var of the preset, using
11
+ * NativeWind's `vars()` when available. Returns `undefined` on web (where the
12
+ * provider writes vars to `documentElement` instead) or when `nativewind` is
13
+ * not installed.
14
+ */
15
+ export declare function buildNativePresetStyle(colorPreset: AppColorName, mode: 'light' | 'dark'): StyleProp<ViewStyle>;
8
16
  //# sourceMappingURL=style-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB"}
1
+ {"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,YAAY,EACzB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,SAAS,CAAC,SAAS,CAAC,CAKtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/bloom",
3
- "version": "0.6.17",
3
+ "version": "0.6.19",
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",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Text } from 'react-native';
2
+ import { Text, View, type StyleProp, type ViewStyle } from 'react-native';
3
3
  import { render } from '@testing-library/react-native';
4
4
 
5
5
  import { BloomThemeProvider } from '../theme/BloomThemeProvider';
@@ -11,6 +11,10 @@ function CurrentPreset() {
11
11
  return <Text testID="preset">{colorPreset}</Text>;
12
12
  }
13
13
 
14
+ function StyledChild({ style }: { style?: StyleProp<ViewStyle> }) {
15
+ return <View testID="styled-child" style={style}><CurrentPreset /></View>;
16
+ }
17
+
14
18
  describe('BloomColorScope', () => {
15
19
  it('overrides the colorPreset of its subtree without affecting the parent', () => {
16
20
  const { getAllByTestId } = render(
@@ -27,16 +31,36 @@ describe('BloomColorScope', () => {
27
31
  expect(presets[1]).toBe('green');
28
32
  });
29
33
 
30
- it('renders children directly with asChild (no wrapper element)', () => {
34
+ it('clones the single child and merges scope vars into its style (asChild)', () => {
31
35
  const { getByTestId } = render(
32
36
  <BloomThemeProvider defaultColorPreset="blue" fonts={false}>
33
37
  <BloomColorScope colorPreset="purple" asChild>
34
- <CurrentPreset />
38
+ <StyledChild style={{ padding: 8 }} />
35
39
  </BloomColorScope>
36
40
  </BloomThemeProvider>,
37
41
  );
38
42
 
39
43
  expect(getByTestId('preset').props.children).toBe('purple');
44
+ const mergedStyle = getByTestId('styled-child').props.style;
45
+ expect(Array.isArray(mergedStyle)).toBe(true);
46
+ expect(mergedStyle).toEqual(
47
+ expect.arrayContaining([expect.objectContaining({ padding: 8 })]),
48
+ );
49
+ });
50
+
51
+ it('throws when asChild has multiple children', () => {
52
+ const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {});
53
+ expect(() =>
54
+ render(
55
+ <BloomThemeProvider defaultColorPreset="blue" fonts={false}>
56
+ <BloomColorScope colorPreset="purple" asChild>
57
+ <CurrentPreset />
58
+ <CurrentPreset />
59
+ </BloomColorScope>
60
+ </BloomThemeProvider>,
61
+ ),
62
+ ).toThrow();
63
+ consoleError.mockRestore();
40
64
  });
41
65
 
42
66
  it('throws when used outside BloomThemeProvider', () => {
@@ -13,7 +13,13 @@ import React, {
13
13
  useRef,
14
14
  useState,
15
15
  } from 'react';
16
- import { useColorScheme as useRNColorScheme } from 'react-native';
16
+ import {
17
+ Platform,
18
+ View,
19
+ useColorScheme as useRNColorScheme,
20
+ type StyleProp,
21
+ type ViewStyle,
22
+ } from 'react-native';
17
23
 
18
24
  import { useControllableState } from '../hooks/useControllableState';
19
25
  import { FontLoader } from '../fonts/FontLoader';
@@ -21,6 +27,7 @@ import { FontLoader } from '../fonts/FontLoader';
21
27
  import { applyDarkClass, applyColorPresetVars } from './apply-dark-class';
22
28
  import { buildTheme } from './build-theme';
23
29
  import { type AppColorName } from './color-presets';
30
+ import { buildNativePresetStyle } from './color-scope/style-builder';
24
31
  import {
25
32
  readPersistedTheme,
26
33
  readPersistedThemeSync,
@@ -91,6 +98,13 @@ export interface BloomThemeProviderProps {
91
98
  /** Rendered while native fonts load. Ignored on web. */
92
99
  onFontsLoading?: React.ReactNode;
93
100
 
101
+ /**
102
+ * Style applied to the native `<View>` wrapper that carries the preset's
103
+ * CSS vars. Defaults to `{ flex: 1 }`. Ignored on web (the provider writes
104
+ * vars to `document.documentElement` instead of using a wrapper).
105
+ */
106
+ nativeWrapperStyle?: StyleProp<ViewStyle>;
107
+
94
108
  children: React.ReactNode;
95
109
  }
96
110
 
@@ -251,6 +265,7 @@ export function BloomThemeProvider({
251
265
  onHydrating,
252
266
  fonts = true,
253
267
  onFontsLoading,
268
+ nativeWrapperStyle,
254
269
  children,
255
270
  }: BloomThemeProviderProps) {
256
271
  const rnScheme = useRNColorScheme();
@@ -295,11 +310,24 @@ export function BloomThemeProvider({
295
310
  const shouldAwait = awaitHydration ?? Boolean(persistKey && storage);
296
311
  const isGated = shouldAwait && !hydrated;
297
312
 
313
+ const nativeVarsStyle = useMemo(
314
+ () => (Platform.OS === 'web' ? undefined : buildNativePresetStyle(colorPreset, resolved)),
315
+ [colorPreset, resolved],
316
+ );
317
+
318
+ const content = (
319
+ <FontLoader enabled={fonts} fallback={onFontsLoading}>
320
+ {isGated ? onHydrating ?? null : children}
321
+ </FontLoader>
322
+ );
323
+
298
324
  return (
299
325
  <BloomThemeContext.Provider value={contextValue}>
300
- <FontLoader enabled={fonts} fallback={onFontsLoading}>
301
- {isGated ? onHydrating ?? null : children}
302
- </FontLoader>
326
+ {Platform.OS === 'web' ? (
327
+ content
328
+ ) : (
329
+ <View style={[{ flex: 1 }, nativeVarsStyle, nativeWrapperStyle]}>{content}</View>
330
+ )}
303
331
  </BloomThemeContext.Provider>
304
332
  );
305
333
  }