@oxyhq/bloom 0.6.16 → 0.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/theme/BloomThemeProvider.js +13 -32
- package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
- package/lib/commonjs/theme/apply-dark-class.js +10 -7
- package/lib/commonjs/theme/apply-dark-class.js.map +1 -1
- package/lib/commonjs/theme/color-scope/index.js +59 -0
- package/lib/commonjs/theme/color-scope/index.js.map +1 -0
- package/lib/commonjs/theme/color-scope/index.web.js +58 -0
- package/lib/commonjs/theme/color-scope/index.web.js.map +1 -0
- package/lib/commonjs/theme/color-scope/style-builder.js +36 -0
- package/lib/commonjs/theme/color-scope/style-builder.js.map +1 -0
- package/lib/commonjs/theme/index.js +8 -1
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/module/theme/BloomThemeProvider.js +15 -33
- package/lib/module/theme/BloomThemeProvider.js.map +1 -1
- package/lib/module/theme/apply-dark-class.js +10 -7
- package/lib/module/theme/apply-dark-class.js.map +1 -1
- package/lib/module/theme/color-scope/index.js +53 -0
- package/lib/module/theme/color-scope/index.js.map +1 -0
- package/lib/module/theme/color-scope/index.web.js +52 -0
- package/lib/module/theme/color-scope/index.web.js.map +1 -0
- package/lib/module/theme/color-scope/style-builder.js +31 -0
- package/lib/module/theme/color-scope/style-builder.js.map +1 -0
- package/lib/module/theme/index.js +2 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/typescript/commonjs/icons/common.d.ts +4 -4
- package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts +8 -10
- package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/apply-dark-class.d.ts +5 -4
- package/lib/typescript/commonjs/theme/apply-dark-class.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/index.d.ts +23 -0
- package/lib/typescript/commonjs/theme/color-scope/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts +21 -0
- package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts +16 -0
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +4 -2
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/icons/common.d.ts +4 -4
- package/lib/typescript/module/theme/BloomThemeProvider.d.ts +8 -10
- package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
- package/lib/typescript/module/theme/apply-dark-class.d.ts +5 -4
- package/lib/typescript/module/theme/apply-dark-class.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/index.d.ts +23 -0
- package/lib/typescript/module/theme/color-scope/index.d.ts.map +1 -0
- package/lib/typescript/module/theme/color-scope/index.web.d.ts +21 -0
- package/lib/typescript/module/theme/color-scope/index.web.d.ts.map +1 -0
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts +16 -0
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +4 -2
- package/lib/typescript/module/theme/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/BloomColorScope.test.tsx +53 -0
- package/src/theme/BloomThemeProvider.tsx +32 -27
- package/src/theme/apply-dark-class.ts +8 -8
- package/src/theme/color-scope/index.tsx +67 -0
- package/src/theme/color-scope/index.web.tsx +65 -0
- package/src/theme/color-scope/style-builder.ts +39 -0
- package/src/theme/index.ts +3 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useContext, useMemo } from 'react';
|
|
4
|
+
import { BloomThemeContext } from "../BloomThemeProvider.js";
|
|
5
|
+
import { buildTheme } from "../build-theme.js";
|
|
6
|
+
import { buildScopeVars } from "./style-builder.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export function BloomColorScope({
|
|
9
|
+
colorPreset,
|
|
10
|
+
asChild = false,
|
|
11
|
+
style,
|
|
12
|
+
children
|
|
13
|
+
}) {
|
|
14
|
+
const parent = useContext(BloomThemeContext);
|
|
15
|
+
if (!parent) {
|
|
16
|
+
throw new Error('BloomColorScope must be used within a <BloomThemeProvider>');
|
|
17
|
+
}
|
|
18
|
+
const resolvedMode = parent.theme.mode;
|
|
19
|
+
const contextValue = useMemo(() => {
|
|
20
|
+
const theme = buildTheme(colorPreset, resolvedMode);
|
|
21
|
+
return {
|
|
22
|
+
...parent,
|
|
23
|
+
theme,
|
|
24
|
+
colorPreset
|
|
25
|
+
};
|
|
26
|
+
}, [colorPreset, resolvedMode, parent]);
|
|
27
|
+
const varsStyle = useMemo(() => ({
|
|
28
|
+
...buildScopeVars(colorPreset, resolvedMode),
|
|
29
|
+
...style
|
|
30
|
+
}), [colorPreset, resolvedMode, style]);
|
|
31
|
+
return /*#__PURE__*/_jsx(BloomThemeContext.Provider, {
|
|
32
|
+
value: contextValue,
|
|
33
|
+
children: asChild ? children : /*#__PURE__*/_jsx("div", {
|
|
34
|
+
style: varsStyle,
|
|
35
|
+
children: children
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Escape hatch for advanced cases where the wrapping element is owned by the
|
|
42
|
+
* caller. Returns a stable React style object carrying the preset's CSS vars.
|
|
43
|
+
*/
|
|
44
|
+
export function useColorScopeStyle(colorPreset) {
|
|
45
|
+
const parent = useContext(BloomThemeContext);
|
|
46
|
+
if (!parent) {
|
|
47
|
+
throw new Error('useColorScopeStyle must be used within a <BloomThemeProvider>');
|
|
48
|
+
}
|
|
49
|
+
const resolvedMode = parent.theme.mode;
|
|
50
|
+
return useMemo(() => buildScopeVars(colorPreset, resolvedMode), [colorPreset, resolvedMode]);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useContext","useMemo","BloomThemeContext","buildTheme","buildScopeVars","jsx","_jsx","BloomColorScope","colorPreset","asChild","style","children","parent","Error","resolvedMode","theme","mode","contextValue","varsStyle","Provider","value","useColorScopeStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/index.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAElD,SAASC,iBAAiB,QAAqC,0BAAuB;AACtF,SAASC,UAAU,QAAQ,mBAAgB;AAE3C,SAASC,cAAc,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAejD,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,EAAEF,MAAM,CAAC,CAAC;EAEvC,MAAMM,SAAS,GAAGjB,OAAO,CACvB,OAAO;IAAE,GAAIG,cAAc,CAACI,WAAW,EAAEM,YAAY,CAAyB;IAAE,GAAGJ;EAAM,CAAC,CAAC,EAC3F,CAACF,WAAW,EAAEM,YAAY,EAAEJ,KAAK,CACnC,CAAC;EAED,oBACEJ,IAAA,CAACJ,iBAAiB,CAACiB,QAAQ;IAACC,KAAK,EAAEH,YAAa;IAAAN,QAAA,EAC7CF,OAAO,GAAGE,QAAQ,gBAAGL,IAAA;MAAKI,KAAK,EAAEQ,SAAU;MAAAP,QAAA,EAAEA;IAAQ,CAAM;EAAC,CACnC,CAAC;AAEjC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASU,kBAAkBA,CAACb,WAAyB,EAAuB;EACjF,MAAMI,MAAM,GAAGZ,UAAU,CAACE,iBAAiB,CAAC;EAC5C,IAAI,CAACU,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,+DAA+D,CAAC;EAClF;EACA,MAAMC,YAAY,GAAGF,MAAM,CAACG,KAAK,CAACC,IAAI;EACtC,OAAOf,OAAO,CACZ,MAAMG,cAAc,CAACI,WAAW,EAAEM,YAAY,CAAwB,EACtE,CAACN,WAAW,EAAEM,YAAY,CAC5B,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { getPresetVars } from "../preset-vars.js";
|
|
5
|
+
import { lazyRequire } from "../../utils/lazy-require.js";
|
|
6
|
+
const getNativeWindVars = lazyRequire('nativewind');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Build the CSS custom-property map for a preset, ready to be applied to a
|
|
10
|
+
* subtree. Always includes the resolved `--color-*` vars so Tailwind v4
|
|
11
|
+
* `@theme` utilities (e.g. `bg-background`) honour the scope.
|
|
12
|
+
*/
|
|
13
|
+
export function buildScopeVars(colorPreset, mode) {
|
|
14
|
+
return getPresetVars(colorPreset, mode, {
|
|
15
|
+
includeResolvedColorVars: true
|
|
16
|
+
});
|
|
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
|
+
}
|
|
31
|
+
//# sourceMappingURL=style-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export { BloomThemeProvider
|
|
3
|
+
export { BloomThemeProvider } from "./BloomThemeProvider.js";
|
|
4
|
+
export { BloomColorScope, useColorScopeStyle } from './color-scope';
|
|
4
5
|
export { buildTheme, STATUS_COLORS } from "./build-theme.js";
|
|
5
6
|
export { useTheme, useThemeColor, useBloomTheme } from "./use-theme.js";
|
|
6
7
|
export { APP_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName } from "./color-presets.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BloomThemeProvider","BloomColorScope","buildTheme","STATUS_COLORS","useTheme","useThemeColor","useBloomTheme","APP_COLOR_NAMES","PREMIUM_COLOR_NAMES","APP_COLOR_PRESETS","HEX_TO_APP_COLOR","hexToAppColorName","getPresetVars","applyPresetVarsToDocument","applyDarkClass","setColorSchemeSafe","initCssInteropDarkMode","webLocalStorage"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,
|
|
1
|
+
{"version":3,"names":["BloomThemeProvider","BloomColorScope","useColorScopeStyle","buildTheme","STATUS_COLORS","useTheme","useThemeColor","useBloomTheme","APP_COLOR_NAMES","PREMIUM_COLOR_NAMES","APP_COLOR_PRESETS","HEX_TO_APP_COLOR","hexToAppColorName","getPresetVars","applyPresetVarsToDocument","applyDarkClass","setColorSchemeSafe","initCssInteropDarkMode","webLocalStorage"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAsB;AAKzD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AAEnE,SAASC,UAAU,EAAEC,aAAa,QAAQ,kBAAe;AACzD,SAASC,QAAQ,EAAEC,aAAa,EAAEC,aAAa,QAAQ,gBAAa;AAGpE,SACEC,eAAe,EACfC,mBAAmB,EACnBC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,QACZ,oBAAiB;AACxB,SACEC,aAAa,EACbC,yBAAyB,QACpB,kBAAe;AAEtB,SAASC,cAAc,QAAQ,uBAAoB;AACnD,SAASC,kBAAkB,QAAQ,4BAAyB;AAC5D,SAASC,sBAAsB,QAAQ,uBAAoB;AAE3D,SAASC,eAAe,QAAQ,kBAAe","ignoreList":[]}
|
|
@@ -37,11 +37,7 @@ export declare function useCommonSVGProps(props: Props): {
|
|
|
37
37
|
title?: string | undefined;
|
|
38
38
|
children?: React.ReactNode;
|
|
39
39
|
filter?: string | undefined;
|
|
40
|
-
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
41
40
|
color?: ColorValue | undefined;
|
|
42
|
-
fontSize?: import("react-native-svg").NumberProp | undefined;
|
|
43
|
-
fontWeight?: import("react-native-svg").FontWeight | undefined;
|
|
44
|
-
fontStyle?: import("react-native-svg").FontStyle | undefined;
|
|
45
41
|
scale?: import("react-native-svg").NumberArray | undefined;
|
|
46
42
|
scaleX?: import("react-native-svg").NumberProp | undefined;
|
|
47
43
|
scaleY?: import("react-native-svg").NumberProp | undefined;
|
|
@@ -53,6 +49,7 @@ export declare function useCommonSVGProps(props: Props): {
|
|
|
53
49
|
id?: string | undefined;
|
|
54
50
|
needsOffscreenAlphaCompositing?: boolean | undefined | undefined;
|
|
55
51
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
52
|
+
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
56
53
|
removeClippedSubviews?: boolean | undefined | undefined;
|
|
57
54
|
testID?: string | undefined;
|
|
58
55
|
nativeID?: string | undefined | undefined;
|
|
@@ -139,6 +136,9 @@ export declare function useCommonSVGProps(props: Props): {
|
|
|
139
136
|
accessibilityShowsLargeContentViewer?: boolean | undefined | undefined;
|
|
140
137
|
accessibilityLargeContentTitle?: string | undefined | undefined;
|
|
141
138
|
accessibilityRespondsToUserInteraction?: boolean | undefined | undefined;
|
|
139
|
+
fontSize?: import("react-native-svg").NumberProp | undefined;
|
|
140
|
+
fontWeight?: import("react-native-svg").FontWeight | undefined;
|
|
141
|
+
fontStyle?: import("react-native-svg").FontStyle | undefined;
|
|
142
142
|
width?: import("react-native-svg").NumberProp | undefined;
|
|
143
143
|
height?: import("react-native-svg").NumberProp | undefined;
|
|
144
144
|
viewBox?: string | 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,16 +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;
|
|
58
|
-
/**
|
|
59
|
-
* Scoped color override for a subtree. Inherits the resolved mode from the
|
|
60
|
-
* parent `BloomThemeProvider` but renders descendants with a different preset.
|
|
61
|
-
*/
|
|
62
|
-
export interface BloomColorScopeProps {
|
|
63
|
-
colorPreset: AppColorName;
|
|
64
|
-
children: React.ReactNode;
|
|
65
|
-
}
|
|
66
|
-
export declare function BloomColorScope({ colorPreset, children }: BloomColorScopeProps): 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;
|
|
67
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;
|
|
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;AACf,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,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;;;;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
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `hsl(var(--primary))
|
|
10
|
-
*
|
|
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;
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { AppColorName } from '../color-presets';
|
|
4
|
+
export interface BloomColorScopeProps {
|
|
5
|
+
/** Preset to apply within this subtree. */
|
|
6
|
+
colorPreset: AppColorName;
|
|
7
|
+
/**
|
|
8
|
+
* When `true`, do not render a wrapping `<View>`. The caller owns the
|
|
9
|
+
* element that receives the CSS vars (via `useColorScopeStyle`).
|
|
10
|
+
*/
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
/** Additional style applied to the wrapping `<View>`. Ignored with `asChild`. */
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function BloomColorScope({ colorPreset, asChild, style, children, }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Escape hatch for advanced cases where the wrapping element is owned by the
|
|
19
|
+
* caller. Returns a stable native style object carrying the preset's CSS vars.
|
|
20
|
+
* Returns `undefined` on web or when `nativewind` is not installed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useColorScopeStyle(colorPreset: AppColorName): StyleProp<ViewStyle>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAGrD,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AppColorName } from '../color-presets';
|
|
3
|
+
export interface BloomColorScopeProps {
|
|
4
|
+
/** Preset to apply within this subtree. */
|
|
5
|
+
colorPreset: AppColorName;
|
|
6
|
+
/**
|
|
7
|
+
* When `true`, do not render a wrapping element. The caller owns the
|
|
8
|
+
* DOM node that receives the CSS vars (via `useColorScopeStyle`).
|
|
9
|
+
*/
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
/** Additional style applied to the wrapping `<div>`. Ignored with `asChild`. */
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function BloomColorScope({ colorPreset, asChild, style, children, }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Escape hatch for advanced cases where the wrapping element is owned by the
|
|
18
|
+
* caller. Returns a stable React style object carrying the preset's CSS vars.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useColorScopeStyle(colorPreset: AppColorName): React.CSSProperties;
|
|
21
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +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;AAGrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAuBtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { AppColorName } from '../color-presets';
|
|
3
|
+
/**
|
|
4
|
+
* Build the CSS custom-property map for a preset, ready to be applied to a
|
|
5
|
+
* subtree. Always includes the resolved `--color-*` vars so Tailwind v4
|
|
6
|
+
* `@theme` utilities (e.g. `bg-background`) honour the scope.
|
|
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>;
|
|
16
|
+
//# sourceMappingURL=style-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { BloomThemeProvider
|
|
2
|
-
export type { BloomThemeProviderProps, BloomThemeContextValue,
|
|
1
|
+
export { BloomThemeProvider } from './BloomThemeProvider';
|
|
2
|
+
export type { BloomThemeProviderProps, BloomThemeContextValue, } from './BloomThemeProvider';
|
|
3
|
+
export { BloomColorScope, useColorScopeStyle } from './color-scope';
|
|
4
|
+
export type { BloomColorScopeProps } from './color-scope';
|
|
3
5
|
export { buildTheme, STATUS_COLORS } from './build-theme';
|
|
4
6
|
export { useTheme, useThemeColor, useBloomTheme } from './use-theme';
|
|
5
7
|
export type { Theme, ThemeColors, ThemeMode } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -37,11 +37,7 @@ export declare function useCommonSVGProps(props: Props): {
|
|
|
37
37
|
title?: string | undefined;
|
|
38
38
|
children?: React.ReactNode;
|
|
39
39
|
filter?: string | undefined;
|
|
40
|
-
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
41
40
|
color?: ColorValue | undefined;
|
|
42
|
-
fontSize?: import("react-native-svg").NumberProp | undefined;
|
|
43
|
-
fontWeight?: import("react-native-svg").FontWeight | undefined;
|
|
44
|
-
fontStyle?: import("react-native-svg").FontStyle | undefined;
|
|
45
41
|
scale?: import("react-native-svg").NumberArray | undefined;
|
|
46
42
|
scaleX?: import("react-native-svg").NumberProp | undefined;
|
|
47
43
|
scaleY?: import("react-native-svg").NumberProp | undefined;
|
|
@@ -53,6 +49,7 @@ export declare function useCommonSVGProps(props: Props): {
|
|
|
53
49
|
id?: string | undefined;
|
|
54
50
|
needsOffscreenAlphaCompositing?: boolean | undefined | undefined;
|
|
55
51
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
52
|
+
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
56
53
|
removeClippedSubviews?: boolean | undefined | undefined;
|
|
57
54
|
testID?: string | undefined;
|
|
58
55
|
nativeID?: string | undefined | undefined;
|
|
@@ -139,6 +136,9 @@ export declare function useCommonSVGProps(props: Props): {
|
|
|
139
136
|
accessibilityShowsLargeContentViewer?: boolean | undefined | undefined;
|
|
140
137
|
accessibilityLargeContentTitle?: string | undefined | undefined;
|
|
141
138
|
accessibilityRespondsToUserInteraction?: boolean | undefined | undefined;
|
|
139
|
+
fontSize?: import("react-native-svg").NumberProp | undefined;
|
|
140
|
+
fontWeight?: import("react-native-svg").FontWeight | undefined;
|
|
141
|
+
fontStyle?: import("react-native-svg").FontStyle | undefined;
|
|
142
142
|
width?: import("react-native-svg").NumberProp | undefined;
|
|
143
143
|
height?: import("react-native-svg").NumberProp | undefined;
|
|
144
144
|
viewBox?: string | 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,16 +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;
|
|
58
|
-
/**
|
|
59
|
-
* Scoped color override for a subtree. Inherits the resolved mode from the
|
|
60
|
-
* parent `BloomThemeProvider` but renders descendants with a different preset.
|
|
61
|
-
*/
|
|
62
|
-
export interface BloomColorScopeProps {
|
|
63
|
-
colorPreset: AppColorName;
|
|
64
|
-
children: React.ReactNode;
|
|
65
|
-
}
|
|
66
|
-
export declare function BloomColorScope({ colorPreset, children }: BloomColorScopeProps): 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;
|
|
67
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;
|
|
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;AACf,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,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;;;;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
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `hsl(var(--primary))
|
|
10
|
-
*
|
|
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;
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { AppColorName } from '../color-presets';
|
|
4
|
+
export interface BloomColorScopeProps {
|
|
5
|
+
/** Preset to apply within this subtree. */
|
|
6
|
+
colorPreset: AppColorName;
|
|
7
|
+
/**
|
|
8
|
+
* When `true`, do not render a wrapping `<View>`. The caller owns the
|
|
9
|
+
* element that receives the CSS vars (via `useColorScopeStyle`).
|
|
10
|
+
*/
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
/** Additional style applied to the wrapping `<View>`. Ignored with `asChild`. */
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function BloomColorScope({ colorPreset, asChild, style, children, }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Escape hatch for advanced cases where the wrapping element is owned by the
|
|
19
|
+
* caller. Returns a stable native style object carrying the preset's CSS vars.
|
|
20
|
+
* Returns `undefined` on web or when `nativewind` is not installed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useColorScopeStyle(colorPreset: AppColorName): StyleProp<ViewStyle>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAGrD,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AppColorName } from '../color-presets';
|
|
3
|
+
export interface BloomColorScopeProps {
|
|
4
|
+
/** Preset to apply within this subtree. */
|
|
5
|
+
colorPreset: AppColorName;
|
|
6
|
+
/**
|
|
7
|
+
* When `true`, do not render a wrapping element. The caller owns the
|
|
8
|
+
* DOM node that receives the CSS vars (via `useColorScopeStyle`).
|
|
9
|
+
*/
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
/** Additional style applied to the wrapping `<div>`. Ignored with `asChild`. */
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function BloomColorScope({ colorPreset, asChild, style, children, }: BloomColorScopeProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Escape hatch for advanced cases where the wrapping element is owned by the
|
|
18
|
+
* caller. Returns a stable React style object carrying the preset's CSS vars.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useColorScopeStyle(colorPreset: AppColorName): React.CSSProperties;
|
|
21
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +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;AAGrD,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CAuBtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { AppColorName } from '../color-presets';
|
|
3
|
+
/**
|
|
4
|
+
* Build the CSS custom-property map for a preset, ready to be applied to a
|
|
5
|
+
* subtree. Always includes the resolved `--color-*` vars so Tailwind v4
|
|
6
|
+
* `@theme` utilities (e.g. `bg-background`) honour the scope.
|
|
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>;
|
|
16
|
+
//# sourceMappingURL=style-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { BloomThemeProvider
|
|
2
|
-
export type { BloomThemeProviderProps, BloomThemeContextValue,
|
|
1
|
+
export { BloomThemeProvider } from './BloomThemeProvider';
|
|
2
|
+
export type { BloomThemeProviderProps, BloomThemeContextValue, } from './BloomThemeProvider';
|
|
3
|
+
export { BloomColorScope, useColorScopeStyle } from './color-scope';
|
|
4
|
+
export type { BloomColorScopeProps } from './color-scope';
|
|
3
5
|
export { buildTheme, STATUS_COLORS } from './build-theme';
|
|
4
6
|
export { useTheme, useThemeColor, useBloomTheme } from './use-theme';
|
|
5
7
|
export type { Theme, ThemeColors, ThemeMode } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { render } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
import { BloomThemeProvider } from '../theme/BloomThemeProvider';
|
|
6
|
+
import { BloomColorScope } from '../theme/color-scope';
|
|
7
|
+
import { useBloomTheme } from '../theme/use-theme';
|
|
8
|
+
|
|
9
|
+
function CurrentPreset() {
|
|
10
|
+
const { colorPreset } = useBloomTheme();
|
|
11
|
+
return <Text testID="preset">{colorPreset}</Text>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
describe('BloomColorScope', () => {
|
|
15
|
+
it('overrides the colorPreset of its subtree without affecting the parent', () => {
|
|
16
|
+
const { getAllByTestId } = render(
|
|
17
|
+
<BloomThemeProvider defaultColorPreset="blue" fonts={false}>
|
|
18
|
+
<CurrentPreset />
|
|
19
|
+
<BloomColorScope colorPreset="green">
|
|
20
|
+
<CurrentPreset />
|
|
21
|
+
</BloomColorScope>
|
|
22
|
+
</BloomThemeProvider>,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const presets = getAllByTestId('preset').map((node) => node.props.children);
|
|
26
|
+
expect(presets[0]).toBe('blue');
|
|
27
|
+
expect(presets[1]).toBe('green');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('renders children directly with asChild (no wrapper element)', () => {
|
|
31
|
+
const { getByTestId } = render(
|
|
32
|
+
<BloomThemeProvider defaultColorPreset="blue" fonts={false}>
|
|
33
|
+
<BloomColorScope colorPreset="purple" asChild>
|
|
34
|
+
<CurrentPreset />
|
|
35
|
+
</BloomColorScope>
|
|
36
|
+
</BloomThemeProvider>,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
expect(getByTestId('preset').props.children).toBe('purple');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('throws when used outside BloomThemeProvider', () => {
|
|
43
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
44
|
+
expect(() =>
|
|
45
|
+
render(
|
|
46
|
+
<BloomColorScope colorPreset="red">
|
|
47
|
+
<CurrentPreset />
|
|
48
|
+
</BloomColorScope>,
|
|
49
|
+
),
|
|
50
|
+
).toThrow('BloomColorScope must be used within a <BloomThemeProvider>');
|
|
51
|
+
consoleError.mockRestore();
|
|
52
|
+
});
|
|
53
|
+
});
|