react-native-unistyles 3.0.0-alpha.1 → 3.0.0-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/Unistyles.podspec +33 -0
- package/cxx/common/Constants.h +1 -0
- package/cxx/common/Helpers.h +92 -0
- package/cxx/core/HostStyle.cpp +18 -12
- package/cxx/core/HostStyle.h +3 -0
- package/cxx/core/StyleSheet.h +0 -1
- package/cxx/core/StyleSheetRegistry.cpp +10 -13
- package/cxx/core/StyleSheetRegistry.h +4 -4
- package/cxx/core/Unistyle.h +7 -10
- package/cxx/core/UnistyleData.h +23 -0
- package/cxx/core/UnistyleWrapper.h +25 -7
- package/cxx/core/UnistylesCommitHook.cpp +8 -7
- package/cxx/core/UnistylesCommitHook.h +6 -1
- package/cxx/core/UnistylesCommitShadowNode.h +13 -0
- package/cxx/core/UnistylesMountHook.cpp +40 -0
- package/cxx/core/UnistylesMountHook.h +30 -0
- package/cxx/core/UnistylesRegistry.cpp +44 -75
- package/cxx/core/UnistylesRegistry.h +10 -11
- package/cxx/core/UnistylesState.cpp +4 -4
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +13 -6
- package/cxx/hybridObjects/HybridStyleSheet.cpp +35 -39
- package/cxx/hybridObjects/HybridStyleSheet.h +9 -6
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +34 -15
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
- package/cxx/parser/Parser.cpp +87 -165
- package/cxx/parser/Parser.h +8 -14
- package/cxx/shadowTree/ShadowLeafUpdate.h +1 -1
- package/cxx/shadowTree/ShadowTreeManager.cpp +3 -8
- package/ios/UnistylesModuleOnLoad.h +2 -0
- package/ios/UnistylesModuleOnLoad.mm +8 -1
- package/lib/commonjs/specs/NavigtionBar/index.js +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +3 -3
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +77 -0
- package/lib/commonjs/web/convert/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/breakpoint.js +25 -0
- package/lib/commonjs/web/convert/breakpoint.js.map +1 -0
- package/lib/commonjs/web/convert/index.js +76 -0
- package/lib/commonjs/web/convert/index.js.map +1 -0
- package/lib/commonjs/web/convert/module.d.js +2 -0
- package/lib/commonjs/web/convert/module.d.js.map +1 -0
- package/lib/commonjs/web/convert/shadow.js +68 -0
- package/lib/commonjs/web/convert/shadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +89 -0
- package/lib/commonjs/web/convert/style.js.map +1 -0
- package/lib/commonjs/web/convert/textShadow.js +73 -0
- package/lib/commonjs/web/convert/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/transform.js +72 -0
- package/lib/commonjs/web/convert/transform.js.map +1 -0
- package/lib/commonjs/web/convert/types.js +9 -0
- package/lib/commonjs/web/convert/types.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +55 -0
- package/lib/commonjs/web/convert/utils.js.map +1 -0
- package/lib/commonjs/web/create.js +89 -0
- package/lib/commonjs/web/create.js.map +1 -0
- package/lib/commonjs/web/index.js +51 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/listener/index.js +13 -0
- package/lib/commonjs/web/listener/index.js.map +1 -0
- package/lib/commonjs/web/listener/listener.js +36 -0
- package/lib/commonjs/web/listener/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +37 -0
- package/lib/commonjs/web/mock.js.map +1 -0
- package/lib/commonjs/web/mq.js +23 -0
- package/lib/commonjs/web/mq.js.map +1 -0
- package/lib/commonjs/web/pseudo.js +11 -0
- package/lib/commonjs/web/pseudo.js.map +1 -0
- package/lib/commonjs/web/registry.js +37 -0
- package/lib/commonjs/web/registry.js.map +1 -0
- package/lib/commonjs/web/runtime.js +164 -0
- package/lib/commonjs/web/runtime.js.map +1 -0
- package/lib/commonjs/web/state.js +121 -0
- package/lib/commonjs/web/state.js.map +1 -0
- package/lib/commonjs/web/utils.js +78 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web/variants/getVariants.js +39 -0
- package/lib/commonjs/web/variants/getVariants.js.map +1 -0
- package/lib/commonjs/web/variants/index.js +28 -0
- package/lib/commonjs/web/variants/index.js.map +1 -0
- package/lib/commonjs/web/variants/useVariants.js +75 -0
- package/lib/commonjs/web/variants/useVariants.js.map +1 -0
- package/lib/module/specs/NavigtionBar/index.js +1 -1
- package/lib/module/specs/NavigtionBar/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +3 -3
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.web.js +1 -1
- package/lib/module/specs/index.web.js.map +1 -1
- package/lib/module/web/convert/boxShadow.js +72 -0
- package/lib/module/web/convert/boxShadow.js.map +1 -0
- package/lib/module/web/convert/breakpoint.js +20 -0
- package/lib/module/web/convert/breakpoint.js.map +1 -0
- package/lib/module/web/convert/index.js +71 -0
- package/lib/module/web/convert/index.js.map +1 -0
- package/lib/module/web/convert/module.d.js +2 -0
- package/lib/module/web/convert/module.d.js.map +1 -0
- package/lib/module/web/convert/shadow.js +63 -0
- package/lib/module/web/convert/shadow.js.map +1 -0
- package/lib/module/web/convert/style.js +84 -0
- package/lib/module/web/convert/style.js.map +1 -0
- package/lib/module/web/convert/textShadow.js +68 -0
- package/lib/module/web/convert/textShadow.js.map +1 -0
- package/lib/module/web/convert/transform.js +67 -0
- package/lib/module/web/convert/transform.js.map +1 -0
- package/lib/module/web/convert/types.js +5 -0
- package/lib/module/web/convert/types.js.map +1 -0
- package/lib/module/web/convert/utils.js +43 -0
- package/lib/module/web/convert/utils.js.map +1 -0
- package/lib/module/web/create.js +84 -0
- package/lib/module/web/create.js.map +1 -0
- package/lib/module/web/index.js +24 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/listener/index.js +4 -0
- package/lib/module/web/listener/index.js.map +1 -0
- package/lib/module/web/listener/listener.js +31 -0
- package/lib/module/web/listener/listener.js.map +1 -0
- package/lib/module/web/mock.js +33 -0
- package/lib/module/web/mock.js.map +1 -0
- package/lib/module/web/mq.js +17 -0
- package/lib/module/web/mq.js.map +1 -0
- package/lib/module/web/pseudo.js +6 -0
- package/lib/module/web/pseudo.js.map +1 -0
- package/lib/module/web/registry.js +33 -0
- package/lib/module/web/registry.js.map +1 -0
- package/lib/module/web/runtime.js +160 -0
- package/lib/module/web/runtime.js.map +1 -0
- package/lib/module/web/state.js +117 -0
- package/lib/module/web/state.js.map +1 -0
- package/lib/module/web/utils.js +65 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/module/web/variants/getVariants.js +34 -0
- package/lib/module/web/variants/getVariants.js.map +1 -0
- package/lib/module/web/variants/index.js +5 -0
- package/lib/module/web/variants/index.js.map +1 -0
- package/lib/module/web/variants/useVariants.js +70 -0
- package/lib/module/web/variants/useVariants.js.map +1 -0
- package/lib/typescript/example/App.d.ts.map +1 -1
- package/lib/typescript/example/Typography.d.ts +12 -0
- package/lib/typescript/example/Typography.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +1 -1
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/index.d.ts +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/create.d.ts +11 -11
- package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
- package/lib/typescript/{web → src/web}/index.d.ts +12 -12
- package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener/index.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/listener/listener.d.ts +1 -1
- package/lib/typescript/src/web/listener/listener.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/mock.d.ts +2 -2
- package/lib/typescript/src/web/mock.d.ts.map +1 -0
- package/lib/typescript/src/web/mq.d.ts.map +1 -0
- package/lib/typescript/src/web/pseudo.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/registry.d.ts +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/runtime.d.ts +6 -6
- package/lib/typescript/src/web/runtime.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/state.d.ts +4 -4
- package/lib/typescript/src/web/state.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/utils.d.ts +5 -3
- package/lib/typescript/src/web/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/index.d.ts +3 -0
- package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
- package/package.json +2 -2
- package/plugin/__tests__/dependencies.spec.js +195 -107
- package/plugin/__tests__/ref.spec.js +537 -179
- package/plugin/__tests__/stylesheet.spec.js +174 -63
- package/plugin/index.js +68 -23
- package/plugin/ref.js +74 -12
- package/plugin/style.js +57 -24
- package/plugin/stylesheet.js +44 -1
- package/plugin/variants.js +33 -0
- package/src/specs/NavigtionBar/index.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +5 -5
- package/src/specs/StatusBar/index.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -1
- package/src/specs/UnistylesRuntime/index.ts +1 -1
- package/src/specs/index.web.ts +1 -1
- package/src/types/stylesheet.ts +1 -1
- package/{web → src/web}/convert/breakpoint.ts +1 -1
- package/{web → src/web}/convert/index.ts +1 -1
- package/{web → src/web}/convert/types.ts +1 -1
- package/{web → src/web}/create.ts +36 -33
- package/{web → src/web}/listener/listener.ts +1 -1
- package/{web → src/web}/mock.ts +2 -2
- package/{web → src/web}/registry.ts +1 -1
- package/{web → src/web}/runtime.ts +4 -4
- package/{web → src/web}/state.ts +5 -5
- package/{web → src/web}/utils.ts +5 -5
- package/src/web/variants/getVariants.ts +42 -0
- package/src/web/variants/index.ts +2 -0
- package/{web → src/web/variants}/useVariants.ts +24 -44
- package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/web/convert/index.d.ts.map +0 -1
- package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/style.d.ts.map +0 -1
- package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/transform.d.ts.map +0 -1
- package/lib/typescript/web/convert/types.d.ts.map +0 -1
- package/lib/typescript/web/convert/utils.d.ts.map +0 -1
- package/lib/typescript/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/web/mock.d.ts.map +0 -1
- package/lib/typescript/web/mq.d.ts.map +0 -1
- package/lib/typescript/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/web/registry.d.ts.map +0 -1
- package/lib/typescript/web/runtime.d.ts.map +0 -1
- package/lib/typescript/web/state.d.ts.map +0 -1
- package/lib/typescript/web/useVariants.d.ts +0 -3
- package/lib/typescript/web/useVariants.d.ts.map +0 -1
- package/lib/typescript/web/utils.d.ts.map +0 -1
- /package/lib/typescript/{web → src/web}/convert/boxShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/breakpoint.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/shadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/style.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/textShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/transform.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/utils.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/listener/index.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/mq.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/pseudo.d.ts +0 -0
- /package/{web → src/web}/convert/boxShadow.ts +0 -0
- /package/{web → src/web}/convert/module.d.ts +0 -0
- /package/{web → src/web}/convert/shadow.ts +0 -0
- /package/{web → src/web}/convert/style.ts +0 -0
- /package/{web → src/web}/convert/textShadow.ts +0 -0
- /package/{web → src/web}/convert/transform.ts +0 -0
- /package/{web → src/web}/convert/utils.ts +0 -0
- /package/{web → src/web}/index.ts +0 -0
- /package/{web → src/web}/listener/index.ts +0 -0
- /package/{web → src/web}/mq.ts +0 -0
- /package/{web → src/web}/pseudo.ts +0 -0
package/plugin/ref.js
CHANGED
@@ -14,21 +14,35 @@ function hasStringRef(t, path) {
|
|
14
14
|
)
|
15
15
|
}
|
16
16
|
|
17
|
-
function addRef(t, path,
|
17
|
+
function addRef(t, path, metadata, state) {
|
18
|
+
const hasVariants = state.file.hasVariants
|
19
|
+
|
18
20
|
const newRefFunction = t.arrowFunctionExpression(
|
19
21
|
[t.identifier('ref')],
|
20
22
|
t.blockStatement([
|
21
23
|
t.expressionStatement(
|
22
24
|
t.callExpression(
|
23
25
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('add')),
|
24
|
-
[
|
26
|
+
[
|
27
|
+
t.identifier('ref'),
|
28
|
+
metadata.styleProp
|
29
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
30
|
+
: t.identifier(metadata.styleObj),
|
31
|
+
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
32
|
+
metadata.dynamicFunction ? t.arrayExpression(metadata.dynamicFunction.arguments) : t.identifier('undefined')
|
33
|
+
]
|
25
34
|
)
|
26
35
|
),
|
27
36
|
t.returnStatement(
|
28
37
|
t.arrowFunctionExpression([],
|
29
38
|
t.callExpression(
|
30
39
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('remove')),
|
31
|
-
[
|
40
|
+
[
|
41
|
+
t.identifier('ref'),
|
42
|
+
metadata.styleProp
|
43
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
44
|
+
: t.identifier(metadata.styleObj)
|
45
|
+
]
|
32
46
|
)
|
33
47
|
)
|
34
48
|
)
|
@@ -43,7 +57,8 @@ function addRef(t, path, styleObj, styleProp) {
|
|
43
57
|
path.node.openingElement.attributes.push(newRefProp)
|
44
58
|
}
|
45
59
|
|
46
|
-
function overrideRef(t, path, refProp,
|
60
|
+
function overrideRef(t, path, refProp, metadata, state) {
|
61
|
+
const hasVariants = state.file.hasVariants
|
47
62
|
const uniqueRefName = path.scope.generateUidIdentifier('ref').name
|
48
63
|
const isIdentifier = t.isIdentifier(refProp.value.expression)
|
49
64
|
const binding = path.scope.getBinding(refProp.value.expression.name)
|
@@ -55,19 +70,35 @@ function overrideRef(t, path, refProp, styleObj, styleProp) {
|
|
55
70
|
[t.identifier(uniqueRefName)],
|
56
71
|
t.blockStatement([
|
57
72
|
t.expressionStatement(
|
58
|
-
t.assignmentExpression(
|
73
|
+
t.assignmentExpression(
|
74
|
+
'=',
|
75
|
+
t.memberExpression(t.identifier(userVariableName), t.identifier('current')),
|
76
|
+
t.identifier(uniqueRefName)
|
77
|
+
)
|
59
78
|
),
|
60
79
|
t.expressionStatement(
|
61
80
|
t.callExpression(
|
62
81
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('add')),
|
63
|
-
[
|
82
|
+
[
|
83
|
+
t.identifier(uniqueRefName),
|
84
|
+
metadata.styleProp
|
85
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
86
|
+
: t.identifier(metadata.styleObj),
|
87
|
+
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
88
|
+
metadata.dynamicFunction ? t.arrayExpression(metadata.dynamicFunction.arguments) : t.identifier('undefined')
|
89
|
+
]
|
64
90
|
)
|
65
91
|
),
|
66
92
|
t.returnStatement(
|
67
93
|
t.arrowFunctionExpression([],
|
68
94
|
t.callExpression(
|
69
95
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('remove')),
|
70
|
-
[
|
96
|
+
[
|
97
|
+
t.identifier(uniqueRefName),
|
98
|
+
metadata.styleProp
|
99
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
100
|
+
: t.identifier(metadata.styleObj)
|
101
|
+
]
|
71
102
|
)
|
72
103
|
)
|
73
104
|
)
|
@@ -87,15 +118,25 @@ function overrideRef(t, path, refProp, styleObj, styleProp) {
|
|
87
118
|
const userCleanupFunction = userReturnStatement
|
88
119
|
? userReturnStatement.argument
|
89
120
|
: null
|
121
|
+
const userRefName = refProp.value.expression.params.length >= 1
|
122
|
+
? refProp.value.expression.params.at(0).name
|
123
|
+
: 'ref'
|
90
124
|
|
91
125
|
const newRefFunction = t.arrowFunctionExpression(
|
92
|
-
[t.identifier(
|
126
|
+
[t.identifier(userRefName)],
|
93
127
|
t.blockStatement([
|
94
128
|
...userStatements.filter(statement => !t.isReturnStatement(statement)),
|
95
129
|
t.expressionStatement(
|
96
130
|
t.callExpression(
|
97
131
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('add')),
|
98
|
-
[
|
132
|
+
[
|
133
|
+
t.identifier(userRefName),
|
134
|
+
metadata.styleProp
|
135
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
136
|
+
: t.identifier(metadata.styleObj),
|
137
|
+
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
138
|
+
metadata.dynamicFunction ? t.arrayExpression(metadata.dynamicFunction.arguments) : t.identifier('undefined')
|
139
|
+
]
|
99
140
|
)
|
100
141
|
),
|
101
142
|
// Merged cleanup function
|
@@ -109,7 +150,12 @@ function overrideRef(t, path, refProp, styleObj, styleProp) {
|
|
109
150
|
t.expressionStatement(
|
110
151
|
t.callExpression(
|
111
152
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('remove')),
|
112
|
-
[
|
153
|
+
[
|
154
|
+
t.identifier(userRefName),
|
155
|
+
metadata.styleProp
|
156
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
157
|
+
: t.identifier(metadata.styleObj)
|
158
|
+
]
|
113
159
|
)
|
114
160
|
)
|
115
161
|
]))
|
@@ -122,6 +168,10 @@ function overrideRef(t, path, refProp, styleObj, styleProp) {
|
|
122
168
|
return
|
123
169
|
}
|
124
170
|
|
171
|
+
if (!binding) {
|
172
|
+
return
|
173
|
+
}
|
174
|
+
|
125
175
|
// ref={scopedFunction}
|
126
176
|
const isArrowFunction = t.isArrowFunctionExpression(binding.path.node.init)
|
127
177
|
const isFunction = t.isFunctionDeclaration(binding.path.node)
|
@@ -146,7 +196,14 @@ function overrideRef(t, path, refProp, styleObj, styleProp) {
|
|
146
196
|
t.expressionStatement(
|
147
197
|
t.callExpression(
|
148
198
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('add')),
|
149
|
-
[
|
199
|
+
[
|
200
|
+
t.identifier(uniqueRefName),
|
201
|
+
metadata.styleProp
|
202
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
203
|
+
: t.identifier(metadata.styleObj),
|
204
|
+
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
205
|
+
metadata.dynamicFunction ? t.arrayExpression(metadata.dynamicFunction.arguments) : t.identifier('undefined')
|
206
|
+
]
|
150
207
|
)
|
151
208
|
),
|
152
209
|
t.returnStatement(
|
@@ -159,7 +216,12 @@ function overrideRef(t, path, refProp, styleObj, styleProp) {
|
|
159
216
|
t.expressionStatement(
|
160
217
|
t.callExpression(
|
161
218
|
t.memberExpression(t.identifier('UnistylesShadowRegistry'), t.identifier('remove')),
|
162
|
-
[
|
219
|
+
[
|
220
|
+
t.identifier(uniqueRefName),
|
221
|
+
metadata.styleProp
|
222
|
+
? t.memberExpression(t.identifier(metadata.styleObj), t.identifier(metadata.styleProp))
|
223
|
+
: t.identifier(metadata.styleObj)
|
224
|
+
]
|
163
225
|
)
|
164
226
|
)
|
165
227
|
]))
|
package/plugin/style.js
CHANGED
@@ -1,44 +1,42 @@
|
|
1
|
-
function
|
1
|
+
function getStyleMetadata(t, node, dynamicFunction = null) {
|
2
2
|
// {styles.container}
|
3
3
|
if (t.isMemberExpression(node)) {
|
4
|
-
return [
|
4
|
+
return [
|
5
|
+
{
|
6
|
+
styleObj: node.object.name,
|
7
|
+
styleProp: node.property.name,
|
8
|
+
dynamicFunction
|
9
|
+
}
|
10
|
+
]
|
5
11
|
}
|
6
12
|
|
7
13
|
// [styles.container]
|
8
14
|
if (t.isArrayExpression(node)) {
|
9
|
-
return node.elements.flatMap(element =>
|
15
|
+
return node.elements.flatMap(element => getStyleMetadata(t, element))
|
10
16
|
}
|
11
17
|
|
12
18
|
// [...styles.container]
|
13
19
|
if (t.isSpreadElement(node)) {
|
14
|
-
return
|
20
|
+
return getStyleMetadata(t, node.argument)
|
15
21
|
}
|
16
22
|
|
17
23
|
// {{ ...styles.container }}
|
18
24
|
if (t.isObjectExpression(node)) {
|
19
|
-
return node.properties.flatMap(prop =>
|
25
|
+
return node.properties.flatMap(prop => getStyleMetadata(t, prop.argument))
|
20
26
|
}
|
21
27
|
|
22
28
|
// {styles.container(arg1, arg2)}
|
23
29
|
if (t.isCallExpression(node)) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
if (!lastPart) {
|
28
|
-
return path
|
29
|
-
}
|
30
|
-
|
31
|
-
// for web increment counter for dynamic functions
|
32
|
-
if (state.file.webDynamicFunctions[lastPart]) {
|
33
|
-
node.arguments.push(t.numericLiteral(++state.file.webDynamicFunctions[lastPart]))
|
34
|
-
|
35
|
-
return path
|
36
|
-
}
|
37
|
-
|
38
|
-
state.file.webDynamicFunctions[lastPart] = 1
|
39
|
-
node.arguments.push(t.numericLiteral(1))
|
30
|
+
return getStyleMetadata(t, node.callee, node)
|
31
|
+
}
|
40
32
|
|
41
|
-
|
33
|
+
// {styles}
|
34
|
+
if (t.isIdentifier(node)) {
|
35
|
+
return [{
|
36
|
+
styleObj: node.name,
|
37
|
+
styleProp: undefined,
|
38
|
+
dynamicFunction: undefined
|
39
|
+
}]
|
42
40
|
}
|
43
41
|
|
44
42
|
return []
|
@@ -52,7 +50,42 @@ function getStyleAttribute(t, path) {
|
|
52
50
|
)
|
53
51
|
}
|
54
52
|
|
53
|
+
function styleAttributeToArray(t, path) {
|
54
|
+
const styleAttribute = getStyleAttribute(t, path)
|
55
|
+
|
56
|
+
// {{...style.container, ...style.container}}
|
57
|
+
if (t.isObjectExpression(styleAttribute.value.expression)) {
|
58
|
+
const properties = styleAttribute.value.expression.properties
|
59
|
+
.map(property => t.isSpreadElement(property)
|
60
|
+
? property.argument
|
61
|
+
: t.objectExpression([property])
|
62
|
+
)
|
63
|
+
|
64
|
+
styleAttribute.value.expression = t.arrayExpression(properties)
|
65
|
+
|
66
|
+
return
|
67
|
+
}
|
68
|
+
|
69
|
+
// [{...style.container, ...style.container}]
|
70
|
+
if (t.isArrayExpression(styleAttribute.value.expression)) {
|
71
|
+
const properties = styleAttribute.value.expression.elements
|
72
|
+
.flatMap(property => {
|
73
|
+
if (t.isSpreadElement(property)) {
|
74
|
+
return property.argument
|
75
|
+
}
|
76
|
+
return property
|
77
|
+
})
|
78
|
+
|
79
|
+
styleAttribute.value.expression = t.arrayExpression(properties)
|
80
|
+
|
81
|
+
return
|
82
|
+
}
|
83
|
+
|
84
|
+
styleAttribute.value.expression = t.arrayExpression([styleAttribute.value.expression])
|
85
|
+
}
|
86
|
+
|
55
87
|
module.exports = {
|
56
|
-
|
57
|
-
getStyleAttribute
|
88
|
+
getStyleMetadata,
|
89
|
+
getStyleAttribute,
|
90
|
+
styleAttributeToArray
|
58
91
|
}
|
package/plugin/stylesheet.js
CHANGED
@@ -17,6 +17,19 @@ const UnistyleDependency = {
|
|
17
17
|
NavigationBar: 13
|
18
18
|
}
|
19
19
|
|
20
|
+
function stringToUniqueId(str) {
|
21
|
+
let hash = 0;
|
22
|
+
|
23
|
+
for (let i = 0; i < str.length; i++) {
|
24
|
+
hash = (hash << 5) - hash + str.charCodeAt(i)
|
25
|
+
hash |= 0
|
26
|
+
}
|
27
|
+
|
28
|
+
const absHash = Math.abs(hash)
|
29
|
+
|
30
|
+
return absHash % 1000000000
|
31
|
+
}
|
32
|
+
|
20
33
|
function isUnistylesStyleSheet(t, path, state) {
|
21
34
|
const callee = path.get('callee')
|
22
35
|
|
@@ -28,6 +41,13 @@ function isUnistylesStyleSheet(t, path, state) {
|
|
28
41
|
)
|
29
42
|
}
|
30
43
|
|
44
|
+
function addStyleSheetTag(t, path, state) {
|
45
|
+
const callee = path.get('callee')
|
46
|
+
const uniqueId = stringToUniqueId(state.filename) + ++state.file.tagNumber
|
47
|
+
|
48
|
+
callee.container.arguments.push(t.numericLiteral(uniqueId))
|
49
|
+
}
|
50
|
+
|
31
51
|
function analyzeDependencies(t, state, name, unistyleObj, themeName, rtName) {
|
32
52
|
const debugMessage = deps => {
|
33
53
|
if (state.opts.debug) {
|
@@ -141,7 +161,30 @@ function analyzeDependencies(t, state, name, unistyleObj, themeName, rtName) {
|
|
141
161
|
}
|
142
162
|
}
|
143
163
|
|
164
|
+
function getUnistyle(t, property) {
|
165
|
+
const propertyValue = t.isArrowFunctionExpression(property.value)
|
166
|
+
? property.value.body
|
167
|
+
: property.value
|
168
|
+
|
169
|
+
if (t.isObjectExpression(propertyValue)) {
|
170
|
+
return propertyValue
|
171
|
+
}
|
172
|
+
|
173
|
+
if (t.isBlockStatement(propertyValue)) {
|
174
|
+
const returnStatement = propertyValue.body
|
175
|
+
.find(value => t.isReturnStatement(value))
|
176
|
+
|
177
|
+
return returnStatement
|
178
|
+
? returnStatement.argument
|
179
|
+
: null
|
180
|
+
}
|
181
|
+
|
182
|
+
return null
|
183
|
+
}
|
184
|
+
|
144
185
|
module.exports = {
|
145
186
|
isUnistylesStyleSheet,
|
146
|
-
analyzeDependencies
|
187
|
+
analyzeDependencies,
|
188
|
+
addStyleSheetTag,
|
189
|
+
getUnistyle
|
147
190
|
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
function isUsingVariants(t, path) {
|
2
|
+
const callee = path.get('callee')
|
3
|
+
|
4
|
+
return (
|
5
|
+
t.isMemberExpression(callee) &&
|
6
|
+
t.isIdentifier(callee.node.object, { name: 'styles' }) &&
|
7
|
+
t.isIdentifier(callee.node.property, { name: 'useVariants' }) &&
|
8
|
+
t.isObjectExpression(path.node.arguments[0])
|
9
|
+
)
|
10
|
+
}
|
11
|
+
|
12
|
+
function extractVariants(t, path, state) {
|
13
|
+
const arg = path.node.arguments[0]
|
14
|
+
|
15
|
+
const variantDeclaration = t.variableDeclaration('const', [
|
16
|
+
t.variableDeclarator(
|
17
|
+
t.identifier('__uni__variants'),
|
18
|
+
arg
|
19
|
+
)
|
20
|
+
])
|
21
|
+
|
22
|
+
// Replace useVariants argument with __uni__variants
|
23
|
+
path.node.arguments[0] = t.identifier('__uni__variants')
|
24
|
+
|
25
|
+
path.insertBefore(variantDeclaration)
|
26
|
+
|
27
|
+
state.file.hasVariants = true
|
28
|
+
}
|
29
|
+
|
30
|
+
module.exports = {
|
31
|
+
isUsingVariants,
|
32
|
+
extractVariants
|
33
|
+
}
|
@@ -12,7 +12,7 @@ export const attachNavigationBarJSMethods = (hybridObject: UnistylesNavigationBa
|
|
12
12
|
|
13
13
|
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor
|
14
14
|
hybridObject.setBackgroundColor = (color?: string) => {
|
15
|
-
const parsedColor = processColor(color)
|
15
|
+
const parsedColor = processColor(color) ?? 0
|
16
16
|
|
17
17
|
privateHybrid._setBackgroundColor(parsedColor as number)
|
18
18
|
}
|
@@ -4,10 +4,10 @@ import type { ShadowNode, Unistyle, ViewHandle } from './types'
|
|
4
4
|
|
5
5
|
interface ShadowRegistry extends UnistylesShadowRegistrySpec {
|
6
6
|
// Babel API
|
7
|
-
add(handle?: ViewHandle, style?: Unistyle): void,
|
7
|
+
add(handle?: ViewHandle, style?: Unistyle, variants?: Record<string, string | boolean>, args?: Array<any>): void,
|
8
8
|
remove(handle?: ViewHandle, style?: Unistyle): void,
|
9
9
|
// JSI
|
10
|
-
link(node: ShadowNode, style
|
10
|
+
link(node: ShadowNode, style?: Unistyle, variants?: Record<string, string | boolean>, args?: Array<any>): void,
|
11
11
|
unlink(node: ShadowNode, style: Unistyle): void
|
12
12
|
}
|
13
13
|
|
@@ -26,12 +26,12 @@ const findShadowNodeForHandle = (handle: ViewHandle) => {
|
|
26
26
|
return node
|
27
27
|
}
|
28
28
|
|
29
|
-
HybridShadowRegistry.add = (handle, style) => {
|
30
|
-
if (!handle
|
29
|
+
HybridShadowRegistry.add = (handle, style, variants, args) => {
|
30
|
+
if (!handle) {
|
31
31
|
return
|
32
32
|
}
|
33
33
|
|
34
|
-
HybridShadowRegistry.link(findShadowNodeForHandle(handle), style)
|
34
|
+
HybridShadowRegistry.link(findShadowNodeForHandle(handle), style, variants ?? {}, args ?? [])
|
35
35
|
}
|
36
36
|
|
37
37
|
HybridShadowRegistry.remove = (handle, style) => {
|
@@ -34,7 +34,7 @@ export const attachStatusBarJSMethods = (hybridObject: UnistylesStatusBar) => {
|
|
34
34
|
|
35
35
|
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor
|
36
36
|
hybridObject.setBackgroundColor = (color?: string) => {
|
37
|
-
const parsedColor = processColor(color)
|
37
|
+
const parsedColor = processColor(color) ?? 0
|
38
38
|
|
39
39
|
privateHybrid._setBackgroundColor(parsedColor as number)
|
40
40
|
}
|
@@ -41,4 +41,6 @@ HybridUnistylesStyleSheet.jsMethods = {
|
|
41
41
|
processColor
|
42
42
|
}
|
43
43
|
|
44
|
-
|
44
|
+
type PrivateMethods = 'jsMethods'
|
45
|
+
|
46
|
+
export const StyleSheet = HybridUnistylesStyleSheet as Omit<UnistylesStyleSheet, PrivateMethods>
|
@@ -45,7 +45,7 @@ HybridUnistylesRuntime.navigationBar = HybridUnistylesRuntime.createHybridNaviga
|
|
45
45
|
HybridUnistylesRuntime._setRootViewBackgroundColor = HybridUnistylesRuntime.setRootViewBackgroundColor
|
46
46
|
|
47
47
|
HybridUnistylesRuntime.setRootViewBackgroundColor = (color?: string) => {
|
48
|
-
const parsedColor = processColor(color)
|
48
|
+
const parsedColor = processColor(color) ?? 0
|
49
49
|
|
50
50
|
HybridUnistylesRuntime._setRootViewBackgroundColor(parsedColor as number)
|
51
51
|
}
|
package/src/specs/index.web.ts
CHANGED
package/src/types/stylesheet.ts
CHANGED
@@ -5,7 +5,7 @@ import type { UnistylesMiniRuntime } from '../specs'
|
|
5
5
|
import type { ReactNativeStyleSheet } from './breakpoints'
|
6
6
|
import type { ExtractVariantNames } from './variants'
|
7
7
|
import type { CSSProperties } from 'react'
|
8
|
-
import type { Pseudo } from '
|
8
|
+
import type { Pseudo } from '../web/pseudo'
|
9
9
|
|
10
10
|
// these props are treated differently to nest breakpoints and media queries
|
11
11
|
type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset'
|
@@ -2,7 +2,7 @@ import type { MediaQuery } from 'typestyle/lib/types'
|
|
2
2
|
import { UnistylesState } from '../state'
|
3
3
|
import { keyInObject } from '../utils'
|
4
4
|
import { isUnistylesMq, parseMq } from '../mq'
|
5
|
-
import { Orientation } from '../../
|
5
|
+
import { Orientation } from '../../specs/types'
|
6
6
|
|
7
7
|
export const convertBreakpoint = (breakpoint: string): MediaQuery => {
|
8
8
|
if (Object.values(Orientation).includes(breakpoint as Orientation)) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { NestedCSSProperties } from 'typestyle/lib/types'
|
2
|
-
import type { UnistylesValues } from '../../
|
2
|
+
import type { UnistylesValues } from '../../types'
|
3
3
|
import { media } from 'typestyle'
|
4
4
|
import { isPseudo } from '../pseudo'
|
5
5
|
import { convertBreakpoint } from './breakpoint'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { TextStyle, ViewStyle } from 'react-native'
|
2
|
-
import type { ToDeepUnistyles } from '../../
|
2
|
+
import type { ToDeepUnistyles } from '../../types/stylesheet'
|
3
3
|
|
4
4
|
export type ShadowOffset = ToDeepUnistyles<{ width: number, height: number }>
|
5
5
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import type { TypeStyle } from 'typestyle'
|
2
|
-
import type { ReactNativeStyleSheet } from '../
|
3
|
-
import type { StyleSheetWithSuperPowers, StyleSheet } from '../
|
2
|
+
import type { ReactNativeStyleSheet } from '../types'
|
3
|
+
import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet'
|
4
4
|
import { UnistylesRegistry } from './registry'
|
5
5
|
import { keyInObject, reduceObject, toReactNativeClassName } from './utils'
|
6
6
|
import { UnistylesRuntime } from './runtime'
|
7
|
-
import { createUseVariants } from './
|
7
|
+
import { createUseVariants, getVariants } from './variants'
|
8
8
|
import { UnistylesListener } from './listener'
|
9
|
-
import type { UnistyleDependency } from '../
|
9
|
+
import type { UnistyleDependency } from '../specs/NativePlatform'
|
10
10
|
|
11
11
|
type ListenToDependenciesProps = {
|
12
12
|
value: StyleSheet[keyof StyleSheet],
|
@@ -16,10 +16,13 @@ type ListenToDependenciesProps = {
|
|
16
16
|
args?: Array<any>
|
17
17
|
}
|
18
18
|
|
19
|
+
type WebUnistyle = ReturnType<typeof UnistylesRegistry.createStyles>
|
20
|
+
|
19
21
|
export const create = (stylesheet: StyleSheetWithSuperPowers<StyleSheet>) => {
|
20
22
|
const computedStylesheet = typeof stylesheet === 'function'
|
21
23
|
? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime)
|
22
24
|
: stylesheet
|
25
|
+
let lastlySelectedVariants: Record<string, any> = {}
|
23
26
|
|
24
27
|
const listenToDependencies = ({ key, className, unistyles, value, args = [] } : ListenToDependenciesProps) => {
|
25
28
|
const dependencies = ('uni__dependencies' in value ? value['uni__dependencies'] : []) as Array<UnistyleDependency>
|
@@ -48,44 +51,42 @@ export const create = (stylesheet: StyleSheetWithSuperPowers<StyleSheet>) => {
|
|
48
51
|
|
49
52
|
const styles = reduceObject(computedStylesheet, (value, key) => {
|
50
53
|
if (typeof value === 'function') {
|
51
|
-
const
|
52
|
-
const
|
53
|
-
const disposeMap = new Map<number, VoidFunction | undefined>()
|
54
|
+
const webUnistyleByRef = new Map<HTMLElement, WebUnistyle>()
|
55
|
+
const disposeByRef = new Map<HTMLElement, VoidFunction | undefined>()
|
54
56
|
|
55
57
|
return (...args: Array<any>) => {
|
56
|
-
const [
|
57
|
-
const result = value(...args
|
58
|
-
const
|
59
|
-
const
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
const [ref] = args.slice(-1)
|
59
|
+
const result = value(...args)
|
60
|
+
const variants = Object.fromEntries(getVariants({ [key]: result } as ReactNativeStyleSheet<StyleSheet>, lastlySelectedVariants))
|
61
|
+
const resultWithVariants = {
|
62
|
+
...result,
|
63
|
+
...variants[key]
|
64
|
+
}
|
65
|
+
|
66
|
+
if (ref instanceof HTMLElement) {
|
67
|
+
const storedWebUnistyle = webUnistyleByRef.get(ref)
|
68
|
+
const webUnistyle = storedWebUnistyle ?? UnistylesRegistry.createStyles(resultWithVariants, key)
|
69
|
+
|
70
|
+
webUnistyleByRef.set(ref, webUnistyle)
|
71
|
+
disposeByRef.get(ref)?.()
|
72
|
+
disposeByRef.set(ref, listenToDependencies({
|
66
73
|
key,
|
67
74
|
value,
|
68
|
-
unistyles,
|
69
|
-
className,
|
75
|
+
unistyles: webUnistyle.unistyles,
|
76
|
+
className: webUnistyle.className,
|
70
77
|
args
|
71
78
|
}))
|
79
|
+
ref.classList.add(webUnistyle.className)
|
72
80
|
|
73
|
-
|
74
|
-
|
81
|
+
if (storedWebUnistyle) {
|
82
|
+
UnistylesRegistry.updateStyles(webUnistyle.unistyles, resultWithVariants, webUnistyle.className)
|
83
|
+
}
|
75
84
|
|
76
|
-
const entry = UnistylesRegistry.createStyles(result, key)
|
77
85
|
|
78
|
-
|
79
|
-
|
80
|
-
disposeMap.set(id, listenToDependencies({
|
81
|
-
key,
|
82
|
-
value,
|
83
|
-
unistyles: entry.unistyles,
|
84
|
-
className: entry.className,
|
85
|
-
args
|
86
|
-
}))
|
86
|
+
return
|
87
|
+
}
|
87
88
|
|
88
|
-
return toReactNativeClassName(
|
89
|
+
return toReactNativeClassName(null, resultWithVariants)
|
89
90
|
}
|
90
91
|
}
|
91
92
|
|
@@ -96,7 +97,9 @@ export const create = (stylesheet: StyleSheetWithSuperPowers<StyleSheet>) => {
|
|
96
97
|
return toReactNativeClassName(className, value)
|
97
98
|
}) as ReactNativeStyleSheet<StyleSheet>
|
98
99
|
|
99
|
-
createUseVariants(styles
|
100
|
+
createUseVariants(styles, newVariants => {
|
101
|
+
lastlySelectedVariants = newVariants
|
102
|
+
})
|
100
103
|
|
101
104
|
return styles
|
102
105
|
}
|
package/{web → src/web}/mock.ts
RENAMED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { UnistylesNavigationBar as NavigationBarSpec } from '../
|
2
|
-
import type { UnistylesStatusBar as StatusBarSpec } from '../
|
1
|
+
import type { UnistylesNavigationBar as NavigationBarSpec } from '../specs/NavigtionBar'
|
2
|
+
import type { UnistylesStatusBar as StatusBarSpec } from '../specs/StatusBar'
|
3
3
|
|
4
4
|
export const StatusBar: StatusBarSpec = {
|
5
5
|
width: 0,
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { UnistyleDependency } from '../
|
2
|
-
import { ColorScheme, Orientation, type AppTheme, type AppThemeName } from '../
|
3
|
-
import type { UnistylesMiniRuntime } from '../
|
4
|
-
import { WebContentSizeCategory } from '../
|
1
|
+
import { UnistyleDependency } from '../specs/NativePlatform'
|
2
|
+
import { ColorScheme, Orientation, type AppTheme, type AppThemeName } from '../specs/types'
|
3
|
+
import type { UnistylesMiniRuntime } from '../specs/UnistylesRuntime'
|
4
|
+
import { WebContentSizeCategory } from '../types'
|
5
5
|
import { UnistylesListener } from './listener'
|
6
6
|
import { NavigationBar, StatusBar } from './mock'
|
7
7
|
import { UnistylesState } from './state'
|
package/{web → src/web}/state.ts
RENAMED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { type ReactElement, createElement, createRef } from 'react'
|
2
|
-
import type { UnistylesTheme } from '../
|
3
|
-
import type { UnistylesConfig } from '../
|
4
|
-
import type { AppBreakpoint, AppThemeName } from '../
|
5
|
-
import type { UnistylesBreakpoints, UnistylesThemes } from '../
|
2
|
+
import type { UnistylesTheme } from '../types'
|
3
|
+
import type { UnistylesConfig } from '../specs/StyleSheet'
|
4
|
+
import type { AppBreakpoint, AppThemeName } from '../specs/types'
|
5
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
|
6
6
|
import { UnistylesRuntime } from './runtime'
|
7
7
|
import { isServer, schemeToTheme } from './utils'
|
8
8
|
import { UnistylesListener } from './listener'
|
9
|
-
import { UnistyleDependency } from '../
|
9
|
+
import { UnistyleDependency } from '../specs/NativePlatform'
|
10
10
|
|
11
11
|
class UnistylesStateBuilder {
|
12
12
|
private readonly isSSR = isServer()
|