react-native-unistyles 3.0.0-alpha.42 → 3.0.0-alpha.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/lib/commonjs/components/Pressable.js +15 -5
  2. package/lib/commonjs/components/Pressable.js.map +1 -1
  3. package/lib/commonjs/components/Pressable.web.js +35 -17
  4. package/lib/commonjs/components/Pressable.web.js.map +1 -1
  5. package/lib/commonjs/web/create.js +6 -1
  6. package/lib/commonjs/web/create.js.map +1 -1
  7. package/lib/commonjs/web/shadowRegistry.js +49 -48
  8. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  9. package/lib/commonjs/web/{variants/getVariants.js → variants.js} +2 -2
  10. package/lib/commonjs/web/variants.js.map +1 -0
  11. package/lib/module/components/Pressable.js +15 -5
  12. package/lib/module/components/Pressable.js.map +1 -1
  13. package/lib/module/components/Pressable.web.js +35 -17
  14. package/lib/module/components/Pressable.web.js.map +1 -1
  15. package/lib/module/web/create.js +7 -2
  16. package/lib/module/web/create.js.map +1 -1
  17. package/lib/module/web/shadowRegistry.js +49 -48
  18. package/lib/module/web/shadowRegistry.js.map +1 -1
  19. package/lib/module/web/{variants/getVariants.js → variants.js} +2 -2
  20. package/lib/module/web/variants.js.map +1 -0
  21. package/lib/typescript/src/components/Pressable.d.ts +2 -1
  22. package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
  23. package/lib/typescript/src/components/Pressable.web.d.ts +2 -1
  24. package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -1
  25. package/lib/typescript/src/web/create.d.ts.map +1 -1
  26. package/lib/typescript/src/web/shadowRegistry.d.ts +1 -1
  27. package/lib/typescript/src/web/{variants/getVariants.d.ts → variants.d.ts} +2 -2
  28. package/lib/typescript/src/web/variants.d.ts.map +1 -0
  29. package/package.json +1 -1
  30. package/plugin/index.js +1 -1
  31. package/plugin/ref.js +1 -1
  32. package/plugin/style.js +282 -99
  33. package/plugin/stylesheet.js +1 -1
  34. package/src/components/Pressable.tsx +24 -7
  35. package/src/components/Pressable.web.tsx +54 -28
  36. package/src/web/create.ts +7 -2
  37. package/src/web/shadowRegistry.ts +47 -47
  38. package/src/web/{variants/getVariants.ts → variants.ts} +2 -2
  39. package/lib/commonjs/web/variants/getVariants.js.map +0 -1
  40. package/lib/commonjs/web/variants/index.js +0 -28
  41. package/lib/commonjs/web/variants/index.js.map +0 -1
  42. package/lib/commonjs/web/variants/useVariants.js +0 -59
  43. package/lib/commonjs/web/variants/useVariants.js.map +0 -1
  44. package/lib/module/web/variants/getVariants.js.map +0 -1
  45. package/lib/module/web/variants/index.js +0 -5
  46. package/lib/module/web/variants/index.js.map +0 -1
  47. package/lib/module/web/variants/useVariants.js +0 -54
  48. package/lib/module/web/variants/useVariants.js.map +0 -1
  49. package/lib/typescript/src/web/variants/getVariants.d.ts.map +0 -1
  50. package/lib/typescript/src/web/variants/index.d.ts +0 -3
  51. package/lib/typescript/src/web/variants/index.d.ts.map +0 -1
  52. package/lib/typescript/src/web/variants/useVariants.d.ts +0 -3
  53. package/lib/typescript/src/web/variants/useVariants.d.ts.map +0 -1
  54. package/src/web/variants/index.ts +0 -2
  55. package/src/web/variants/useVariants.ts +0 -65
@@ -27,14 +27,19 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
27
27
  }) : style;
28
28
  const fnArgs = typeof styleResult === 'function'
29
29
  // @ts-expect-error - this is hidden from TS
30
- ? styleResult.getBoundArgs() : [];
30
+ ? styleResult.getBoundArgs() : Array.isArray(styleResult) ? styleResult
31
+ // @ts-expect-error - this is hidden from TS
32
+ .map(style => typeof style === 'function' ? style.getBoundArgs() : []) : [];
31
33
  if (typeof passedRef === 'object' && passedRef !== null) {
32
34
  passedRef.current = ref;
33
35
  }
34
36
  const returnFn = typeof passedRef === 'function' ? passedRef(ref) : () => {};
37
+ const unistyles = typeof rawStyle === 'function' ? rawStyle({
38
+ pressed: false
39
+ }) : rawStyle ?? [];
35
40
 
36
41
  // @ts-expect-error - this is hidden from TS
37
- _specs.UnistylesShadowRegistry.add(ref, rawStyle ?? [], variants, [fnArgs]);
42
+ _specs.UnistylesShadowRegistry.add(ref, unistyles, variants, Array.isArray(styleResult) ? fnArgs : [fnArgs]);
38
43
  return () => {
39
44
  // @ts-expect-error - this is hidden from TS
40
45
  _specs.UnistylesShadowRegistry.remove(ref);
@@ -47,17 +52,22 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
47
52
  const styleResult = typeof style === 'function' ? style(state) : style;
48
53
  const fnArgs = typeof styleResult === 'function'
49
54
  // @ts-expect-error - this is hidden from TS
50
- ? styleResult.getBoundArgs() : [];
55
+ ? styleResult.getBoundArgs() : Array.isArray(styleResult) ? styleResult
56
+ // @ts-expect-error - this is hidden from TS
57
+ .map(style => typeof style === 'function' ? style.getBoundArgs() : []) : [];
51
58
  const pressId = (0, _core.getId)();
59
+ const unistyles = typeof rawStyle === 'function' ? rawStyle(state) : rawStyle ?? [];
52
60
  if (storedRef.current) {
53
61
  // @ts-expect-error - this is hidden from TS
54
62
  _specs.UnistylesShadowRegistry.remove(storedRef.current);
55
63
  // @ts-expect-error - this is hidden from TS
56
- _specs.UnistylesShadowRegistry.add(storedRef.current, rawStyle ?? [], variants, [fnArgs], pressId);
64
+ _specs.UnistylesShadowRegistry.add(storedRef.current, unistyles, variants, Array.isArray(styleResult) ? fnArgs : [fnArgs], pressId);
57
65
  }
58
66
  return typeof styleResult === 'function'
59
67
  // @ts-expect-error - this is hidden from TS
60
- ? styleResult(pressId) : styleResult;
68
+ ? styleResult(pressId) : Array.isArray(styleResult)
69
+ // @ts-expect-error - this is hidden from TS
70
+ ? styleResult.map(style => typeof style === 'function' ? style(pressId) : style) : styleResult;
61
71
  }
62
72
  });
63
73
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_specs","_core","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Pressable","exports","forwardRef","variants","style","rawStyle","props","passedRef","storedRef","useRef","jsx","ref","current","styleResult","pressed","fnArgs","getBoundArgs","returnFn","UnistylesShadowRegistry","add","remove","state","pressId","getId"],"sourceRoot":"../../../src","sources":["components/Pressable.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAA+B,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAA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,QAAQ,KAAK,UAAU,EAAE;UAChCA,QAAQ,CAAC,CAAC;QACd;MACJ,CAAC;IACL,CAAE;IACFb,KAAK,EAAEiB,KAAK,IAAI;MACZ,MAAMR,WAAW,GAAG,OAAOT,KAAK,KAAK,UAAU,GACzCA,KAAK,CAACiB,KAAK,CAAC,GACZjB,KAAK;MACX,MAAMW,MAAM,GAAG,OAAOF,WAAW,KAAK;MAClC;MAAA,EACEA,WAAW,CAACG,YAAY,CAAC,CAAC,GAC1B,EAAE;MACR,MAAMM,OAAO,GAAG,IAAAC,WAAK,EAAC,CAAC;MAEvB,IAAIf,SAAS,CAACI,OAAO,EAAE;QACnB;QACAM,8BAAuB,CAACE,MAAM,CAACZ,SAAS,CAACI,OAAO,CAAC;QACjD;QACAM,8BAAuB,CAACC,GAAG,CAACX,SAAS,CAACI,OAAO,EAAEP,QAAQ,IAAI,EAAE,EAAEF,QAAQ,EAAE,CAACY,MAAM,CAAC,EAAEO,OAAO,CAAC;MAC/F;MAEA,OAAO,OAAOT,WAAW,KAAK;MAC1B;MAAA,EACEA,WAAW,CAACS,OAAO,CAAC,GACpBT,WAAW;IACrB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_specs","_core","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Pressable","exports","forwardRef","variants","style","rawStyle","props","passedRef","storedRef","useRef","jsx","ref","current","styleResult","pressed","fnArgs","getBoundArgs","Array","isArray","map","returnFn","unistyles","UnistylesShadowRegistry","add","remove","state","pressId","getId"],"sourceRoot":"../../../src","sources":["components/Pressable.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAA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AK,CAAC,GAC9ES,WAAW;IACzB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -35,12 +35,34 @@ const events = {
35
35
  focused: false
36
36
  }
37
37
  };
38
+ const isFunctionWithBoundArgs = fn => {
39
+ return typeof fn === 'function' && 'getBoundArgs' in fn;
40
+ };
41
+ const extractFunctionArgs = styleResult => {
42
+ return isFunctionWithBoundArgs(styleResult) ? [styleResult.getBoundArgs()] : Array.isArray(styleResult) ? styleResult.map(style => isFunctionWithBoundArgs(style) ? style.getBoundArgs() : []) : [];
43
+ };
44
+ const extractStyleResult = style => {
45
+ return typeof style === 'function' ? [style()] : Array.isArray(style) ? style.map(style => typeof style === 'function' ? style() : style) : [style];
46
+ };
47
+ const updateStyles = ({
48
+ ref,
49
+ style,
50
+ variants,
51
+ state
52
+ }) => {
53
+ const styleResult = typeof style === 'function' ? style(state) : style;
54
+ const fnArgs = extractFunctionArgs(styleResult);
55
+ const extractedResult = extractStyleResult(styleResult);
56
+
57
+ // @ts-expect-error - this is hidden from TS
58
+ _specs.UnistylesShadowRegistry.add(ref, extractedResult, variants, fnArgs);
59
+ };
38
60
  const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
39
61
  variants,
40
62
  style,
41
63
  ...props
42
64
  }, passedRef) => {
43
- const storedRef = (0, _react.useRef)();
65
+ const storedRef = (0, _react.useRef)(null);
44
66
  const state = (0, _react.useRef)(initialState);
45
67
  const styleRef = (0, _react.useRef)(style);
46
68
  (0, _react.useEffect)(() => {
@@ -52,14 +74,12 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
52
74
  ...state.current,
53
75
  ...newState
54
76
  };
55
- const styleResult = typeof styleRef.current === 'function' ? styleRef.current(state.current) : styleRef.current;
56
- const fnArgs = typeof styleResult === 'function'
57
- // @ts-expect-error - this is hidden from TS
58
- ? styleResult.getBoundArgs() : [];
59
- const extractedResult = typeof styleResult === 'function' ? styleResult() : styleResult;
60
-
61
- // @ts-expect-error - this is hidden from TS
62
- _specs.UnistylesShadowRegistry.add(storedRef.current, [extractedResult], variants, [fnArgs]);
77
+ updateStyles({
78
+ ref: storedRef.current,
79
+ style: styleRef.current,
80
+ variants,
81
+ state: state.current
82
+ });
63
83
  };
64
84
  if (!storedRef.current) {
65
85
  return;
@@ -80,17 +100,15 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
80
100
  ...props,
81
101
  ref: ref => {
82
102
  storedRef.current = ref;
83
- const styleResult = typeof style === 'function' ? style(initialState) : style;
84
- const fnArgs = typeof styleResult === 'function'
85
- // @ts-expect-error - this is hidden from TS
86
- ? styleResult.getBoundArgs() : [];
87
- const extractedResult = typeof styleResult === 'function' ? styleResult() : styleResult;
103
+ updateStyles({
104
+ ref,
105
+ style: style,
106
+ variants,
107
+ state: initialState
108
+ });
88
109
  if (typeof passedRef === 'object' && passedRef !== null) {
89
110
  passedRef.current = ref;
90
111
  }
91
-
92
- // @ts-expect-error - this is hidden from TS
93
- _specs.UnistylesShadowRegistry.add(ref, [extractedResult], variants, [fnArgs]);
94
112
  }
95
113
  });
96
114
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","initialState","pressed","hovered","focused","events","Pressable","exports","forwardRef","variants","style","props","passedRef","storedRef","useRef","state","styleRef","useEffect","current","handler","newState","styleResult","fnArgs","getBoundArgs","extractedResult","UnistylesShadowRegistry","add","ref","entries","forEach","event","addEventListener","removeEventListener","jsx"],"sourceRoot":"../../../src","sources":["components/Pressable.web.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAAkD,IAAAG,WA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IAAI,EAAE;QACrDA,SAAS,CAACM,OAAO,GAAGS,GAAG;MAC3B;;MAEA;MACAF,8BAAuB,CAACC,GAAG,CAACC,GAAG,EAAE,CAACH,eAAe,CAAC,EAAEf,QAAQ,EAAE,CAACa,MAAM,CAAC,CAAC;IAC3E;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","initialState","pressed","hovered","focused","events","isFunctionWithBoundArgs","fn","extractFunctionArgs","styleResult","getBoundArgs","Array","isArray","map","style","extractStyleResult","updateStyles","ref","variants","state","fnArgs","extractedResult","UnistylesShadowRegistry","add","Pressable","exports","forwardRef","props","passedRef","storedRef","useRef","styleRef","useEffect","current","handler","newState","entries","forEach","event","addEventListener","removeEventListener","jsx"],"sourceRoot":"../../../src","sources":["components/Pressable.web.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAAkD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IA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0B;IAAA,GACnBG,KAAK;IACTV,GAAG,EAAEA,GAAG,IAAI;MACRY,SAAS,CAACI,OAAO,GAAGhB,GAAG;MACvBD,YAAY,CAAC;QACTC,GAAG;QACHH,KAAK,EAAEA,KAA0B;QACjCI,QAAQ;QACRC,KAAK,EAAElB;MACX,CAAC,CAAC;MAEF,IAAI,OAAO2B,SAAS,KAAK,QAAQ,IAAIA,SAAS,KAAK,IAAI,EAAE;QACrDA,SAAS,CAACK,OAAO,GAAGhB,GAAG;MAC3B;IACJ;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -45,7 +45,12 @@ const create = (stylesheet, id) => {
45
45
  });
46
46
 
47
47
  // Inject useVariants hook to styles
48
- (0, _variants.createUseVariants)(styles, newVariants => Object.entries(newVariants).forEach(([key, value]) => selectedVariants.set(key, value)));
48
+ Object.defineProperty(styles, 'useVariants', {
49
+ value: variants => {
50
+ Object.entries(variants).forEach(([key, value]) => selectedVariants.set(key, value));
51
+ },
52
+ configurable: false
53
+ });
49
54
  return styles;
50
55
  };
51
56
  exports.create = create;
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_utils2","_runtime","_variants","create","stylesheet","id","error","computedStylesheet","UnistylesRuntime","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","assignSecrets","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","reduceObject","_key","String","dynamicStyle","result","variants","getVariants","resultWithVariants","deepMergeObjects","getStyles","createUseVariants","newVariants","forEach","set","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEO,MAAMI,MAAM,GAAGA,CAACC,UAAiD,EAAEC,EAAW,KAAK;EACtF,IAAI,CAACA,EAAE,EAAE;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IAAAqB,gBAAS,EAACF,kBAAkB,CAAC,EAAEjB,GAAG,EAAEC,IAAI,CAAC;MAC/D,CAAC;;MAED;MACA,OAAOH,UAAU,CAACe,YAAY,EAAEb,GAAG,CAAC;IACxC;;IAEA;IACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACpB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACA,IAAAoB,2BAAiB,EAACX,MAAM,EAAEY,WAAW,IAAI1B,MAAM,CAACE,OAAO,CAACwB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAACtB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAAC+B,GAAG,CAACvB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOU,MAAM;AACjB,CAAC;AAAAe,OAAA,CAAAxC,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","_utils2","_runtime","_variants","create","stylesheet","id","error","computedStylesheet","UnistylesRuntime","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","assignSecrets","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","reduceObject","_key","String","dynamicStyle","result","variants","getVariants","resultWithVariants","deepMergeObjects","getStyles","defineProperty","forEach","set","configurable","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEO,MAAMI,MAAM,GAAGA,CAACC,UAAiD,EAAEC,EAAW,KAAK;EACtF,IAAI,CAACA,EAAE,EAAE;IACL,MAAM,IAAAC,YAAK,EAAC,uFAAuF,CAAC;EACxG;EAEA,MAAMC,kBAAkB,GAAG,OAAOH,UAAU,KAAK,UAAU,GACrDA,UAAU,CAACI,yB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,GAAG,CAAC;IACxC;;IAEA;IACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACpB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACAL,MAAM,CAACyB,cAAc,CAACX,MAAM,EAAE,aAAa,EAAE;IACzCV,KAAK,EAAGgB,QAA0C,IAAK;MACnDpB,MAAM,CAACE,OAAO,CAACkB,QAAQ,CAAC,CAACM,OAAO,CAAC,CAAC,CAACrB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAAC8B,GAAG,CAACtB,GAAG,EAAED,KAAK,CAAC,CAAC;IACxF,CAAC;IACDwB,YAAY,EAAE;EAClB,CAAC,CAAC;EAEF,OAAOd,MAAM;AACjB,CAAC;AAAAe,OAAA,CAAAxC,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -22,16 +22,15 @@ class UnistylesShadowRegistryBuilder {
22
22
  resultsMap = new Map();
23
23
  hashMap = new Map();
24
24
  classNamesMap = new Map();
25
- add = (ref, _style, _variants, _args) => {
26
- // Style is not provided
27
- if (!_style) {
25
+ add = (ref, styles, _variants, _args) => {
26
+ // Styles are not provided
27
+ if (!styles) {
28
28
  return;
29
29
  }
30
30
 
31
31
  // Ref is unmounted, remove style tags from the document
32
32
  if (ref === null) {
33
- const secrets = (0, _utils2.extractSecrets)(_style);
34
- secrets.forEach(({
33
+ (0, _utils2.extractSecrets)(styles).forEach(({
35
34
  __uni__refs
36
35
  }) => {
37
36
  __uni__refs.forEach(ref => {
@@ -53,58 +52,60 @@ class UnistylesShadowRegistryBuilder {
53
52
  if (!(ref instanceof HTMLElement)) {
54
53
  return;
55
54
  }
56
- const styles = _style.filter(style => Object.keys(style ?? {}).some(key => key.startsWith('__uni__')));
55
+ const parsedStyles = styles.flatMap((style, styleIndex) => {
56
+ const secrets = (0, _utils2.extractSecrets)(style);
57
57
 
58
- // No unistyles
59
- if (styles.length === 0) {
60
- return;
61
- }
62
- const parsedStyles = styles.flatMap((style, styleIndex) => (0, _utils2.extractSecrets)(style).map(secret => {
63
- const {
64
- __uni__key,
65
- __uni__stylesheet,
66
- __uni__variants,
67
- __uni__args = [],
68
- __uni__refs
69
- } = secret;
70
- const newComputedStylesheet = _registry.UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
71
- const style = newComputedStylesheet[__uni__key];
72
- const variants = _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants;
73
- const args = _args[styleIndex] ? _args[styleIndex] : __uni__args;
74
- const result = typeof style === 'function' ? style(...args) : style;
75
- const {
76
- variantsResult
77
- } = Object.fromEntries((0, _variants2.getVariants)({
78
- variantsResult: result
79
- }, variants));
80
- const resultWithVariants = (0, _utils.deepMergeObjects)(result, variantsResult ?? {});
81
- const dependencies = (0, _utils2.extractUnistyleDependencies)(resultWithVariants);
82
- if (typeof __uni__stylesheet === 'function') {
83
- // Add dependencies from dynamic styles to stylesheet
84
- _registry.UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
58
+ // Regular style
59
+ if (secrets.length === 0) {
60
+ return style;
85
61
  }
86
- __uni__refs.add(ref);
87
- const dispose = _listener.UnistylesListener.addListeners((0, _utils2.extractUnistyleDependencies)(resultWithVariants), () => {
88
- const hash = this.hashMap.get(ref);
89
-
90
- // Dispose listener if there is no hash
91
- if (!hash) {
92
- dispose();
93
- return;
94
- }
95
- const newComputedStyleSheet = _registry.UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
96
- const newValue = newComputedStyleSheet[__uni__key];
97
- const result = typeof newValue === 'function' ? newValue(...args) : newValue;
62
+ return secrets.map(secret => {
63
+ const {
64
+ __uni__key,
65
+ __uni__stylesheet,
66
+ __uni__variants,
67
+ __uni__args = [],
68
+ __uni__refs
69
+ } = secret;
70
+ const newComputedStylesheet = _registry.UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
71
+ const style = newComputedStylesheet[__uni__key];
72
+ const variants = _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants;
73
+ const args = _args[styleIndex] && _args[styleIndex].length > 0 ? _args[styleIndex] : __uni__args;
74
+ const result = typeof style === 'function' ? style(...args) : style;
98
75
  const {
99
76
  variantsResult
100
77
  } = Object.fromEntries((0, _variants2.getVariants)({
101
78
  variantsResult: result
102
79
  }, variants));
103
80
  const resultWithVariants = (0, _utils.deepMergeObjects)(result, variantsResult ?? {});
104
- _registry.UnistylesRegistry.applyStyles(hash, (0, _convert.convertUnistyles)(resultWithVariants));
81
+ const dependencies = (0, _utils2.extractUnistyleDependencies)(resultWithVariants);
82
+ if (typeof __uni__stylesheet === 'function') {
83
+ // Add dependencies from dynamic styles to stylesheet
84
+ _registry.UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
85
+ }
86
+ __uni__refs.add(ref);
87
+ const dispose = _listener.UnistylesListener.addListeners((0, _utils2.extractUnistyleDependencies)(resultWithVariants), () => {
88
+ const hash = this.hashMap.get(ref);
89
+
90
+ // Dispose listener if there is no hash
91
+ if (!hash) {
92
+ dispose();
93
+ return;
94
+ }
95
+ const newComputedStyleSheet = _registry.UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
96
+ const newValue = newComputedStyleSheet[__uni__key];
97
+ const result = typeof newValue === 'function' ? newValue(...args) : newValue;
98
+ const {
99
+ variantsResult
100
+ } = Object.fromEntries((0, _variants2.getVariants)({
101
+ variantsResult: result
102
+ }, variants));
103
+ const resultWithVariants = (0, _utils.deepMergeObjects)(result, variantsResult ?? {});
104
+ _registry.UnistylesRegistry.applyStyles(hash, (0, _convert.convertUnistyles)(resultWithVariants));
105
+ });
106
+ return resultWithVariants;
105
107
  });
106
- return resultWithVariants;
107
- }));
108
+ });
108
109
  const combinedStyles = (0, _utils.deepMergeObjects)(...parsedStyles);
109
110
  const oldStyles = this.resultsMap.get(ref);
110
111
  if ((0, _utils2.equal)(combinedStyles, oldStyles)) {
@@ -1 +1 @@
1
- {"version":3,"names":["_convert","require","_listener","_registry","_utils","_utils2","_variants2","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","add","ref","_style","_variants","_args","secrets","extractSecrets","forEach","__uni__refs","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","styles","filter","style","Object","keys","some","key","startsWith","length","parsedStyles","flatMap","styleIndex","map","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","variants","args","result","variantsResult","fromEntries","getVariants","resultWithVariants","deepMergeObjects","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesListener","addListeners","hash","newComputedStyleSheet","newValue","applyStyles","convertUnistyles","combinedStyles","oldStyles","equal","oldClassNames","className","classList","set","existingHash","injectedClassNames","_web","_classNames","newClassNames","Array","isArray","concat","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAIA,MAAMM,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1CC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;;EAEQC,UAAU,GAAG,IAAIC,GAAG,CAA+B,CAAC;EACpDC,OAAO,GAAG,IAAID,GAAG,CAAsB,CAAC;EACxCE,aAAa,GAAG,IAAIF,GAAG,CAA6B,CAAC;EAE7DG,GAAG,GAAGA,CAACC,GAAQ,EAAEC,MAAoB,EAAEC,SAA0C,EAAEC,KAAwB,KAAK;IAC5G;IACA,IAAI,CAACF,MAAM,EAAE;MACT;IACJ;;IAEA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EAAES,IAAI,EAAEC,WAAW,IAAI,EAAE;IAClE,MAAMC,aAAa,GAAG,CAACC,KAAK,CAACC,OAAO,CAACL,kBAAkB,CAAC,GAAGA,kBAAkB,GAAG,CAACA,kBAAkB,CAAC,EAAEM,MAAM,CAACnB,IAAI,CAAC;IAElH,IAAI,CAAClD,aAAa,CAAC6D,GAAG,CAAC3D,GAAG,EAAEgE,aAAa,CAAC;IAC1C;IACAhE,GAAG,CAAC0D,SAAS,CAAC3D,GAAG,CAAC,GAAGiE,aAAa,CAAC;;IAEnC;IACA,IAAI,CAACJ,YAAY,EAAE;MACf,IAAI,CAAC/D,OAAO,CAAC8D,GAAG,CAAC3D,GAAG,EAAEgD,IAAI,CAAC;IAC/B;IAEA,OAAOgB,aAAa;EACxB,CAAC;EAEDnD,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEO,MAAMuD,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAI/E,8BAA8B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_convert","require","_listener","_registry","_utils","_utils2","_variants2","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","add","ref","styles","_variants","_args","extractSecrets","forEach","__uni__refs","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","parsedStyles","flatMap","style","styleIndex","secrets","length","map","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","variants","Object","keys","args","result","variantsResult","fromEntries","getVariants","resultWithVariants","deepMergeObjects","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesListener","addListeners","hash","newComputedStyleSheet","newValue","applyStyles","convertUnistyles","combinedStyles","oldStyles","equal","oldClassNames","className","classList","set","existingHash","injectedClassNames","_web","_classNames","newClassNames","Array","isArray","concat","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AACA,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
4
  value: true
5
5
  });
6
6
  exports.getVariants = void 0;
7
- var _utils = require("../../utils");
7
+ var _utils = require("../utils");
8
8
  const hasVariants = value => 'variants' in value[1];
9
9
  const getVariants = (styles, selectedVariants) => {
10
10
  return Object.entries(styles).filter(hasVariants).filter(([_key, {
@@ -36,4 +36,4 @@ const getVariants = (styles, selectedVariants) => {
36
36
  });
37
37
  };
38
38
  exports.getVariants = getVariants;
39
- //# sourceMappingURL=getVariants.js.map
39
+ //# sourceMappingURL=variants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","default","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles","deepMergeObjects","exports"],"sourceRoot":"../../../src","sources":["web/variants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,MAAMC,WAAW,GAAsBC,KAAkB,IAAgD,UAAU,IAAIA,KAAK,CAAC,CAAC,CAAC;AAExH,MAAMC,WAAW,GAAGA,CAACC,MAAyC,EAAEC,gBAAqC,KAAK;EAC7G,OAAOC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CACxBI,MAAM,CAACP,WAAW,CAAC,CACnBO,MAAM,CAAC,CAAC,CAACC,IAAI,EAAE;IAAEC;EAAS,CAAC,CAAC,KAAKJ,MAAM,CAACK,IAAI,CAACD,QAAQ,CAAC,CAACE,IAAI,CAACC,OAAO,IAAIA,OAAO,IAAIH,QAAQ,CAAC,CAAC,CAC5FI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAE;IAAEL,QAAQ;IAAEM,gBAAgB,GAAG;EAAG,CAAC,CAAC,KAAK;IACjD,MAAMC,aAAa,GAAGX,MAAM,CAACC,OAAO,CAACG,QAAQ,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACL,OAAO,EAAET,MAAM,CAAC,KAAK;MAC1E,MAAMe,eAAe,GAAGd,gBAAgB,CAACQ,OAAO,CAAC;MACjD,MAAMO,qBAAqB,GAAGhB,MAAM,CAACe,eAAe,CAAC,IAAIf,MAAM,CAACiB,OAAO;MAEvE,IAAI,CAACD,qBAAqB,EAAE;QACxB,OAAO,EAAE;MACb;MAEA,OAAOA,qBAAqB;IAChC,CAAC,CAAC;IAEF,MAAME,qBAAqB,GAAGN,gBAAgB,CAACE,OAAO,CAACK,eAAe,IAAI;MACtE,MAAM;QAAEnB,MAAM;QAAE,GAAGoB;MAAW,CAAC,GAAGD,eAAe;MAEjD,IAAIjB,MAAM,CAACC,OAAO,CAACiB,UAAU,CAAC,CAACZ,IAAI,CAAC,CAAC,CAACC,OAAO,EAAEX,KAAK,CAAC,KAAKuB,MAAM,CAACpB,gBAAgB,CAACQ,OAAO,CAAC,CAAC,KAAKY,MAAM,CAACvB,KAAK,CAAC,CAAC,EAAE;QAC5G,OAAO,EAAE;MACb;MAEA,OAAOE,MAAM;IACjB,CAAC,CAAC;IAEF,MAAMsB,mBAAmB,GAAG,IAAAC,uBAAgB,EAAC,GAAGV,aAAa,EAAE,GAAGK,qBAAqB,CAAC;IAExF,OAAO,CAACP,GAAG,EAAEW,mBAAmB,CAAC;EACrC,CAAC,CAAC;AACV,CAAC;AAAAE,OAAA,CAAAzB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -21,14 +21,19 @@ export const Pressable = /*#__PURE__*/forwardRef(({
21
21
  }) : style;
22
22
  const fnArgs = typeof styleResult === 'function'
23
23
  // @ts-expect-error - this is hidden from TS
24
- ? styleResult.getBoundArgs() : [];
24
+ ? styleResult.getBoundArgs() : Array.isArray(styleResult) ? styleResult
25
+ // @ts-expect-error - this is hidden from TS
26
+ .map(style => typeof style === 'function' ? style.getBoundArgs() : []) : [];
25
27
  if (typeof passedRef === 'object' && passedRef !== null) {
26
28
  passedRef.current = ref;
27
29
  }
28
30
  const returnFn = typeof passedRef === 'function' ? passedRef(ref) : () => {};
31
+ const unistyles = typeof rawStyle === 'function' ? rawStyle({
32
+ pressed: false
33
+ }) : rawStyle ?? [];
29
34
 
30
35
  // @ts-expect-error - this is hidden from TS
31
- UnistylesShadowRegistry.add(ref, rawStyle ?? [], variants, [fnArgs]);
36
+ UnistylesShadowRegistry.add(ref, unistyles, variants, Array.isArray(styleResult) ? fnArgs : [fnArgs]);
32
37
  return () => {
33
38
  // @ts-expect-error - this is hidden from TS
34
39
  UnistylesShadowRegistry.remove(ref);
@@ -41,17 +46,22 @@ export const Pressable = /*#__PURE__*/forwardRef(({
41
46
  const styleResult = typeof style === 'function' ? style(state) : style;
42
47
  const fnArgs = typeof styleResult === 'function'
43
48
  // @ts-expect-error - this is hidden from TS
44
- ? styleResult.getBoundArgs() : [];
49
+ ? styleResult.getBoundArgs() : Array.isArray(styleResult) ? styleResult
50
+ // @ts-expect-error - this is hidden from TS
51
+ .map(style => typeof style === 'function' ? style.getBoundArgs() : []) : [];
45
52
  const pressId = getId();
53
+ const unistyles = typeof rawStyle === 'function' ? rawStyle(state) : rawStyle ?? [];
46
54
  if (storedRef.current) {
47
55
  // @ts-expect-error - this is hidden from TS
48
56
  UnistylesShadowRegistry.remove(storedRef.current);
49
57
  // @ts-expect-error - this is hidden from TS
50
- UnistylesShadowRegistry.add(storedRef.current, rawStyle ?? [], variants, [fnArgs], pressId);
58
+ UnistylesShadowRegistry.add(storedRef.current, unistyles, variants, Array.isArray(styleResult) ? fnArgs : [fnArgs], pressId);
51
59
  }
52
60
  return typeof styleResult === 'function'
53
61
  // @ts-expect-error - this is hidden from TS
54
- ? styleResult(pressId) : styleResult;
62
+ ? styleResult(pressId) : Array.isArray(styleResult)
63
+ // @ts-expect-error - this is hidden from TS
64
+ ? styleResult.map(style => typeof style === 'function' ? style(pressId) : style) : styleResult;
55
65
  }
56
66
  });
57
67
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","getId","jsx","_jsx","variants","style","rawStyle","props","passedRef","storedRef","ref","current","styleResult","pressed","fnArgs","getBoundArgs","returnFn","add","remove","state","pressId"],"sourceRoot":"../../../src","sources":["components/Pressable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AACjD,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,KAAK,QAAQ,SAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAO/B,OAAO,MAAML,SAAS,gBAAGF,UAAU,CAAuB,CAAC;EAAEQ,QAAQ;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,SAAS,KAAK;EAC9G,MAAMC,SAAS,GAAGZ,MAAM,CAAc,CAAC;EAEvC,oBACIM,IAAA,CAACJ,0BAA0B;IAAA,GACnBQ,KAAK;IACTG,GAAG,EAAEA,GAAG,IAAI;MACRD,SAAS,CAACE,OAAO,GAAGD,GAAG;MACvB,MAAME,WAAW,GAAG,OAAOP,KAAK,KAAK,UAAU,GACzCA,KAAK,CAAC;QAAEQ,OAAO,EAAE;MAAM,CAAC,CAAC,GACzBR,KAAK;MACX,MAAMS,MAAM,GAAG,OAAOF,WAAW,KAAK;MAClC;MAAA,EACEA,WAAW,CAACG,YAAY,CAAC,CAAC,GAC1B,EAAE;MAER,IAAI,OAAOP,SAAS,KAAK,QAAQ,IAAIA,SAAS,KAAK,IAAI,EAAE;QACrDA,SAAS,CAACG,OAAO,GAAGD,GAAG;MAC3B;MAEA,MAAMM,QAAQ,GAAG,OAAOR,SAAS,KAAK,UAAU,GAC1CA,SAAS,CAACE,GAAG,CAAC,GACd,MAAM,CAAC,CAAC;;MAEd;MACAV,uBAAuB,CAACiB,GAAG,CAACP,GAAG,EAAEJ,QAAQ,IAAI,EAAE,EAAEF,QAAQ,EAAE,CAACU,MAAM,CAAC,CAAC;MAEpE,OAAO,MAAM;QACT;QACAd,uBAAuB,CAACkB,MAAM,CAACR,GAAG,CAAC;QAEnC,IAAI,OAAOM,QAAQ,KAAK,UAAU,EAAE;UAChCA,QAAQ,CAAC,CAAC;QACd;MACJ,CAAC;IACL,CAAE;IACFX,KAAK,EAAEc,KAAK,IAAI;MACZ,MAAMP,WAAW,GAAG,OAAOP,KAAK,KAAK,UAAU,GACzCA,KAAK,CAACc,KAAK,CAAC,GACZd,KAAK;MACX,MAAMS,MAAM,GAAG,OAAOF,WAAW,KAAK;MAClC;MAAA,EACEA,WAAW,CAACG,YAAY,CAAC,CAAC,GAC1B,EAAE;MACR,MAAMK,OAAO,GAAGnB,KAAK,CAAC,CAAC;MAEvB,IAAIQ,SAAS,CAACE,OAAO,EAAE;QACnB;QACAX,uBAAuB,CAACkB,MAAM,CAACT,SAAS,CAACE,OAAO,CAAC;QACjD;QACAX,uBAAuB,CAACiB,GAAG,CAACR,SAAS,CAACE,OAAO,EAAEL,QAAQ,IAAI,EAAE,EAAEF,QAAQ,EAAE,CAACU,MAAM,CAAC,EAAEM,OAAO,CAAC;MAC/F;MAEA,OAAO,OAAOR,WAAW,KAAK;MAC1B;MAAA,EACEA,WAAW,CAACQ,OAAO,CAAC,GACpBR,WAAW;IACrB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","getId","jsx","_jsx","variants","style","rawStyle","props","passedRef","storedRef","ref","current","styleResult","pressed","fnArgs","getBoundArgs","Array","isArray","map","returnFn","unistyles","add","remove","state","pressId"],"sourceRoot":"../../../src","sources":["components/Pressable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AACjD,SAASC,SAAS,IAAIC,0BAA0B,QAAyC,cAAc;AAEvG,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,KAAK,QAAQ,SAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA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,KAAK,CAACmB,OAAO,CAAC,GAAGnB,KAAK,CAAC,GAC9EO,WAAW;IACzB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -29,12 +29,34 @@ const events = {
29
29
  focused: false
30
30
  }
31
31
  };
32
+ const isFunctionWithBoundArgs = fn => {
33
+ return typeof fn === 'function' && 'getBoundArgs' in fn;
34
+ };
35
+ const extractFunctionArgs = styleResult => {
36
+ return isFunctionWithBoundArgs(styleResult) ? [styleResult.getBoundArgs()] : Array.isArray(styleResult) ? styleResult.map(style => isFunctionWithBoundArgs(style) ? style.getBoundArgs() : []) : [];
37
+ };
38
+ const extractStyleResult = style => {
39
+ return typeof style === 'function' ? [style()] : Array.isArray(style) ? style.map(style => typeof style === 'function' ? style() : style) : [style];
40
+ };
41
+ const updateStyles = ({
42
+ ref,
43
+ style,
44
+ variants,
45
+ state
46
+ }) => {
47
+ const styleResult = typeof style === 'function' ? style(state) : style;
48
+ const fnArgs = extractFunctionArgs(styleResult);
49
+ const extractedResult = extractStyleResult(styleResult);
50
+
51
+ // @ts-expect-error - this is hidden from TS
52
+ UnistylesShadowRegistry.add(ref, extractedResult, variants, fnArgs);
53
+ };
32
54
  export const Pressable = /*#__PURE__*/forwardRef(({
33
55
  variants,
34
56
  style,
35
57
  ...props
36
58
  }, passedRef) => {
37
- const storedRef = useRef();
59
+ const storedRef = useRef(null);
38
60
  const state = useRef(initialState);
39
61
  const styleRef = useRef(style);
40
62
  useEffect(() => {
@@ -46,14 +68,12 @@ export const Pressable = /*#__PURE__*/forwardRef(({
46
68
  ...state.current,
47
69
  ...newState
48
70
  };
49
- const styleResult = typeof styleRef.current === 'function' ? styleRef.current(state.current) : styleRef.current;
50
- const fnArgs = typeof styleResult === 'function'
51
- // @ts-expect-error - this is hidden from TS
52
- ? styleResult.getBoundArgs() : [];
53
- const extractedResult = typeof styleResult === 'function' ? styleResult() : styleResult;
54
-
55
- // @ts-expect-error - this is hidden from TS
56
- UnistylesShadowRegistry.add(storedRef.current, [extractedResult], variants, [fnArgs]);
71
+ updateStyles({
72
+ ref: storedRef.current,
73
+ style: styleRef.current,
74
+ variants,
75
+ state: state.current
76
+ });
57
77
  };
58
78
  if (!storedRef.current) {
59
79
  return;
@@ -74,17 +94,15 @@ export const Pressable = /*#__PURE__*/forwardRef(({
74
94
  ...props,
75
95
  ref: ref => {
76
96
  storedRef.current = ref;
77
- const styleResult = typeof style === 'function' ? style(initialState) : style;
78
- const fnArgs = typeof styleResult === 'function'
79
- // @ts-expect-error - this is hidden from TS
80
- ? styleResult.getBoundArgs() : [];
81
- const extractedResult = typeof styleResult === 'function' ? styleResult() : styleResult;
97
+ updateStyles({
98
+ ref,
99
+ style: style,
100
+ variants,
101
+ state: initialState
102
+ });
82
103
  if (typeof passedRef === 'object' && passedRef !== null) {
83
104
  passedRef.current = ref;
84
105
  }
85
-
86
- // @ts-expect-error - this is hidden from TS
87
- UnistylesShadowRegistry.add(ref, [extractedResult], variants, [fnArgs]);
88
106
  }
89
107
  });
90
108
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useEffect","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","jsx","_jsx","initialState","pressed","hovered","focused","events","variants","style","props","passedRef","storedRef","state","styleRef","current","handler","newState","styleResult","fnArgs","getBoundArgs","extractedResult","add","ref","Object","entries","forEach","event","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["components/Pressable.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAalD,MAAMC,YAA+B,GAAG;EACpCC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE;AACb,CAAC;AAED,MAAMC,MAAM,GAAG;EACX,aAA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,GAAG,CAACC,GAAG,EAAE,CAACF,eAAe,CAAC,EAAEb,QAAQ,EAAE,CAACW,MAAM,CAAC,CAAC;IAC3E;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useEffect","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","jsx","_jsx","initialState","pressed","hovered","focused","events","isFunctionWithBoundArgs","fn","extractFunctionArgs","styleResult","getBoundArgs","Array","isArray","map","style","extractStyleResult","updateStyles","ref","variants","state","fnArgs","extractedResult","add","props","passedRef","storedRef","styleRef","current","handler","newState","Object","entries","forEach","event","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["components/Pressable.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAelD,MAAMC,YAA+B,GAAG;EACpCC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE;AACb,CAAC;AAED,MAAMC,MAAM,GAAG;EACX,aAAa,EAAE;IAAEH,OAAO,EAAE;EAAK,CAAC;EAChC,WAAW,EAAE;IAAEA,OAAO,EAAE;EAAM,CAAC;EAC/B,cAAc,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC;EACjC,cAAc,EAAE;IAAEA,OAAO,EAAE;EAAM,CAAC;EAClC,OAAO,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC;EAC1B,MAAM,EAAE;IAAEA,OAAO,EAAE;EAAM;AAC7B,CAAkF;AASlF,MAAME,uBAAuB,GAAIC,EAAO,IAAkD;EACtF,OAAO,OAAOA,EAAE,KAAK,UAAU,IAAI,cAAc,IAAIA,EAAE;AAC3D,CAAC;AAED,MAAMC,mBAAmB,GAAIC,WAAgB,I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C;QACTC,GAAG;QACHH,KAAK,EAAEA,KAA0B;QACjCI,QAAQ;QACRC,KAAK,EAAElB;MACX,CAAC,CAAC;MAEF,IAAI,OAAOuB,SAAS,KAAK,QAAQ,IAAIA,SAAS,KAAK,IAAI,EAAE;QACrDA,SAAS,CAACG,OAAO,GAAGV,GAAG;MAC3B;IACJ;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  import { assignSecrets, reduceObject, getStyles, error } from './utils';
4
4
  import { deepMergeObjects } from '../utils';
5
5
  import { UnistylesRuntime } from './runtime';
6
- import { createUseVariants, getVariants } from './variants';
6
+ import { getVariants } from './variants';
7
7
  export const create = (stylesheet, id) => {
8
8
  if (!id) {
9
9
  throw error('Unistyles is not initialized correctly. Please add babel plugin to your babel config.');
@@ -41,7 +41,12 @@ export const create = (stylesheet, id) => {
41
41
  });
42
42
 
43
43
  // Inject useVariants hook to styles
44
- createUseVariants(styles, newVariants => Object.entries(newVariants).forEach(([key, value]) => selectedVariants.set(key, value)));
44
+ Object.defineProperty(styles, 'useVariants', {
45
+ value: variants => {
46
+ Object.entries(variants).forEach(([key, value]) => selectedVariants.set(key, value));
47
+ },
48
+ configurable: false
49
+ });
45
50
  return styles;
46
51
  };
47
52
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["assignSecrets","reduceObject","getStyles","error","deepMergeObjects","UnistylesRuntime","createUseVariants","getVariants","create","stylesheet","id","computedStylesheet","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","_key","String","dynamicStyle","result","variants","resultWithVariants","newVariants","forEach","set"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AAEA,SAASA,aAAa,EAAEC,YAAY,EAAEC,SAAS,EAAEC,KAAK,QAAQ,SAAS;AACvE,SAASC,gBAAgB,QAAQ,UAAU;A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CAAC;QACxH,MAAMoB,kBAAkB,GAAGhC,gBAAgB,CAAC8B,MAAM,EAAEC,QAAQ,CAACb,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;;QAExE;QACA,OAAOF,UAAU,CAAClB,SAAS,CAACkC,kBAAkB,CAAC,EAAEd,GAAG,EAAEC,IAAI,CAAC;MAC/D,CAAC;;MAED;MACA,OAAOH,UAAU,CAACa,YAAY,EAAEX,GAAG,CAAC;IACxC;;IAEA;IACA,OAAOF,UAAU,CAAClB,SAAS,CAACmB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACAhB,iBAAiB,CAACwB,MAAM,EAAEO,WAAW,IAAIpB,MAAM,CAACE,OAAO,CAACkB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAAChB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAACyB,GAAG,CAACjB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOS,MAAM;AACjB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["assignSecrets","reduceObject","getStyles","error","deepMergeObjects","UnistylesRuntime","getVariants","create","stylesheet","id","computedStylesheet","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","_key","String","dynamicStyle","result","variants","resultWithVariants","defineProperty","forEach","set","configurable"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AAEA,SAASA,aAAa,EAAEC,YAAY,EAAEC,SAAS,EAAEC,KAAK,QAAQ,SAAS;AACvE,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,YAAY;AAExC,OAAO,MAAMC,MAAM,GAAGA,CAACC,UAAiD,EAAEC,EAAW,KAAK;EACtF,IAAI,CAACA,EAAE,EAAE;IACL,MAAMN,KAAK,CAA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