react-native-unistyles 3.0.0-nightly-20250609 → 3.0.0-nightly-20250616
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/README.md +7 -8
- package/Unistyles.podspec +12 -1
- package/android/src/main/cxx/NativeUnistylesModule.cpp +2 -1
- package/android/src/main/cxx/NativeUnistylesModule.h +4 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +7 -0
- package/cxx/core/UnistylesRegistry.cpp +7 -6
- package/cxx/core/UnistylesRegistry.h +2 -1
- package/ios/UnistylesModuleOnLoad.mm +5 -0
- package/lib/commonjs/components/ScopedTheme.js +6 -2
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +9 -3
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +9 -3
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/reanimated/index.js +7 -0
- package/lib/commonjs/reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated/variant/index.js +17 -0
- package/lib/commonjs/reanimated/variant/index.js.map +1 -0
- package/lib/commonjs/reanimated/variant/types.js +2 -0
- package/lib/commonjs/reanimated/variant/types.js.map +1 -0
- package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js +38 -0
- package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js.map +1 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js +66 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js.map +1 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js +39 -0
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js.map +1 -0
- package/lib/commonjs/web/convert/pseudo.js +13 -3
- package/lib/commonjs/web/convert/pseudo.js.map +1 -1
- package/lib/commonjs/web/create.js +1 -1
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/css/core.js +3 -1
- package/lib/commonjs/web/css/core.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +3 -2
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/types.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +13 -1
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/ScopedTheme.js +6 -2
- package/lib/module/components/ScopedTheme.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +9 -3
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +9 -3
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/reanimated/index.js +1 -0
- package/lib/module/reanimated/index.js.map +1 -1
- package/lib/module/reanimated/variant/index.js +4 -0
- package/lib/module/reanimated/variant/index.js.map +1 -0
- package/lib/module/reanimated/variant/types.js +2 -0
- package/lib/module/reanimated/variant/types.js.map +1 -0
- package/lib/module/reanimated/variant/useAnimatedVariantColor.js +33 -0
- package/lib/module/reanimated/variant/useAnimatedVariantColor.js.map +1 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.js +61 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.js.map +1 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.native.js +34 -0
- package/lib/module/reanimated/variant/useUpdateVariantColor.native.js.map +1 -0
- package/lib/module/web/convert/pseudo.js +10 -2
- package/lib/module/web/convert/pseudo.js.map +1 -1
- package/lib/module/web/create.js +1 -1
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/css/core.js +3 -1
- package/lib/module/web/css/core.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +3 -2
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/types.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +12 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/types.d.ts +3 -1
- package/lib/typescript/src/core/withUnistyles/types.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/reanimated/index.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/variant/index.d.ts +2 -0
- package/lib/typescript/src/reanimated/variant/index.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/types.d.ts +10 -0
- package/lib/typescript/src/reanimated/variant/types.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts +3 -0
- package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts +6 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts +6 -0
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/pseudo.d.ts +6 -3
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
- package/lib/typescript/src/web/css/core.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +4 -1
- package/lib/typescript/src/web/types.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +4 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ScopedTheme.tsx +7 -2
- package/src/core/withUnistyles/types.ts +1 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +10 -3
- package/src/core/withUnistyles/withUnistyles.tsx +11 -8
- package/src/reanimated/index.ts +1 -0
- package/src/reanimated/variant/index.ts +1 -0
- package/src/reanimated/variant/types.ts +14 -0
- package/src/reanimated/variant/useAnimatedVariantColor.ts +38 -0
- package/src/reanimated/variant/useUpdateVariantColor.native.ts +38 -0
- package/src/reanimated/variant/useUpdateVariantColor.ts +81 -0
- package/src/web/convert/pseudo.ts +23 -52
- package/src/web/create.ts +1 -1
- package/src/web/css/core.ts +3 -1
- package/src/web/shadowRegistry.ts +2 -2
- package/src/web/types.ts +4 -1
- package/src/web/utils/unistyle.ts +18 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Animated } from 'react-native';
|
|
4
4
|
import { ColorScheme, Orientation } from '../../specs/types';
|
|
5
|
-
import { isUnistylesMq, parseMq } from '../../utils';
|
|
5
|
+
import { isDefined, isUnistylesMq, parseMq } from '../../utils';
|
|
6
6
|
import * as unistyles from '../services';
|
|
7
7
|
import { UNI_GENERATED_KEYS } from '../types';
|
|
8
8
|
import { hyphenate, keyInObject, reduceObject } from './common';
|
|
@@ -108,4 +108,15 @@ export const convertTheme = (key, value, prev = '-') => {
|
|
|
108
108
|
}
|
|
109
109
|
return [key, value];
|
|
110
110
|
};
|
|
111
|
+
export const getClosestBreakpointValue = (runtime, values) => {
|
|
112
|
+
const breakpoints = runtime.breakpoints;
|
|
113
|
+
const breakpointValues = Object.entries(values)
|
|
114
|
+
// Filter out non-breakpoint values
|
|
115
|
+
.filter(pair => pair[0] in breakpoints)
|
|
116
|
+
// Sort in descending order
|
|
117
|
+
.sort(([a], [b]) => (breakpoints[b] ?? 0) - (breakpoints[a] ?? 0));
|
|
118
|
+
// Get breakpoint value with highest priority
|
|
119
|
+
const [_, currentBreakpointValue] = breakpointValues.find(([key]) => isDefined(runtime.breakpoint) && (breakpoints[key] ?? 0) <= (breakpoints[runtime.breakpoint] ?? 0)) ?? [];
|
|
120
|
+
return currentBreakpointValue;
|
|
121
|
+
};
|
|
111
122
|
//# sourceMappingURL=unistyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Animated","ColorScheme","Orientation","isUnistylesMq","parseMq","unistyles","UNI_GENERATED_KEYS","hyphenate","keyInObject","reduceObject","schemeToTheme","scheme","Dark","Light","assignSecrets","object","secrets","secretsId","Math","random","toString","slice","Object","defineProperties","secret","value","enumerable","configurable","extractSecrets","undefined","entries","find","key","startsWith","getOwnPropertyDescriptors","removeInlineStyles","values","returnValue","getMediaQuery","query","allBreakpoints","includes","minWidth","maxWidth","minHeight","maxHeight","queries","filter","Boolean","join","breakpointValue","services","runtime","breakpoints","nextBreakpoint","b","map","sort","a","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray","checkForProp","prop","some","nestedValue","_web","checkForAnimated","objectValues","Node","length","keys","isGeneratedUnistyle","every","convertTheme","prev","fromEntries","nestedKey"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,SAASC,WAAW,EAAEC,WAAW,QAAQ,mBAAmB;AAE5D,SAASC,aAAa,EAAEC,OAAO,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"names":["Animated","ColorScheme","Orientation","isDefined","isUnistylesMq","parseMq","unistyles","UNI_GENERATED_KEYS","hyphenate","keyInObject","reduceObject","schemeToTheme","scheme","Dark","Light","assignSecrets","object","secrets","secretsId","Math","random","toString","slice","Object","defineProperties","secret","value","enumerable","configurable","extractSecrets","undefined","entries","find","key","startsWith","getOwnPropertyDescriptors","removeInlineStyles","values","returnValue","getMediaQuery","query","allBreakpoints","includes","minWidth","maxWidth","minHeight","maxHeight","queries","filter","Boolean","join","breakpointValue","services","runtime","breakpoints","nextBreakpoint","b","map","sort","a","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray","checkForProp","prop","some","nestedValue","_web","checkForAnimated","objectValues","Node","length","keys","isGeneratedUnistyle","every","convertTheme","prev","fromEntries","nestedKey","getClosestBreakpointValue","breakpointValues","pair","_","currentBre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AG,CAAC,IAAI,CAAC,MAAMqB,WAAW,CAACD,OAAO,CAACiC,UAAU,CAAC,IAAI,CAAC,CAChH,CAAC,IAAI,EAAE;EAEP,OAAOD,sBAAsB;AACjC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedTheme.d.ts","sourceRoot":"","sources":["../../../../src/components/ScopedTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAKhD,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,eAAe,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC7B,GAAG;IACA,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gBAAgB,EAAE,IAAI,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"ScopedTheme.d.ts","sourceRoot":"","sources":["../../../../src/components/ScopedTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAKhD,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,eAAe,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC7B,GAAG;IACA,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gBAAgB,EAAE,IAAI,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAqCpF,CAAA"}
|
|
@@ -2,5 +2,7 @@ import type { UnistylesMiniRuntime } from '../../specs';
|
|
|
2
2
|
import type { UnistylesTheme } from '../../types';
|
|
3
3
|
export declare const SUPPORTED_STYLE_PROPS: readonly ["style", "contentContainerStyle"];
|
|
4
4
|
export type SupportedStyleProps = typeof SUPPORTED_STYLE_PROPS[number];
|
|
5
|
-
export type Mappings<T = {}> = (theme: UnistylesTheme, rt: UnistylesMiniRuntime) => Omit<Partial<T>, SupportedStyleProps
|
|
5
|
+
export type Mappings<T = {}> = (theme: UnistylesTheme, rt: UnistylesMiniRuntime) => Omit<Partial<T>, SupportedStyleProps> & {
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
6
8
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,qBAAqB,6CAA8C,CAAA;AAEhF,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAA;AACtE,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,oBAAoB,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,qBAAqB,6CAA8C,CAAA;AAEhF,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAA;AACtE,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,oBAAoB,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withUnistyles.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/withUnistyles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkC,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAA;AAMrG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGvC,KAAK,qBAAqB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;AAIjD,eAAO,MAAM,aAAa,GAAI,UAAU,EAAE,SAAS,SAAS,qBAAqB,CAAC,UAAU,CAAC,EAAE,WAAW,UAAU,EAAE,WAAW,QAAQ,CAAC,SAAS,CAAC;eAGjI,QAAQ,kCAAQ;
|
|
1
|
+
{"version":3,"file":"withUnistyles.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/withUnistyles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkC,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAA;AAMrG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGvC,KAAK,qBAAqB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;AAIjD,eAAO,MAAM,aAAa,GAAI,UAAU,EAAE,SAAS,SAAS,qBAAqB,CAAC,UAAU,CAAC,EAAE,WAAW,UAAU,EAAE,WAAW,QAAQ,CAAC,SAAS,CAAC;eAGjI,QAAQ,kCAAQ;yDAwDlC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withUnistyles.native.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/withUnistyles.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAMhF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGvC,KAAK,qBAAqB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;AAcjD,eAAO,MAAM,aAAa,GAAI,UAAU,EAAE,SAAS,SAAS,qBAAqB,CAAC,UAAU,CAAC,EAAE,WAAW,UAAU,EAAE,WAAW,QAAQ,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"withUnistyles.native.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/withUnistyles.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAMhF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGvC,KAAK,qBAAqB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;AAcjD,eAAO,MAAM,aAAa,GAAI,UAAU,EAAE,SAAS,SAAS,qBAAqB,CAAC,UAAU,CAAC,EAAE,WAAW,UAAU,EAAE,WAAW,QAAQ,CAAC,SAAS,CAAC,yCA8EnJ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/reanimated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/reanimated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/reanimated/variant/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ColorKeys<T> = {
|
|
2
|
+
[K in keyof T]: K extends string ? K extends `${string}color${string}` | `${string}Color${string}` ? K : never : never;
|
|
3
|
+
}[keyof T];
|
|
4
|
+
export type UseUpdateVariantColorConfig<T extends Record<string, any>> = {
|
|
5
|
+
animateCallback?: (from: string, to: string) => void;
|
|
6
|
+
colorKey: ColorKeys<T>;
|
|
7
|
+
style: T;
|
|
8
|
+
secretKey: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/reanimated/variant/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAC1B,CAAC,SAAS,GAAG,MAAM,QAAQ,MAAM,EAAE,GAAG,GAAG,MAAM,QAAQ,MAAM,EAAE,GAC3D,CAAC,GACD,KAAK,GACT,KAAK;CACd,CAAC,MAAM,CAAC,CAAC,CAAA;AAEV,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACrE,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC;IACT,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimatedVariantColor.d.ts","sourceRoot":"","sources":["../../../../../src/reanimated/variant/useAnimatedVariantColor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,UAAU,SAAS,CAAC,CAAC,CAAC,2DAiCtG,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UseUpdateVariantColorConfig } from './types';
|
|
2
|
+
export declare const useUpdateVariantColor: <T extends Record<string, any>>({ animateCallback, colorKey, style }: UseUpdateVariantColorConfig<T>) => {
|
|
3
|
+
fromValue: import("react-native-reanimated").SharedValue<string>;
|
|
4
|
+
toValue: import("react-native-reanimated").SharedValue<string>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useUpdateVariantColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateVariantColor.d.ts","sourceRoot":"","sources":["../../../../../src/reanimated/variant/useUpdateVariantColor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,sCAIlE,2BAA2B,CAAC,CAAC,CAAC;;;CAoEhC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UseUpdateVariantColorConfig } from './types';
|
|
2
|
+
export declare const useUpdateVariantColor: <T extends Record<string, any>>({ colorKey, style, secretKey }: UseUpdateVariantColorConfig<T>) => {
|
|
3
|
+
fromValue: import("react-native-reanimated").SharedValue<string>;
|
|
4
|
+
toValue: import("react-native-reanimated").SharedValue<string>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useUpdateVariantColor.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateVariantColor.native.d.ts","sourceRoot":"","sources":["../../../../../src/reanimated/variant/useUpdateVariantColor.native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,gCAIlE,2BAA2B,CAAC,CAAC,CAAC;;;CA4BhC,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const pseudoClasses: readonly ["_active", "_any-link", "_autofill", "_buffering", "_checked", "_default", "_defined", "_dir(", "_disabled", "_empty", "_enabled", "_first", "_first-child", "_first-of-type", "_focus", "_focus-visible", "_focus-within", "_future", "_has-slotted", "_has(", "_host", "_host-context(", "_host(", "_hover", "_in-range", "_indeterminate", "_invalid", "_is(", "_lang(", "_last-child", "_last-of-type", "_left", "_link", "_modal", "_muted", "_not(", "_nth-child(", "_nth-last-child(", "_nth-last-of-type(", "_nth-of-type(", "_only-child", "_only-of-type", "_open", "_optional", "_out-of-range", "_past", "_paused", "_picture-in-picture", "_placeholder-shown", "_playing", "_popover-open", "_read-only", "_read-write", "_required", "_right", "_root", "_scope", "_seeking", "_stalled", "_state(", "_target", "_user-invalid", "_user-valid", "_valid", "_visited", "_volume-locked", "_where"];
|
|
2
|
+
declare const pseudoElements: readonly ["_after", "_backdrop", "_before", "_cue", "_details-content", "_file-selector-button", "_first-letter", "_first-line", "_grammar-error", "_highlight(", "_marker", "_part(", "_placeholder", "_selection", "_slotted(", "_spelling-error", "_target-text", "_view-transition", "_view-transition-group(", "_view-transition-image-pair(", "_view-transition-new(", "_view-transition-old("];
|
|
3
3
|
type AddDynamicSelector<T extends string> = T extends `${infer U}(` ? `${U}(${string})` : T;
|
|
4
|
-
export type Pseudo = AddDynamicSelector<typeof
|
|
4
|
+
export type Pseudo = AddDynamicSelector<(typeof pseudoClasses)[number] | (typeof pseudoElements)[number]>;
|
|
5
|
+
export declare const isPseudoClass: (selector: string) => boolean;
|
|
6
|
+
export declare const isPseudoElement: (selector: string) => boolean;
|
|
7
|
+
export declare const isPseudo: (selector: string) => boolean;
|
|
5
8
|
export {};
|
|
6
9
|
//# sourceMappingURL=pseudo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pseudo.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/pseudo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pseudo.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/pseudo.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa,43BAoET,CAAA;AAGV,QAAA,MAAM,cAAc,uYAuBV,CAAA;AAEV,KAAK,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,MAAM,GAAG,GAAG,CAAC,CAAA;AAE3F,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAEzG,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,YAA8D,CAAA;AAE5G,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,YAA+D,CAAA;AAE/G,eAAO,MAAM,QAAQ,GAAI,UAAU,MAAM,YAAyD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../src/web/css/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../src/web/css/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,QAAQ,SA+DrF,CAAA"}
|
|
@@ -14,6 +14,7 @@ export declare class UnistylesShadowRegistry {
|
|
|
14
14
|
addStyles: (unistyles: Array<UnistylesValues>, forChild?: boolean) => UniGeneratedStyle | {
|
|
15
15
|
injectedClassName: string;
|
|
16
16
|
hash: string;
|
|
17
|
+
parsedStyles: UnistylesValues;
|
|
17
18
|
};
|
|
18
19
|
setScopedTheme: (theme?: UnistylesTheme) => void;
|
|
19
20
|
getScopedTheme: () => undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAInE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAM7B;IAED,SAAS,GAAI,WAAW,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,OAAO
|
|
1
|
+
{"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAInE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAM7B;IAED,SAAS,GAAI,WAAW,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,OAAO;;;;MAoEjE;IAED,cAAc,GAAI,QAAQ,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAchC;IAED,KAAK,aAAW;CACnB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UnistylesValues } from '../types';
|
|
1
2
|
import type { UnistylesListener } from './listener';
|
|
2
3
|
import type { UnistylesRegistry } from './registry';
|
|
3
4
|
import type { UnistylesRuntime } from './runtime';
|
|
@@ -12,5 +13,7 @@ export type UnistylesServices = {
|
|
|
12
13
|
};
|
|
13
14
|
export declare const UNI_GENERATED_KEYS: readonly ["$$css", "hash", "injectedClassName"];
|
|
14
15
|
export type UniGeneratedKey = typeof UNI_GENERATED_KEYS[number];
|
|
15
|
-
export type UniGeneratedStyle = Record<UniGeneratedKey, string
|
|
16
|
+
export type UniGeneratedStyle = Record<UniGeneratedKey, string> & {
|
|
17
|
+
parsedStyles?: UnistylesValues;
|
|
18
|
+
};
|
|
16
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EAAE,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CAAC,GAAG;IAC9D,YAAY,CAAC,EAAE,eAAe,CAAA;CACjC,CAAA"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import type { UnistylesBreakpoints } from '../../global';
|
|
1
2
|
import type { UnistyleDependency } from '../../specs/NativePlatform/NativePlatform.nitro';
|
|
2
3
|
import { ColorScheme } from '../../specs/types';
|
|
3
4
|
import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet';
|
|
5
|
+
import type { UnistylesRuntime } from '../runtime';
|
|
4
6
|
import { type UniGeneratedStyle } from '../types';
|
|
5
7
|
export declare const schemeToTheme: (scheme: ColorScheme) => "light" | "dark";
|
|
6
8
|
export type UnistyleSecrets = {
|
|
7
9
|
__uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>;
|
|
8
10
|
__uni__key: string;
|
|
9
11
|
__uni__args?: Array<any>;
|
|
10
|
-
|
|
12
|
+
__stylesheetVariants: Record<string, string | boolean | undefined>;
|
|
11
13
|
};
|
|
12
14
|
export declare const assignSecrets: <T>(object: T, secrets: UnistyleSecrets) => T;
|
|
13
15
|
export declare const extractSecrets: (object: any) => {
|
|
@@ -20,4 +22,5 @@ export declare const checkForProp: (value: any, prop: string) => boolean;
|
|
|
20
22
|
export declare const checkForAnimated: (value: any) => boolean;
|
|
21
23
|
export declare const isGeneratedUnistyle: (value: Record<string, any>) => value is UniGeneratedStyle;
|
|
22
24
|
export declare const convertTheme: (key: string, value: any, prev?: string) => [string, any];
|
|
25
|
+
export declare const getClosestBreakpointValue: <T>(runtime: UnistylesRuntime, values: Partial<Record<keyof UnistylesBreakpoints, T>>) => T | undefined;
|
|
23
26
|
//# sourceMappingURL=unistyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web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mB,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,KAAK,IAAI,iBAIzE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,OAAO,GAAG,EAAE,aAAU,KAAG,CAAC,MAAM,EAAE,GAAG,CAU9E,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,CAAC,EAAE,SAAS,gBAAgB,EAAE,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,oBAAoB,EAAE,CAAC,CAAC,CAAC,kBAa7H,CAAA"}
|
package/package.json
CHANGED
|
@@ -17,9 +17,14 @@ export const ScopedTheme: React.FunctionComponent<React.PropsWithChildren<ThemeP
|
|
|
17
17
|
children,
|
|
18
18
|
invertedAdaptive
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
20
|
+
const hasAdaptiveThemes = UnistylesRuntime.hasAdaptiveThemes
|
|
21
|
+
const isAdaptiveTheme = invertedAdaptive && hasAdaptiveThemes
|
|
21
22
|
|
|
22
|
-
if (
|
|
23
|
+
if (invertedAdaptive && !hasAdaptiveThemes) {
|
|
24
|
+
return children
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!invertedAdaptive && !name) {
|
|
23
28
|
if (__DEV__) {
|
|
24
29
|
console.error('ScopedTheme: name or invertedAdaptive must be provided')
|
|
25
30
|
}
|
|
@@ -4,4 +4,4 @@ import type { UnistylesTheme } from '../../types';
|
|
|
4
4
|
export const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'] as const
|
|
5
5
|
|
|
6
6
|
export type SupportedStyleProps = typeof SUPPORTED_STYLE_PROPS[number]
|
|
7
|
-
export type Mappings<T = {}> = (theme: UnistylesTheme, rt: UnistylesMiniRuntime) => Omit<Partial<T>, SupportedStyleProps>
|
|
7
|
+
export type Mappings<T = {}> = (theme: UnistylesTheme, rt: UnistylesMiniRuntime) => Omit<Partial<T>, SupportedStyleProps> & { key?: string }
|
|
@@ -26,6 +26,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
26
26
|
type PropsWithUnistyles = Partial<TProps> & {
|
|
27
27
|
uniProps?: Mappings<TProps>
|
|
28
28
|
}
|
|
29
|
+
|
|
29
30
|
const getSecrets = (styleProps: Record<string, any> = {}): MappedSecrets => {
|
|
30
31
|
const styles = Array.isArray(styleProps)
|
|
31
32
|
? styleProps.flat()
|
|
@@ -74,8 +75,8 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
74
75
|
addDependencies(Array.from(new Set([...styleSecrets.dependencies, ...contentContainerStyleSecrets.dependencies])))
|
|
75
76
|
}, [narrowedProps.style, narrowedProps.contentContainerStyle])
|
|
76
77
|
|
|
77
|
-
const mappingsProps = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {}
|
|
78
|
-
const unistyleProps = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {}
|
|
78
|
+
const { key: mappingsKey, ...mappingsProps } = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {}
|
|
79
|
+
const { key: uniPropsKey, ...unistyleProps } = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {}
|
|
79
80
|
|
|
80
81
|
const styleSecrets = getSecrets(narrowedProps.style)
|
|
81
82
|
const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle)
|
|
@@ -90,6 +91,12 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
90
91
|
} : {},
|
|
91
92
|
} as any
|
|
92
93
|
|
|
93
|
-
return
|
|
94
|
+
return (
|
|
95
|
+
<NativeComponent
|
|
96
|
+
key={uniPropsKey || mappingsKey}
|
|
97
|
+
{...finalProps as TProps}
|
|
98
|
+
ref={ref}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
94
101
|
})
|
|
95
102
|
}
|
|
@@ -27,16 +27,15 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
27
27
|
const contentContainerStyleClassNames = getClassName(narrowedProps.contentContainerStyle)
|
|
28
28
|
const { proxifiedRuntime, proxifiedTheme } = useProxifiedUnistyles()
|
|
29
29
|
|
|
30
|
-
const mappingsProps = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {}
|
|
31
|
-
const unistyleProps = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {}
|
|
32
|
-
|
|
30
|
+
const { key: mappingsKey, ...mappingsProps } = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {}
|
|
31
|
+
const { key: uniPropsKey, ...unistyleProps } = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {}
|
|
33
32
|
|
|
34
33
|
const emptyStyles = narrowedProps.style
|
|
35
34
|
? Object.fromEntries(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
Object.entries(Object.getOwnPropertyDescriptors(narrowedProps.style))
|
|
36
|
+
.filter(([key]) => !key.startsWith("unistyles") && !key.startsWith("_"))
|
|
37
|
+
.map(([key]) => [key, undefined])
|
|
38
|
+
)
|
|
40
39
|
: undefined
|
|
41
40
|
|
|
42
41
|
const combinedProps = {
|
|
@@ -63,7 +62,11 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
63
62
|
className={classNames?.hash}
|
|
64
63
|
style={{ display: 'contents' }}
|
|
65
64
|
>
|
|
66
|
-
<NativeComponent
|
|
65
|
+
<NativeComponent
|
|
66
|
+
key={uniPropsKey || mappingsKey}
|
|
67
|
+
{...combinedProps}
|
|
68
|
+
ref={ref}
|
|
69
|
+
/>
|
|
67
70
|
</div>
|
|
68
71
|
)
|
|
69
72
|
})
|
package/src/reanimated/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useAnimatedVariantColor'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ColorKeys<T> = {
|
|
2
|
+
[K in keyof T]: K extends string
|
|
3
|
+
? K extends `${string}color${string}` | `${string}Color${string}`
|
|
4
|
+
? K
|
|
5
|
+
: never
|
|
6
|
+
: never
|
|
7
|
+
}[keyof T]
|
|
8
|
+
|
|
9
|
+
export type UseUpdateVariantColorConfig<T extends Record<string, any>> = {
|
|
10
|
+
animateCallback?: (from: string, to: string) => void,
|
|
11
|
+
colorKey: ColorKeys<T>,
|
|
12
|
+
style: T,
|
|
13
|
+
secretKey: string | undefined
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { interpolateColor, useDerivedValue, useSharedValue } from 'react-native-reanimated'
|
|
2
|
+
import type { ColorKeys } from './types'
|
|
3
|
+
import { useUpdateVariantColor } from './useUpdateVariantColor'
|
|
4
|
+
|
|
5
|
+
export const useAnimatedVariantColor = <T extends Record<string, any>>(style: T, colorKey: ColorKeys<T>) => {
|
|
6
|
+
const secretKey = Object.keys(style).find(key => key.startsWith('unistyles_'))
|
|
7
|
+
// @ts-ignore this is hidden from TS
|
|
8
|
+
const hasVariants = style[secretKey]?.__stylesheetVariants
|
|
9
|
+
|
|
10
|
+
if (!hasVariants || !colorKey.toLowerCase().includes('color')) {
|
|
11
|
+
throw new Error('useAnimatedVariantColor: Style was not created by Unistyles, does not have variants or has no color property')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { fromValue, toValue } = useUpdateVariantColor({
|
|
15
|
+
animateCallback: (from, to) => animate(from, to),
|
|
16
|
+
colorKey,
|
|
17
|
+
secretKey,
|
|
18
|
+
style,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const progress = useSharedValue(1)
|
|
22
|
+
const animate = (from: string, to: string) => {
|
|
23
|
+
'worklet'
|
|
24
|
+
|
|
25
|
+
fromValue.set(from)
|
|
26
|
+
toValue.set(to)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const derivedColor = useDerivedValue(() => {
|
|
30
|
+
return interpolateColor(
|
|
31
|
+
progress.value,
|
|
32
|
+
[0, 1],
|
|
33
|
+
[fromValue.get(), toValue.get()]
|
|
34
|
+
)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
return derivedColor
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect } from 'react'
|
|
2
|
+
import { useSharedValue } from 'react-native-reanimated'
|
|
3
|
+
import { StyleSheet, UnistyleDependency } from '../../specs'
|
|
4
|
+
import type { UseUpdateVariantColorConfig } from './types'
|
|
5
|
+
|
|
6
|
+
export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
7
|
+
colorKey,
|
|
8
|
+
style,
|
|
9
|
+
secretKey
|
|
10
|
+
}: UseUpdateVariantColorConfig<T>) => {
|
|
11
|
+
const fromValue = useSharedValue<string>(style[colorKey])
|
|
12
|
+
const toValue = useSharedValue<string>(style[colorKey])
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
// @ts-ignore this is hidden from TS
|
|
16
|
+
const dispose = StyleSheet.addChangeListener(changedDependencies => {
|
|
17
|
+
if (changedDependencies.includes(UnistyleDependency.Theme) || changedDependencies.includes(UnistyleDependency.Breakpoints)) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const newStyles = style[secretKey]?.uni__getStyles()
|
|
20
|
+
|
|
21
|
+
fromValue.set(toValue.value)
|
|
22
|
+
toValue.set(newStyles[colorKey])
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return () => dispose()
|
|
27
|
+
}, [style, colorKey])
|
|
28
|
+
|
|
29
|
+
useLayoutEffect(() => {
|
|
30
|
+
fromValue.set(toValue.value)
|
|
31
|
+
toValue.set(style[colorKey])
|
|
32
|
+
}, [style, colorKey])
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
fromValue,
|
|
36
|
+
toValue
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react'
|
|
2
|
+
import { runOnUI, useSharedValue } from 'react-native-reanimated'
|
|
3
|
+
import { UnistyleDependency } from '../../specs'
|
|
4
|
+
import type { UnistylesValues } from '../../types'
|
|
5
|
+
import { services } from '../../web/services'
|
|
6
|
+
import { getClosestBreakpointValue } from '../../web/utils'
|
|
7
|
+
import type { UseUpdateVariantColorConfig } from './types'
|
|
8
|
+
|
|
9
|
+
export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
10
|
+
animateCallback,
|
|
11
|
+
colorKey,
|
|
12
|
+
style
|
|
13
|
+
}: UseUpdateVariantColorConfig<T>) => {
|
|
14
|
+
const [dummyDiv] = useState(() => {
|
|
15
|
+
const div = document.createElement('div')
|
|
16
|
+
|
|
17
|
+
div.style.display = 'none'
|
|
18
|
+
document.body.appendChild(div)
|
|
19
|
+
|
|
20
|
+
return div
|
|
21
|
+
})
|
|
22
|
+
const parsedStyles = useMemo(() => {
|
|
23
|
+
return services.shadowRegistry.addStyles([style]).parsedStyles
|
|
24
|
+
}, [style])
|
|
25
|
+
const getCurrentColor = useCallback(
|
|
26
|
+
() => {
|
|
27
|
+
if (!parsedStyles) {
|
|
28
|
+
return 'rgb(0, 0, 0)'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const currentColor = parsedStyles[colorKey as keyof UnistylesValues] as string | Record<string, string>
|
|
32
|
+
const currentColorVar = typeof currentColor === 'string'
|
|
33
|
+
? currentColor
|
|
34
|
+
: getClosestBreakpointValue<string>(services.runtime, currentColor) ?? 'rgb(0, 0, 0)'
|
|
35
|
+
|
|
36
|
+
if (currentColorVar.startsWith('var(--')) {
|
|
37
|
+
dummyDiv.style.color = currentColorVar
|
|
38
|
+
|
|
39
|
+
return getComputedStyle(dummyDiv).color
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return currentColorVar
|
|
43
|
+
},
|
|
44
|
+
[style, colorKey]
|
|
45
|
+
)
|
|
46
|
+
const fromValue = useSharedValue<string>(getCurrentColor())
|
|
47
|
+
const toValue = useSharedValue<string>(getCurrentColor())
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const dispose = services.listener.addListeners([UnistyleDependency.Theme], () => {
|
|
51
|
+
runOnUI(() => {
|
|
52
|
+
animateCallback?.(toValue.get(), getCurrentColor())
|
|
53
|
+
})()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return () => dispose()
|
|
57
|
+
}, [style, colorKey])
|
|
58
|
+
|
|
59
|
+
useLayoutEffect(() => {
|
|
60
|
+
animateCallback?.(toValue.get(), getCurrentColor())
|
|
61
|
+
|
|
62
|
+
const colorStyle = parsedStyles?.[colorKey as keyof UnistylesValues]
|
|
63
|
+
|
|
64
|
+
if (typeof colorStyle !== 'object' || colorStyle === null) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const dispose = services.listener.addListeners([UnistyleDependency.Breakpoints], () => {
|
|
69
|
+
animateCallback?.(toValue.get(), getCurrentColor())
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return () => dispose()
|
|
73
|
+
}, [style, colorKey])
|
|
74
|
+
|
|
75
|
+
useEffect(() => () => dummyDiv.remove(), [])
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
fromValue,
|
|
79
|
+
toValue
|
|
80
|
+
}
|
|
81
|
+
}
|