react-native-unistyles 3.0.0-alpha.38 → 3.0.0-alpha.39
Sign up to get free protection for your applications and to get access to all the features.
- package/android/build.gradle +4 -4
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +13 -30
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +22 -18
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +10 -5
- package/cxx/core/UnistyleWrapper.h +27 -10
- package/cxx/core/UnistylesRegistry.cpp +34 -10
- package/cxx/core/UnistylesRegistry.h +2 -2
- package/cxx/hybridObjects/HybridNavigationBar.cpp +0 -4
- package/cxx/hybridObjects/HybridNavigationBar.h +0 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +7 -3
- package/cxx/hybridObjects/HybridStatusBar.cpp +0 -4
- package/cxx/hybridObjects/HybridStatusBar.h +0 -1
- package/cxx/hybridObjects/HybridStyleSheet.cpp +59 -28
- package/cxx/hybridObjects/HybridStyleSheet.h +7 -3
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +37 -6
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +7 -3
- package/cxx/parser/Parser.cpp +7 -7
- package/cxx/parser/Parser.h +2 -2
- package/ios/NativePlatform+ios.swift +2 -4
- package/ios/NativePlatform+keyboard.swift +1 -1
- package/ios/NativePlatformListener+ios.swift +6 -6
- package/ios/UnistylesModuleOnLoad.h +1 -6
- package/lib/commonjs/core/createUnistylesComponent.js +27 -20
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.native.js +14 -17
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js +0 -15
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +5 -7
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js +0 -5
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +0 -2
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/utils.js +26 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/web/convert/index.js +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +2 -1
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/object/objectStyle.js +3 -2
- package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -1
- package/lib/commonjs/web/convert/shadow/boxShadow.js +1 -1
- package/lib/commonjs/web/convert/shadow/textShadow.js +1 -1
- package/lib/commonjs/web/create.js +2 -1
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -1
- package/lib/commonjs/web/listener.js +18 -2
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/mock.js +1 -2
- package/lib/commonjs/web/mock.js.map +1 -1
- package/lib/commonjs/web/runtime.js +5 -2
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +53 -73
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +1 -24
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/commonjs/web/variants/getVariants.js +1 -1
- package/lib/module/core/createUnistylesComponent.js +28 -21
- package/lib/module/core/createUnistylesComponent.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.native.js +15 -18
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/module/specs/NavigtionBar/index.js +0 -10
- package/lib/module/specs/NavigtionBar/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +5 -7
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js +1 -6
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +0 -2
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/utils.js +21 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/web/convert/index.js +1 -1
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +2 -1
- package/lib/module/web/convert/object/boxShadow.js.map +1 -1
- package/lib/module/web/convert/object/objectStyle.js +2 -1
- package/lib/module/web/convert/object/objectStyle.js.map +1 -1
- package/lib/module/web/convert/shadow/boxShadow.js +1 -1
- package/lib/module/web/convert/shadow/boxShadow.js.map +1 -1
- package/lib/module/web/convert/shadow/textShadow.js +1 -1
- package/lib/module/web/convert/shadow/textShadow.js.map +1 -1
- package/lib/module/web/create.js +2 -1
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/index.js +1 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js +18 -2
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/mock.js +1 -2
- package/lib/module/web/mock.js.map +1 -1
- package/lib/module/web/runtime.js +6 -3
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +51 -71
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/utils/common.js +0 -22
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/variants/getVariants.js +1 -1
- package/lib/module/web/variants/getVariants.js.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +2 -4
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts +0 -1
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts +1 -15
- package/lib/typescript/src/specs/NavigtionBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +3 -3
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts +0 -1
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts +2 -9
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/mock.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +1 -3
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +0 -4
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +57 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +8 -16
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +2 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/{Func_void_std__vector_UnistyleDependency_.kt → Func_void_UnistylesNativeMiniRuntime.kt} +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/{Func_void.kt → Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt} +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +4 -12
- package/nitrogen/generated/android/unistylesOnLoad.cpp +4 -4
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +43 -30
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +2 -8
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -4
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +10 -32
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +0 -2
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +2 -4
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +0 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +0 -1
- package/package.json +4 -2
- package/plugin/common.js +12 -1
- package/plugin/index.js +12 -10
- package/plugin/ref.js +80 -15
- package/plugin/style.js +113 -18
- package/src/core/createUnistylesComponent.native.tsx +15 -22
- package/src/core/createUnistylesComponent.tsx +29 -23
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +2 -4
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +0 -1
- package/src/specs/NavigtionBar/index.ts +1 -30
- package/src/specs/ShadowRegistry/index.ts +8 -11
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +0 -1
- package/src/specs/StatusBar/index.ts +2 -17
- package/src/specs/UnistylesRuntime/index.ts +1 -2
- package/src/utils.ts +22 -0
- package/src/web/convert/index.ts +1 -1
- package/src/web/convert/object/boxShadow.ts +2 -1
- package/src/web/convert/object/objectStyle.ts +2 -1
- package/src/web/convert/shadow/boxShadow.ts +1 -1
- package/src/web/convert/shadow/textShadow.ts +1 -1
- package/src/web/create.ts +2 -1
- package/src/web/index.ts +1 -1
- package/src/web/listener.ts +22 -2
- package/src/web/mock.ts +1 -2
- package/src/web/runtime.ts +7 -3
- package/src/web/shadowRegistry.ts +55 -70
- package/src/web/utils/common.ts +0 -26
- package/src/web/utils/unistyle.ts +1 -1
- package/src/web/variants/getVariants.ts +1 -1
- package/nitrogen/generated/android/c++/JFunc_void.hpp +0 -48
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +0 -60
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getVariants = void 0;
|
7
|
-
var _utils = require("
|
7
|
+
var _utils = require("../../utils");
|
8
8
|
const hasVariants = value => 'variants' in value[1];
|
9
9
|
const getVariants = (styles, selectedVariants) => {
|
10
10
|
return Object.entries(styles).filter(hasVariants).filter(([_key, {
|
@@ -1,36 +1,43 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
3
|
+
import React, { useEffect, useState, forwardRef, useRef, useMemo } from 'react';
|
4
4
|
import { UnistylesRuntime } from '../specs';
|
5
5
|
import { UnistyleDependency } from '../specs/NativePlatform';
|
6
6
|
import { UnistylesListener } from '../web/listener';
|
7
7
|
import { UnistylesShadowRegistry } from '../web';
|
8
8
|
import { equal } from '../web/utils';
|
9
|
+
import { deepMergeObjects } from '../utils';
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
11
|
const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
|
11
12
|
const ALL_DEPENDENCIES = Object.values(UnistyleDependency).filter(dependency => typeof dependency === 'number');
|
12
13
|
const useShadowRegistry = style => {
|
13
|
-
const [classNames, setClassNames] = useState([]);
|
14
14
|
const [ref] = useState(document.createElement('div'));
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
const oldClassNames = useRef([]);
|
16
|
+
const classNames = useMemo(() => {
|
17
|
+
if (!style) {
|
18
|
+
return [];
|
19
|
+
}
|
20
|
+
const newClassNames = UnistylesShadowRegistry.add(ref, [style], undefined, []) ?? [];
|
21
|
+
if (equal(oldClassNames.current, newClassNames)) {
|
22
|
+
return oldClassNames.current;
|
23
|
+
}
|
24
|
+
oldClassNames.current = newClassNames;
|
25
|
+
return newClassNames;
|
26
|
+
}, [style]);
|
23
27
|
useEffect(() => () => {
|
24
28
|
// Remove styles on unmount
|
25
|
-
|
29
|
+
if (style) {
|
30
|
+
UnistylesShadowRegistry.add(null, [style], undefined, []);
|
31
|
+
}
|
26
32
|
});
|
27
33
|
return classNames;
|
28
34
|
};
|
29
35
|
export const createUnistylesComponent = (Component, mappings) => {
|
30
|
-
return props => {
|
36
|
+
return /*#__PURE__*/forwardRef((props, ref) => {
|
37
|
+
const narrowedProps = props;
|
31
38
|
const [mappingsProps, setMappingsProps] = useState(mappings?.(UnistylesRuntime.getTheme()));
|
32
|
-
const styleClassNames = useShadowRegistry(
|
33
|
-
const contentContainerStyleClassNames = useShadowRegistry(
|
39
|
+
const styleClassNames = useShadowRegistry(narrowedProps.style);
|
40
|
+
const contentContainerStyleClassNames = useShadowRegistry(narrowedProps.contentContainerStyle);
|
34
41
|
useEffect(() => {
|
35
42
|
const disposeMappings = UnistylesListener.addListeners(ALL_DEPENDENCIES, () => {
|
36
43
|
if (!mappings) {
|
@@ -40,17 +47,16 @@ export const createUnistylesComponent = (Component, mappings) => {
|
|
40
47
|
return setMappingsProps(mappings(UnistylesRuntime.getTheme()));
|
41
48
|
});
|
42
49
|
return () => disposeMappings();
|
43
|
-
}, [mappingsProps,
|
50
|
+
}, [mappingsProps, narrowedProps.style]);
|
44
51
|
const combinedProps = {
|
45
|
-
...mappingsProps,
|
46
|
-
...
|
47
|
-
...(props.style ? {
|
52
|
+
...deepMergeObjects(props, mappingsProps ?? {}),
|
53
|
+
...(narrowedProps.style ? {
|
48
54
|
style: {
|
49
55
|
$$css: true,
|
50
56
|
'unistyles': styleClassNames.join(' ')
|
51
57
|
}
|
52
58
|
} : {}),
|
53
|
-
...(
|
59
|
+
...(narrowedProps.contentContainerStyle ? {
|
54
60
|
style: {
|
55
61
|
$$css: true,
|
56
62
|
'unistyles': contentContainerStyleClassNames.join(' ')
|
@@ -58,8 +64,9 @@ export const createUnistylesComponent = (Component, mappings) => {
|
|
58
64
|
} : {})
|
59
65
|
};
|
60
66
|
return /*#__PURE__*/_jsx(Component, {
|
61
|
-
...combinedProps
|
67
|
+
...combinedProps,
|
68
|
+
ref: ref
|
62
69
|
});
|
63
|
-
};
|
70
|
+
});
|
64
71
|
};
|
65
72
|
//# sourceMappingURL=createUnistylesComponent.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","UnistylesRuntime","UnistyleDependency","UnistylesListener","UnistylesShadowRegistry","equal","jsx","_jsx","SUPPORTED_STYLE_PROPS","ALL_DEPENDENCIES","Object","values","filter","dependency","useShadowRegistry","style","
|
1
|
+
{"version":3,"names":["React","useEffect","useState","forwardRef","useRef","useMemo","UnistylesRuntime","UnistyleDependency","UnistylesListener","UnistylesShadowRegistry","equal","deepMergeObjects","jsx","_jsx","SUPPORTED_STYLE_PROPS","ALL_DEPENDENCIES","Object","values","filter","dependency","useShadowRegistry","style","ref","document","createElement","oldClassNames","classNames","newClassNames","add","undefined","current","createUnistylesComponent","Component","mappings","props","narrowedProps","mappingsProps","setMappingsProps","getTheme","styleClassNames","contentContainerStyleClassNames","contentContainerStyle","disposeMappings","addListeners","combinedProps","$$css","join"],"sourceRoot":"../../../src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ACO,IAAI,CAAC,GAAG;QACzC;MACJ,CAAC,GAAG,CAAC,CAAC;MACN,IAAGX,aAAa,CAACM,qBAAqB,GAAG;QACrCpB,KAAK,EAAE;UACHwB,KAAK,EAAE,IAAI;UACX,WAAW,EAAEL,+BAA+B,CAACM,IAAI,CAAC,GAAG;QACzD;MACJ,CAAC,GAAG,CAAC,CAAC;IACV,CAAsB;IAEtB,oBAAOjC,IAAA,CAACmB,SAAS;MAAA,GAAKY,aAAa;MAAEtB,GAAG,EAAEA;IAAI,CAAE,CAAC;EACrD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -1,19 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React, { useEffect, useRef, useState } from 'react';
|
3
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
4
4
|
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
5
|
+
import { deepMergeObjects } from '../utils';
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
7
|
const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
|
7
8
|
export const createUnistylesComponent = (Component, mappings) => {
|
8
|
-
return props => {
|
9
|
+
return /*#__PURE__*/forwardRef((props, ref) => {
|
10
|
+
const narrowedProps = props;
|
9
11
|
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
10
12
|
const [, setRt] = useState(0);
|
11
13
|
const stylesRef = useRef({});
|
12
14
|
const isForcedRef = useRef(false);
|
13
15
|
if (!isForcedRef.current) {
|
14
16
|
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
15
|
-
if (
|
16
|
-
if (Array.isArray(
|
17
|
+
if (narrowedProps?.[propName]) {
|
18
|
+
if (Array.isArray(narrowedProps[propName])) {
|
17
19
|
console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`);
|
18
20
|
}
|
19
21
|
|
@@ -23,20 +25,20 @@ export const createUnistylesComponent = (Component, mappings) => {
|
|
23
25
|
}
|
24
26
|
stylesRef.current = {
|
25
27
|
...stylesRef.current,
|
26
|
-
[propName]:
|
28
|
+
[propName]: narrowedProps[propName]
|
27
29
|
};
|
28
30
|
}
|
29
31
|
});
|
30
32
|
}
|
31
33
|
useEffect(() => {
|
32
34
|
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
33
|
-
const componentDependencies =
|
35
|
+
const componentDependencies = narrowedProps.style?.__proto__.uni__dependencies || mappings?.(theme).style?.__proto__.uni__dependencies;
|
34
36
|
if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(UnistyleDependency.Theme))) {
|
35
37
|
setTheme(UnistylesRuntime.getTheme());
|
36
38
|
|
37
39
|
// override with Unistyles styles
|
38
40
|
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
39
|
-
if (
|
41
|
+
if (narrowedProps?.[propName]) {
|
40
42
|
stylesRef.current = {
|
41
43
|
...stylesRef.current,
|
42
44
|
// @ts-expect-error - this is hidden from TS
|
@@ -55,24 +57,19 @@ export const createUnistylesComponent = (Component, mappings) => {
|
|
55
57
|
};
|
56
58
|
}, []);
|
57
59
|
const mergedProps = mappings?.(theme) ?? {};
|
58
|
-
|
59
|
-
if (key in mergedProps) {
|
60
|
-
mergedProps[key] = Object.assign(props[key], mergedProps[key]);
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
mergedProps[key] = props[key];
|
64
|
-
});
|
60
|
+
const finalProps = deepMergeObjects(mergedProps, props);
|
65
61
|
|
66
62
|
// override with Unistyles styles
|
67
63
|
SUPPORTED_STYLE_PROPS.forEach(propName => {
|
68
|
-
if (
|
69
|
-
|
64
|
+
if (finalProps[propName]) {
|
65
|
+
finalProps[propName] = stylesRef.current[propName];
|
70
66
|
}
|
71
67
|
});
|
72
68
|
isForcedRef.current = false;
|
73
69
|
return /*#__PURE__*/_jsx(Component, {
|
74
|
-
...
|
70
|
+
...finalProps,
|
71
|
+
ref: ref
|
75
72
|
});
|
76
|
-
};
|
73
|
+
});
|
77
74
|
};
|
78
75
|
//# sourceMappingURL=createUnistylesComponent.native.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","theme","setTheme","getTheme","setRt","stylesRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","removeChangeListener","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","Theme","some","dependency","prevState","mergedProps","
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useRef","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","deepMergeObjects","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","ref","narrowedProps","theme","setTheme","getTheme","setRt","stylesRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","removeChangeListener","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","Theme","some","dependency","prevState","mergedProps","finalProps"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAwBC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE1F,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAkC,UAAU;AAErG,SAASC,gBAAgB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAGzE,OAAO,MAAMC,wBAAwB,GAAGA,CAAmGC,SAAgC,EAAEC,QAA+C,KAAK;EAC7N,oBAAOb,UAAU,CAAoE,CAACc,KAAK,EAAEC,GAAG,KAAK;IACjG,MAAMC,aAAa,GAAGF,KAAiE;IACvF,MAAM,CAACG,KAAK,EAAEC,QAA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C,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAOd,IAAA,CAACG,SAAS;MAAA,GAAKkC,UAAU;MAAY/B,GAAG,EAAEA;IAAI,CAAE,CAAC;EAC5D,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -1,12 +1,2 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
import { processColor } from 'react-native';
|
4
|
-
export const attachNavigationBarJSMethods = hybridObject => {
|
5
|
-
const privateHybrid = hybridObject;
|
6
|
-
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
|
7
|
-
hybridObject.setBackgroundColor = color => {
|
8
|
-
const parsedColor = processColor(color) ?? 0;
|
9
|
-
privateHybrid._setBackgroundColor(parsedColor);
|
10
|
-
};
|
11
|
-
};
|
12
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["specs/NavigtionBar/index.ts"],"mappings":"","ignoreList":[]}
|
@@ -10,17 +10,15 @@ const findShadowNodeForHandle = handle => {
|
|
10
10
|
}
|
11
11
|
return node;
|
12
12
|
};
|
13
|
-
HybridShadowRegistry.add = (handle,
|
13
|
+
HybridShadowRegistry.add = (handle, styles, variants, args) => {
|
14
14
|
// virtualized nodes can be null
|
15
|
-
if (!handle || !
|
15
|
+
if (!handle || !styles || !Array.isArray(styles)) {
|
16
16
|
return;
|
17
17
|
}
|
18
18
|
|
19
|
-
//
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
HybridShadowRegistry.link(findShadowNodeForHandle(handle), style, variants ?? {}, args ?? []);
|
19
|
+
// filter Reanimated styles
|
20
|
+
const filteredStyles = styles.filter(style => !style?.initial?.updater);
|
21
|
+
HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles, variants ?? {}, args ?? []);
|
24
22
|
};
|
25
23
|
HybridShadowRegistry.remove = handle => {
|
26
24
|
if (!handle) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","
|
1
|
+
{"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","styles","variants","args","Array","isArray","filteredStyles","filter","style","initial","updater","link","remove","unlink","UnistylesShadowRegistry"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAazD,MAAMC,oBAAoB,GAAGD,YAAY,CAACE,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEhF,IAAI,CAACA,IAAI,EAAE;IACP;IACA,MAAM,IAAIK,KAAK,CAAC,uDAAuD,CAAC;EAC5E;EAEA,OAAOL,IAAI;AACf,CAAC;AAEDJ,oBAAoB,CAACU,GAAG,GAAG,CAACP,MAAM,EAAEQ,MAAM,EAAEC,QAAQ,EAAEC,IAAI,KAAK;EAC3D;EACA,IAAI,CAACV,MAAM,IAAI,CAACQ,MAAM,IAAI,CAACG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,EAAE;IAC9C;EACJ;;EAEA;EACA,MAAMK,cAAc,GAAGL,MAAM,CAACM,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,EAAEC,OAAO,EAAEC,OAAO,CAAC;EACvEpB,oBAAoB,CAACqB,IAAI,CAACnB,uBAAuB,CAACC,MAAM,CAAC,EAAEa,cAAc,EAAEJ,QAAQ,IAAI,CAAC,CAAC,EAAEC,IAAI,IAAI,EAAE,CAAC;AAC1G,CAAC;AAEDb,oBAAoB,CAACsB,MAAM,GAAGnB,MAAM,IAAI;EACpC,IAAI,CAACA,MAAM,EAAE;IACT;EACJ;EAEAH,oBAAoB,CAACuB,MAAM,CAACrB,uBAAuB,CAACC,MAAM,CAAC,CAAC;AAChE,CAAC;AAQD,OAAO,MAAMqB,uBAAuB,GAAGxB,oBAA4D","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { StatusBar as NativeStatusBar } from 'react-native';
|
4
4
|
import { StatusBarStyle } from '../types';
|
5
5
|
export const attachStatusBarJSMethods = hybridObject => {
|
6
6
|
hybridObject.setStyle = (style, animated) => {
|
@@ -19,10 +19,5 @@ export const attachStatusBarJSMethods = hybridObject => {
|
|
19
19
|
NativeStatusBar.setHidden(isHidden, animation);
|
20
20
|
privateHybrid._setHidden(isHidden);
|
21
21
|
};
|
22
|
-
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
|
23
|
-
hybridObject.setBackgroundColor = color => {
|
24
|
-
const parsedColor = processColor(color) ?? 0;
|
25
|
-
privateHybrid._setBackgroundColor(parsedColor);
|
26
|
-
};
|
27
22
|
};
|
28
23
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["StatusBar","NativeStatusBar","StatusBarStyle","attachStatusBarJSMethods","hybridObject","setStyle","style","animated","Light","setBarStyle","Dark","Default","privateHybrid","_setHidden","setHidden","isHidden","animation"],"sourceRoot":"../../../../src","sources":["specs/StatusBar/index.ts"],"mappings":";;AAAA,SAASA,SAAS,IAAIC,eAAe,QAAQ,cAAc;AAE3D,SAASC,cAAc,QAAQ,UAAU;AAUzC,OAAO,MAAMC,wBAAwB,GAAIC,YAAgC,IAAK;EAC1EA,YAAY,CAACC,QAAQ,GAAG,CAACC,KAAqB,EAAEC,QAAkB,KAAK;IACnE,QAAQD,KAAK;MACT,KAAKJ,cAAc,CAACM,KAAK;QACrB,OAAOP,eAAe,CAACQ,WAAW,CAAC,eAAe,EAAEF,QAAQ,CAAC;MACjE,KAAKL,cAAc,CAACQ,IAAI;QACpB,OAAOT,eAAe,CAACQ,WAAW,CAAC,cAAc,EAAEF,QAAQ,CAAC;MAChE,KAAKL,cAAc,CAACS,OAAO;QACvB,OAAOV,eAAe,CAACQ,WAAW,CAAC,SAAS,EAAEF,QAAQ,CAAC;IAC/D;EACJ,CAAC;EAED,MAAMK,aAAa,GAAGR,YAAyC;EAE/DQ,aAAa,CAACC,UAAU,GAAGT,YAAY,CAACU,SAAS;EACjDV,YAAY,CAACU,SAAS,GAAG,CAACC,QAAiB,EAAEC,SAAoC,KAAK;IAClFf,eAAe,CAACa,SAAS,CAACC,QAAQ,EAAEC,SAAS,CAAC;IAC9CJ,aAAa,CAACC,UAAU,CAACE,QAAQ,CAAC;EACtC,CAAC;AACL,CAAC","ignoreList":[]}
|
@@ -3,7 +3,6 @@
|
|
3
3
|
import { processColor } from 'react-native';
|
4
4
|
import { NitroModules } from 'react-native-nitro-modules';
|
5
5
|
import { attachStatusBarJSMethods } from '../StatusBar';
|
6
|
-
import { attachNavigationBarJSMethods } from '../NavigtionBar';
|
7
6
|
import { isIOS } from '../../common';
|
8
7
|
const HybridUnistylesRuntime = NitroModules.createHybridObject('UnistylesRuntime');
|
9
8
|
HybridUnistylesRuntime.statusBar = HybridUnistylesRuntime.createHybridStatusBar();
|
@@ -17,6 +16,5 @@ if (isIOS) {
|
|
17
16
|
HybridUnistylesRuntime.setImmersiveMode = isEnabled => HybridUnistylesRuntime.statusBar.setHidden(isEnabled, 'fade');
|
18
17
|
}
|
19
18
|
attachStatusBarJSMethods(HybridUnistylesRuntime.statusBar);
|
20
|
-
attachNavigationBarJSMethods(HybridUnistylesRuntime.navigationBar);
|
21
19
|
export const Runtime = HybridUnistylesRuntime;
|
22
20
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["processColor","NitroModules","attachStatusBarJSMethods","
|
1
|
+
{"version":3,"names":["processColor","NitroModules","attachStatusBarJSMethods","isIOS","HybridUnistylesRuntime","createHybridObject","statusBar","createHybridStatusBar","navigationBar","createHybridNavigationBar","_setRootViewBackgroundColor","setRootViewBackgroundColor","color","parsedColor","setImmersiveMode","isEnabled","setHidden","Runtime"],"sourceRoot":"../../../../src","sources":["specs/UnistylesRuntime/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,YAAY,QAAQ,4BAA4B;AAGzD,SAASC,wBAAwB,QAAiC,cAAc;AAGhF,SAASC,KAAK,QAAQ,cAAc;AAkCpC,MAAMC,sBAAsB,GAAGH,YAAY,CACtCI,kBAAkB,CAA0B,kBAAkB,CAAC;AAEpED,sBAAsB,CAACE,SAAS,GAAGF,sBAAsB,CAACG,qBAAqB,CAAC,CAAC;AACjFH,sBAAsB,CAACI,aAAa,GAAGJ,sBAAsB,CAACK,yBAAyB,CAAC,CAAC;AACzFL,sBAAsB,CAACM,2BAA2B,GAAGN,sBAAsB,CAACO,0BAA0B;AAEtGP,sBAAsB,CAACO,0BAA0B,GAAIC,KAAc,IAAK;EACpE,MAAMC,WAAW,GAAGb,YAAY,CAACY,KAAK,CAAC,IAAI,CAAC;EAE5CR,sBAAsB,CAACM,2BAA2B,CAACG,WAAqB,CAAC;AAC7E,CAAC;AAED,IAAIV,KAAK,EAAE;EACPC,sBAAsB,CAACU,gBAAgB,GAAIC,SAAkB,IAAKX,sBAAsB,CAACE,SAAS,CAACU,SAAS,CAACD,SAAS,EAAE,MAAM,CAAC;AACnI;AAEAb,wBAAwB,CAACE,sBAAsB,CAACE,SAAS,CAAC;AAE1D,OAAO,MAAMW,OAAO,GAAGb,sBAA0C","ignoreList":[]}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
export const deepMergeObjects = (...sources) => {
|
4
|
+
const target = {};
|
5
|
+
sources.forEach(source => {
|
6
|
+
Object.keys(source).forEach(key => {
|
7
|
+
const sourceValue = source[key];
|
8
|
+
const targetValue = target[key];
|
9
|
+
if (Object(sourceValue) == sourceValue && Object(targetValue) === targetValue) {
|
10
|
+
// @ts-expect-error - can't assign to generic
|
11
|
+
target[key] = deepMergeObjects(targetValue, sourceValue);
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
// @ts-expect-error - can't assign to generic
|
16
|
+
target[key] = sourceValue;
|
17
|
+
});
|
18
|
+
});
|
19
|
+
return target;
|
20
|
+
};
|
21
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deepMergeObjects","sources","target","forEach","source","Object","keys","key","sourceValue","targetValue"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;AAAA,OAAO,MAAMA,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CAACE,OAAO,CAACC,MAAM,IAAI;IACtBC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACD,OAAO,CAACI,GAAG,IAAI;MAC/B,MAAMC,WAAW,GAAGJ,MAAM,CAACG,GAAG,CAAC;MAC/B,MAAME,WAAW,GAAGP,MAAM,CAACK,GAAG,CAAC;MAE/B,IAAIF,MAAM,CAACG,WAAW,CAAC,IAAIA,WAAW,IAAIH,MAAM,CAACI,WAAW,CAAC,KAAKA,WAAW,EAAE;QAC3E;QACAP,MAAM,CAACK,GAAG,CAAC,GAAGP,gBAAgB,CAACS,WAAW,EAAED,WAAW,CAAC;QAExD;MACJ;;MAEA;MACAN,MAAM,CAACK,GAAG,CAAC,GAAGC,WAAW;IAC7B,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAON,MAAM;AACjB,CAAC","ignoreList":[]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import { isPseudo } from './pseudo';
|
4
4
|
import { getStyle } from './style';
|
5
|
-
import { deepMergeObjects } from '
|
5
|
+
import { deepMergeObjects } from '../../utils';
|
6
6
|
import { getTransformStyle, getBoxShadow, getFilterStyle } from './object';
|
7
7
|
import { isShadow, isFilter, isTextShadow, isTransform, isBoxShadow } from './utils';
|
8
8
|
import { getTextShadowStyle, getBoxShadowStyle } from './shadow';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isPseudo","getStyle","deepMergeObjects","getTransformStyle","getBoxShadow","getFilterStyle","isShadow","isFilter","isTextShadow","isTransform","isBoxShadow","getTextShadowStyle","getBoxShadowStyle","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,UAAU;AACnC,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,gBAAgB,QAAQ,
|
1
|
+
{"version":3,"names":["isPseudo","getStyle","deepMergeObjects","getTransformStyle","getBoxShadow","getFilterStyle","isShadow","isFilter","isTextShadow","isTransform","isBoxShadow","getTextShadowStyle","getBoxShadowStyle","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,UAAU;AACnC,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,iBAAiB,EAAEC,YAAY,EAAEC,cAAc,QAAQ,UAAU;AAC1E,SAASC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;IACzC;IAEA,IAAIb,WAAW,CAACY,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAOnB,YAAY,CAACmB,cAAc,CAAC;IACvC;;IAEA;IACA,IAAId,WAAW,CAACa,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAOpB,iBAAiB,CAACoB,cAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOL,MAAM,CAACC,OAAO,CAACI,cAAc,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAG3B,QAAQ,CAACqB,YAAY,EAAEO,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAO5B,QAAQ,CAACqB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAOrB,gBAAgB,CAAC,GAAGe,WAAW,CAAC;AAC3C,CAAC","ignoreList":[]}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import { normalizeNumericValue } from '../utils';
|
4
|
-
import {
|
4
|
+
import { keyInObject } from '../../utils';
|
5
|
+
import { deepMergeObjects } from '../../../utils';
|
5
6
|
const createBoxShadowValue = style => {
|
6
7
|
const {
|
7
8
|
offsetX,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["normalizeNumericValue","
|
1
|
+
{"version":3,"names":["normalizeNumericValue","keyInObject","deepMergeObjects","createBoxShadowValue","style","offsetX","offsetY","blurRadius","spreadDistance","color","inset","getBoxShadow","boxShadow","breakpoints","Set","forEach","shadow","key","Object","keys","value","breakpoint","add","size","boxShadowStyle","fromEntries","map","breakpointStyles","Array","from","styles"],"sourceRoot":"../../../../../src","sources":["web/convert/object/boxShadow.ts"],"mappings":";;AACA,SAASA,qBAAqB,QAAQ,UAAU;A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IAEH,OAAO;MACHL,SAAS,EAAET,oBAAoB,CAACqB,cAAc;IAClD,CAAC;EACL;EAEA,MAAMG,gBAAgB,GAAGC,KAAK,CAACC,IAAI,CAAChB,WAAW,CAAC,CAACa,GAAG,CAACL,UAAU,IAAI;IAC/D,MAAMS,MAAM,GAAGZ,MAAM,CAACO,WAAW,CAACb,SAAS,CAACc,GAAG,CAACV,MAAM,IAAI;MACtD,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;MACjC,MAAMI,KAAK,GAAGJ,MAAM,CAACC,GAAG,CAAyB;MAEjD,IAAI,OAAOG,KAAK,KAAK,QAAQ,IAAInB,WAAW,CAACmB,KAAK,EAAEC,UAAU,CAAC,EAAE;QAC7D,OAAO,CAACJ,GAAG,EAAEG,KAAK,CAACC,UAAU,CAAC,CAAC;MACnC;MAEA,OAAO,CAACJ,GAAG,EAAEG,KAAK,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO;MACH,CAACC,UAAU,GAAG;QACVT,SAAS,EAAET,oBAAoB,CAAC2B,MAAM;MAC1C;IACJ,CAAC;EACL,CAAC,CAAC;EAEF,OAAO5B,gBAAgB,CAAC,GAAGyB,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { deepMergeObjects
|
3
|
+
import { deepMergeObjects } from '../../../utils';
|
4
|
+
import { keyInObject } from '../../utils';
|
4
5
|
const createStylesValue = (styles, normalize) => styles.map(style => {
|
5
6
|
const [key] = Object.keys(style);
|
6
7
|
if (!key) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","keyInObject","createStylesValue","styles","normalize","map","style","key","Object","keys","undefined","filter","Boolean","join","getObjectStyle","styleKey","breakpoints","Set","normalStyles","forEach","property","value","Array","isArray","breakpoint","add","push","breakpointStyles","from","flatMap","stylesPerBreakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/object/objectStyle.ts"],"mappings":";;AAAA,SAASA,gBAAgB,
|
1
|
+
{"version":3,"names":["deepMergeObjects","keyInObject","createStylesValue","styles","normalize","map","style","key","Object","keys","undefined","filter","Boolean","join","getObjectStyle","styleKey","breakpoints","Set","normalStyles","forEach","property","value","Array","isArray","breakpoint","add","push","breakpointStyles","from","flatMap","stylesPerBreakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/object/objectStyle.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,WAAW,QAAQ,aAAa;AAKzC,MAAMC,iBAAiB,GAAGA,CAAyBC,MAAsB,EAAEC,SAA6B,KAAKD,MAAM,CAC9GE,GAAG,CAACC,KAAK,IAAI;EACV,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;EAEhC,IAAI,CAACC,GAAG,EAAE;IACN,OAAOG,SAAS;EACpB;EAEA,OAAON,SAAS,CAACG,GAAG,EAAED,KAAK,CAACC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;AAEd,OAAO,MAAMC,cAAc,GAAGA,CAAyBX,MAAsB,EAAEY,QAAgB,EAAEX,SAA6B,KAAK;EAC/H,MAAMY,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrC,MAAMC,YAA4B,GAAG,EAAE;EAEvCf,MAAM,CAACgB,OAAO,CAACb,KAAK,IAAI;IACpB,MAAM,CAACc,QAAQ,CAAC,GAAGZ,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;IAErC,IAAI,CAACc,QAAQ,EAAE;MACX;IACJ;IAEA,MAAMC,KAAK,GAAGf,KAAK,CAACc,QAAQ,CAAC;IAE7B,IAAI,OAAOC,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACpDb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eObjects } from '../../../utils';
|
4
4
|
import { BOX_SHADOW_STYLES } from '../types';
|
5
5
|
import { extractShadowValue, normalizeColor, normalizeNumericValue } from '../utils';
|
6
6
|
import { getShadowBreakpoints } from './getShadowBreakpoints';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","BOX_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","width","offsetY","height","radius","color","getBoxShadowStyle","styles","breakpoints","length","boxShadow","breakpointStyles","map","breakpoint","opacity"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/boxShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,
|
1
|
+
{"version":3,"names":["deepMergeObjects","BOX_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","width","offsetY","height","radius","color","getBoxShadowStyle","styles","breakpoints","length","boxShadow","breakpointStyles","map","breakpoint","opacity"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/boxShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,iBAAiB,QAAwB,UAAU;AAC5D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AACpF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,oBAAoB,GAAIC,KAAgB,IAAK;EAC/C,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGJ,KAAK;EACxE,MAAMK,OAAO,GAAGR,qBAAqB,CAACK,YAAY,EAAEI,KAAK,IAAI,CAAC,CAAC;EAC/D,MAAMC,OAAO,GAAGV,qBAAqB,CAACK,YAAY,EAAEM,MAAM,IAAI,CAAC,CAAC;EAChE,MAAMC,MAAM,GA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
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { deepMergeObjects } from '
|
3
|
+
import { deepMergeObjects } from '../../../utils';
|
4
4
|
import { TEXT_SHADOW_STYLES } from '../types';
|
5
5
|
import { extractShadowValue, normalizeColor, normalizeNumericValue } from '../utils';
|
6
6
|
import { getShadowBreakpoints } from './getShadowBreakpoints';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","TEXT_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","color","getTextShadowStyle","styles","breakpoints","length","textShadow","breakpointStyles","map","breakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/textShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,
|
1
|
+
{"version":3,"names":["deepMergeObjects","TEXT_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","color","getTextShadowStyle","styles","breakpoints","length","textShadow","breakpointStyles","map","breakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/textShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,kBAAkB,QAAyB,UAAU;AAC9D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AACpF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAGP,qBAAqB,CAACK,gBAAgB,EAAEG,KAAK,IAAI,CAAC,CAAC;EACnE,MAAMC,OAAO,GAAGT,qBAAqB,CAACK,gBAAgB,EAAEK,MAAM,IAAI,C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3
|
+
import { assignSecrets, reduceObject, getStyles } from './utils';
|
4
|
+
import { deepMergeObjects } from '../utils';
|
4
5
|
import { UnistylesRuntime } from './runtime';
|
5
6
|
import { createUseVariants, getVariants } from './variants';
|
6
7
|
export const create = stylesheet => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["assignSecrets","reduceObject","getStyles","deepMergeObjects","UnistylesRuntime","createUseVariants","getVariants","create","stylesheet","computedStylesheet","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","_key","String","dynamicStyle","result","variants","resultWithVariants","newVariants","forEach","set"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AAEA,SAASA,aAAa,EAAEC,YAAY,EAAEC,SAAS,
|
1
|
+
{"version":3,"names":["assignSecrets","reduceObject","getStyles","deepMergeObjects","UnistylesRuntime","createUseVariants","getVariants","create","stylesheet","computedStylesheet","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","_key","String","dynamicStyle","result","variants","resultWithVariants","newVariants","forEach","set"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AAEA,SAASA,aAAa,EAAEC,YAAY,EAAEC,SAAS,QAAQ,SAAS;AAChE,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,iBAAiB,EAAEC,WAAW,QAAQ,YAAY;AAE3D,OAAO,MAAMC,MAAM,GAAIC,UAAiD,IAAK;EACzE,MAAMC,kBAAkB,GAAG,OAAOD,UAAU,KAAK,UAAU,GACrDA,UAAU,CAACJ,gBAAgB,CAACM,KAAK,EAAEN,gBAAgB,CAACO,WAAW,CAAC,GAChEH,UAAU;EAChB,MAAMI,gBAAgB,GAAG,IAAIC,GAAG,CAAc,CAAC;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EAAEO,WAAW,IAAIpB,MAAM,CAACE,OAAO,CAACkB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAAChB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAACyB,GAAG,CAACjB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOS,MAAM;AACjB,CAAC","ignoreList":[]}
|
package/lib/module/web/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["create","UnistylesState","deepMergeObjects","StyleSheet","configure","init","absoluteFill","position","left","top","right","bottom","compose","a","b","flatten","styles","hairlineWidth","UnistylesRuntime","UnistylesShadowRegistry","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,gBAAgB,QAAQ,
|
1
|
+
{"version":3,"names":["create","UnistylesState","deepMergeObjects","StyleSheet","configure","init","absoluteFill","position","left","top","right","bottom","compose","a","b","flatten","styles","hairlineWidth","UnistylesRuntime","UnistylesShadowRegistry","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,gBAAgB,QAAQ,UAAU;AAE3C,OAAO,MAAMC,UAAU,GAAG;EACtBC,SAAS,EAAEH,cAAc,CAACI,IAAI;EAC9BL,MAAM;EACNM,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAS,EAAEC,CAAS,KAAKZ,gBAAgB,CAACW,CAAC,EAAEC,CAAC,CAAC;EACzDC,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAKd,gBAAgB,CAAC,GAAGc,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC;AAED,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,cAAc,QAAQ;;AAEtB;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM,EAAE","ignoreList":[]}
|
@@ -19,8 +19,24 @@ class UnistylesListenerBuilder {
|
|
19
19
|
return;
|
20
20
|
}
|
21
21
|
this.isInitialized = true;
|
22
|
-
UnistylesRuntime.darkMedia?.addEventListener('change',
|
23
|
-
|
22
|
+
UnistylesRuntime.darkMedia?.addEventListener('change', event => {
|
23
|
+
if (!event.matches) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
this.emitChange(UnistyleDependency.ColorScheme);
|
27
|
+
if (UnistylesRuntime.hasAdaptiveThemes) {
|
28
|
+
this.emitChange(UnistyleDependency.Theme);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
UnistylesRuntime.lightMedia?.addEventListener('change', event => {
|
32
|
+
if (!event.matches) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
this.emitChange(UnistyleDependency.ColorScheme);
|
36
|
+
if (UnistylesRuntime.hasAdaptiveThemes) {
|
37
|
+
this.emitChange(UnistyleDependency.Theme);
|
38
|
+
}
|
39
|
+
});
|
24
40
|
window.addEventListener('orientationchange', () => this.emitChange(UnistyleDependency.Orientation));
|
25
41
|
window.addEventListener('resize', () => this.emitChange(UnistyleDependency.Dimensions));
|
26
42
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,MAAMC,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;EAC7GC,mBAAmB,GAAGN,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;EAE/HE,UAAU,GAAIC,UAA8B,IAAK;IAC7C,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;IACrE,IAAI,CAACX,SAAS,CAACS,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;EAC/D,CAAC;EAEDC,aAAa,GAAGA,CAAA,KAAM;IAClB,IAAI,IAAI,CAACb,aAAa,EAAE;MACpB;IACJ;IAEA,IAAI,CAACA,aAAa,GAAG,IAAI;IACzBF,gBAAgB,CAACgB,SAAS,EAAEC,gBAAgB,CAAC,QAAQ,
|
1
|
+
{"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","event","matches","ColorScheme","hasAdaptiveThemes","Theme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,WAAW;AAE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@@ export const StatusBar = {
|
|
5
5
|
height: 0,
|
6
6
|
setStyle: () => {},
|
7
7
|
setHidden: () => {},
|
8
|
-
setBackgroundColor: () => {},
|
9
8
|
equals: () => true,
|
10
9
|
toString: () => 'StatusBar',
|
11
10
|
__type: 'web',
|
@@ -15,8 +14,8 @@ export const NavigationBar = {
|
|
15
14
|
width: 0,
|
16
15
|
height: 0,
|
17
16
|
setHidden: () => {},
|
18
|
-
setBackgroundColor: () => {},
|
19
17
|
equals: () => true,
|
18
|
+
dispose: () => {},
|
20
19
|
toString: () => 'NavigationBar',
|
21
20
|
__type: 'web',
|
22
21
|
name: 'NavigationBar'
|