react-native-unistyles 3.0.0-alpha.35 → 3.0.0-alpha.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. package/android/CMakeLists.txt +31 -36
  2. package/android/build.gradle +2 -1
  3. package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
  4. package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
  5. package/android/src/main/cxx/cpp-adapter.cpp +8 -86
  6. package/android/src/main/java/com/unistyles/NativePlatform.kt +184 -0
  7. package/android/src/main/java/com/unistyles/UnistylesModule+insets.kt +8 -0
  8. package/android/src/main/java/com/unistyles/UnistylesModule.kt +47 -0
  9. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
  10. package/cxx/NativePlatform.h +11 -0
  11. package/cxx/common/Helpers.h +1 -1
  12. package/cxx/core/Unistyle.h +1 -1
  13. package/cxx/core/UnistylesRegistry.h +1 -1
  14. package/cxx/hybridObjects/HybridNavigationBar.h +3 -3
  15. package/cxx/hybridObjects/HybridStatusBar.h +3 -3
  16. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +4 -4
  17. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
  18. package/lib/commonjs/components/useMedia.js.map +1 -1
  19. package/lib/commonjs/components/useMedia.web.js +43 -0
  20. package/lib/commonjs/components/useMedia.web.js.map +1 -0
  21. package/lib/commonjs/core/createUnistylesComponent.js +57 -4
  22. package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
  23. package/lib/commonjs/core/createUnistylesComponent.native.js +6 -5
  24. package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
  25. package/lib/commonjs/web/convert/index.js +16 -11
  26. package/lib/commonjs/web/convert/index.js.map +1 -1
  27. package/lib/commonjs/web/convert/object/boxShadow.js +58 -0
  28. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
  29. package/lib/commonjs/web/convert/object/filter.js +42 -0
  30. package/lib/commonjs/web/convert/object/filter.js.map +1 -0
  31. package/lib/commonjs/web/convert/object/index.js +39 -0
  32. package/lib/commonjs/web/convert/object/index.js.map +1 -0
  33. package/lib/commonjs/web/convert/object/objectStyle.js +55 -0
  34. package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
  35. package/lib/commonjs/web/convert/object/transform.js +27 -0
  36. package/lib/commonjs/web/convert/object/transform.js.map +1 -0
  37. package/lib/commonjs/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
  38. package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
  39. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
  40. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
  41. package/lib/commonjs/web/convert/shadow/index.js +28 -0
  42. package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
  43. package/lib/commonjs/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
  44. package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
  45. package/lib/commonjs/web/convert/utils.js +7 -3
  46. package/lib/commonjs/web/convert/utils.js.map +1 -1
  47. package/lib/commonjs/web/listener.js +10 -0
  48. package/lib/commonjs/web/listener.js.map +1 -1
  49. package/lib/commonjs/web/registry.js +13 -26
  50. package/lib/commonjs/web/registry.js.map +1 -1
  51. package/lib/commonjs/web/runtime.js +3 -0
  52. package/lib/commonjs/web/runtime.js.map +1 -1
  53. package/lib/commonjs/web/shadowRegistry.js +79 -39
  54. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  55. package/lib/commonjs/web/utils/common.js +3 -33
  56. package/lib/commonjs/web/utils/common.js.map +1 -1
  57. package/lib/commonjs/web/utils/unistyle.js +4 -1
  58. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  59. package/lib/module/components/useMedia.js.map +1 -1
  60. package/lib/module/components/useMedia.web.js +38 -0
  61. package/lib/module/components/useMedia.web.js.map +1 -0
  62. package/lib/module/core/createUnistylesComponent.js +55 -3
  63. package/lib/module/core/createUnistylesComponent.js.map +1 -1
  64. package/lib/module/core/createUnistylesComponent.native.js +6 -5
  65. package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
  66. package/lib/module/web/convert/index.js +14 -9
  67. package/lib/module/web/convert/index.js.map +1 -1
  68. package/lib/module/web/convert/object/boxShadow.js +53 -0
  69. package/lib/module/web/convert/object/boxShadow.js.map +1 -0
  70. package/lib/module/web/convert/object/filter.js +37 -0
  71. package/lib/module/web/convert/object/filter.js.map +1 -0
  72. package/lib/module/web/convert/object/index.js +6 -0
  73. package/lib/module/web/convert/object/index.js.map +1 -0
  74. package/lib/module/web/convert/object/objectStyle.js +50 -0
  75. package/lib/module/web/convert/object/objectStyle.js.map +1 -0
  76. package/lib/module/web/convert/object/transform.js +22 -0
  77. package/lib/module/web/convert/object/transform.js.map +1 -0
  78. package/lib/module/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
  79. package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
  80. package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
  81. package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
  82. package/lib/module/web/convert/shadow/index.js +5 -0
  83. package/lib/module/web/convert/shadow/index.js.map +1 -0
  84. package/lib/module/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
  85. package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
  86. package/lib/module/web/convert/utils.js +4 -2
  87. package/lib/module/web/convert/utils.js.map +1 -1
  88. package/lib/module/web/listener.js +10 -0
  89. package/lib/module/web/listener.js.map +1 -1
  90. package/lib/module/web/registry.js +14 -27
  91. package/lib/module/web/registry.js.map +1 -1
  92. package/lib/module/web/runtime.js +3 -0
  93. package/lib/module/web/runtime.js.map +1 -1
  94. package/lib/module/web/shadowRegistry.js +80 -40
  95. package/lib/module/web/shadowRegistry.js.map +1 -1
  96. package/lib/module/web/utils/common.js +1 -31
  97. package/lib/module/web/utils/common.js.map +1 -1
  98. package/lib/module/web/utils/unistyle.js +4 -1
  99. package/lib/module/web/utils/unistyle.js.map +1 -1
  100. package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
  101. package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
  102. package/lib/typescript/src/core/createUnistylesComponent.d.ts +4 -3
  103. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
  104. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +4 -3
  105. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
  106. package/lib/typescript/src/types/common.d.ts +1 -0
  107. package/lib/typescript/src/types/common.d.ts.map +1 -1
  108. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  109. package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
  110. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
  111. package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
  112. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
  113. package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
  114. package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
  115. package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
  116. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
  117. package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
  118. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
  119. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
  120. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
  121. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
  122. package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
  123. package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
  124. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
  125. package/lib/typescript/src/web/convert/types.d.ts +7 -1
  126. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  127. package/lib/typescript/src/web/convert/utils.d.ts +8 -4
  128. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  129. package/lib/typescript/src/web/create.d.ts +8 -8
  130. package/lib/typescript/src/web/index.d.ts +8 -8
  131. package/lib/typescript/src/web/listener.d.ts +2 -0
  132. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  133. package/lib/typescript/src/web/registry.d.ts +5 -9
  134. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  135. package/lib/typescript/src/web/runtime.d.ts +1 -0
  136. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  137. package/lib/typescript/src/web/shadowRegistry.d.ts +4 -1
  138. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  139. package/lib/typescript/src/web/utils/common.d.ts +1 -6
  140. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  141. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  142. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -0
  143. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
  144. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void.kt +1 -0
  145. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency_.kt +1 -0
  146. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
  147. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -0
  148. package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
  149. package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
  150. package/package.json +3 -3
  151. package/src/components/useMedia.ts +1 -1
  152. package/src/components/useMedia.web.ts +47 -0
  153. package/src/core/createUnistylesComponent.native.tsx +12 -10
  154. package/src/core/createUnistylesComponent.tsx +72 -6
  155. package/src/types/common.ts +1 -0
  156. package/src/web/convert/index.ts +16 -9
  157. package/src/web/convert/object/boxShadow.ts +54 -0
  158. package/src/web/convert/object/filter.ts +39 -0
  159. package/src/web/convert/object/index.ts +3 -0
  160. package/src/web/convert/object/objectStyle.ts +68 -0
  161. package/src/web/convert/object/transform.ts +24 -0
  162. package/src/web/convert/{boxShadow.ts → shadow/boxShadow.ts} +9 -30
  163. package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
  164. package/src/web/convert/shadow/index.ts +2 -0
  165. package/src/web/convert/{textShadow.ts → shadow/textShadow.ts} +9 -29
  166. package/src/web/convert/types.ts +8 -1
  167. package/src/web/convert/utils.ts +11 -5
  168. package/src/web/listener.ts +10 -0
  169. package/src/web/registry.ts +10 -31
  170. package/src/web/runtime.ts +4 -0
  171. package/src/web/shadowRegistry.ts +85 -46
  172. package/src/web/utils/common.ts +1 -37
  173. package/src/web/utils/unistyle.ts +5 -1
  174. package/android/src/main/cxx/helpers.cpp +0 -105
  175. package/android/src/main/cxx/helpers.h +0 -16
  176. package/android/src/main/cxx/platform.cpp +0 -170
  177. package/android/src/main/cxx/platform.h +0 -20
  178. package/lib/commonjs/web/convert/boxShadow.js.map +0 -1
  179. package/lib/commonjs/web/convert/shadow.js +0 -68
  180. package/lib/commonjs/web/convert/shadow.js.map +0 -1
  181. package/lib/commonjs/web/convert/textShadow.js.map +0 -1
  182. package/lib/commonjs/web/convert/transform.js +0 -72
  183. package/lib/commonjs/web/convert/transform.js.map +0 -1
  184. package/lib/module/web/convert/boxShadow.js.map +0 -1
  185. package/lib/module/web/convert/shadow.js +0 -63
  186. package/lib/module/web/convert/shadow.js.map +0 -1
  187. package/lib/module/web/convert/textShadow.js.map +0 -1
  188. package/lib/module/web/convert/transform.js +0 -67
  189. package/lib/module/web/convert/transform.js.map +0 -1
  190. package/lib/typescript/src/web/convert/boxShadow.d.ts.map +0 -1
  191. package/lib/typescript/src/web/convert/shadow.d.ts +0 -2
  192. package/lib/typescript/src/web/convert/shadow.d.ts.map +0 -1
  193. package/lib/typescript/src/web/convert/textShadow.d.ts.map +0 -1
  194. package/lib/typescript/src/web/convert/transform.d.ts +0 -4
  195. package/lib/typescript/src/web/convert/transform.d.ts.map +0 -1
  196. package/src/web/convert/shadow.ts +0 -68
  197. package/src/web/convert/transform.ts +0 -88
  198. /package/lib/typescript/src/web/convert/{boxShadow.d.ts → shadow/boxShadow.d.ts} +0 -0
  199. /package/lib/typescript/src/web/convert/{textShadow.d.ts → shadow/textShadow.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_registry","require","_utils","_variants2","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","createDoubleMap","classNamesMap","add","ref","_style","_variants","_args","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","extractSecrets","__uni__refs","__uni__key","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","secret","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","variants","length","result","variantsResult","fromEntries","getVariants","resultWithVariants","deepMergeObjects","equal","oldClassNames","className","classList","set","stylesheet","value","injectedClassNames","_web","_classNames","newClassNames","concat","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAIA,MAAMG,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,IAAAC,sBAAe,EAAuC,CAAC;EACpEC,aAAa,GAAG,IAAAD,sBAAe,EAAqC,CAAC;EAE7EE,GAAG,GAAGA,CAACC,GAAQ,EAAEC,MAA6B,EAAEC,SAA+B,EAAEC,KAAkB,KAAK;IAC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,CAAC3C,GAAG,EAAEgB,UAAU,EAAEqB,kBAAkB,CAAC;MAExD,MAAMI,SAAS,GAAGpB,2BAAiB,CAACtB,GAAG,CAAC;QACpCY,GAAG,EAAEK,UAAU;QACfc,IAAI;QACJc,UAAU,EAAEnB,iBAAiB;QAC7BoB,KAAK,EAAER,kBAAkB;QACzBN;MACJ,CAAC,CAAC;MACF,MAAMe,kBAAiC,GAAGT,kBAAkB,EAAEU,IAAI,EAAEC,WAAW,IAAI,EAAE;MACrF,MAAMC,aAAa,GAAGH,kBAAkB,CAACI,MAAM,CAACT,SAAS,CAAC;MAC1D,MAAMU,YAAY,GAAG,IAAAC,kCAA2B,EAACf,kBAAkB,CAAC;MAEpE,IAAI,OAAOZ,iBAAiB,KAAK,UAAU,EAAE;QACzC;QACAJ,2BAAiB,CAACgC,2BAA2B,CAAC5B,iBAAiB,EAAE0B,YAAY,CAAC;MAClF;MAEApC,WAAW,CAAChB,GAAG,CAACC,GAAG,CAAC;MACpB,IAAI,CAACF,aAAa,CAAC6C,GAAG,CAAC3C,GAAG,EAAEgB,UAAU,EAAEiC,aAAa,CAAC;MACtD;MACAjD,GAAG,CAAC0C,SAAS,CAAC3C,GAAG,CAAC,GAAGkD,aAAa,CAAC;IACvC,CAAC,CAAC;EACN,CAAC;EAED3B,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEO,MAAMgC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAIhE,8BAA8B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_convert","require","_listener","_registry","_utils","_variants2","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","timeoutMap","queuedResultMap","add","ref","_style","_variants","_args","Promise","resolve","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","extractSecrets","__uni__refs","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","variants","length","result","variantsResult","fromEntries","getVariants","resultWithVariants","deepMergeObjects","storedResult","newResult","timeout","set","clearTimeout","setTimeout","equal","oldClassNames","className","classList","hash","existingHash","injectedClassNames","_web","_classNames","newClassNames","concat","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesListener","addListeners","newComputedStyleSheet","newValue","applyStyles","convertUnistyles","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,UAAA,GAAAJ,OAAA;AAIA,MAAMK,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;EACrDG,UAAU,GAAG,IAAIH,GAAG,CAA8B,CAAC;EACnDI,eAAe,GAAG,IAAIJ,GAAG,CAAmC,CAAC;EAErEK,GAAG,GAAGA,CAACC,GAAQ,EAAEC,MAA6B,EAAEC,SAA+B,EAAEC,KAAkB,KAAK,IAAIC,OAAO,CAAgBC,OAAO,IAAI;IAC1I;IACA,IAAI,CAACJ,MAAM,EAAE;MACT;IACJ;;IAEA;IACA,IAAIK,KAAK,CAACC,OAAO,CAACN,MAAM,CAAC,EAAE;MACvBA,MAAM,CAACO,OAAO,CAACC,KAAK,IAAI,IAAI,CAACV,GAAG,CAACC,GAA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AAI,CAACmD,IAAI,EAAE;UACP3D,OAAO,CAAC,CAAC;UAET;QACJ;QAEA,MAAMuE,qBAAqB,GAAGzC,2BAAiB,CAACS,qBAAqB,CAACJ,iBAAiB,CAAC;QACxF,MAAMqC,QAAQ,GAAGD,qBAAqB,CAACrC,UAAU,CAAE;QACnD,MAAMS,MAAM,GAAG,OAAO6B,QAAQ,KAAK,UAAU,GACvCA,QAAQ,CAAC,GAAGhC,IAAI,CAAC,GACjBgC,QAAQ;QACd,MAAM;UAAE5B;QAAe,CAAC,GAAG1B,MAAM,CAAC2B,WAAW,CAAC,IAAAC,sBAAW,EAAC;UAAEF,cAAc,EAAED;QAAO,CAAC,EAAEF,QAAQ,CAAC,CAAC;QAChG,MAAMM,kBAAkB,GAAG,IAAAC,uBAAgB,EAACL,MAAM,EAAEC,cAAc,IAAI,CAAC,CAAC,CAAC;QAEzEd,2BAAiB,CAAC2C,WAAW,CAACd,IAAI,EAAE,IAAAe,yBAAgB,EAAC3B,kBAAkB,CAAC,CAAC;MAC7E,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,CAAC;EAEFhB,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEO,MAAM4C,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAIhF,8BAA8B,CAAC,CAAC","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.warn = exports.reduceObject = exports.keyInObject = exports.isServer = exports.generateHash = exports.equal = exports.deepMergeObjects = exports.createDoubleMap = void 0;
6
+ exports.warn = exports.reduceObject = exports.keyInObject = exports.isServer = exports.hyphenate = exports.generateHash = exports.equal = exports.deepMergeObjects = void 0;
7
7
  const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
8
8
  exports.reduceObject = reduceObject;
9
9
  const keyInObject = (obj, key) => key in obj;
@@ -57,36 +57,6 @@ const generateHash = value => {
57
57
  return `unistyles-${(hasher >>> 0).toString(36)}`;
58
58
  };
59
59
  exports.generateHash = generateHash;
60
- const createDoubleMap = () => {
61
- const map = new Map();
62
- return {
63
- get: (key, secondKey) => {
64
- const mapForKey = map.get(key);
65
- if (!mapForKey) {
66
- return undefined;
67
- }
68
- return mapForKey.get(secondKey);
69
- },
70
- set: (key, secondKey, value) => {
71
- const mapForKey = map.get(key) ?? new Map();
72
- map.set(key, mapForKey);
73
- mapForKey.set(secondKey, value);
74
- },
75
- delete: (key, secondKey) => {
76
- const mapForKey = map.get(key);
77
- if (!mapForKey) {
78
- return;
79
- }
80
- mapForKey.delete(secondKey);
81
- },
82
- forEach: callback => {
83
- map.forEach((mapForKey, key) => {
84
- mapForKey.forEach((value, secondKey) => {
85
- callback(key, secondKey, value);
86
- });
87
- });
88
- }
89
- };
90
- };
91
- exports.createDoubleMap = createDoubleMap;
60
+ const hyphenate = propertyName => propertyName.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
61
+ exports.hyphenate = hyphenate;
92
62
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","exports","keyInObject","isServer","window","deepMergeObjects","sources","target","forEach","source","keys","sourceValue","targetValue","warn","message","console","equal","a","b","is","keysA","length","every","prototype","hasOwnProperty","call","generateHash","str","JSON","stringify","hasher","charCodeAt","toString","createDoubleMap","Map","get","secondKey","mapForKey","undefined","set","delete","callback"],"sourceRoot":"../../../../src","sources":["web/utils/common.ts"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAGA,CACxBC,GAAS,EACTC,OAA+D,KAC9DC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACJ,GAAG,CAAC,CAACK,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK,CAACD,GAAG,EAAEL,OAAO,CAACM,KAAK,EAAsBD,GAAG,CAAC,CAAC,CAA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AAK;MACvC,MAAMC,SAAS,GAAGvC,GAAG,CAACqC,GAAG,CAACpC,GAAG,CAAC;MAE9B,IAAI,CAACsC,SAAS,EAAE;QACZ,OAAOC,SAAS;MACpB;MAEA,OAAOD,SAAS,CAACF,GAAG,CAACC,SAAS,CAAC;IACnC,CAAC;IACDG,GAAG,EAAEA,CAACxC,GAAS,EAAEqC,SAAqB,EAAEpC,KAAa,KAAK;MACtD,MAAMqC,SAAS,GAAGvC,GAAG,CAACqC,GAAG,CAACpC,GAAG,CAAC,IAAI,IAAImC,GAAG,CAAqB,CAAC;MAE/DpC,GAAG,CAACyC,GAAG,CAACxC,GAAG,EAAEsC,SAAS,CAAC;MACvBA,SAAS,CAACE,GAAG,CAACH,SAAS,EAAEpC,KAAK,CAAC;IACnC,CAAC;IACDwC,MAAM,EAAEA,CAACzC,GAAS,EAAEqC,SAAqB,KAAK;MAC1C,MAAMC,SAAS,GAAGvC,GAAG,CAACqC,GAAG,CAACpC,GAAG,CAAC;MAE9B,IAAI,CAACsC,SAAS,EAAE;QACZ;MACJ;MAEAA,SAAS,CAACG,MAAM,CAACJ,SAAS,CAAC;IAC/B,CAAC;IACD5B,OAAO,EAAGiC,QAAmE,IAAK;MAC9E3C,GAAG,CAACU,OAAO,CAAC,CAAC6B,SAAS,EAAEtC,GAAG,KAAK;QAC5BsC,SAAS,CAAC7B,OAAO,CAAC,CAACR,KAAK,EAAEoC,SAAS,KAAK;UACpCK,QAAQ,CAAC1C,GAAG,EAAEqC,SAAS,EAAEpC,KAAK,CAAC;QACnC,CAAC,CAAC;MACN,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAgC,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","exports","keyInObject","isServer","window","deepMergeObjects","sources","target","forEach","source","keys","sourceValue","targetValue","warn","message","console","equal","a","b","is","keysA","length","every","prototype","hasOwnProperty","call","generateHash","str","JSON","stringify","hasher","charCodeAt","toString","hyphenate","propertyName","replace","m","toLowerCase"],"sourceRoot":"../../../../src","sources":["web/utils/common.ts"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAGA,CACxBC,GAAS,EACTC,OAA+D,KAC9DC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACJ,GAAG,CAAC,CAACK,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK,CAACD,GAAG,EAAEL,OAAO,CAACM,KAAK,EAAsBD,GAAG,CAAC,CAAC,CAAC,CAAoC;AAAAE,OAAA,CAAAT,YAAA,GAAAA,YAAA;AAE9I,MAAMU,WAAW,GAAGA,CAAgCT,GAAM,EAAEM,GAAgB,KAAqBA,GAAG,IAAIN,GAAG;AAAAQ,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAE3G,MAAMC,QAAQ,GAAGA,CAAA,KAAM,OAAOC,MAAM,KAAK,WAAW;;AAE3D;AACA;AACA;AAFAH,OAAA,CAAAE,QAAA,GAAAA,QAAA;AAGO,MAAME,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CAACE,OAAO,CAACC,MAAM,IAAI;IACtBd,MAAM,CAACe,IAAI,CAACD,MAAM,CAAC,CAACD,OAAO,CAACT,GAAG,IAAI;MAC/B,MAAMY,WAAW,GAAGF,MAAM,CAACV,GAAG,CAAC;MAC/B,MAAMa,WAAW,GAAGL,MAAM,CAACR,GAAG,CAAC;MAE/B,IAAIJ,MAAM,CAACgB,WAAW,CAAC,IAAIA,WAAW,IAAIhB,MAAM,CAACiB,WAAW,CAAC,KAAKA,WAAW,EAAE;QAC3E;QACAL,MAAM,CAACR,GAAG,CAAC,GAAGM,gBAAgB,CAACO,WAAW,EAAED,WAAW,CAAC;QAExD;MACJ;;MAEA;MACAJ,MAAM,CAACR,GAAG,CAAC,GAAGY,WAAW;IAC7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AIA,MAAM,GAAG,EAAE,GAAIH,GAAG,CAACI,UAAU,CAACV,MAAM,CAAC;EAEhE,OAAO,aAAa,CAACS,MAAM,KAAK,CAAC,EAAEE,QAAQ,CAAC,EAAE,CAAC,EAAE;AACrD,CAAC;AAAA/B,OAAA,CAAAyB,YAAA,GAAAA,YAAA;AAEM,MAAMO,SAAS,GAAIC,YAAoB,IAAKA,YAAY,CAACC,OAAO,CAAC,QAAQ,EAAGC,CAAS,IAAK,IAAIA,CAAC,CAACC,WAAW,CAAC,CAAC,EAAE,CAAC;AAAApC,OAAA,CAAAgC,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -75,8 +75,11 @@ const getMediaQuery = query => {
75
75
  };
76
76
  exports.getMediaQuery = getMediaQuery;
77
77
  const extractUnistyleDependencies = value => {
78
+ if (!value) {
79
+ return [];
80
+ }
78
81
  const dependencies = (0, _common.keyInObject)(value, 'uni__dependencies') ? value.uni__dependencies : [];
79
- return dependencies;
82
+ return Array.isArray(dependencies) ? dependencies : [];
80
83
  };
81
84
  exports.extractUnistyleDependencies = extractUnistyleDependencies;
82
85
  //# sourceMappingURL=unistyle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_mq","_state","_common","schemeToTheme","scheme","ColorScheme","Dark","Light","exports","hexToRGBA","hex","opacity","replace","split","map","x","parseInt","filter","num","isNaN","reduce","acc","color","concat","assignSecrets","object","secrets","Math","random","toString","slice","extractSecrets","Object","entries","key","value","startsWith","push","getStyles","values","returnValue","defineProperties","reduceObject","enumerable","configurable","isInDocument","element","document","body","contains","extractMediaQueryValue","query","_","px","match","undefined","Number","getMediaQuery","Orientation","includes","isUnistylesMq","minWidth","maxWidth","minHeight","maxHeight","parseMq","Boolean","join","UnistylesState","breakpoints","keyInObject","extractUnistyleDependencies","dependencies","uni__dependencies"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GA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GAAG;EACpC;EAEA,IAAI,IAAAS,iBAAa,EAACT,KAAK,CAAC,EAAE;IACtB,MAAM;MAAEU,QAAQ;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAAU,CAAC,GAAG,IAAAC,WAAO,EAACd,KAAK,CAAC;IAEnE,OAAO,CACHU,QAAQ,GAAG,eAAeA,QAAQ,KAAK,GAAGN,SAAS,EACnDO,QAAQ,GAAG,eAAeA,QAAQ,KAAK,GAAGP,SAAS,EACnDQ,SAAS,GAAG,gBAAgBA,SAAS,KAAK,GAAGR,SAAS,EACtDS,SAAS,GAAG,gBAAgBA,SAAS,KAAK,GAAGT,SAAS,CACzD,CAACtC,MAAM,CAACiD,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACnC;EAEA,MAAMN,QAAQ,GAAGO,qBAAc,CAACC,WAAW,IAAI,IAAAC,mBAAW,EAACF,qBAAc,CAACC,WAAW,EAAElB,KAAK,CAAC,GAAGiB,qBAAc,CAACC,WAAW,CAAClB,KAAK,CAAC,GAAGI,SAAS;EAE7I,OAAO,eAAeM,QAAQ,IAAI,CAAC,KAAK;AAC5C,CAAC;AAAArD,OAAA,CAAAiD,aAAA,GAAAA,aAAA;AAEM,MAAMc,2BAA2B,GAAIpC,KAAU,IAAK;EACvD,MAAMqC,YAAuC,GAAG,IAAAF,mBAAW,EAACnC,KAAK,EAAE,mBAAmB,CAAC,GAAGA,KAAK,CAACsC,iBAAiB,GAAG,EAAE;EAEtH,OAAOD,YAAY;AACvB,CAAC;AAAAhE,OAAA,CAAA+D,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","_mq","_state","_common","schemeToTheme","scheme","ColorScheme","Dark","Light","exports","hexToRGBA","hex","opacity","replace","split","map","x","parseInt","filter","num","isNaN","reduce","acc","color","concat","assignSecrets","object","secrets","Math","random","toString","slice","extractSecrets","Object","entries","key","value","startsWith","push","getStyles","values","returnValue","defineProperties","reduceObject","enumerable","configurable","isInDocument","element","document","body","contains","extractMediaQueryValue","query","_","px","match","undefined","Number","getMediaQuery","Orientation","includes","isUnistylesMq","minWidth","maxWidth","minHeight","maxHeight","parseMq","Boolean","join","UnistylesState","breakpoints","keyInObject","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEO,MAAMI,aAAa,GAAIC,MAAmB,IAAa;EAC1D,QAAQA,MAAM;IACV,KAAKC,kBAAW,CAACC,IAAI;MACjB,OAAO,MAAM;IACjB,KAAKD,kBAAW,CAACE,KAAK;IACtB;MACI,OAAO,OAAO;EACtB;AACJ,CAAC;AAAAC,OAAA,CAAAL,aAAA,GAAAA,aAAA;AAEM,MAAMM,SAAS,GAAGA,CAACC,GAAW,EAAEC,OAAe,KAAKD,GAAG,CACzDE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAChBC,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,CAACD,CAAC,EAAE,EAAE,CAAC,CAAC,CACzBE,MAAM,CAACC,GAAG,IAAI,CAACC,KAAK,CAACD,GAAG,CAAC,CAAC,CAC1BE,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK,GAAGD,GAAG,GAAGC,KAAK,GAAG,EAAE,OAAO,CAAC,CAClDC,MAAM,CAAC,GAAGZ,OAAO,GAAG,CAAC;AAAAH,OAAA,CAAAC,SAAA,GAAAA,SAAA;AAUnB,MAAMe,aAAa,GAAGA,CAAIC,MAAS,EAAEC,OAAwB,KAAK;EACrE;EACAD,MAAM,CAAC,mBAAmBE,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CA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AAG,EAAE;EAEtH,OAAOC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,GAAGA,YAAY,GAAG,EAAE;AAC1D,CAAC;AAAAhE,OAAA,CAAA+D,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useLayoutEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","isValidMq","parseMq","isUnistylesMq","useMedia","config","computeIsVisible","maybeMq","mq","console","error","parsedMq","width","height","screen","minWidth","undefined","maxWidth","minHeight","maxHeight","isVisible","setIsVisible","removeChangeListener","addChangeListener","dependencies","includes","Breakpoints"],"sourceRoot":"../../../src","sources":["components/useMedia.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAkC,UAAU;AACrG,SAASC,SAAS,EAAEC,OAAO,EAAEC,aAAa,QAAQ,OAAO;AAEzD,OAAO,MAAMC,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,gBAAgB,GAAGA,CAAA,KAAe;IACpC,MAAMC,OAAO,GAAGF,MAAM,CAACG,EAAuB;IAE9C,IAAI,CAACL,aAAa,CAACI,OAAO,CAAC,EAAE;MACzBE,OAAO,CAACC,KAAK,CAAC,sCAAsCH,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA,MAAMI,QAAQ,GAAIT,OAAO,CAACK,OAAO,CAAC;IAElC,IAAI,CAACN,SAAS,CAACU,QAAQ,CAAC,EAAE;MACtBF,OAAO,CAACC,KAAK,CAAC,oEAAoEH,OAAO,EAAE,CAAC;MAE5F,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK,KAAK;MAAEC;IAAO,CAAC,GAAGb,gBAAgB,CAACc,MAAM;IAEjD,IAAIH,QAAQ,CAACI,QAAQ,KAAKC,SAAS,IAAIJ,KAAK,GAAGD,QAAQ,CAACI,QAAQ,EAAE;MAC9D,OAAO,KAAK;IAChB;IAEA,IAAIJ,QAAQ,CAACM,QAAQ,KAAKD,SAAS,IAAIJ,KAAK,GAAGD,QAAQ,CAACM,QAAQ,EAAE;MAC9D,OAAO,KAAK;IAChB;IAEA,IAAIN,QAAQ,CAACO,SAAS,KAAKF,SAAS,IAAIH,MAAM,GAAGF,QAAQ,CAACO,SAAS,EAAE;MACjE,OAAO,KAAK;IAChB;IAEA,IAAIP,QAAQ,CAACQ,SAAS,KAAKH,SAAS,IAAIH,MAAM,GAAGF,QAAQ,CAACQ,SAAS,EAAE;MACjE,OAAO,KAAK;IAChB;IAEA,OAAO,IAAI;EACf,CAAC;EACD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGxB,QAAQ,CAAiBS,gBAAgB,CAAC,CAAC,CAAC;EAE9EX,SAAS,CAAC,MAAM;IACZ0B,YAAY,CAACf,gBAAgB,CAAC,CAAC,CAAC;EACpC,CAAC,EAAE,CAACD,MAAM,CAACG,EAAE,CAAC,CAAC;EAEfZ,eAAe,CAAC,MAAM;IAClB,MAAM0B,oBAAoB,GAAIxB,UAAU,CAAyByB,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAAC1B,kBAAkB,CAAC2B,WAAW,CAAC,EAAE;QACvDL,YAAY,CAACf,gBAAgB,CAAC,CAAC,CAAC;MACpC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTgB,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,CAACjB,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,OAAO;IACHY;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useLayoutEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","isValidMq","parseMq","isUnistylesMq","useMedia","config","computeIsVisible","maybeMq","mq","console","error","parsedMq","width","height","screen","minWidth","undefined","maxWidth","minHeight","maxHeight","isVisible","setIsVisible","removeChangeListener","addChangeListener","dependencies","includes","Breakpoints"],"sourceRoot":"../../../src","sources":["components/useMedia.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAkC,UAAU;AACrG,SAASC,SAAS,EAAEC,OAAO,EAAEC,aAAa,QAAQ,OAAO;AAEzD,OAAO,MAAMC,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,gBAAgB,GAAGA,CAAA,KAAe;IACpC,MAAMC,OAAO,GAAGF,MAAM,CAACG,EAAuB;IAE9C,IAAI,CAACL,aAAa,CAACI,OAAO,CAAC,EAAE;MACzBE,OAAO,CAACC,KAAK,CAAC,sCAAsCH,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA,MAAMI,QAAQ,GAAGT,OAAO,CAACK,OAAO,CAAC;IAEjC,IAAI,CAACN,SAAS,CAACU,QAAQ,CAAC,EAAE;MACtBF,OAAO,CAACC,KAAK,CAAC,oEAAoEH,OAAO,EAAE,CAAC;MAE5F,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK,KAAK;MAAEC;IAAO,CAAC,GAAGb,gBAAgB,CAACc,MAAM;IAEjD,IAAIH,QAAQ,CAACI,QAAQ,KAAKC,SAAS,IAAIJ,KAAK,GAAGD,QAAQ,CAACI,QAAQ,EAAE;MAC9D,OAAO,KAAK;IAChB;IAEA,IAAIJ,QAAQ,CAACM,QAAQ,KAAKD,SAAS,IAAIJ,KAAK,GAAGD,QAAQ,CAACM,QAAQ,EAAE;MAC9D,OAAO,KAAK;IAChB;IAEA,IAAIN,QAAQ,CAACO,SAAS,KAAKF,SAAS,IAAIH,MAAM,GAAGF,QAAQ,CAACO,SAAS,EAAE;MACjE,OAAO,KAAK;IAChB;IAEA,IAAIP,QAAQ,CAACQ,SAAS,KAAKH,SAAS,IAAIH,MAAM,GAAGF,QAAQ,CAACQ,SAAS,EAAE;MACjE,OAAO,KAAK;IAChB;IAEA,OAAO,IAAI;EACf,CAAC;EACD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGxB,QAAQ,CAAiBS,gBAAgB,CAAC,CAAC,CAAC;EAE9EX,SAAS,CAAC,MAAM;IACZ0B,YAAY,CAACf,gBAAgB,CAAC,CAAC,CAAC;EACpC,CAAC,EAAE,CAACD,MAAM,CAACG,EAAE,CAAC,CAAC;EAEfZ,eAAe,CAAC,MAAM;IAClB,MAAM0B,oBAAoB,GAAIxB,UAAU,CAAyByB,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAAC1B,kBAAkB,CAAC2B,WAAW,CAAC,EAAE;QACvDL,YAAY,CAACf,gBAAgB,CAAC,CAAC,CAAC;MACpC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTgB,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,CAACjB,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,OAAO;IACHY;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { isUnistylesMq, isValidMq, parseMq } from '../mq';
5
+ export const useMedia = config => {
6
+ const disposeRef = useRef(() => {});
7
+ const [isVisible, setIsVisible] = useState(() => {
8
+ const maybeMq = config.mq;
9
+ if (!isUnistylesMq(maybeMq)) {
10
+ console.error(`🦄 Unistyles: Received invalid mq: ${maybeMq}`);
11
+ return false;
12
+ }
13
+ const parsedMq = parseMq(maybeMq);
14
+ if (!isValidMq(parsedMq)) {
15
+ console.error(`🦄 Unistyles: Received invalid mq where min is greater than max: ${maybeMq}`);
16
+ return false;
17
+ }
18
+ const {
19
+ minWidth,
20
+ maxWidth,
21
+ minHeight,
22
+ maxHeight
23
+ } = parsedMq;
24
+ const mediaQuery = [minWidth !== undefined ? `(min-width: ${minWidth}px)` : undefined, maxWidth !== undefined ? `(max-width: ${maxWidth}px)` : undefined, minHeight !== undefined ? `(min-height: ${minHeight}px)` : undefined, maxHeight !== undefined ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
25
+ const media = window.matchMedia(mediaQuery);
26
+ const handler = event => setIsVisible(event.matches);
27
+ media.addEventListener('change', handler);
28
+ disposeRef.current = () => media.removeEventListener('change', handler);
29
+ return media.matches;
30
+ });
31
+
32
+ // Unmount
33
+ useEffect(() => () => disposeRef.current(), []);
34
+ return {
35
+ isVisible
36
+ };
37
+ };
38
+ //# sourceMappingURL=useMedia.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","useState","isUnistylesMq","isValidMq","parseMq","useMedia","config","disposeRef","isVisible","setIsVisible","maybeMq","mq","console","error","parsedMq","minWidth","maxWidth","minHeight","maxHeight","mediaQuery","undefined","filter","Boolean","join","media","window","matchMedia","handler","event","matches","addEventListener","current","removeEventListener"],"sourceRoot":"../../../src","sources":["components/useMedia.web.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,aAAa,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAEzD,OAAO,MAAMC,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,UAAU,GAAGP,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;EACnC,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGR,QAAQ,CAAC,MAAM;IAC7C,MAAMS,OAAO,GAAGJ,MAAM,CAACK,EAAuB;IAE9C,IAAI,CAACT,aAAa,CAACQ,OAAO,CAAC,EAAE;MACzBE,OAAO,CAACC,KAAK,CAAC,sCAAsCH,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA,MAAMI,QAAQ,GAAGV,OAAO,CAACM,OAAO,CAAC;IAEjC,IAAI,CAACP,SAAS,CAACW,QAAQ,CAAC,EAAE;MACtBF,OAAO,CAACC,KAAK,CAAC,oEAAoEH,OAAO,EAAE,CAAC;MAE5F,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK,QAAQ;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAAU,CAAC,GAAGJ,QAAQ;IAE7D,MAAMK,UAAU,GAAG,CACfJ,QAAQ,KAAKK,SAAS,GAAG,eAAeL,QAAQ,KAAK,GAAGK,SAAS,EACjEJ,QAAQ,KAAKI,SAAS,GAAG,eAAeJ,QAAQ,KAAK,GAAGI,SAAS,EACjEH,SAAS,KAAKG,SAAS,GAAG,gBAAgBH,SAAS,KAAK,GAAGG,SAAS,EACpEF,SAAS,KAAKE,SAAS,GAAG,gBAAgBF,SAAS,KAAK,GAAGE,SAAS,CACvE,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;IAE/B,MAAMC,KAAK,GAAGC,MAAM,CAACC,UAAU,CAACP,UAAU,CAAC;IAC3C,MAAMQ,OAAO,GAAIC,KAA0B,IAAKnB,YAAY,CAACmB,KAAK,CAACC,OAAO,CAAC;IAE3EL,KAAK,CAACM,gBAAgB,CAAC,QAAQ,EAAEH,OAAO,CAAC;IACzCpB,UAAU,CAACwB,OAAO,GAAG,MAAMP,KAAK,CAACQ,mBAAmB,CAAC,QAAQ,EAAEL,OAAO,CAAC;IAEvE,OAAOH,KAAK,CAACK,OAAO;EACxB,CAAC,CAAC;;EAEF;EACA9B,SAAS,CAAC,MAAM,MAAMQ,UAAU,CAACwB,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;EAE/C,OAAO;IACHvB;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,12 +1,64 @@
1
1
  "use strict";
2
2
 
3
- import React from 'react';
3
+ import React, { useEffect, useState } from 'react';
4
+ import { UnistylesRuntime } from '../specs';
5
+ import { UnistyleDependency } from '../specs/NativePlatform';
6
+ import { UnistylesListener } from '../web/listener';
7
+ import { UnistylesShadowRegistry } from '../web';
8
+ import { equal } from '../web/utils';
4
9
  import { jsx as _jsx } from "react/jsx-runtime";
5
10
  const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
6
- export const createUnistylesComponent = (Component, _ = () => ({})) => {
11
+ const ALL_DEPENDENCIES = Object.values(UnistyleDependency).filter(dependency => typeof dependency === 'number');
12
+ const useShadowRegistry = style => {
13
+ const [classNames, setClassNames] = useState([]);
14
+ const [ref] = useState(document.createElement('div'));
15
+ if (style) {
16
+ UnistylesShadowRegistry.add(ref, style).then(newClassNames => {
17
+ if (equal(classNames, newClassNames)) {
18
+ return;
19
+ }
20
+ setClassNames(newClassNames);
21
+ });
22
+ }
23
+ useEffect(() => () => {
24
+ // Remove styles on unmount
25
+ UnistylesShadowRegistry.add(null, style);
26
+ });
27
+ return classNames;
28
+ };
29
+ export const createUnistylesComponent = (Component, mappings) => {
7
30
  return props => {
31
+ const [mappingsProps, setMappingsProps] = useState(mappings?.(UnistylesRuntime.getTheme()));
32
+ const styleClassNames = useShadowRegistry(props.style);
33
+ const contentContainerStyleClassNames = useShadowRegistry(props.contentContainerStyle);
34
+ useEffect(() => {
35
+ const disposeMappings = UnistylesListener.addListeners(ALL_DEPENDENCIES, () => {
36
+ if (!mappings) {
37
+ disposeMappings();
38
+ return;
39
+ }
40
+ return setMappingsProps(mappings(UnistylesRuntime.getTheme()));
41
+ });
42
+ return () => disposeMappings();
43
+ }, [mappingsProps, props.style]);
44
+ const combinedProps = {
45
+ ...mappingsProps,
46
+ ...props,
47
+ ...(props.style ? {
48
+ style: {
49
+ $$css: true,
50
+ 'unistyles': styleClassNames.join(' ')
51
+ }
52
+ } : {}),
53
+ ...(props.contentContainerStyle ? {
54
+ style: {
55
+ $$css: true,
56
+ 'unistyles': contentContainerStyleClassNames.join(' ')
57
+ }
58
+ } : {})
59
+ };
8
60
  return /*#__PURE__*/_jsx(Component, {
9
- ...props
61
+ ...combinedProps
10
62
  });
11
63
  };
12
64
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","_","props"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAmD,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAKtE,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAEzE,OAAO,MAAMC,wBAAwB,GAAGA,CAA+BC,SAAY,EAAEC,CAAc,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC,KAAK;EACjH,OAAQC,KAAwB,IAAK;IACjC,oBAAOL,IAAA,CAACG,SAAS;MAAA,GAAKE;IAAK,CAAG,CAAC;EACnC,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useState","UnistylesRuntime","UnistyleDependency","UnistylesListener","UnistylesShadowRegistry","equal","jsx","_jsx","SUPPORTED_STYLE_PROPS","ALL_DEPENDENCIES","Object","values","filter","dependency","useShadowRegistry","style","classNames","setClassNames","ref","document","createElement","add","then","newClassNames","createUnistylesComponent","Component","mappings","props","mappingsProps","setMappingsProps","getTheme","styleClassNames","contentContainerStyleClassNames","contentContainerStyle","disposeMappings","addListeners","combinedProps","$$css","join"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAA4B,OAAO;AAEtE,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,uBAAuB,QAAQ,QAAQ;AAChD,SAASC,KAAK,QAAQ,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpC,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AACzE,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACT,kBAAkB,CAA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,OAAOL,gBAAgB,CAACH,QAAQ,CAACzB,gBAAgB,CAAC6B,QAAQ,CAAC,CAAC,CAAC,CAAC;MAClE,CAAC,CAAC;MAEF,OAAO,MAAMI,eAAe,CAAC,CAAC;IAClC,CAAC,EAAE,CAACN,aAAa,EAAED,KAAK,CAACZ,KAAK,CAAC,CAAC;IAEhC,MAAMqB,aAAa,GAAG;MAClB,GAAGR,aAAa;MAChB,GAAGD,KAAK;MACR,IAAGA,KAAK,CAACZ,KAAK,GAAG;QACbA,KAAK,EAAE;UACHsB,KAAK,EAAE,IAAI;UACX,WAAW,EAAEN,eAAe,CAACO,IAAI,CAAC,GAAG;QACzC;MACJ,CAAC,GAAG,CAAC,CAAC;MACN,IAAGX,KAAK,CAACM,qBAAqB,GAAG;QAC7BlB,KAAK,EAAE;UACHsB,KAAK,EAAE,IAAI;UACX,WAAW,EAAEL,+BAA+B,CAACM,IAAI,CAAC,GAAG;QACzD;MACJ,CAAC,GAAG,CAAC,CAAC;IACV,CAAsB;IAEtB,oBAAO/B,IAAA,CAACkB,SAAS;MAAA,GAAKW;IAAa,CAAG,CAAC;EAC3C,CAAC;AACL,CAAC","ignoreList":[]}
@@ -4,7 +4,7 @@ import React, { useEffect, useRef, useState } from 'react';
4
4
  import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
7
- export const createUnistylesComponent = (Component, mappings = () => ({})) => {
7
+ export const createUnistylesComponent = (Component, mappings) => {
8
8
  return props => {
9
9
  const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
10
10
  const [, setRt] = useState(0);
@@ -16,6 +16,8 @@ export const createUnistylesComponent = (Component, mappings = () => ({})) => {
16
16
  if (Array.isArray(props[propName])) {
17
17
  console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`);
18
18
  }
19
+
20
+ // @ts-expect-error - this is hidden from TS
19
21
  if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
20
22
  console.error(`🦄 Unistyles: createUnistylesComponent received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${Component.displayName}`);
21
23
  }
@@ -28,7 +30,7 @@ export const createUnistylesComponent = (Component, mappings = () => ({})) => {
28
30
  }
29
31
  useEffect(() => {
30
32
  const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
31
- const componentDependencies = props.style?.__proto__.uni__dependencies || mappings(theme).style?.__proto__.uni__dependencies;
33
+ const componentDependencies = props.style?.__proto__.uni__dependencies || mappings?.(theme).style?.__proto__.uni__dependencies;
32
34
  if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(UnistyleDependency.Theme))) {
33
35
  setTheme(UnistylesRuntime.getTheme());
34
36
 
@@ -37,6 +39,7 @@ export const createUnistylesComponent = (Component, mappings = () => ({})) => {
37
39
  if (props?.[propName]) {
38
40
  stylesRef.current = {
39
41
  ...stylesRef.current,
42
+ // @ts-expect-error - this is hidden from TS
40
43
  [propName]: props[propName].__proto__?.getStyle() || props[propName]
41
44
  };
42
45
  }
@@ -51,9 +54,7 @@ export const createUnistylesComponent = (Component, mappings = () => ({})) => {
51
54
  removeChangeListener();
52
55
  };
53
56
  }, []);
54
- const mergedProps = {
55
- ...mappings(theme)
56
- };
57
+ const mergedProps = mappings?.(theme) ?? {};
57
58
  Object.keys(props).forEach(key => {
58
59
  if (key in mergedProps) {
59
60
  mergedProps[key] = Object.assign(props[key], mergedProps[key]);
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useRef","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","theme","setTheme","getTheme","setRt","stylesRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","removeChangeListener","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","Theme","some","dependency","prevState","mergedProps","Object","keys","key","assign"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAA6CC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnG,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAkC,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAIrG,MAAMC,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAEzE,OAAO,MAAMC,wBAAwB,GAAGA,CAA+BC,SAAY,EAAEC,QAAqB,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC,KAAK;EACxH,OAAQC,KAAwB,IAAK;IACjC,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGZ,QAAQ,CAAiBG,gBAAgB,CAACU,QAAQ,CAAC,CAAC,CAAC;IAC/E,MAAM,GAAGC,KAAK,CAAC,GAAGd,QAAQ,CAAC,CAAC,CAAC;IAC7B,MAAMe,SAAS,GAAGhB,MAAM,CAAsB,CAAC,CAAC,CAAC;IACjD,MAAMiB,WAAW,GAAGjB,MAAM,CAAC,KAAK,CAAC;IAEjC,IAAI,CAACiB,WAAW,CAACC,OAAO,EAAE;MACtBX,qBAAqB,CAACY,OAAO,CAACC,QAAQ,IAAI;QACtC,IAAIT,KAAK,GAAGS,QAAQ,CAAC,EAAE;UACnB,IAAIC,KAAK,CAACC,OAAO,CAACX,KAAK,CAACS,QAAQ,CAAC,CAAC,EAAE;YAChCG,OAAO,CAACC,KAAK,CAAC,mDAAmDJ,QAAQ,uDAAuDX,SAAS,CAACgB,WAAW,EAAE,CAAC;UAC5J;UAEA,IAAId,KAAK,CAACS,QAAQ,CAAC,CAACM,gBAAgB,IAAI,CAACf,KAAK,CAACS,QAAQ,CAAC,CAACO,SAAS,EAAEC,QAAQ,EAAE;YAC1EL,OAAO,CAACC,KAAK,CAAC,uKAAuKf,SAAS,CAAC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SAAS,GAAG,CAAC,CAAC;QACrC;MACJ,CAAC,CAAC;MAEF,OAAO,MAAM;QACTV,oBAAoB,CAAC,CAAC;MAC1B,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,MAAMW,WAAW,GAAG;MAAE,GAAG9B,QAAQ,CAACE,KAAK;IAAE,CAAsB;IAE/D6B,MAAM,CAACC,IAAI,CAAC/B,KAAK,CAAC,CAACQ,OAAO,CAACwB,GAAG,IAAI;MAC9B,IAAIA,GAAG,IAAIH,WAAW,EAAE;QACpBA,WAAW,CAACG,GAAG,CAAC,GAAGF,MAAM,CAACG,MAAM,CAACjC,KAAK,CAACgC,GAAG,CAAC,EAAEH,WAAW,CAACG,GAAG,CAAC,CAAC;QAE9D;MACJ;MAEAH,WAAW,CAACG,GAAG,CAAC,GAAGhC,KAAK,CAACgC,GAAG,CAAC;IACjC,CAAC,CAAC;;IAEF;IACApC,qBAAqB,CAACY,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAIoB,WAAW,CAACpB,QAAQ,CAAC,EAAE;QACvBoB,WAAW,CAACpB,QAAQ,CAAC,GAAGJ,SAAS,CAACE,OAAO,CAACE,QAAQ,CAAC;MACvD;IACJ,CAAC,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAOZ,IAAA,CAACG,SAAS;MAAA,GAAK+B;IAAW,CAAG,CAAC;EACzC,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useRef","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","theme","setTheme","getTheme","setRt","stylesRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","removeChangeListener","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","Theme","some","dependency","prevState","mergedProps","Object","keys","key","assign"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],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,CAAC,EAAE,EAAE,CAAC;IAEN,MAAMW,WAAW,GAAG9B,QAAQ,GAAGE,KAAK,CAAC,IAA2B,CAAC,CAAC;IAElE6B,MAAM,CAACC,IAAI,CAAC/B,KAAK,CAAC,CAACQ,OAAO,CAACwB,GAAG,IAAI;MAC9B,IAAIA,GAAG,IAAIH,WAAW,EAAE;QACpBA,WAAW,CAACG,GAAG,CAAC,GAAGF,MAAM,CAACG,MAAM,CAACjC,KAAK,CAACgC,GAAG,CAAuB,EAAEH,WAAW,CAACG,GAAG,CAAC,CAAC;QAEpF;MACJ;MAEAH,WAAW,CAACG,GAAG,CAAC,GAAGhC,KAAK,CAACgC,GAAG,CAAuB;IACvD,CAAC,CAAC;;IAEF;IACApC,qBAAqB,CAACY,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAIoB,WAAW,CAACpB,QAAQ,CAAC,EAAE;QACvBoB,WAAW,CAACpB,QAAQ,CAAC,GAAGJ,SAAS,CAACE,OAAO,CAACE,QAAQ,CAAC;MACvD;IACJ,CAAC,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAOZ,IAAA,CAACG,SAAS;MAAA,GAAK+B;IAAW,CAAa,CAAC;EACnD,CAAC;AACL,CAAC","ignoreList":[]}
@@ -3,15 +3,14 @@
3
3
  import { isPseudo } from './pseudo';
4
4
  import { getStyle } from './style';
5
5
  import { deepMergeObjects } from '../utils';
6
- import { getTransformStyle } from './transform';
7
- import { isBoxShadow, isTextShadow, isTransform } from './utils';
8
- import { getTextShadowStyle } from './textShadow';
9
- import { getBoxShadowStyle } from './boxShadow';
6
+ import { getTransformStyle, getBoxShadow, getFilterStyle } from './object';
7
+ import { isShadow, isFilter, isTextShadow, isTransform, isBoxShadow } from './utils';
8
+ import { getTextShadowStyle, getBoxShadowStyle } from './shadow';
10
9
  export const convertUnistyles = value => {
11
10
  // Flag to mark if textShadow is already created
12
11
  let hasTextShadow = false;
13
12
  // Flag to mark if boxShadow is already created
14
- let hasBoxShadow = false;
13
+ let hasShadow = false;
15
14
  const stylesArray = Object.entries({
16
15
  ...value,
17
16
  ...value._web
@@ -38,14 +37,20 @@ export const convertUnistyles = value => {
38
37
  return getTextShadowStyle(value);
39
38
  }
40
39
 
41
- // Box shadow
42
- if (isBoxShadow(unistylesKey)) {
43
- if (hasBoxShadow) {
40
+ // RN shadows
41
+ if (isShadow(unistylesKey)) {
42
+ if (hasShadow) {
44
43
  return [];
45
44
  }
46
- hasBoxShadow = true;
45
+ hasShadow = true;
47
46
  return getBoxShadowStyle(value);
48
47
  }
48
+ if (isFilter(unistylesKey, unistylesValue)) {
49
+ return getFilterStyle(unistylesValue);
50
+ }
51
+ if (isBoxShadow(unistylesKey, unistylesValue)) {
52
+ return getBoxShadow(unistylesValue);
53
+ }
49
54
 
50
55
  // Transforms
51
56
  if (isTransform(unistylesKey, unistylesValue)) {
@@ -1 +1 @@
1
- {"version":3,"names":["isPseudo","getStyle","deepMergeObjects","getTransformStyle","isBoxShadow","isTextShadow","isTransform","getTextShadowStyle","getBoxShadowStyle","convertUnistyles","value","hasTextShadow","hasBoxShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,UAAU;AACnC,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,WAAW,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAChE,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,iBAAiB,QAAQ,aAAa;AAE/C,OAAO,MAAMC,gBAAgB,GAAIC,KAAsB,IAAK;EACxD;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,YAAY,GAAG,KAAK;EAExB,MAAMC,WAAW,GAAGC,MAAM,CAACC,O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AC;MACvE,CAAC,CAAC;IACN;;IAEA;IACA,OAAOxB,QAAQ,CAACiB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAOjB,gBAAgB,CAAC,GAAGW,WAAW,CAAC;AAC3C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isPseudo","getStyle","deepMergeObjects","getTransformStyle","getBoxShadow","getFilterStyle","isShadow","isFilter","isTextShadow","isTransform","isBoxShadow","getTextShadowStyle","getBoxShadowStyle","convertUnistyles","value","hasTextShadow","hasShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","startsWith","flattenValues","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,UAAU;AACnC,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,iBAAiB,EAAEC,YAAY,EAAEC,cAAc,QAAQ,UAAU;AAC1E,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,WAAW,EAAEC,WAAW,QAAQ,SAAS;AACpF,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,UAAU;AAEhE,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,CAAC;IAC/B,GAAGL,KAAK;IACR,GAAGA,KAAK,CAACM;EACb,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,YAAY,EAAEC,cAAc,CAAC,KAAK;IAC3C;IACA,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,uBAAuB,CAAC,CAACC,QAAQ,CAACF,YAAY,CAAC,IAAIA,YAAY,CAACG,UAAU,CAAC,UAAU,CAAC,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EAEhC,OAAOrB,gBAAgB,CAAC,GAAGe,WAAW,CAAC;AAC3C,CAAC","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ import { normalizeNumericValue } from '../utils';
4
+ import { deepMergeObjects, keyInObject } from '../../utils';
5
+ const createBoxShadowValue = style => {
6
+ const {
7
+ offsetX,
8
+ offsetY,
9
+ blurRadius = 0,
10
+ spreadDistance = 0,
11
+ color = '#000',
12
+ inset
13
+ } = style;
14
+ return `${inset ? 'inset ' : ''}${normalizeNumericValue(offsetX)} ${normalizeNumericValue(offsetY)} ${normalizeNumericValue(blurRadius)} ${normalizeNumericValue(spreadDistance)} ${color}`;
15
+ };
16
+ export const getBoxShadow = boxShadow => {
17
+ const breakpoints = new Set();
18
+ boxShadow.forEach(shadow => {
19
+ const [key] = Object.keys(shadow);
20
+ const value = shadow[key];
21
+
22
+ // Breakpoints
23
+ if (typeof value === 'object') {
24
+ Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
25
+ }
26
+ });
27
+ if (breakpoints.size === 0) {
28
+ const boxShadowStyle = Object.fromEntries(boxShadow.map(shadow => {
29
+ const [key] = Object.keys(shadow);
30
+ return [key, shadow[key]];
31
+ }));
32
+ return {
33
+ boxShadow: createBoxShadowValue(boxShadowStyle)
34
+ };
35
+ }
36
+ const breakpointStyles = Array.from(breakpoints).map(breakpoint => {
37
+ const styles = Object.fromEntries(boxShadow.map(shadow => {
38
+ const [key] = Object.keys(shadow);
39
+ const value = shadow[key];
40
+ if (typeof value === 'object' && keyInObject(value, breakpoint)) {
41
+ return [key, value[breakpoint]];
42
+ }
43
+ return [key, value];
44
+ }));
45
+ return {
46
+ [breakpoint]: {
47
+ boxShadow: createBoxShadowValue(styles)
48
+ }
49
+ };
50
+ });
51
+ return deepMergeObjects(...breakpointStyles);
52
+ };
53
+ //# sourceMappingURL=boxShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeNumericValue","deepMergeObjects","keyInObject","createBoxShadowValue","style","offsetX","offsetY","blurRadius","spreadDistance","color","inset","getBoxShadow","boxShadow","breakpoints","Set","forEach","shadow","key","Object","keys","value","breakpoint","add","size","boxShadowStyle","fromEntries","map","breakpointStyles","Array","from","styles"],"sourceRoot":"../../../../../src","sources":["web/convert/object/boxShadow.ts"],"mappings":";;AACA,SAASA,qBAAqB,QAAQ,UAAU;AAChD,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,aAAa;AAE3D,MAAMC,oBAAoB,GAAIC,KAAqB,IAAK;EACpD,MAAM;IAAEC,OAAO;IAAEC,OAAO;IAAEC,UAAU,GAAG,CAAC;IAAEC,cAAc,GAAG,CAAC;IAAEC,KAAK,GAAG,MAAM;IAAEC;EAAM,CAAC,GAAGN,KAAK;EAE7F,OAAO,GAAGM,KAAK,GAAG,QAAQ,GAAG,EAAE,GAAGV,qBAAqB,CAACK,OAAO,CAAC,IAAIL,qBAAqB,CAACM,OAAO,CAAC,IAAIN,qBAAqB,CAACO,UAAoB,CAAC,IAAIP,qBAAqB,CAACQ,cAAwB,CAAC,IAAIC,KAAK,EAAE;AACnN,CAAC;AAED,OAAO,MAAME,YAAY,GAAIC,SAAgC,IAAK;EAC9D,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrCF,SAAS,CAACG,OAAO,CAACC,MAAM,IAAI;IACxB,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;IACjC,MAAMI,KAAK,GAAGJ,MAAM,CAACC,GAAG,CAAyB;;IAEjD;IACA,IAAI,OAAOG,KAAK,KAAK,QAAQ,EAAE;MAC3BF,MAAM,CAACC,IAAI,CAACC,KAAK,CAAC,CAACL,OAAO,CAACM,UAAU,IAAIR,WAAW,CAACS,GAAG,CAACD,UAAU,CAAC,CAAC;IACzE;EACJ,CAAC,CAAC;EAEF,IAAIR,WAAW,CAACU,IAAI,KAAK,CAAC,EAAE;IACxB,MAAMC,cAAc,GAAGN,MAAM,CAACO,WAAW,CAACb,SAAS,CAACc,GAAG,CAACV,MAAM,IAAI;MAC9D,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;MACjC,OAAO,CAACC,GAAG,EAAED,MAAM,CAACC,GAAG,CAAyB,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,OAAO;MACHL,SAAS,EAAET,oBAAoB,CAACqB,cAAc;IAClD,CAAC;EACL;EAEA,MAAMG,gBAAgB,GAAGC,KAAK,CAACC,IAAI,CAAChB,WAAW,CAAC,CAACa,GAAG,CAACL,UAAU,IAAI;IAC/D,MAAMS,MAAM,GAAGZ,MAAM,CAACO,WAAW,CAACb,SAAS,CAACc,GAAG,CAACV,MAAM,IAAI;MACtD,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC;MACjC,MAAMI,KAAK,GAAGJ,MAAM,CAACC,GAAG,CAAyB;MAEjD,IAAI,OAAOG,KAAK,KAAK,QAAQ,IAAIlB,WAAW,CAACkB,KAAK,EAAEC,UAAU,CAAC,EAAE;QAC7D,OAAO,CAACJ,GAAG,EAAEG,KAAK,CAACC,UAAU,CAAC,CAAC;MACnC;MAEA,OAAO,CAACJ,GAAG,EAAEG,KAAK,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO;MACH,CAACC,UAAU,GAAG;QACVT,SAAS,EAAET,oBAAoB,CAAC2B,MAAM;MAC1C;IACJ,CAAC;EACL,CAAC,CAAC;EAEF,OAAO7B,gBAAgB,CAAC,GAAG0B,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import { hyphenate } from '../../utils';
4
+ import { getObjectStyle } from './objectStyle';
5
+ import { normalizeColor, normalizeNumericValue } from '../utils';
6
+ import { UnistylesRuntime } from '../../runtime';
7
+ import { isUnistylesMq } from '../../../mq';
8
+ const getDropShadowStyle = dropShadow => {
9
+ const {
10
+ offsetX = 0,
11
+ offsetY = 0,
12
+ standardDeviation = 0,
13
+ color = '#000'
14
+ } = dropShadow;
15
+ return `${normalizeColor(String(color))} ${normalizeNumericValue(offsetX)} ${normalizeNumericValue(offsetY)} ${normalizeNumericValue(standardDeviation)}`;
16
+ };
17
+ export const getFilterStyle = filters => {
18
+ const restFilters = filters.filter(filter => Object.keys(filter)[0] !== 'dropShadow');
19
+ const dropShadow = (() => {
20
+ const dropShadowValue = filters.find(filter => Object.keys(filter)[0] === 'dropShadow')?.dropShadow;
21
+ if (typeof dropShadowValue !== 'object') {
22
+ return [];
23
+ }
24
+ const breakpoints = Object.keys(dropShadowValue).filter(key => Object.keys(UnistylesRuntime.breakpoints).includes(key) || isUnistylesMq(key));
25
+ const breakpointsDropShadow = Object.fromEntries(breakpoints.map(breakpoint => [breakpoint, getDropShadowStyle(dropShadowValue[breakpoint])]));
26
+ if (breakpoints.length === 0) {
27
+ return [{
28
+ dropShadow: getDropShadowStyle(dropShadowValue)
29
+ }];
30
+ }
31
+ return [{
32
+ dropShadow: breakpointsDropShadow
33
+ }];
34
+ })();
35
+ return getObjectStyle([...restFilters, ...dropShadow], 'filter', (key, value) => `${hyphenate(key)}(${normalizeNumericValue(value)})`);
36
+ };
37
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hyphenate","getObjectStyle","normalizeColor","normalizeNumericValue","UnistylesRuntime","isUnistylesMq","getDropShadowStyle","dropShadow","offsetX","offsetY","standardDeviation","color","String","getFilterStyle","filters","restFilters","filter","Object","keys","dropShadowValue","find","breakpoints","key","includes","breakpointsDropShadow","fromEntries","map","breakpoint","length","value"],"sourceRoot":"../../../../../src","sources":["web/convert/object/filter.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AAChE,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAAS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W,CAACO,MAAM,KAAK,CAAC,EAAE;MAC1B,OAAO,CAAC;QACJrB,UAAU,EAAED,kBAAkB,CAACa,eAAkC;MACrE,CAAC,CAAC;IACN;IAEA,OAAO,CAAC;MACJZ,UAAU,EAAEiB;IAChB,CAAC,CAAC;EACN,CAAC,EAAE,CAAC;EAEJ,OAAOvB,cAAc,CAAC,CAAC,GAAGc,WAAW,EAAE,GAAGR,UAAU,CAAC,EAAE,QAAQ,EAAE,CAACe,GAAG,EAAEO,KAAK,KAAK,GAAG7B,SAAS,CAACsB,GAAG,CAAC,IAAInB,qBAAqB,CAAC0B,KAAwB,CAAC,GAAG,CAAC;AAC7J,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export * from './transform';
4
+ export * from './boxShadow';
5
+ export * from './filter';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["web/convert/object/index.ts"],"mappings":";;AAAA,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,UAAU","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ import { deepMergeObjects, keyInObject } from '../../utils';
4
+ const createStylesValue = (styles, normalize) => styles.map(style => {
5
+ const [key] = Object.keys(style);
6
+ if (!key) {
7
+ return undefined;
8
+ }
9
+ return normalize(key, style[key]);
10
+ }).filter(Boolean).join(' ');
11
+ export const getObjectStyle = (styles, styleKey, normalize) => {
12
+ const breakpoints = new Set();
13
+ const normalStyles = [];
14
+ styles.forEach(style => {
15
+ const [property] = Object.keys(style);
16
+ if (!property) {
17
+ return;
18
+ }
19
+ const value = style[property];
20
+ if (typeof value === 'object' && !Array.isArray(value)) {
21
+ Object.keys(value ?? {}).forEach(breakpoint => breakpoints.add(breakpoint));
22
+ return;
23
+ }
24
+ normalStyles.push(style);
25
+ });
26
+ const breakpointStyles = Array.from(breakpoints).flatMap(breakpoint => {
27
+ const stylesPerBreakpoint = styles.flatMap(style => {
28
+ const [property] = Object.keys(style);
29
+ if (!property) {
30
+ return [];
31
+ }
32
+ const value = style[property];
33
+ if (typeof value === 'object' && !Array.isArray(value)) {
34
+ return keyInObject(value, breakpoint) ? [{
35
+ [property]: value[breakpoint]
36
+ }] : [];
37
+ }
38
+ return [];
39
+ });
40
+ return [{
41
+ [breakpoint]: {
42
+ [styleKey]: createStylesValue(stylesPerBreakpoint, normalize)
43
+ }
44
+ }];
45
+ });
46
+ return deepMergeObjects({
47
+ [styleKey]: createStylesValue(normalStyles, normalize)
48
+ }, ...breakpointStyles);
49
+ };
50
+ //# sourceMappingURL=objectStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deepMergeObjects","keyInObject","createStylesValue","styles","normalize","map","style","key","Object","keys","undefined","filter","Boolean","join","getObjectStyle","styleKey","breakpoints","Set","normalStyles","forEach","property","value","Array","isArray","breakpoint","add","push","breakpointStyles","from","flatMap","stylesPerBreakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/object/objectStyle.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,aAAa;AAK3D,MAAMC,iBAAiB,GAAGA,CAAyBC,MAAsB,EAAEC,SAA6B,KAAKD,MAAM,CAC9GE,GAAG,CAACC,KAAK,IAAI;EACV,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;EAEhC,IAAI,CAACC,GAAG,EAAE;IACN,OAAOG,SAAS;EACpB;EAEA,OAAON,SAAS,CAACG,GAAG,EAAED,KAAK,CAACC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;AAEd,OAAO,MAAMC,cAAc,GAAGA,CAAyBX,MAAsB,EAAEY,QAAgB,EAAEX,SAA6B,KAAK;EAC/H,MAAMY,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrC,MAAMC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Gb,iBAAiB,CAAC4B,mBAAmB,EAAE1B,SAAS;MAChE;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAOJ,gBAAgB,CAAsB;IACzC,CAACe,QAAQ,GAAGb,iBAAiB,CAACgB,YAAY,EAAEd,SAAS;EACzD,CAAC,EAAE,GAAGuB,gBAAgB,CAAC;AAC3B,CAAC","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ import { getObjectStyle } from './objectStyle';
4
+ import { normalizeNumericValue } from '../utils';
5
+ const normalizeTransform = (key, value) => {
6
+ if (key.includes('scale')) {
7
+ return value;
8
+ }
9
+ if (typeof value === 'number') {
10
+ return normalizeNumericValue(value);
11
+ }
12
+ return value;
13
+ };
14
+ export const getTransformStyle = transforms => getObjectStyle(transforms, 'transform', (key, value) => {
15
+ switch (key) {
16
+ case 'matrix':
17
+ return `${key}(${value.join(',')})`;
18
+ default:
19
+ return `${key}(${normalizeTransform(key, value)})`;
20
+ }
21
+ });
22
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getObjectStyle","normalizeNumericValue","normalizeTransform","key","value","includes","getTransformStyle","transforms","join"],"sourceRoot":"../../../../../src","sources":["web/convert/object/transform.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,qBAAqB,QAAQ,UAAU;AAGhD,MAAMC,kBAAkB,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAK;EACpD,IAAID,GAAG,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IACvB,OAAOD,KAAK;EAChB;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOH,qBAAqB,CAACG,KAAK,CAAC;EACvC;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,OAAO,MAAME,iBAAiB,GAAIC,UAAkC,IAAKP,cAAc,CAACO,UAAU,EAAE,WAAW,EAAE,CAACJ,GAAG,EAAEC,KAAK,KAAK;EAC7H,QAAOD,GAAG;IACN,KAAK,QAAQ;MACT,OAAO,GAAGA,GAAG,IAAKC,KAAK,CAAmBI,IAAI,CAAC,GAAG,CAAC,GAAG;IAC1D;MACI,OAAO,GAAGL,GAAG,IAAID,kBAAkB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAG;EAC1D;AACJ,CAAC,CAAC","ignoreList":[]}