react-native-unistyles 3.0.0-nightly-20250416 → 3.0.0-nightly-20250422
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -17
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +5 -1
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +2 -3
- package/lib/commonjs/web/convert/index.js +1 -4
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +4 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/convert/index.js +1 -4
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +4 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/index.js +63 -3
- package/src/web/convert/index.ts +1 -4
- package/src/web/shadowRegistry.ts +4 -1
package/README.md
CHANGED
@@ -28,8 +28,7 @@ yarn add react-native-edge-to-edge react-native-nitro-modules@0.25.2
|
|
28
28
|
|
29
29
|
| react-native-unistyles | react-native-nitro-modules |
|
30
30
|
|------------------------|----------------------------|
|
31
|
-
| 3.0.0-rc.
|
32
|
-
| 3.0.0-nightly-20250409 | 0.25.2 |
|
31
|
+
| 3.0.0-rc.2 | 0.25.2 |
|
33
32
|
|
34
33
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
35
34
|
|
@@ -78,9 +77,6 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
78
77
|
<a href="https://github.com/oscklm">
|
79
78
|
<img src="https://avatars.githubusercontent.com/u/22825865?v=4" height="70px" width="70px" alt="oscklm" />
|
80
79
|
</a>
|
81
|
-
<a href="https://github.com/guillaumehcht">
|
82
|
-
<img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="70px" width="70px" alt="guillaumehcht" />
|
83
|
-
</a>
|
84
80
|
<a href="https://github.com/ryanlanciaux">
|
85
81
|
<img src="https://avatars.githubusercontent.com/u/85041?v=4" height="70px" width="70px" alt="ryanlanciaux" />
|
86
82
|
</a>
|
@@ -91,40 +87,43 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
91
87
|
## Past sponsors
|
92
88
|
|
93
89
|
<a href="https://github.com/kmartinezmedia">
|
94
|
-
<img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="
|
90
|
+
<img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="60px" width="60px" alt="kmartinezmedia" />
|
95
91
|
</a>
|
96
92
|
<a href="https://github.com/levibuzolic">
|
97
|
-
<img src="https://avatars.githubusercontent.com/u/721323?v=4" height="
|
93
|
+
<img src="https://avatars.githubusercontent.com/u/721323?v=4" height="60px" width="60px" alt="levibuzolic" />
|
98
94
|
</a>
|
99
95
|
<a href="https://github.com/claudesortwell">
|
100
|
-
<img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="
|
96
|
+
<img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="60px" width="60px" alt="claudesortwell" />
|
101
97
|
</a>
|
102
98
|
<a href="https://github.com/luoxuhai">
|
103
|
-
<img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="
|
99
|
+
<img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="60px" width="60px" alt="luoxuhai" />
|
104
100
|
</a>
|
105
101
|
<a href="https://github.com">
|
106
|
-
<img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="
|
102
|
+
<img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="60px" width="60px" alt="anonymous" />
|
107
103
|
</a>
|
108
104
|
<a href="https://github.com/abanobboles">
|
109
|
-
<img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="
|
105
|
+
<img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="60px" width="60px" alt="abanobboles" />
|
110
106
|
</a>
|
111
107
|
<a href="https://github.com/hyoban">
|
112
|
-
<img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="
|
108
|
+
<img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="60px" width="60px" alt="hyoban" />
|
113
109
|
</a>
|
114
110
|
<a href="https://github.com/giovannilondero">
|
115
|
-
<img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="
|
111
|
+
<img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="60px" width="60px" alt="giovannilondero" />
|
116
112
|
</a>
|
117
113
|
<a href="https://github.com/4cc3ssX">
|
118
|
-
<img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="
|
114
|
+
<img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="60px" width="60px" alt="4cc3ssX" />
|
119
115
|
</a>
|
120
116
|
<a href="https://github.com/FilipiRafael">
|
121
|
-
<img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="
|
117
|
+
<img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="60px" width="60px" alt="FilipiRafael" />
|
122
118
|
</a>
|
123
119
|
<a href="https://github.com/dacoto97">
|
124
|
-
<img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="
|
120
|
+
<img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="60px" width="60px" alt="dacoto97" />
|
125
121
|
</a>
|
126
122
|
<a href="https://github.com/chinamcafee">
|
127
|
-
<img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="
|
123
|
+
<img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="60px" width="60px" alt="chinamcafee" />
|
124
|
+
</a>
|
125
|
+
<a href="https://github.com/guillaumehcht">
|
126
|
+
<img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="60px" width="60px" alt="guillaumehcht" />
|
128
127
|
</a>
|
129
128
|
|
130
129
|
## Sponsor my work
|
@@ -27,7 +27,7 @@ import java.util.Locale
|
|
27
27
|
@Keep
|
28
28
|
@DoNotStrip
|
29
29
|
class NativePlatformAndroid(private val reactContext: ReactApplicationContext): HybridNativePlatformSpec(), LifecycleEventListener {
|
30
|
-
private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.
|
30
|
+
private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.onConfigChange() }
|
31
31
|
private var _miniRuntime: UnistylesNativeMiniRuntime = buildMiniRuntime()
|
32
32
|
private val _listener = NativePlatformListener(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
|
33
33
|
|
@@ -263,6 +263,10 @@ class NativePlatformAndroid(private val reactContext: ReactApplicationContext):
|
|
263
263
|
return changedDependencies
|
264
264
|
}
|
265
265
|
|
266
|
+
private fun onConfigChange() {
|
267
|
+
this._listener.onConfigChange()
|
268
|
+
}
|
269
|
+
|
266
270
|
override fun registerPlatformListener(callback: (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit) {
|
267
271
|
this._listener.addPlatformListener(callback)
|
268
272
|
}
|
@@ -12,7 +12,6 @@ import androidx.core.view.WindowInsetsCompat
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
13
13
|
import com.facebook.react.bridge.ReactApplicationContext
|
14
14
|
import com.margelo.nitro.unistyles.Insets
|
15
|
-
import com.margelo.nitro.unistyles.UnistyleDependency
|
16
15
|
import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
17
16
|
|
18
17
|
typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
@@ -22,7 +21,7 @@ typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
|
22
21
|
class NativePlatformInsets(
|
23
22
|
private val reactContext: ReactApplicationContext,
|
24
23
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
25
|
-
private val
|
24
|
+
private val onConfigChange: () -> Unit
|
26
25
|
) {
|
27
26
|
private var _shouldListenToImeEvents = false
|
28
27
|
private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
|
@@ -106,7 +105,7 @@ class NativePlatformInsets(
|
|
106
105
|
return
|
107
106
|
}
|
108
107
|
|
109
|
-
|
108
|
+
this@NativePlatformInsets.onConfigChange()
|
110
109
|
|
111
110
|
if (shouldEmitImeEvent) {
|
112
111
|
this@NativePlatformInsets.emitImeEvent(this.getMiniRuntime())
|
@@ -15,10 +15,7 @@ const convertUnistyles = value => {
|
|
15
15
|
let hasTextShadow = false;
|
16
16
|
// Flag to mark if boxShadow is already created
|
17
17
|
let hasShadow = false;
|
18
|
-
const stylesArray = Object.entries({
|
19
|
-
...value,
|
20
|
-
...value._web
|
21
|
-
}).flatMap(([unistylesKey, unistylesValue]) => {
|
18
|
+
const stylesArray = Object.entries(value).flatMap(([unistylesKey, unistylesValue]) => {
|
22
19
|
// Keys to omit
|
23
20
|
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
|
24
21
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","_object","_pseudo","_shadow","_style","_utils2","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","
|
1
|
+
{"version":3,"names":["_utils","require","_object","_pseudo","_shadow","_style","_utils2","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","flatMap","unistylesKey","unistylesValue","includes","startsWith","isPseudo","flattenValues","isTextShadow","getTextShadowStyle","isShadow","getBoxShadowStyle","isFilter","getFilterStyle","isBoxShadow","getBoxShadow","isTransform","getTransformStyle","map","breakpointKey","breakpointValue","getStyle","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEO,MAAMM,gBAAgB,GAAI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c,CAAC,EAAE;MAC3C,OAAO,IAAAc,yBAAiB,EAACd,cAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOJ,MAAM,CAACC,OAAO,CAACG,cAAc,CAAC,CAACe,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAG,IAAAE,eAAQ,EAACnB,YAAY,EAAEkB,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAO,IAAAC,eAAQ,EAACnB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAO,IAAAmB,uBAAgB,EAAC,GAAGxB,WAAW,CAAC;AAC3C,CAAC;AAAAyB,OAAA,CAAA7B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -53,7 +53,10 @@ class UnistylesShadowRegistry {
|
|
53
53
|
// Add dependencies from dynamic styles to stylesheet
|
54
54
|
this.services.registry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
|
55
55
|
}
|
56
|
-
return
|
56
|
+
return {
|
57
|
+
...resultWithVariants,
|
58
|
+
...resultWithVariants._web
|
59
|
+
};
|
57
60
|
});
|
58
61
|
return (0, _utils.deepMergeObjects)(...allStyles);
|
59
62
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_specs","require","_utils","_utils2","_variants","UnistylesShadowRegistry","name","__type","equals","toString","dispose","scopedTheme","undefined","disposeMap","Map","constructor","services","add","ref","hash","HTMLElement","registry","connect","addStyles","unistyles","forChild","getParsedStyles","allStyles","map","unistyle","secrets","extractSecrets","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","variants","newComputedStylesheet","getComputedStylesheet","style","result","variantsResult","getVariants","resultWithVariants","deepMergeObjects","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","parsedStyles","existingHash","injectedClassNames","
|
1
|
+
{"version":3,"names":["_specs","require","_utils","_utils2","_variants","UnistylesShadowRegistry","name","__type","equals","toString","dispose","scopedTheme","undefined","disposeMap","Map","constructor","services","add","ref","hash","HTMLElement","registry","connect","addStyles","unistyles","forChild","getParsedStyles","allStyles","map","unistyle","secrets","extractSecrets","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","variants","newComputedStylesheet","getComputedStylesheet","style","result","variantsResult","getVariants","resultWithVariants","deepMergeObjects","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","_web","parsedStyles","existingHash","injectedClassNames","_classNames","injectedClassName","Array","isArray","join","filteredDependencies","state","CSSVars","filter","dependency","UnistyleDependency","Theme","set","listener","addListeners","applyStyles","hashClassname","replace","setScopedTheme","theme","getScopedTheme","remove","then","removed","get","delete","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEO,MAAMI,uBAAuB,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,WAAW,GAA+BC,SAAS;EACnDC,UAAU,GAAG,IAAIC,GAAG,CAAuB,CAAC;EAEpDC,WAAWA,CAASC,QAA2B,EAAE;IAAA,KAA7BA,QAA2B,GAA3BA,QAA2B;EAAG;EAElDC,GAAG,GAAGA,CAACC,GAAQ,EAAEC,IAAa,KAAK;IAC/B,IAAI,EAAED,GAAG,YAAYE,WAAW,CAAC,IAAI,CAACD,IAAI,EAAE;MACxC;IACJ;IAEA,IAAI,CAACH,QAAQ,CAACK,QAAQ,CAACC,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cAAc,GAAGA,CAAA,KAAM,IAAI,CAAC7D,WAAW;EAEvC8D,MAAM,GAAGA,CAACvD,GAAQ,EAAEC,IAAa,KAAK;IAClC,IAAI,EAAED,GAAG,YAAYE,WAAW,CAAC,IAAI,CAACD,IAAI,EAAE;MACxC;IACJ;IAEA,IAAI,CAACH,QAAQ,CAACK,QAAQ,CAACoD,MAAM,CAACvD,GAAG,EAAEC,IAAI,CAAC,CACnCuD,IAAI,CAACC,OAAO,IAAI;MACb,IAAI,CAACA,OAAO,EAAE;QACV;MACJ;MAEA,IAAI,CAAC9D,UAAU,CAAC+D,GAAG,CAACzD,IAAI,CAAC,GAAG,CAAC;MAC7B,IAAI,CAACN,UAAU,CAACgE,MAAM,CAAC1D,IAAI,CAAC;IAChC,CAAC,CAAC;EACV,CAAC;AACL;AAAC2D,OAAA,CAAAzE,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
@@ -11,10 +11,7 @@ export const convertUnistyles = value => {
|
|
11
11
|
let hasTextShadow = false;
|
12
12
|
// Flag to mark if boxShadow is already created
|
13
13
|
let hasShadow = false;
|
14
|
-
const stylesArray = Object.entries({
|
15
|
-
...value,
|
16
|
-
...value._web
|
17
|
-
}).flatMap(([unistylesKey, unistylesValue]) => {
|
14
|
+
const stylesArray = Object.entries(value).flatMap(([unistylesKey, unistylesValue]) => {
|
18
15
|
// Keys to omit
|
19
16
|
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
|
20
17
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","getBoxShadow","getFilterStyle","getTransformStyle","isPseudo","getBoxShadowStyle","getTextShadowStyle","getStyle","isBoxShadow","isFilter","isShadow","isTextShadow","isTransform","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","
|
1
|
+
{"version":3,"names":["deepMergeObjects","getBoxShadow","getFilterStyle","getTransformStyle","isPseudo","getBoxShadowStyle","getTextShadowStyle","getStyle","isBoxShadow","isFilter","isShadow","isTextShadow","isTransform","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,YAAY,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,UAAU;AAC1E,SAASC,QAAQ,QAAQ,UAAU;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,UAAU;AAChE,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAEpF,OAAO,MAAMC,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,SAAS,GAAG,KAAK;EAErB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO,CAACL,KAAK,CAAC,CAACM,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAClF;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAACC,QAAQ,CAACF,YAAY,CAAC,IAAIA,YAAY,CAACG,UAAU,CAAC,YAAY,CAAC,EAAE;MAC9I,OAAO,EAAE;IACb;;IAEA;IACA,IAAIpB,QAAQ,CAACiB,YAAY,CAAC,EAAE;MACxB,MAAMI,aAAa,GAAGZ,gBAAgB,CAACS,cAAiC,CAAC;MAEzE,OAAO;QAAE,CAACD,YAAY,GAAGI;MAAc,CAAC;IAC5C;;IAEA;IACA,IAAId,YAAY,CAACU,YAAY,CAAC,EAAE;MAC5B,IAAIN,aAAa,EAAE;QACf,OAAO,EAAE;MACb;MAEAA,aAAa,GAAG,IAAI;MAEpB,OAAOT,kBAAkB,CAACQ,KAAK,CAAC;IACpC;;IAEA;IACA,IAAIJ,QAAQ,CAACW,YAAY,CAAC,EAAE;MACxB,IAAIL,SAAS,EAAE;QACX,OAAO,EAAE;MACb;MAEAA,SAAS,GAAG,IAAI;MAEhB,OAAOX,iBAAiB,CAACS,KAAK,CAAC;IACnC;IAEA,IAAIL,QAAQ,CAACY,YAAY,EAAEC,cAAc,CAAC,EAAE;MACxC,OAAOpB,cAAc,CAACoB,cAAc,CAAC;IACzC;IAEA,IAAId,WAAW,CAACa,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAOrB,YAAY,CAACqB,cAAc,CAAC;IACvC;;IAEA;IACA,IAAIV,WAAW,CAACS,YAAY,EAAEC,cAAc,CAAC,EAAE;MAC3C,OAAOnB,iBAAiB,CAACmB,cAAc,CAAC;IAC5C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOJ,MAAM,CAACC,OAAO,CAACG,cAAc,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO;UAAE,CAACD,aAAa,GAAGpB,QAAQ,CAACc,YAAY,EAAEO,eAAe;QAAE,CAAC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAOrB,QAAQ,CAACc,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAOtB,gBAAgB,CAAC,GAAGiB,WAAW,CAAC;AAC3C,CAAC","ignoreList":[]}
|
@@ -49,7 +49,10 @@ export class UnistylesShadowRegistry {
|
|
49
49
|
// Add dependencies from dynamic styles to stylesheet
|
50
50
|
this.services.registry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
|
51
51
|
}
|
52
|
-
return
|
52
|
+
return {
|
53
|
+
...resultWithVariants,
|
54
|
+
...resultWithVariants._web
|
55
|
+
};
|
53
56
|
});
|
54
57
|
return deepMergeObjects(...allStyles);
|
55
58
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistyleDependency","deepMergeObjects","extractSecrets","extractUnistyleDependencies","getVariants","UnistylesShadowRegistry","name","__type","equals","toString","dispose","scopedTheme","undefined","disposeMap","Map","constructor","services","add","ref","hash","HTMLElement","registry","connect","addStyles","unistyles","forChild","getParsedStyles","allStyles","map","unistyle","secrets","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","variants","newComputedStylesheet","getComputedStylesheet","style","result","variantsResult","resultWithVariants","dependencies","addDependenciesToStylesheet","parsedStyles","existingHash","injectedClassNames","
|
1
|
+
{"version":3,"names":["UnistyleDependency","deepMergeObjects","extractSecrets","extractUnistyleDependencies","getVariants","UnistylesShadowRegistry","name","__type","equals","toString","dispose","scopedTheme","undefined","disposeMap","Map","constructor","services","add","ref","hash","HTMLElement","registry","connect","addStyles","unistyles","forChild","getParsedStyles","allStyles","map","unistyle","secrets","__uni__key","__uni__stylesheet","__uni__args","__uni_variants","variants","newComputedStylesheet","getComputedStylesheet","style","result","variantsResult","resultWithVariants","dependencies","addDependenciesToStylesheet","_web","parsedStyles","existingHash","injectedClassNames","_classNames","injectedClassName","Array","isArray","join","filteredDependencies","state","CSSVars","filter","dependency","Theme","set","listener","addListeners","applyStyles","hashClassname","replace","setScopedTheme","theme","getScopedTheme","remove","then","removed","get","delete"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,UAAU;AAE7C,SAASC,gBAAgB,QAAQ,UAAU;AAE3C,SAASC,cAAc,EAAEC,2BAA2B,QAAQ,SAAS;AACrE,SAASC,WAAW,QAAQ,YAAY;AAExC,OAAO,MAAMC,uBAAuB,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1C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,CAAC3C,IAAI,EAAEO,eAAe,CAAC,CAAC,CAAC;MAC/D,CAAC,CAAC,CAAC;IACP;IAEA,MAAMqC,aAAa,GAAGtC,QAAQ,GACxBN,IAAI,CAAC6C,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GACxB7C,IAAI;IAEV,OAAO;MAAE8B,iBAAiB;MAAE9B,IAAI,EAAE4C;IAAc,CAAC;EACrD,CAAC;EAEDE,cAAc,GAAIC,KAAsB,IAAK;IACzC,IAAI,CAACvD,WAAW,GAAGuD,KAAK;EAC5B,CAAC;EAEDC,cAAc,GAAGA,CAAA,KAAM,IAAI,CAACxD,WAAW;EAEvCyD,MAAM,GAAGA,CAAClD,GAAQ,EAAEC,IAAa,KAAK;IAClC,IAAI,EAAED,GAAG,YAAYE,WAAW,CAAC,IAAI,CAACD,IAAI,EAAE;MACxC;IACJ;IAEA,IAAI,CAACH,QAAQ,CAACK,QAAQ,CAAC+C,MAAM,CAAClD,GAAG,EAAEC,IAAI,CAAC,CACnCkD,IAAI,CAACC,OAAO,IAAI;MACb,IAAI,CAACA,OAAO,EAAE;QACV;MACJ;MAEA,IAAI,CAACzD,UAAU,CAAC0D,GAAG,CAACpD,IAAI,CAAC,GAAG,CAAC;MAC7B,IAAI,CAACN,UAAU,CAAC2D,MAAM,CAACrD,IAAI,CAAC;IAChC,CAAC,CAAC;EACV,CAAC;AACL","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAQlD,eAAO,MAAM,gBAAgB,UAAW,eAAe,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAQlD,eAAO,MAAM,gBAAgB,UAAW,eAAe,wBAkEtD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAIhD,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,QAAS,GAAG,SAAS,MAAM,UAM7B;IAED,SAAS,cAAe,KAAK,CAAC,eAAe,CAAC,aAAa,OAAO;;;
|
1
|
+
{"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAIhD,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,QAAS,GAAG,SAAS,MAAM,UAM7B;IAED,SAAS,cAAe,KAAK,CAAC,eAAe,CAAC,aAAa,OAAO;;;MAwDjE;IAED,cAAc,WAAY,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,QAAS,GAAG,SAAS,MAAM,UAchC;CACJ"}
|
package/package.json
CHANGED
package/plugin/index.js
CHANGED
@@ -171,6 +171,19 @@ function addUnistylesImport(path2, state) {
|
|
171
171
|
function isInsideNodeModules(state) {
|
172
172
|
return state.file.opts.filename?.includes("node_modules") && !state.file.replaceWithUnistyles;
|
173
173
|
}
|
174
|
+
function addUnistylesRequire(path2, state) {
|
175
|
+
Object.entries(state.reactNativeImports).forEach(([componentName, uniqueName]) => {
|
176
|
+
const newRequire = t2.variableDeclaration("const", [
|
177
|
+
t2.variableDeclarator(
|
178
|
+
t2.identifier(uniqueName),
|
179
|
+
t2.callExpression(t2.identifier("require"), [
|
180
|
+
t2.stringLiteral(toPlatformPath(`react-native-unistyles/src/components/native/${componentName}`))
|
181
|
+
])
|
182
|
+
)
|
183
|
+
]);
|
184
|
+
path2.node.body.unshift(newRequire);
|
185
|
+
});
|
186
|
+
}
|
174
187
|
|
175
188
|
// plugin/src/ref.ts
|
176
189
|
var t3 = __toESM(require("@babel/types"));
|
@@ -314,10 +327,29 @@ function stringToUniqueId(str) {
|
|
314
327
|
}
|
315
328
|
function isUnistylesStyleSheet(path2, state) {
|
316
329
|
const { callee } = path2.node;
|
317
|
-
if (t4.isMemberExpression(callee)
|
318
|
-
return
|
330
|
+
if (!t4.isMemberExpression(callee) || !t4.isIdentifier(callee.property)) {
|
331
|
+
return false;
|
332
|
+
}
|
333
|
+
const isImport = callee.property.name === "create" && t4.isIdentifier(callee.object) && callee.object.name === state.file.styleSheetLocalName;
|
334
|
+
const isRequire = state.file.hasUnistylesImport && callee.property.name === "create" && t4.isMemberExpression(callee.object) && t4.isIdentifier(callee.object.property) && t4.isIdentifier(callee.object.object) && callee.object.object.name === state.file.styleSheetLocalName && callee.object.property.name === "StyleSheet";
|
335
|
+
return isImport || isRequire;
|
336
|
+
}
|
337
|
+
function isUnistylesCommonJSRequire(path2, state) {
|
338
|
+
const isRequire = t4.isIdentifier(path2.node.callee) && path2.node.arguments.length > 0 && t4.isStringLiteral(path2.node.arguments[0]) && path2.node.arguments[0].value === "react-native-unistyles";
|
339
|
+
if (isRequire && t4.isVariableDeclarator(path2.parent) && t4.isIdentifier(path2.parent.id)) {
|
340
|
+
state.file.hasUnistylesImport = true;
|
341
|
+
state.file.styleSheetLocalName = path2.parent.id.name;
|
319
342
|
}
|
320
|
-
return
|
343
|
+
return isRequire;
|
344
|
+
}
|
345
|
+
function isReactNativeCommonJSRequire(path2, state) {
|
346
|
+
const isRequire = t4.isIdentifier(path2.node.callee) && path2.node.arguments.length > 0 && path2.node.callee.name === "require";
|
347
|
+
const requireImportName = path2.node.arguments.find((node) => t4.isStringLiteral(node));
|
348
|
+
const isReactNativeRequire = isRequire && requireImportName && (requireImportName.value === "react-native" || requireImportName.value === "react-native-web/dist/index");
|
349
|
+
if (isReactNativeRequire && t4.isVariableDeclarator(path2.parent) && t4.isIdentifier(path2.parent.id)) {
|
350
|
+
state.file.reactNativeCommonJSName = path2.parent.id.name;
|
351
|
+
}
|
352
|
+
return isRequire;
|
321
353
|
}
|
322
354
|
function isKindOfStyleSheet(path2, state) {
|
323
355
|
if (!state.file.forceProcessing && !state.file.hasUnistylesImport) {
|
@@ -691,8 +723,10 @@ function index_default() {
|
|
691
723
|
state.file.replaceWithUnistyles = REPLACE_WITH_UNISTYLES_PATHS.map(toPlatformPath).concat(state.opts.autoProcessPaths ?? []).some((path3) => state.filename?.includes(path3));
|
692
724
|
state.file.hasAnyUnistyle = false;
|
693
725
|
state.file.hasUnistylesImport = false;
|
726
|
+
state.file.addUnistylesRequire = false;
|
694
727
|
state.file.hasVariants = false;
|
695
728
|
state.file.styleSheetLocalName = "";
|
729
|
+
state.file.reactNativeCommonJSName = "";
|
696
730
|
state.file.tagNumber = 0;
|
697
731
|
state.reactNativeImports = {};
|
698
732
|
state.file.forceProcessing = state.opts.autoProcessRoot && state.filename ? state.filename.includes(toPlatformPath(`${state.file.opts.root}/${state.opts.autoProcessRoot}/`)) : false;
|
@@ -709,6 +743,9 @@ function index_default() {
|
|
709
743
|
if (isInsideNodeModules(state)) {
|
710
744
|
return;
|
711
745
|
}
|
746
|
+
if (state.file.addUnistylesRequire) {
|
747
|
+
return addUnistylesRequire(path2, state);
|
748
|
+
}
|
712
749
|
if (state.file.hasAnyUnistyle || state.file.hasVariants || state.file.replaceWithUnistyles || state.file.forceProcessing) {
|
713
750
|
addUnistylesImport(path2, state);
|
714
751
|
}
|
@@ -784,10 +821,33 @@ function index_default() {
|
|
784
821
|
throw new Error("Detected string based ref which is not supported by Unistyles.");
|
785
822
|
}
|
786
823
|
},
|
824
|
+
MemberExpression(path2, state) {
|
825
|
+
if (isInsideNodeModules(state)) {
|
826
|
+
return;
|
827
|
+
}
|
828
|
+
if (!state.file.reactNativeCommonJSName || !t6.isIdentifier(path2.node.object)) {
|
829
|
+
return;
|
830
|
+
}
|
831
|
+
if (path2.node.object.name !== state.file.reactNativeCommonJSName || !t6.isIdentifier(path2.node.property)) {
|
832
|
+
return;
|
833
|
+
}
|
834
|
+
if (!state.reactNativeImports[path2.node.property.name]) {
|
835
|
+
const uniqueId = path2.scope.generateUidIdentifier(`reactNativeUnistyles_${path2.node.property.name}`);
|
836
|
+
state.reactNativeImports[path2.node.property.name] = uniqueId.name;
|
837
|
+
state.file.addUnistylesRequire = true;
|
838
|
+
}
|
839
|
+
path2.node.object.name = state.reactNativeImports[path2.node.property.name];
|
840
|
+
},
|
787
841
|
CallExpression(path2, state) {
|
788
842
|
if (isInsideNodeModules(state)) {
|
789
843
|
return;
|
790
844
|
}
|
845
|
+
if (isUnistylesCommonJSRequire(path2, state)) {
|
846
|
+
return;
|
847
|
+
}
|
848
|
+
if (isReactNativeCommonJSRequire(path2, state)) {
|
849
|
+
return;
|
850
|
+
}
|
791
851
|
if (!isUnistylesStyleSheet(path2, state) && !isKindOfStyleSheet(path2, state)) {
|
792
852
|
return;
|
793
853
|
}
|
package/src/web/convert/index.ts
CHANGED
@@ -12,10 +12,7 @@ export const convertUnistyles = (value: UnistylesValues) => {
|
|
12
12
|
// Flag to mark if boxShadow is already created
|
13
13
|
let hasShadow = false
|
14
14
|
|
15
|
-
const stylesArray = Object.entries({
|
16
|
-
...value,
|
17
|
-
...value._web
|
18
|
-
}).flatMap(([unistylesKey, unistylesValue]) => {
|
15
|
+
const stylesArray = Object.entries(value).flatMap(([unistylesKey, unistylesValue]) => {
|
19
16
|
// Keys to omit
|
20
17
|
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
|
21
18
|
return []
|
@@ -52,7 +52,10 @@ export class UnistylesShadowRegistry {
|
|
52
52
|
this.services.registry.addDependenciesToStylesheet(__uni__stylesheet, dependencies)
|
53
53
|
}
|
54
54
|
|
55
|
-
return
|
55
|
+
return {
|
56
|
+
...resultWithVariants,
|
57
|
+
...resultWithVariants._web
|
58
|
+
} as UnistylesValues
|
56
59
|
})
|
57
60
|
|
58
61
|
return deepMergeObjects(...allStyles)
|