react-native-unistyles 3.0.0-alpha.42 → 3.0.0-alpha.44
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/components/Pressable.js +15 -5
- package/lib/commonjs/components/Pressable.js.map +1 -1
- package/lib/commonjs/components/Pressable.web.js +35 -17
- package/lib/commonjs/components/Pressable.web.js.map +1 -1
- package/lib/commonjs/web/create.js +6 -1
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +49 -48
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/{variants/getVariants.js → variants.js} +2 -2
- package/lib/commonjs/web/variants.js.map +1 -0
- package/lib/module/components/Pressable.js +15 -5
- package/lib/module/components/Pressable.js.map +1 -1
- package/lib/module/components/Pressable.web.js +35 -17
- package/lib/module/components/Pressable.web.js.map +1 -1
- package/lib/module/web/create.js +7 -2
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +49 -48
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/{variants/getVariants.js → variants.js} +2 -2
- package/lib/module/web/variants.js.map +1 -0
- package/lib/typescript/src/components/Pressable.d.ts +2 -1
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.web.d.ts +2 -1
- package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +1 -1
- package/lib/typescript/src/web/{variants/getVariants.d.ts → variants.d.ts} +2 -2
- package/lib/typescript/src/web/variants.d.ts.map +1 -0
- package/package.json +1 -1
- package/plugin/index.js +1 -1
- package/plugin/ref.js +1 -1
- package/plugin/style.js +282 -99
- package/plugin/stylesheet.js +1 -1
- package/src/components/Pressable.tsx +24 -7
- package/src/components/Pressable.web.tsx +54 -28
- package/src/web/create.ts +7 -2
- package/src/web/shadowRegistry.ts +47 -47
- package/src/web/{variants/getVariants.ts → variants.ts} +2 -2
- package/lib/commonjs/web/variants/getVariants.js.map +0 -1
- package/lib/commonjs/web/variants/index.js +0 -28
- package/lib/commonjs/web/variants/index.js.map +0 -1
- package/lib/commonjs/web/variants/useVariants.js +0 -59
- package/lib/commonjs/web/variants/useVariants.js.map +0 -1
- package/lib/module/web/variants/getVariants.js.map +0 -1
- package/lib/module/web/variants/index.js +0 -5
- package/lib/module/web/variants/index.js.map +0 -1
- package/lib/module/web/variants/useVariants.js +0 -54
- package/lib/module/web/variants/useVariants.js.map +0 -1
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +0 -1
- package/lib/typescript/src/web/variants/index.d.ts +0 -3
- package/lib/typescript/src/web/variants/index.d.ts.map +0 -1
- package/lib/typescript/src/web/variants/useVariants.d.ts +0 -3
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +0 -1
- package/src/web/variants/index.ts +0 -2
- package/src/web/variants/useVariants.ts +0 -65
@@ -18,16 +18,15 @@ class UnistylesShadowRegistryBuilder {
|
|
18
18
|
resultsMap = new Map();
|
19
19
|
hashMap = new Map();
|
20
20
|
classNamesMap = new Map();
|
21
|
-
add = (ref,
|
22
|
-
//
|
23
|
-
if (!
|
21
|
+
add = (ref, styles, _variants, _args) => {
|
22
|
+
// Styles are not provided
|
23
|
+
if (!styles) {
|
24
24
|
return;
|
25
25
|
}
|
26
26
|
|
27
27
|
// Ref is unmounted, remove style tags from the document
|
28
28
|
if (ref === null) {
|
29
|
-
|
30
|
-
secrets.forEach(({
|
29
|
+
extractSecrets(styles).forEach(({
|
31
30
|
__uni__refs
|
32
31
|
}) => {
|
33
32
|
__uni__refs.forEach(ref => {
|
@@ -49,58 +48,60 @@ class UnistylesShadowRegistryBuilder {
|
|
49
48
|
if (!(ref instanceof HTMLElement)) {
|
50
49
|
return;
|
51
50
|
}
|
52
|
-
const
|
51
|
+
const parsedStyles = styles.flatMap((style, styleIndex) => {
|
52
|
+
const secrets = extractSecrets(style);
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
const parsedStyles = styles.flatMap((style, styleIndex) => extractSecrets(style).map(secret => {
|
59
|
-
const {
|
60
|
-
__uni__key,
|
61
|
-
__uni__stylesheet,
|
62
|
-
__uni__variants,
|
63
|
-
__uni__args = [],
|
64
|
-
__uni__refs
|
65
|
-
} = secret;
|
66
|
-
const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
|
67
|
-
const style = newComputedStylesheet[__uni__key];
|
68
|
-
const variants = _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants;
|
69
|
-
const args = _args[styleIndex] ? _args[styleIndex] : __uni__args;
|
70
|
-
const result = typeof style === 'function' ? style(...args) : style;
|
71
|
-
const {
|
72
|
-
variantsResult
|
73
|
-
} = Object.fromEntries(getVariants({
|
74
|
-
variantsResult: result
|
75
|
-
}, variants));
|
76
|
-
const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
|
77
|
-
const dependencies = extractUnistyleDependencies(resultWithVariants);
|
78
|
-
if (typeof __uni__stylesheet === 'function') {
|
79
|
-
// Add dependencies from dynamic styles to stylesheet
|
80
|
-
UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
|
54
|
+
// Regular style
|
55
|
+
if (secrets.length === 0) {
|
56
|
+
return style;
|
81
57
|
}
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
const
|
92
|
-
const
|
93
|
-
const
|
58
|
+
return secrets.map(secret => {
|
59
|
+
const {
|
60
|
+
__uni__key,
|
61
|
+
__uni__stylesheet,
|
62
|
+
__uni__variants,
|
63
|
+
__uni__args = [],
|
64
|
+
__uni__refs
|
65
|
+
} = secret;
|
66
|
+
const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
|
67
|
+
const style = newComputedStylesheet[__uni__key];
|
68
|
+
const variants = _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants;
|
69
|
+
const args = _args[styleIndex] && _args[styleIndex].length > 0 ? _args[styleIndex] : __uni__args;
|
70
|
+
const result = typeof style === 'function' ? style(...args) : style;
|
94
71
|
const {
|
95
72
|
variantsResult
|
96
73
|
} = Object.fromEntries(getVariants({
|
97
74
|
variantsResult: result
|
98
75
|
}, variants));
|
99
76
|
const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
|
100
|
-
|
77
|
+
const dependencies = extractUnistyleDependencies(resultWithVariants);
|
78
|
+
if (typeof __uni__stylesheet === 'function') {
|
79
|
+
// Add dependencies from dynamic styles to stylesheet
|
80
|
+
UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
|
81
|
+
}
|
82
|
+
__uni__refs.add(ref);
|
83
|
+
const dispose = UnistylesListener.addListeners(extractUnistyleDependencies(resultWithVariants), () => {
|
84
|
+
const hash = this.hashMap.get(ref);
|
85
|
+
|
86
|
+
// Dispose listener if there is no hash
|
87
|
+
if (!hash) {
|
88
|
+
dispose();
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
const newComputedStyleSheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
|
92
|
+
const newValue = newComputedStyleSheet[__uni__key];
|
93
|
+
const result = typeof newValue === 'function' ? newValue(...args) : newValue;
|
94
|
+
const {
|
95
|
+
variantsResult
|
96
|
+
} = Object.fromEntries(getVariants({
|
97
|
+
variantsResult: result
|
98
|
+
}, variants));
|
99
|
+
const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
|
100
|
+
UnistylesRegistry.applyStyles(hash, convertUnistyles(resultWithVariants));
|
101
|
+
});
|
102
|
+
return resultWithVariants;
|
101
103
|
});
|
102
|
-
|
103
|
-
}));
|
104
|
+
});
|
104
105
|
const combinedStyles = deepMergeObjects(...parsedStyles);
|
105
106
|
const oldStyles = this.resultsMap.get(ref);
|
106
107
|
if (equal(combinedStyles, oldStyles)) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["convertUnistyles","UnistylesListener","UnistylesRegistry","deepMergeObjects","equal","extractSecrets","extractUnistyleDependencies","isInDocument","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","add","ref","
|
1
|
+
{"version":3,"names":["convertUnistyles","UnistylesListener","UnistylesRegistry","deepMergeObjects","equal","extractSecrets","extractUnistyleDependencies","isInDocument","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","add","ref","styles","_variants","_args","forEach","__uni__refs","oldResult","get","delete","remove","HTMLElement","parsedStyles","flatMap","style","styleIndex","secrets","length","map","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","variants","Object","keys","args","result","variantsResult","fromEntries","resultWithVariants","dependencies","addDependenciesToStylesheet","addListeners","hash","newComputedStyleSheet","newValue","applyStyles","combinedStyles","oldStyles","oldClassNames","className","classList","set","existingHash","injectedClassNames","_web","_classNames","newClassNames","Array","isArray","concat","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,KAAK,EAAEC,cAAc,EAAEC,2BAA2B,EAAEC,YAAY,QAAQ,SAAS;AAC1F,SAASC,WAAW,QAAQ,YAAY;AAIxC,MAAMC,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1CC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;;EAEQC,UAAU,GAAG,IAAIC,GAAG,CAA+B,CAAC;EACpDC,OAAO,GAAG,IAAID,GA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IACpE,MAAMO,kBAAkB,GAAGP,cAAc,EAAEQ,IAAI,EAAEC,WAAW,IAAI,EAAE;IAClE,MAAMC,aAAa,GAAG,CAACC,KAAK,CAACC,OAAO,CAACL,kBAAkB,CAAC,GAAGA,kBAAkB,GAAG,CAACA,kBAAkB,CAAC,EAAEM,MAAM,CAACjB,IAAI,CAAC;IAElH,IAAI,CAACtC,aAAa,CAAC+C,GAAG,CAAC7C,GAAG,EAAEkD,aAAa,CAAC;IAC1C;IACAlD,GAAG,CAAC4C,SAAS,CAAC7C,GAAG,CAAC,GAAGmD,aAAa,CAAC;;IAEnC;IACA,IAAI,CAACJ,YAAY,EAAE;MACf,IAAI,CAACjD,OAAO,CAACgD,GAAG,CAAC7C,GAAG,EAAEoC,IAAI,CAAC;IAC/B;IAEA,OAAOc,aAAa;EACxB,CAAC;EAEDzC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEA,OAAO,MAAM6C,uBAAuB,GAAG,IAAIjE,8BAA8B,CAAC,CAAC","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { deepMergeObjects } from '
|
3
|
+
import { deepMergeObjects } from '../utils';
|
4
4
|
const hasVariants = value => 'variants' in value[1];
|
5
5
|
export const getVariants = (styles, selectedVariants) => {
|
6
6
|
return Object.entries(styles).filter(hasVariants).filter(([_key, {
|
@@ -31,4 +31,4 @@ export const getVariants = (styles, selectedVariants) => {
|
|
31
31
|
return [key, mergedVariantStyles];
|
32
32
|
});
|
33
33
|
};
|
34
|
-
//# sourceMappingURL=
|
34
|
+
//# sourceMappingURL=variants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deepMergeObjects","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","default","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles"],"sourceRoot":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,KAAKY,MAAM,CAACvB,KAAK,CAAC,CAAC,EAAE;QAC5G,OAAO,EAAE;MACb;MAEA,OAAOE,MAAM;IACjB,CAAC,CAAC;IAEF,MAAMsB,mBAAmB,GAAG1B,gBAAgB,CAAC,GAAGiB,aAAa,EAAE,GAAGK,qBAAqB,CAAC;IAExF,OAAO,CAACP,GAAG,EAAEW,mBAAmB,CAAC;EACrC,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { type PressableStateCallbackType } from 'react-native';
|
2
3
|
import type { PressableProps as Props, View } from 'react-native';
|
3
4
|
export declare const Pressable: React.ForwardRefExoticComponent<Props & {
|
4
|
-
rawStyle?: Array<any
|
5
|
+
rawStyle?: Array<any> | ((event: PressableStateCallbackType) => Array<any>);
|
5
6
|
variants?: Record<string, string | boolean>;
|
6
7
|
} & React.RefAttributes<View>>;
|
7
8
|
//# sourceMappingURL=Pressable.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,EAA2C,KAAK,0BAA0B,EAAE,MAAM,cAAc,CAAA;AACvG,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AASjE,eAAO,MAAM,SAAS;eAJP,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC;eAChE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;8BAgF7C,CAAA"}
|
@@ -5,9 +5,10 @@ type WebPressableState = {
|
|
5
5
|
hovered: boolean;
|
6
6
|
focused: boolean;
|
7
7
|
};
|
8
|
+
type WebPressableStyle = ((state: WebPressableState) => ViewStyle) | ViewStyle;
|
8
9
|
export declare const Pressable: React.ForwardRefExoticComponent<Props & {
|
9
10
|
variants?: Record<string, string | boolean>;
|
10
|
-
style?:
|
11
|
+
style?: WebPressableStyle;
|
11
12
|
} & React.RefAttributes<View>>;
|
12
13
|
export {};
|
13
14
|
//# sourceMappingURL=Pressable.web.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Pressable.web.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAE5D,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG5E,KAAK,iBAAiB,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAA;CACnB,CAAA;
|
1
|
+
{"version":3,"file":"Pressable.web.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAE5D,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG5E,KAAK,iBAAiB,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,EAAE,iBAAiB,KAAK,SAAS,CAAC,GAAG,SAAS,CAAA;AA4D9E,eAAO,MAAM,SAAS;eAzDP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;YACnC,iBAAiB;8B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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDpF,CAAA"}
|
@@ -9,7 +9,7 @@ declare class UnistylesShadowRegistryBuilder {
|
|
9
9
|
private resultsMap;
|
10
10
|
private hashMap;
|
11
11
|
private classNamesMap;
|
12
|
-
add: (ref: any,
|
12
|
+
add: (ref: any, styles: Array<Style>, _variants: Record<string, any> | undefined, _args: Array<Array<any>>) => string[] | undefined;
|
13
13
|
remove: () => void;
|
14
14
|
}
|
15
15
|
export declare const UnistylesShadowRegistry: UnistylesShadowRegistryBuilder;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type { ReactNativeStyleSheet, StyleSheet } from '
|
1
|
+
import type { ReactNativeStyleSheet, StyleSheet } from '../types';
|
2
2
|
export declare const getVariants: (styles: ReactNativeStyleSheet<StyleSheet>, selectedVariants: Record<string, any>) => (readonly [string, any])[];
|
3
|
-
//# sourceMappingURL=
|
3
|
+
//# sourceMappingURL=variants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/web/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAWjE,eAAO,MAAM,WAAW,WAAY,qBAAqB,CAAC,UAAU,CAAC,oBAAoB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,+BA8B3G,CAAA"}
|
package/package.json
CHANGED
package/plugin/index.js
CHANGED
@@ -131,7 +131,7 @@ module.exports = function ({ types: t }) {
|
|
131
131
|
return
|
132
132
|
}
|
133
133
|
|
134
|
-
const metadata = getStyleMetadata(t, styleAttr.value.expression)
|
134
|
+
const metadata = getStyleMetadata(t, styleAttr.value.expression, null, state)
|
135
135
|
|
136
136
|
if (openingElementName === 'Pressable') {
|
137
137
|
return handlePressable(t, path, styleAttr, metadata, state)
|
package/plugin/ref.js
CHANGED
@@ -19,7 +19,7 @@ function arrayExpressionFromMetadata(t, metadata) {
|
|
19
19
|
.map(meta => {
|
20
20
|
// possible for inline styles
|
21
21
|
if (meta.members.length === 0) {
|
22
|
-
return meta.inlineStyle || meta.conditionalExpression
|
22
|
+
return meta.inlineStyle || meta.conditionalExpression || meta.logicalExpression
|
23
23
|
}
|
24
24
|
|
25
25
|
const [base, ...members] = meta.members
|