react-native-unistyles 3.0.0-alpha.41 → 3.0.0-alpha.43
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -1
- package/cxx/common/Constants.h +0 -1
- package/cxx/core/UnistylesRegistry.cpp +10 -4
- package/cxx/core/UnistylesRegistry.h +1 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -2
- package/cxx/parser/Parser.cpp +7 -22
- package/cxx/parser/Parser.h +0 -1
- package/lib/commonjs/components/Display.js +2 -2
- package/lib/commonjs/components/Display.js.map +1 -1
- package/lib/commonjs/components/Hide.js +2 -2
- package/lib/commonjs/components/Hide.js.map +1 -1
- package/lib/commonjs/components/Pressable.js +82 -0
- package/lib/commonjs/components/Pressable.js.map +1 -0
- package/lib/commonjs/components/Pressable.web.js +97 -0
- package/lib/commonjs/components/Pressable.web.js.map +1 -0
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/core/getBoundArgs.js +18 -0
- package/lib/commonjs/core/getBoundArgs.js.map +1 -0
- package/lib/commonjs/core/getId.js +9 -0
- package/lib/commonjs/core/getId.js.map +1 -0
- package/lib/commonjs/core/index.js +14 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useMedia.js.map +1 -0
- package/lib/commonjs/hooks/useMedia.web.js.map +1 -0
- package/lib/commonjs/index.js +8 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +6 -6
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +3 -4
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +0 -7
- package/lib/commonjs/specs/index.web.js.map +1 -1
- package/lib/commonjs/utils.js +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/types.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js +1 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/create.js +10 -2
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/index.js +7 -5
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/runtime.js +7 -7
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +1 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +23 -16
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +3 -3
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +2 -4
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/commonjs/web/{variants/getVariants.js → variants.js} +3 -3
- package/lib/commonjs/web/variants.js.map +1 -0
- package/lib/module/components/Display.js +1 -1
- package/lib/module/components/Display.js.map +1 -1
- package/lib/module/components/Hide.js +1 -1
- package/lib/module/components/Hide.js.map +1 -1
- package/lib/module/components/Pressable.js +76 -0
- package/lib/module/components/Pressable.js.map +1 -0
- package/lib/module/components/Pressable.web.js +91 -0
- package/lib/module/components/Pressable.web.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/core/getBoundArgs.js +13 -0
- package/lib/module/core/getBoundArgs.js.map +1 -0
- package/lib/module/core/getId.js +4 -0
- package/lib/module/core/getId.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/hooks/index.js +4 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useMedia.js.map +1 -0
- package/lib/module/hooks/useMedia.web.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +6 -6
- package/lib/module/mq.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +3 -4
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/module/specs/index.web.js +0 -1
- package/lib/module/specs/index.web.js.map +1 -1
- package/lib/module/utils.js +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/types.js.map +1 -1
- package/lib/module/web/convert/utils.js +1 -1
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/create.js +12 -4
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/index.js +7 -3
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/runtime.js +8 -8
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +24 -17
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -1
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +1 -2
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/{variants/getVariants.js → variants.js} +3 -3
- package/lib/module/web/variants.js.map +1 -0
- package/lib/typescript/src/components/Pressable.d.ts +7 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Pressable.web.d.ts +13 -0
- package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/core/getBoundArgs.d.ts +2 -0
- package/lib/typescript/src/core/getBoundArgs.d.ts.map +1 -0
- package/lib/typescript/src/core/getId.d.ts +2 -0
- package/lib/typescript/src/core/getId.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +2 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMedia.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- 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/ShadowRegistry/types.d.ts +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -2
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +0 -2
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +1 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +8 -2
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +1 -1
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +0 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +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 +12 -16
- package/plugin/common.js +1 -4
- package/plugin/import.js +29 -3
- package/plugin/index.js +18 -8
- package/plugin/ref.js +15 -75
- package/plugin/style.js +251 -88
- package/src/components/Display.tsx +1 -1
- package/src/components/Hide.tsx +1 -1
- package/src/components/Pressable.tsx +101 -0
- package/src/components/Pressable.web.tsx +103 -0
- package/src/components/index.ts +1 -0
- package/src/core/getBoundArgs.ts +15 -0
- package/src/core/getId.ts +1 -0
- package/src/core/index.ts +2 -0
- package/src/hooks/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/mq.ts +6 -6
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +5 -6
- package/src/specs/ShadowRegistry/types.ts +2 -1
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -2
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -2
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
- package/src/specs/UnistylesRuntime/index.ts +1 -1
- package/src/specs/index.web.ts +0 -4
- package/src/types/common.ts +1 -0
- package/src/types/index.ts +1 -1
- package/src/utils.ts +1 -1
- package/src/web/convert/types.ts +1 -1
- package/src/web/convert/utils.ts +2 -2
- package/src/web/create.ts +13 -4
- package/src/web/index.ts +7 -3
- package/src/web/listener.ts +2 -0
- package/src/web/registry.ts +1 -1
- package/src/web/runtime.ts +9 -9
- package/src/web/shadowRegistry.ts +3 -3
- package/src/web/state.ts +36 -17
- package/src/web/utils/common.ts +1 -1
- package/src/web/utils/unistyle.ts +3 -9
- package/src/web/{variants/getVariants.ts → variants.ts} +3 -3
- package/lib/commonjs/components/useMedia.js.map +0 -1
- package/lib/commonjs/components/useMedia.web.js.map +0 -1
- 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/components/useMedia.js.map +0 -1
- package/lib/module/components/useMedia.web.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/components/useMedia.d.ts.map +0 -1
- package/lib/typescript/src/components/useMedia.web.d.ts.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
- /package/lib/commonjs/{components → hooks}/useMedia.js +0 -0
- /package/lib/commonjs/{components → hooks}/useMedia.web.js +0 -0
- /package/lib/module/{components → hooks}/useMedia.js +0 -0
- /package/lib/module/{components → hooks}/useMedia.web.js +0 -0
- /package/lib/typescript/src/{components → hooks}/useMedia.d.ts +0 -0
- /package/lib/typescript/src/{components → hooks}/useMedia.web.d.ts +0 -0
- /package/src/{components → hooks}/useMedia.ts +0 -0
- /package/src/{components → hooks}/useMedia.web.ts +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
export declare const StyleSheet: {
|
2
2
|
configure: (config: import("../specs/StyleSheet").UnistylesConfig) => void;
|
3
|
-
create: (stylesheet: import("../types/stylesheet").StyleSheetWithSuperPowers<import("../types").StyleSheet
|
3
|
+
create: (stylesheet: import("../types/stylesheet").StyleSheetWithSuperPowers<import("../types").StyleSheet>, id?: string) => {
|
4
4
|
[x: string]: {
|
5
5
|
backfaceVisibility?: "visible" | "hidden" | {
|
6
6
|
[x: symbol]: "visible" | "hidden" | undefined;
|
@@ -1448,6 +1448,13 @@ export declare const StyleSheet: {
|
|
1448
1448
|
right: number;
|
1449
1449
|
bottom: number;
|
1450
1450
|
};
|
1451
|
+
absoluteFillObject: {
|
1452
|
+
position: string;
|
1453
|
+
left: number;
|
1454
|
+
top: number;
|
1455
|
+
right: number;
|
1456
|
+
bottom: number;
|
1457
|
+
};
|
1451
1458
|
compose: (a: object, b: object) => object;
|
1452
1459
|
flatten: (...styles: Array<object>) => object;
|
1453
1460
|
hairlineWidth: number;
|
@@ -1455,5 +1462,4 @@ export declare const StyleSheet: {
|
|
1455
1462
|
export { UnistylesRuntime } from './runtime';
|
1456
1463
|
export { UnistylesShadowRegistry } from './shadowRegistry';
|
1457
1464
|
export * from './mock';
|
1458
|
-
export declare const getSSRUnistyles: () => never[];
|
1459
1465
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/web/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/web/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBN,MAAM,KAAK,MAAM;yBACT,KAAK,CAAC,MAAM,CAAC;;CAErC,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,cAAc,QAAQ,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/web/listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAG5D,cAAM,wBAAwB;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAoG;IACrH,OAAO,CAAC,mBAAmB,CAAoG;IAE/H,UAAU,eAAgB,kBAAkB,UAG3C;IAED,aAAa,
|
1
|
+
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/web/listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAG5D,cAAM,wBAAwB;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAoG;IACrH,OAAO,CAAC,mBAAmB,CAAoG;IAE/H,UAAU,eAAgB,kBAAkB,UAG3C;IAED,aAAa,aAgCZ;IAED,YAAY,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAM9E;IAED,sBAAsB,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAMxF;CACJ;AAED,eAAO,MAAM,iBAAiB,0BAAiC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/web/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAMjD,cAAM,uBAAuB;IACzB,UAAU,wBAAuB;IACjC,SAAS,wBAAsB;IAE/B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;IAYpB,IAAI,WAAW,gBASd;IAED,IAAI,SAAS,cAMZ;IAED,IAAI,mBAAmB,2BAEtB;IAED,IAAI,WAAW,sCAEd;IAED,IAAI,UAAU,wDAEb;IAED,IAAI,WAAW,gBAMd;IAED,IAAI,KAAK,UAER;IAED,IAAI,UAAU,WAEb;IAED,IAAI,MAAM;;;MAYT;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,MAAM;;;;;;MAQT;IAED,IAAI,SAAS,oDAEZ;IAED,IAAI,GAAG,YAEN;IAED,IAAI,iBAAiB,YAEpB;IAED,IAAI,aAAa,2DAEhB;IAED,IAAI,WAAW,IAAI,oBAAoB,CAuBtC;IAED,QAAQ,cAAe,YAAY,
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/web/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAMjD,cAAM,uBAAuB;IACzB,UAAU,wBAAuB;IACjC,SAAS,wBAAsB;IAE/B,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;IAYpB,IAAI,WAAW,gBASd;IAED,IAAI,SAAS,cAMZ;IAED,IAAI,mBAAmB,2BAEtB;IAED,IAAI,WAAW,sCAEd;IAED,IAAI,UAAU,wDAEb;IAED,IAAI,WAAW,gBAMd;IAED,IAAI,KAAK,UAER;IAED,IAAI,UAAU,WAEb;IAED,IAAI,MAAM;;;MAYT;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,MAAM;;;;;;MAQT;IAED,IAAI,SAAS,oDAEZ;IAED,IAAI,GAAG,YAEN;IAED,IAAI,iBAAiB,YAEpB;IAED,IAAI,aAAa,2DAEhB;IAED,IAAI,WAAW,IAAI,oBAAoB,CAuBtC;IAED,QAAQ,cAAe,YAAY,UAYlC;IAED,iBAAiB,cAAe,OAAO,UAQtC;IAED,0BAA0B,UAAW,MAAM,UAM1C;IAED,gBAAgB,aAAW;IAE3B,WAAW,cAAe,YAAY,WAAW,CAAC,YAAY,EAAE,QAAQ,KAAK,QAAQ,UAQpF;IAED,QAAQ,mCAQP;CACJ;AAED,eAAO,MAAM,gBAAgB,yBAAgC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/web/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,WAAW,CAAA;
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/web/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,WAAW,CAAA;AAStE,cAAM,qBAAqB;IACvB,MAAM,qBAAoC;IAC1C,SAAS,CAAC,EAAE,YAAY,CAAA;IAExB,OAAO,CAAC,mBAAmB,CAA6B;IAExD,IAAI,UAAU,IAKkB,aAAa,GAAG,SAAS,CACxD;IAED,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAElC,iBAAiB,UAAQ;IAEzB,IAAI,WAAY,eAAe,UAa9B;IAED,OAAO,CAAC,UAAU,CAIjB;IAED,OAAO,CAAC,YAAY,CA6BnB;IAED,OAAO,CAAC,eAAe,CA2BtB;CACJ;AAED,eAAO,MAAM,cAAc,uBAA8B,CAAA"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export declare const reduceObject: <TObj extends Record<string, any>, TReducer>(obj: TObj, reducer: (value: TObj[keyof TObj], key: keyof TObj) => TReducer) => { [K in keyof TObj]: TReducer; };
|
2
2
|
export declare const keyInObject: <T extends Record<string, any>>(obj: T, key: PropertyKey) => key is keyof T;
|
3
3
|
export declare const isServer: () => boolean;
|
4
|
-
export declare const
|
4
|
+
export declare const error: (message: string) => Error;
|
5
5
|
export declare const equal: <T>(a: T, b: T) => boolean;
|
6
6
|
export declare const generateHash: (value: any) => string;
|
7
7
|
export declare const hyphenate: (propertyName: string) => string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,OAC9D,IAAI,WACA,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,KAAK,QAAQ,KACmD,GAAG,
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,OAC9D,IAAI,WACA,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,KAAK,QAAQ,KACmD,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,QAAQ,GAAE,CAAA;AAErJ,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,WAAW,KAAG,GAAG,IAAI,MAAM,CAAe,CAAA;AAElH,eAAO,MAAM,QAAQ,eAAsC,CAAA;AAE3D,eAAO,MAAM,KAAK,YAAa,MAAM,UAAuC,CAAA;AAE5E,eAAO,MAAM,KAAK,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAqBlC,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,GAAG,WAQtC,CAAA;AAED,eAAO,MAAM,SAAS,iBAAkB,MAAM,WAAyE,CAAA"}
|
@@ -2,7 +2,6 @@ import type { UnistyleDependency } from '../../specs/NativePlatform';
|
|
2
2
|
import { ColorScheme } from '../../specs/types';
|
3
3
|
import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet';
|
4
4
|
export declare const schemeToTheme: (scheme: ColorScheme) => "light" | "dark";
|
5
|
-
export declare const hexToRGBA: (hex: string, opacity: number) => string;
|
6
5
|
export type UnistyleSecrets = {
|
7
6
|
__uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>;
|
8
7
|
__uni__key: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKpG,eAAO,MAAM,aAAa,WAAY,WAAW,qBAQhD,CAAA;AAED,
|
1
|
+
{"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKpG,eAAO,MAAM,aAAa,WAAY,WAAW,qBAQhD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,iBAAiB,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAKnE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG,sBAUzC,CAAA;AAED,eAAO,MAAM,SAAS,WAAY,eAAe,OAUhD,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,WAAW,YAAoC,CAAA;AAErF,eAAO,MAAM,sBAAsB,UAAW,MAAM,uBAYnD,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,MAAM,WAmB1C,CAAA;AAED,eAAO,MAAM,2BAA2B,UAAW,GAAG,yBAQrD,CAAA"}
|
@@ -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
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.43",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "jest",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"tsc": "node_modules/typescript/bin/tsc --noEmit",
|
9
9
|
"lint": "biome lint",
|
10
10
|
"prepare": "husky && bob build",
|
11
|
-
"precommit": "concurrently '
|
11
|
+
"precommit": "concurrently 'yarn tsc' 'yarn lint' 'yarn test'",
|
12
12
|
"release": "release-it"
|
13
13
|
},
|
14
14
|
"main": "lib/commonjs/index",
|
@@ -42,11 +42,7 @@
|
|
42
42
|
"react-native",
|
43
43
|
"ios",
|
44
44
|
"android",
|
45
|
-
"react-native-macos",
|
46
|
-
"react-native-windows",
|
47
45
|
"react-native-web",
|
48
|
-
"react-native-tvos",
|
49
|
-
"react-native-visionos",
|
50
46
|
"expo"
|
51
47
|
],
|
52
48
|
"repository": "https://github.com/jpudysz/react-native-unistyles",
|
@@ -62,26 +58,26 @@
|
|
62
58
|
"devDependencies": {
|
63
59
|
"@babel/plugin-syntax-jsx": "7.25.9",
|
64
60
|
"@biomejs/biome": "1.9.4",
|
65
|
-
"@commitlint/config-conventional": "19.
|
66
|
-
"@react-native/normalize-colors": "0.76.
|
61
|
+
"@commitlint/config-conventional": "19.6.0",
|
62
|
+
"@react-native/normalize-colors": "0.76.3",
|
67
63
|
"@release-it/conventional-changelog": "8.0.2",
|
68
|
-
"@testing-library/react-hooks": "8.0.1",
|
69
64
|
"@types/jest": "29.5.14",
|
70
65
|
"@types/react": "18.3.12",
|
71
66
|
"babel-plugin-tester": "11.0.4",
|
72
|
-
"commitlint": "19.
|
73
|
-
"concurrently": "
|
74
|
-
"husky": "9.1.
|
67
|
+
"commitlint": "19.6.0",
|
68
|
+
"concurrently": "9.1.0",
|
69
|
+
"husky": "9.1.7",
|
75
70
|
"jest": "29.7.0",
|
76
71
|
"metro-react-native-babel-preset": "0.77.0",
|
77
72
|
"nitro-codegen": "0.17.0",
|
78
73
|
"react": "18.3.1",
|
79
|
-
"react-native": "0.76.
|
80
|
-
"react-native-builder-bob": "0.
|
74
|
+
"react-native": "0.76.3",
|
75
|
+
"react-native-builder-bob": "0.33.1",
|
81
76
|
"react-native-nitro-modules": "0.17.0",
|
77
|
+
"react-native-web": "0.19.13",
|
82
78
|
"react-test-renderer": "18.3.1",
|
83
|
-
"release-it": "17.
|
84
|
-
"typescript": "5.
|
79
|
+
"release-it": "17.6.0",
|
80
|
+
"typescript": "5.7.2"
|
85
81
|
},
|
86
82
|
"peerDependencies": {
|
87
83
|
"@react-native/normalize-colors": "*",
|
package/plugin/common.js
CHANGED
@@ -138,10 +138,7 @@ function getSecondPropertyName(t, memberExpression) {
|
|
138
138
|
return []
|
139
139
|
}
|
140
140
|
|
141
|
-
const PRESSABLE_STATE_NAME = '__uni_pressable_state'
|
142
|
-
|
143
141
|
module.exports = {
|
144
142
|
getIdentifierNameFromExpression,
|
145
|
-
getSecondPropertyName
|
146
|
-
PRESSABLE_STATE_NAME
|
143
|
+
getSecondPropertyName
|
147
144
|
}
|
package/plugin/import.js
CHANGED
@@ -1,8 +1,34 @@
|
|
1
|
-
module.exports = function
|
1
|
+
module.exports = function addUnistylesImport(t, path, state) {
|
2
2
|
const newImport = t.importDeclaration(
|
3
|
-
[
|
3
|
+
[
|
4
|
+
t.importSpecifier(t.identifier('UnistylesShadowRegistry'), t.identifier('UnistylesShadowRegistry')),
|
5
|
+
...state.file.shouldIncludePressable
|
6
|
+
? [
|
7
|
+
t.importSpecifier(t.identifier('Pressable'), t.identifier('Pressable')),
|
8
|
+
t.importSpecifier(t.identifier('getBoundArgs'), t.identifier('getBoundArgs'))
|
9
|
+
]
|
10
|
+
: []
|
11
|
+
].filter(Boolean),
|
4
12
|
t.stringLiteral('react-native-unistyles')
|
5
13
|
)
|
6
14
|
|
7
|
-
|
15
|
+
if (state.file.shouldIncludePressable) {
|
16
|
+
const rnImport = path.node.body.find(node => t.isImportDeclaration(node) && node.source.value === 'react-native')
|
17
|
+
|
18
|
+
if (rnImport) {
|
19
|
+
rnImport.specifiers = rnImport.specifiers.filter(specifier => specifier.local.name !== 'Pressable')
|
20
|
+
}
|
21
|
+
|
22
|
+
const rnWebImport = path.node.body.find(node => t.isImportDeclaration(node) && node.source.value === 'react-native-web/dist/exports/Pressable')
|
23
|
+
const unistylesImport = path.node.body.find(node => t.isImportDeclaration(node) && node.source.value === 'react-native-unistyles')
|
24
|
+
const hasUniPressable = unistylesImport && unistylesImport.specifiers
|
25
|
+
? unistylesImport.specifiers.find(specifier => specifier.imported.name === 'Pressable' && specifier.local.name !== "NativePressableReactNative")
|
26
|
+
: false
|
27
|
+
|
28
|
+
if (rnWebImport && !hasUniPressable) {
|
29
|
+
rnWebImport.specifiers = []
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
path.node.body.unshift(newImport)
|
8
34
|
}
|
package/plugin/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const
|
1
|
+
const addUnistylesImport = require('./import')
|
2
2
|
const { getStyleMetadata, getStyleAttribute, styleAttributeToArray, handlePressable } = require('./style')
|
3
3
|
const { getRefProp, addRef, overrideRef, hasStringRef } = require('./ref')
|
4
4
|
const { isUnistylesStyleSheet, analyzeDependencies, addStyleSheetTag, getUnistyle } = require('./stylesheet')
|
@@ -32,6 +32,8 @@ module.exports = function ({ types: t }) {
|
|
32
32
|
enter(path, state) {
|
33
33
|
state.file.hasAnyUnistyle = false
|
34
34
|
state.file.hasUnistylesImport = false
|
35
|
+
state.file.shouldIncludePressable = false
|
36
|
+
state.file.hasVariants = false
|
35
37
|
state.file.styleSheetLocalName = ''
|
36
38
|
state.file.tagNumber = 0
|
37
39
|
state.file.isClassComponent = false
|
@@ -39,7 +41,7 @@ module.exports = function ({ types: t }) {
|
|
39
41
|
},
|
40
42
|
exit(path, state) {
|
41
43
|
if (state.file.hasAnyUnistyle) {
|
42
|
-
|
44
|
+
addUnistylesImport(t, path, state)
|
43
45
|
}
|
44
46
|
}
|
45
47
|
},
|
@@ -90,11 +92,19 @@ module.exports = function ({ types: t }) {
|
|
90
92
|
|
91
93
|
if (importSource.includes('react-native')) {
|
92
94
|
path.node.specifiers.forEach(specifier => {
|
95
|
+
if (specifier.imported && specifier.imported.name === 'Pressable' && specifier.local.name !== 'NativePressableReactNative') {
|
96
|
+
state.file.shouldIncludePressable = true
|
97
|
+
}
|
98
|
+
|
93
99
|
if (specifier.imported && reactNativeComponentNames.includes(specifier.imported.name)) {
|
94
100
|
state.reactNativeImports[specifier.local.name] = true
|
95
101
|
}
|
96
102
|
})
|
97
103
|
}
|
104
|
+
|
105
|
+
if (importSource.includes('react-native-web/dist/exports/Pressable')) {
|
106
|
+
state.file.shouldIncludePressable = true
|
107
|
+
}
|
98
108
|
},
|
99
109
|
JSXElement(path, state) {
|
100
110
|
if (state.file.isClassComponent) {
|
@@ -123,15 +133,15 @@ module.exports = function ({ types: t }) {
|
|
123
133
|
|
124
134
|
const metadata = getStyleMetadata(t, styleAttr.value.expression)
|
125
135
|
|
136
|
+
if (openingElementName === 'Pressable') {
|
137
|
+
return handlePressable(t, path, styleAttr, metadata, state)
|
138
|
+
}
|
139
|
+
|
126
140
|
// style prop is using unexpected expression
|
127
141
|
if (metadata.length === 0) {
|
128
142
|
return
|
129
143
|
}
|
130
144
|
|
131
|
-
const uniquePressableId = openingElementName === 'Pressable'
|
132
|
-
? handlePressable(t, path, styleAttr, metadata)
|
133
|
-
: undefined
|
134
|
-
|
135
145
|
styleAttributeToArray(t, path)
|
136
146
|
|
137
147
|
// to add import
|
@@ -144,8 +154,8 @@ module.exports = function ({ types: t }) {
|
|
144
154
|
}
|
145
155
|
|
146
156
|
refProp
|
147
|
-
? overrideRef(t, path, refProp, metadata, state
|
148
|
-
: addRef(t, path, metadata, state
|
157
|
+
? overrideRef(t, path, refProp, metadata, state)
|
158
|
+
: addRef(t, path, metadata, state)
|
149
159
|
},
|
150
160
|
CallExpression(path, state) {
|
151
161
|
if (isUsingVariants(t, path)) {
|
package/plugin/ref.js
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
const { PRESSABLE_STATE_NAME } = require('./common')
|
2
|
-
|
3
|
-
function generateUniqueId() {
|
4
|
-
return `${Math.random().toString(36).substring(2, 9)}`
|
5
|
-
}
|
6
|
-
|
7
1
|
function getRefProp(t, path) {
|
8
2
|
return path.node.openingElement.attributes.find(attr =>
|
9
3
|
t.isJSXAttribute(attr) &&
|
@@ -25,7 +19,7 @@ function arrayExpressionFromMetadata(t, metadata) {
|
|
25
19
|
.map(meta => {
|
26
20
|
// possible for inline styles
|
27
21
|
if (meta.members.length === 0) {
|
28
|
-
return meta.inlineStyle || meta.conditionalExpression
|
22
|
+
return meta.inlineStyle || meta.conditionalExpression || meta.logicalExpression
|
29
23
|
}
|
30
24
|
|
31
25
|
const [base, ...members] = meta.members
|
@@ -37,65 +31,16 @@ function arrayExpressionFromMetadata(t, metadata) {
|
|
37
31
|
}
|
38
32
|
|
39
33
|
function arrayFromDynamicFunctionArgs(t, metadata, path) {
|
40
|
-
const hasPressableDynamicFunction = path.node.openingElement.attributes
|
41
|
-
.find(attr => t.isJSXIdentifier(attr.name) && attr.name.name === "style" && t.isArrowFunctionExpression(attr.value.expression))
|
42
|
-
|
43
34
|
const memberExpressions = metadata
|
44
|
-
.map(meta =>
|
45
|
-
|
46
|
-
|
47
|
-
// special case for pressable
|
48
|
-
if (t.isIdentifier(arg) && arg.name === PRESSABLE_STATE_NAME) {
|
49
|
-
// replace with { pressed: false }
|
50
|
-
return t.objectExpression([
|
51
|
-
t.objectProperty(
|
52
|
-
t.identifier("pressed"),
|
53
|
-
t.booleanLiteral(false)
|
54
|
-
)
|
55
|
-
])
|
56
|
-
}
|
57
|
-
|
58
|
-
if (t.isMemberExpression(arg) && arg.object.name === PRESSABLE_STATE_NAME) {
|
59
|
-
return t.identifier('false')
|
60
|
-
}
|
61
|
-
|
62
|
-
return arg
|
63
|
-
})
|
64
|
-
|
65
|
-
return t.arrayExpression(args)
|
66
|
-
}
|
67
|
-
|
68
|
-
// typeof styles.pressable === "function" ? { pressed: false } : []
|
69
|
-
if (hasPressableDynamicFunction) {
|
70
|
-
return t.arrayExpression([
|
71
|
-
t.conditionalExpression(
|
72
|
-
t.binaryExpression(
|
73
|
-
"===",
|
74
|
-
t.unaryExpression(
|
75
|
-
"typeof",
|
76
|
-
t.identifier("styles.pressable")
|
77
|
-
),
|
78
|
-
t.stringLiteral("function")
|
79
|
-
),
|
80
|
-
t.objectExpression([
|
81
|
-
t.objectProperty(
|
82
|
-
t.identifier("pressed"),
|
83
|
-
t.booleanLiteral(false)
|
84
|
-
)
|
85
|
-
]),
|
86
|
-
t.arrayExpression([])
|
87
|
-
)
|
88
|
-
])
|
89
|
-
}
|
90
|
-
|
91
|
-
return t.arrayExpression([])
|
92
|
-
})
|
35
|
+
.map(meta => meta.dynamicFunction
|
36
|
+
? t.arrayExpression(meta.dynamicFunction.arguments)
|
37
|
+
: t.arrayExpression([]))
|
93
38
|
.filter(Boolean)
|
94
39
|
|
95
40
|
return t.arrayExpression(memberExpressions)
|
96
41
|
}
|
97
42
|
|
98
|
-
function addRef(t, path, metadata, state
|
43
|
+
function addRef(t, path, metadata, state) {
|
99
44
|
const hasVariants = state.file.hasVariants
|
100
45
|
|
101
46
|
const newRefFunction = t.arrowFunctionExpression(
|
@@ -108,9 +53,8 @@ function addRef(t, path, metadata, state, uniquePressableId) {
|
|
108
53
|
t.identifier('ref'),
|
109
54
|
arrayExpressionFromMetadata(t, metadata),
|
110
55
|
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
111
|
-
arrayFromDynamicFunctionArgs(t, metadata, path)
|
112
|
-
|
113
|
-
].filter(Boolean)
|
56
|
+
arrayFromDynamicFunctionArgs(t, metadata, path)
|
57
|
+
]
|
114
58
|
)
|
115
59
|
),
|
116
60
|
t.returnStatement(
|
@@ -132,7 +76,7 @@ function addRef(t, path, metadata, state, uniquePressableId) {
|
|
132
76
|
path.node.openingElement.attributes.push(newRefProp)
|
133
77
|
}
|
134
78
|
|
135
|
-
function overrideRef(t, path, refProp, metadata, state
|
79
|
+
function overrideRef(t, path, refProp, metadata, state) {
|
136
80
|
const hasVariants = state.file.hasVariants
|
137
81
|
const uniqueRefName = path.scope.generateUidIdentifier('ref').name
|
138
82
|
const isIdentifier = t.isIdentifier(refProp.value.expression)
|
@@ -158,9 +102,8 @@ function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
|
|
158
102
|
t.identifier(uniqueRefName),
|
159
103
|
arrayExpressionFromMetadata(t, metadata),
|
160
104
|
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
161
|
-
arrayFromDynamicFunctionArgs(t, metadata, path)
|
162
|
-
|
163
|
-
].filter(Boolean)
|
105
|
+
arrayFromDynamicFunctionArgs(t, metadata, path)
|
106
|
+
]
|
164
107
|
)
|
165
108
|
),
|
166
109
|
t.returnStatement(
|
@@ -204,9 +147,8 @@ function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
|
|
204
147
|
t.identifier(userRefName),
|
205
148
|
arrayExpressionFromMetadata(t, metadata),
|
206
149
|
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
207
|
-
arrayFromDynamicFunctionArgs(t, metadata, path)
|
208
|
-
|
209
|
-
].filter(Boolean)
|
150
|
+
arrayFromDynamicFunctionArgs(t, metadata, path)
|
151
|
+
]
|
210
152
|
)
|
211
153
|
),
|
212
154
|
// Merged cleanup function
|
@@ -267,9 +209,8 @@ function overrideRef(t, path, refProp, metadata, state, uniquePressableId) {
|
|
267
209
|
t.identifier(uniqueRefName),
|
268
210
|
arrayExpressionFromMetadata(t, metadata),
|
269
211
|
t.identifier(hasVariants ? '__uni__variants' : 'undefined'),
|
270
|
-
arrayFromDynamicFunctionArgs(t, metadata, path)
|
271
|
-
|
272
|
-
].filter(Boolean)
|
212
|
+
arrayFromDynamicFunctionArgs(t, metadata, path)
|
213
|
+
]
|
273
214
|
)
|
274
215
|
),
|
275
216
|
t.returnStatement(
|
@@ -300,6 +241,5 @@ module.exports = {
|
|
300
241
|
getRefProp,
|
301
242
|
addRef,
|
302
243
|
overrideRef,
|
303
|
-
hasStringRef
|
304
|
-
generateUniqueId
|
244
|
+
hasStringRef
|
305
245
|
}
|