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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. package/cxx/common/Helpers.h +24 -2
  2. package/cxx/core/HostStyle.cpp +1 -1
  3. package/cxx/core/UnistyleWrapper.h +31 -1
  4. package/cxx/core/UnistylesMountHook.cpp +1 -1
  5. package/cxx/core/UnistylesMountHook.h +4 -2
  6. package/cxx/core/UnistylesRegistry.cpp +7 -1
  7. package/cxx/hybridObjects/HybridShadowRegistry.cpp +1 -2
  8. package/cxx/hybridObjects/HybridShadowRegistry.h +1 -3
  9. package/cxx/hybridObjects/HybridStyleSheet.cpp +4 -1
  10. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +12 -0
  11. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
  12. package/cxx/parser/Parser.cpp +6 -6
  13. package/cxx/parser/Parser.h +1 -1
  14. package/cxx/shadowTree/ShadowTrafficController.h +2 -0
  15. package/lib/commonjs/components/Display.js +18 -0
  16. package/lib/commonjs/components/Display.js.map +1 -0
  17. package/lib/commonjs/components/Hide.js +18 -0
  18. package/lib/commonjs/components/Hide.js.map +1 -0
  19. package/lib/commonjs/components/index.js +20 -0
  20. package/lib/commonjs/components/index.js.map +1 -0
  21. package/lib/commonjs/components/useMedia.js +59 -0
  22. package/lib/commonjs/components/useMedia.js.map +1 -0
  23. package/lib/commonjs/core/createUnistylesComponent.js +2 -1
  24. package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
  25. package/lib/commonjs/core/createUnistylesComponent.native.js +40 -2
  26. package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
  27. package/lib/commonjs/core/index.js +0 -14
  28. package/lib/commonjs/core/index.js.map +1 -1
  29. package/lib/commonjs/global.js +0 -4
  30. package/lib/commonjs/global.js.map +1 -1
  31. package/lib/commonjs/index.js +12 -14
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/mq.js +27 -11
  34. package/lib/commonjs/mq.js.map +1 -2
  35. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
  36. package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -2
  37. package/lib/commonjs/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -1
  38. package/lib/commonjs/specs/ShadowRegistry/index.js +5 -0
  39. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -2
  40. package/lib/commonjs/specs/ShadowRegistry/types.js +0 -4
  41. package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
  42. package/lib/commonjs/specs/StatusBar/index.js.map +1 -2
  43. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +4 -2
  44. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
  45. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +3 -1
  46. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -2
  47. package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -1
  48. package/lib/commonjs/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
  49. package/lib/commonjs/specs/index.web.js.map +1 -2
  50. package/lib/commonjs/specs/types.js +10 -10
  51. package/lib/commonjs/specs/types.js.map +1 -1
  52. package/lib/commonjs/types/accessibility.js +9 -9
  53. package/lib/commonjs/types/accessibility.js.map +1 -1
  54. package/lib/commonjs/types/breakpoints.js.map +1 -1
  55. package/lib/commonjs/types/common.js +0 -4
  56. package/lib/commonjs/types/common.js.map +1 -1
  57. package/lib/commonjs/types/core.js.map +1 -1
  58. package/lib/commonjs/types/index.js.map +1 -2
  59. package/lib/commonjs/types/stylesheet.js +2 -1
  60. package/lib/commonjs/types/stylesheet.js.map +1 -2
  61. package/lib/commonjs/web/convert/index.js +7 -1
  62. package/lib/commonjs/web/convert/index.js.map +1 -2
  63. package/lib/commonjs/web/convert/pseudo.js.map +1 -2
  64. package/lib/commonjs/web/convert/shadow.js +5 -1
  65. package/lib/commonjs/web/convert/shadow.js.map +1 -2
  66. package/lib/commonjs/web/convert/style.js.map +1 -2
  67. package/lib/commonjs/web/convert/textShadow.js.map +1 -2
  68. package/lib/commonjs/web/convert/transform.js.map +1 -2
  69. package/lib/commonjs/web/convert/types.js.map +1 -1
  70. package/lib/commonjs/web/convert/utils.js +2 -1
  71. package/lib/commonjs/web/convert/utils.js.map +1 -2
  72. package/lib/commonjs/web/index.js.map +1 -2
  73. package/lib/commonjs/web/listener.js.map +1 -2
  74. package/lib/commonjs/web/mock.js.map +1 -2
  75. package/lib/commonjs/web/runtime.js.map +1 -2
  76. package/lib/commonjs/web/shadowRegistry.js +9 -1
  77. package/lib/commonjs/web/shadowRegistry.js.map +1 -2
  78. package/lib/commonjs/web/state.js +5 -1
  79. package/lib/commonjs/web/utils/common.js +3 -1
  80. package/lib/commonjs/web/utils/common.js.map +1 -2
  81. package/lib/commonjs/web/utils/index.js.map +1 -1
  82. package/lib/commonjs/web/utils/unistyle.js +1 -1
  83. package/lib/commonjs/web/variants/index.js.map +1 -1
  84. package/lib/module/common.js.map +1 -1
  85. package/lib/module/components/Display.js +13 -0
  86. package/lib/module/components/Display.js.map +1 -0
  87. package/lib/module/components/Hide.js +13 -0
  88. package/lib/module/components/Hide.js.map +1 -0
  89. package/lib/module/components/index.js +5 -0
  90. package/lib/module/components/index.js.map +1 -0
  91. package/lib/module/components/useMedia.js +54 -0
  92. package/lib/module/components/useMedia.js.map +1 -0
  93. package/lib/module/core/createUnistylesComponent.js +2 -1
  94. package/lib/module/core/createUnistylesComponent.js.map +1 -1
  95. package/lib/module/core/createUnistylesComponent.native.js +41 -3
  96. package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
  97. package/lib/module/core/index.js +0 -2
  98. package/lib/module/core/index.js.map +1 -1
  99. package/lib/module/global.js +1 -1
  100. package/lib/module/global.js.map +0 -1
  101. package/lib/module/index.js +2 -1
  102. package/lib/module/index.js.map +1 -1
  103. package/lib/module/mq.js +21 -11
  104. package/lib/module/mq.js.map +1 -1
  105. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
  106. package/lib/module/specs/NativePlatform/index.js.map +1 -1
  107. package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +0 -1
  108. package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +0 -1
  109. package/lib/module/specs/ShadowRegistry/index.js +5 -0
  110. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  111. package/lib/module/specs/ShadowRegistry/types.js +0 -2
  112. package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
  113. package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
  114. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
  115. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +0 -1
  116. package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +0 -1
  117. package/lib/module/specs/index.web.js.map +1 -2
  118. package/lib/module/specs/types.js.map +0 -1
  119. package/lib/module/types/accessibility.js +1 -1
  120. package/lib/module/types/accessibility.js.map +0 -1
  121. package/lib/module/types/breakpoints.js.map +0 -1
  122. package/lib/module/types/common.js +1 -1
  123. package/lib/module/types/common.js.map +0 -1
  124. package/lib/module/types/core.js.map +0 -1
  125. package/lib/module/types/index.js.map +1 -2
  126. package/lib/module/types/stylesheet.js +2 -2
  127. package/lib/module/types/stylesheet.js.map +1 -2
  128. package/lib/module/types/variants.js.map +0 -1
  129. package/lib/module/web/convert/boxShadow.js +4 -1
  130. package/lib/module/web/convert/boxShadow.js.map +1 -2
  131. package/lib/module/web/convert/index.js +7 -1
  132. package/lib/module/web/convert/shadow.js +5 -1
  133. package/lib/module/web/convert/shadow.js.map +1 -2
  134. package/lib/module/web/convert/textShadow.js +4 -1
  135. package/lib/module/web/convert/utils.js +2 -1
  136. package/lib/module/web/convert/utils.js.map +1 -2
  137. package/lib/module/web/create.js +5 -1
  138. package/lib/module/web/create.js.map +1 -2
  139. package/lib/module/web/index.js +2 -1
  140. package/lib/module/web/index.js.map +1 -2
  141. package/lib/module/web/listener.js.map +1 -2
  142. package/lib/module/web/registry.js +3 -1
  143. package/lib/module/web/shadowRegistry.js +9 -1
  144. package/lib/module/web/shadowRegistry.js.map +1 -2
  145. package/lib/module/web/state.js +5 -1
  146. package/lib/module/web/state.js.map +1 -2
  147. package/lib/module/web/utils/common.js +3 -1
  148. package/lib/module/web/utils/common.js.map +1 -2
  149. package/lib/module/web/utils/unistyle.js +1 -1
  150. package/lib/module/web/utils/unistyle.js.map +1 -1
  151. package/lib/module/web/variants/getVariants.js.map +1 -2
  152. package/lib/module/web/variants/index.js.map +1 -1
  153. package/lib/typescript/src/components/Display.d.ts +7 -0
  154. package/lib/typescript/src/components/Display.d.ts.map +1 -0
  155. package/lib/typescript/src/components/Hide.d.ts +7 -0
  156. package/lib/typescript/src/components/Hide.d.ts.map +1 -0
  157. package/lib/typescript/src/components/index.d.ts +3 -0
  158. package/lib/typescript/src/components/index.d.ts.map +1 -0
  159. package/lib/typescript/src/components/useMedia.d.ts +6 -0
  160. package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
  161. package/lib/typescript/src/core/createUnistylesComponent.d.ts +3 -2
  162. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
  163. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +3 -2
  164. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
  165. package/lib/typescript/src/core/index.d.ts +0 -2
  166. package/lib/typescript/src/core/index.d.ts.map +1 -1
  167. package/lib/typescript/src/index.d.ts +2 -1
  168. package/lib/typescript/src/index.d.ts.map +1 -1
  169. package/lib/typescript/src/mq.d.ts +8 -0
  170. package/lib/typescript/src/mq.d.ts.map +1 -1
  171. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  172. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -0
  173. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  174. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -0
  175. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  176. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
  177. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +2 -0
  178. package/package.json +1 -1
  179. package/plugin/ref.js +4 -4
  180. package/plugin/style.js +15 -3
  181. package/src/components/Display.tsx +12 -0
  182. package/src/components/Hide.tsx +12 -0
  183. package/src/components/index.ts +2 -0
  184. package/src/components/useMedia.ts +64 -0
  185. package/src/core/createUnistylesComponent.native.tsx +48 -4
  186. package/src/core/createUnistylesComponent.tsx +4 -2
  187. package/src/core/index.ts +0 -2
  188. package/src/index.ts +2 -1
  189. package/src/mq.ts +27 -9
  190. package/src/specs/ShadowRegistry/index.ts +5 -0
  191. package/src/specs/ShadowRegistry/types.ts +4 -1
  192. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -0
  193. package/src/web/utils/unistyle.ts +1 -1
  194. package/lib/commonjs/core/useBreakpoint.js +0 -22
  195. package/lib/commonjs/core/useBreakpoint.js.map +0 -1
  196. package/lib/commonjs/core/useBreakpoint.native.js +0 -24
  197. package/lib/commonjs/core/useBreakpoint.native.js.map +0 -1
  198. package/lib/commonjs/core/useTheme.js +0 -22
  199. package/lib/commonjs/core/useTheme.js.map +0 -2
  200. package/lib/commonjs/core/useTheme.native.js +0 -24
  201. package/lib/commonjs/core/useTheme.native.js.map +0 -1
  202. package/lib/commonjs/web/mq.js +0 -23
  203. package/lib/commonjs/web/mq.js.map +0 -1
  204. package/lib/module/core/useBreakpoint.js +0 -17
  205. package/lib/module/core/useBreakpoint.js.map +0 -1
  206. package/lib/module/core/useBreakpoint.native.js +0 -19
  207. package/lib/module/core/useBreakpoint.native.js.map +0 -2
  208. package/lib/module/core/useTheme.js +0 -17
  209. package/lib/module/core/useTheme.js.map +0 -2
  210. package/lib/module/core/useTheme.native.js +0 -19
  211. package/lib/module/core/useTheme.native.js.map +0 -1
  212. package/lib/module/web/mq.js +0 -17
  213. package/lib/module/web/mq.js.map +0 -1
  214. package/lib/typescript/src/core/useBreakpoint.d.ts +0 -2
  215. package/lib/typescript/src/core/useBreakpoint.d.ts.map +0 -1
  216. package/lib/typescript/src/core/useBreakpoint.native.d.ts +0 -2
  217. package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +0 -1
  218. package/lib/typescript/src/core/useTheme.d.ts +0 -3
  219. package/lib/typescript/src/core/useTheme.d.ts.map +0 -1
  220. package/lib/typescript/src/core/useTheme.native.d.ts +0 -3
  221. package/lib/typescript/src/core/useTheme.native.d.ts.map +0 -1
  222. package/lib/typescript/src/web/mq.d.ts +0 -8
  223. package/lib/typescript/src/web/mq.d.ts.map +0 -1
  224. package/src/common.js +0 -4
  225. package/src/core/createUnistylesComponent.js +0 -6
  226. package/src/core/createUnistylesComponent.native.js +0 -31
  227. package/src/core/index.js +0 -3
  228. package/src/core/useBreakpoint.js +0 -14
  229. package/src/core/useBreakpoint.native.js +0 -16
  230. package/src/core/useBreakpoint.native.ts +0 -21
  231. package/src/core/useBreakpoint.ts +0 -18
  232. package/src/core/useTheme.js +0 -14
  233. package/src/core/useTheme.native.js +0 -16
  234. package/src/core/useTheme.native.ts +0 -22
  235. package/src/core/useTheme.ts +0 -19
  236. package/src/global.js +0 -1
  237. package/src/index.js +0 -3
  238. package/src/mq.js +0 -38
  239. package/src/specs/NativePlatform/NativePlatform.nitro.js +0 -19
  240. package/src/specs/NativePlatform/index.js +0 -1
  241. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +0 -1
  242. package/src/specs/NavigtionBar/index.js +0 -9
  243. package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +0 -1
  244. package/src/specs/ShadowRegistry/index.js +0 -26
  245. package/src/specs/ShadowRegistry/types.js +0 -1
  246. package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +0 -1
  247. package/src/specs/StatusBar/index.js +0 -25
  248. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +0 -1
  249. package/src/specs/StyleSheet/index.js +0 -13
  250. package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +0 -2
  251. package/src/specs/TurboUnistyles/index.js +0 -1
  252. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +0 -1
  253. package/src/specs/UnistylesRuntime/index.js +0 -20
  254. package/src/specs/index.js +0 -8
  255. package/src/specs/index.web.js +0 -2
  256. package/src/specs/types.js +0 -17
  257. package/src/types/accessibility.js +0 -30
  258. package/src/types/breakpoints.js +0 -1
  259. package/src/types/common.js +0 -1
  260. package/src/types/core.js +0 -1
  261. package/src/types/index.js +0 -1
  262. package/src/types/stylesheet.js +0 -2
  263. package/src/types/variants.js +0 -1
  264. package/src/web/convert/boxShadow.js +0 -59
  265. package/src/web/convert/index.js +0 -56
  266. package/src/web/convert/pseudo.js +0 -131
  267. package/src/web/convert/shadow.js +0 -50
  268. package/src/web/convert/style.js +0 -137
  269. package/src/web/convert/textShadow.js +0 -56
  270. package/src/web/convert/transform.js +0 -65
  271. package/src/web/convert/types.js +0 -2
  272. package/src/web/convert/utils.js +0 -39
  273. package/src/web/create.js +0 -36
  274. package/src/web/index.js +0 -22
  275. package/src/web/listener.js +0 -26
  276. package/src/web/mock.js +0 -21
  277. package/src/web/mq.js +0 -14
  278. package/src/web/mq.ts +0 -17
  279. package/src/web/registry.js +0 -165
  280. package/src/web/runtime.js +0 -160
  281. package/src/web/shadowRegistry.js +0 -96
  282. package/src/web/state.js +0 -68
  283. package/src/web/utils/common.js +0 -79
  284. package/src/web/utils/index.js +0 -2
  285. package/src/web/utils/unistyle.js +0 -72
  286. package/src/web/variants/getVariants.js +0 -26
  287. package/src/web/variants/index.js +0 -2
  288. package/src/web/variants/useVariants.js +0 -50
@@ -1,7 +1,7 @@
1
1
  import type { UnistyleDependency } from '../../specs/NativePlatform'
2
2
  import { ColorScheme, Orientation } from '../../specs/types'
3
3
  import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet'
4
- import { isUnistylesMq, parseMq } from '../mq'
4
+ import { isUnistylesMq, parseMq } from '../../mq'
5
5
  import { UnistylesState } from '../state'
6
6
  import { keyInObject, reduceObject } from './common'
7
7
 
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useBreakpoint = void 0;
7
- var _react = require("react");
8
- var _web = require("../web");
9
- var _listener = require("../web/listener");
10
- var _NativePlatform = require("../specs/NativePlatform");
11
- const useBreakpoint = () => {
12
- const [breakpoint, setBreakpoint] = (0, _react.useState)(_web.UnistylesRuntime.breakpoint);
13
- (0, _react.useEffect)(() => {
14
- const removeChangeListener = _listener.UnistylesListener.addListeners([_NativePlatform.UnistyleDependency.Breakpoints], () => setBreakpoint(_web.UnistylesRuntime.breakpoint));
15
- return () => {
16
- removeChangeListener();
17
- };
18
- }, []);
19
- return breakpoint;
20
- };
21
- exports.useBreakpoint = useBreakpoint;
22
- //# sourceMappingURL=useBreakpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_web","_listener","_NativePlatform","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","UnistylesListener","addListeners","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACO,MAAMI,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACC,qBAAgB,CAACH,UAAU,CAAC;EACzE,IAAAI,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAGC,2BAAiB,CAACC,YAAY,CAAC,CAACC,kCAAkB,CAACC,WAAW,CAAC,EAAE,MAAMR,aAAa,CAACE,qBAAgB,CAACH,UAAU,CAAC,CAAC;IAC/I,OAAO,MAAM;MACTK,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOL,UAAU;AACrB,CAAC;AAACU,OAAA,CAAAX,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useBreakpoint = void 0;
7
- var _react = require("react");
8
- var _specs = require("../specs");
9
- const useBreakpoint = () => {
10
- const [breakpoint, setBreakpoint] = (0, _react.useState)(_specs.UnistylesRuntime.breakpoint);
11
- (0, _react.useEffect)(() => {
12
- const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
13
- if (dependencies.includes(_specs.UnistyleDependency.Breakpoints)) {
14
- setBreakpoint(_specs.UnistylesRuntime.breakpoint);
15
- }
16
- });
17
- return () => {
18
- removeChangeListener();
19
- };
20
- }, []);
21
- return breakpoint;
22
- };
23
- exports.useBreakpoint = useBreakpoint;
24
- //# sourceMappingURL=useBreakpoint.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_specs","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.native.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGO,MAAME,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACC,uBAAgB,CAACH,UAAU,CAAC;EAEzE,IAAAI,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,WAAW,CAAC,EAAE;QACvDV,aAAa,CAACE,uBAAgB,CAACH,UAAU,CAAC;MAC9C;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTK,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,UAAU;AACrB,CAAC;AAAAY,OAAA,CAAAb,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useTheme = void 0;
7
- var _react = require("react");
8
- var _web = require("../web");
9
- var _listener = require("../web/listener");
10
- var _NativePlatform = require("../specs/NativePlatform");
11
- const useTheme = () => {
12
- const [theme, setTheme] = (0, _react.useState)(_web.UnistylesRuntime.getTheme());
13
- (0, _react.useEffect)(() => {
14
- const removeChangeListener = _listener.UnistylesListener.addListeners([_NativePlatform.UnistyleDependency.Theme], () => setTheme(_web.UnistylesRuntime.getTheme()));
15
- return () => {
16
- removeChangeListener();
17
- };
18
- }, []);
19
- return theme;
20
- };
21
- exports.useTheme = useTheme;
22
- //# sourceMappingURL=useTheme.js.map
@@ -1,2 +0,0 @@
1
- {"version":3,"names":["_react","require","_web","_listener","_NativePlatform","useTheme","theme","setTheme","useState","UnistylesRuntime","getTheme","useEffect","removeChangeListener","UnistylesListener","addListeners","UnistyleDependency","Theme","exports"],"sourceRoot":"../../../src","sources":["core/useTheme.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACO,MAAMI,QAAQ,GAAGA,CAAA,KAAM;EAC1B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,qBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC;EAC/D,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAGC,2BAAiB,CAACC,YAAY,CAAC,CAACC,kCAAkB,CAACC,KAAK,CAAC,EAAE,MAAMT,QAAQ,CAACE,qBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpI,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAON,KAAK;AAChB,CAAC;AAACW,OAAA,CAAAZ,QAAA,GAAAA,QAAA","ignoreList":[]}
2
-
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useTheme = void 0;
7
- var _react = require("react");
8
- var _specs = require("../specs");
9
- const useTheme = () => {
10
- const [theme, setTheme] = (0, _react.useState)(_specs.UnistylesRuntime.getTheme());
11
- (0, _react.useEffect)(() => {
12
- const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
13
- if (dependencies.includes(_specs.UnistyleDependency.Theme)) {
14
- setTheme(_specs.UnistylesRuntime.getTheme());
15
- }
16
- });
17
- return () => {
18
- removeChangeListener();
19
- };
20
- }, []);
21
- return theme;
22
- };
23
- exports.useTheme = useTheme;
24
- //# sourceMappingURL=useTheme.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_specs","useTheme","theme","setTheme","useState","UnistylesRuntime","getTheme","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Theme","exports"],"sourceRoot":"../../../src","sources":["core/useTheme.native.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAIO,MAAME,QAAQ,GAAGA,CAAA,KAAsB;EAC1C,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,uBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC;EAE/D,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,KAAK,CAAC,EAAE;QACjDX,QAAQ,CAACE,uBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC;MACzC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAON,KAAK;AAChB,CAAC;AAAAa,OAAA,CAAAd,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parseMq = exports.isUnistylesMq = void 0;
7
- const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
8
- const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
9
- const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
10
- const parseMq = mq => {
11
- const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
12
- const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
13
- return {
14
- minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
15
- maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
16
- minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
17
- maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
18
- };
19
- };
20
- exports.parseMq = parseMq;
21
- const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
22
- exports.isUnistylesMq = isUnistylesMq;
23
- //# sourceMappingURL=mq.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","exports","isUnistylesMq","test"],"sourceRoot":"../../../src","sources":["web/mq.js"],"mappings":";;;;;;AAAA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAC7D,MAAMC,OAAO,GAAIC,EAAE,IAAK;EAC3B,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EACpE,OAAO;IACHQ,QAAQ,EAAE,CAACP,KAAK,IAAIC,KAAK,KAAK,UAAU,GAAGO,SAAS,GAAGC,MAAM,CAACR,KAAK,CAAC;IACpES,QAAQ,EAAE,CAACV,KAAK,IAAIE,GAAG,KAAK,UAAU,GAAGM,SAAS,GAAGC,MAAM,CAACP,GAAG,CAAC;IAChES,SAAS,EAAE,CAACP,MAAM,IAAIC,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACR,MAAM,IAAIE,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAACO,OAAA,CAAAf,OAAA,GAAAA,OAAA;AACK,MAAMgB,aAAa,GAAIf,EAAE,IAAKJ,kBAAkB,CAACoB,IAAI,CAAChB,EAAE,CAAC;AAACc,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useState } from 'react';
4
- import { UnistylesRuntime } from '../web';
5
- import { UnistylesListener } from '../web/listener';
6
- import { UnistyleDependency } from '../specs/NativePlatform';
7
- export const useBreakpoint = () => {
8
- const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
9
- useEffect(() => {
10
- const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Breakpoints], () => setBreakpoint(UnistylesRuntime.breakpoint));
11
- return () => {
12
- removeChangeListener();
13
- };
14
- }, []);
15
- return breakpoint;
16
- };
17
- //# sourceMappingURL=useBreakpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useState","UnistylesRuntime","UnistylesListener","UnistyleDependency","useBreakpoint","breakpoint","setBreakpoint","removeChangeListener","addListeners","Breakpoints"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,QAAQ;AACzC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGN,QAAQ,CAACC,gBAAgB,CAACI,UAAU,CAAC;EAEzEN,SAAS,CAAC,MAAM;IACZ,MAAMQ,oBAAoB,GAAGL,iBAAiB,CAACM,YAAY,CAAC,CAACL,kBAAkB,CAACM,WAAW,CAAC,EAAE,MAAMH,aAAa,CAACL,gBAAgB,CAACI,UAAU,CAAC,CAAC;IAE/I,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOF,UAAU;AACrB,CAAC","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useState } from 'react';
4
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
5
- export const useBreakpoint = () => {
6
- const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
7
- useEffect(() => {
8
- const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
9
- if (dependencies.includes(UnistyleDependency.Breakpoints)) {
10
- setBreakpoint(UnistylesRuntime.breakpoint);
11
- }
12
- });
13
- return () => {
14
- removeChangeListener();
15
- };
16
- }, []);
17
- return breakpoint;
18
- };
19
- //# sourceMappingURL=useBreakpoint.native.js.map
@@ -1,2 +0,0 @@
1
- {"version":3,"names":["useEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","useBreakpoint","breakpoint","setBreakpoint","removeChangeListener","addChangeListener","dependencies","includes","Breakpoints"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.native.js"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,UAAU;AAC3E,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGN,QAAQ,CAACG,gBAAgB,CAACE,UAAU,CAAC;EACzEN,SAAS,CAAC,MAAM;IACZ,MAAMQ,oBAAoB,GAAGN,UAAU,CAACO,iBAAiB,CAACC,YAAY,IAAI;MACtE,IAAIA,YAAY,CAACC,QAAQ,CAACR,kBAAkB,CAACS,WAAW,CAAC,EAAE;QACvDL,aAAa,CAACH,gBAAgB,CAACE,UAAU,CAAC;MAC9C;IACJ,CAAC,CAAC;IACF,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOF,UAAU;AACrB,CAAC","ignoreList":[]}
2
-
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useState } from 'react';
4
- import { UnistylesRuntime } from '../web';
5
- import { UnistylesListener } from '../web/listener';
6
- import { UnistyleDependency } from '../specs/NativePlatform';
7
- export const useTheme = () => {
8
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
9
- useEffect(() => {
10
- const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Theme], () => setTheme(UnistylesRuntime.getTheme()));
11
- return () => {
12
- removeChangeListener();
13
- };
14
- }, []);
15
- return theme;
16
- };
17
- //# sourceMappingURL=useTheme.js.map
@@ -1,2 +0,0 @@
1
- {"version":3,"names":["useEffect","useState","UnistylesRuntime","UnistylesListener","UnistyleDependency","useTheme","theme","setTheme","getTheme","removeChangeListener","addListeners","Theme"],"sourceRoot":"../../../src","sources":["core/useTheme.js"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,QAAQ;AACzC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EAC1B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,QAAQ,CAACC,gBAAgB,CAACM,QAAQ,CAAC,CAAC,CAAC;EAC/DR,SAAS,CAAC,MAAM;IACZ,MAAMS,oBAAoB,GAAGN,iBAAiB,CAACO,YAAY,CAAC,CAACN,kBAAkB,CAACO,KAAK,CAAC,EAAE,MAAMJ,QAAQ,CAACL,gBAAgB,CAACM,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpI,OAAO,MAAM;MACTC,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
2
-
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useState } from 'react';
4
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
5
- export const useTheme = () => {
6
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
7
- useEffect(() => {
8
- const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
9
- if (dependencies.includes(UnistyleDependency.Theme)) {
10
- setTheme(UnistylesRuntime.getTheme());
11
- }
12
- });
13
- return () => {
14
- removeChangeListener();
15
- };
16
- }, []);
17
- return theme;
18
- };
19
- //# sourceMappingURL=useTheme.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","useTheme","theme","setTheme","getTheme","removeChangeListener","addChangeListener","dependencies","includes","Theme"],"sourceRoot":"../../../src","sources":["core/useTheme.native.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,UAAU;AAI3E,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAsB;EAC1C,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,QAAQ,CAACG,gBAAgB,CAACI,QAAQ,CAAC,CAAC,CAAC;EAE/DR,SAAS,CAAC,MAAM;IACZ,MAAMS,oBAAoB,GAAIP,UAAU,CAAyBQ,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACT,kBAAkB,CAACU,KAAK,CAAC,EAAE;QACjDN,QAAQ,CAACH,gBAAgB,CAACI,QAAQ,CAAC,CAAC,CAAC;MACzC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTC,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
4
- const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
5
- const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
6
- export const parseMq = mq => {
7
- const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
8
- const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
9
- return {
10
- minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
11
- maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
12
- minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
13
- maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
14
- };
15
- };
16
- export const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
17
- //# sourceMappingURL=mq.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","isUnistylesMq","test"],"sourceRoot":"../../../src","sources":["web/mq.ts"],"mappings":";;AAAA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAEpE,OAAO,MAAMC,OAAO,GAAIC,EAAU,IAAK;EACnC,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHQ,QAAQ,EAAE,CAACP,KAAK,IAAIC,KAAK,KAAK,UAAU,GAAGO,SAAS,GAAGC,MAAM,CAACR,KAAK,CAAC;IACpES,QAAQ,EAAE,CAACV,KAAK,IAAIE,GAAG,KAAK,UAAU,GAAGM,SAAS,GAAGC,MAAM,CAACP,GAAG,CAAC;IAChES,SAAS,EAAE,CAACP,MAAM,IAAIC,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACR,MAAM,IAAIE,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAED,OAAO,MAAMO,aAAa,GAAId,EAAU,IAAKJ,kBAAkB,CAACmB,IAAI,CAACf,EAAE,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export declare const useBreakpoint: () => "portrait" | "landscape" | undefined;
2
- //# sourceMappingURL=useBreakpoint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../../../src/core/useBreakpoint.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,4CAYzB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const useBreakpoint: () => "portrait" | "landscape" | undefined;
2
- //# sourceMappingURL=useBreakpoint.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBreakpoint.native.d.ts","sourceRoot":"","sources":["../../../../src/core/useBreakpoint.native.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,4CAgBzB,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { UnistylesTheme } from '../types';
2
- export declare const useTheme: () => UnistylesTheme;
3
- //# sourceMappingURL=useTheme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../src/core/useTheme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,eAAO,MAAM,QAAQ,QAAO,cAY3B,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { UnistylesTheme } from '../types';
2
- export declare const useTheme: () => UnistylesTheme;
3
- //# sourceMappingURL=useTheme.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTheme.native.d.ts","sourceRoot":"","sources":["../../../../src/core/useTheme.native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,eAAO,MAAM,QAAQ,QAAO,cAgB3B,CAAA"}
@@ -1,8 +0,0 @@
1
- export declare const parseMq: (mq: string) => {
2
- minWidth: number | undefined;
3
- maxWidth: number | undefined;
4
- minHeight: number | undefined;
5
- maxHeight: number | undefined;
6
- };
7
- export declare const isUnistylesMq: (mq: string) => boolean;
8
- //# sourceMappingURL=mq.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/web/mq.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,OAAQ,MAAM;;;;;CAUjC,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,YAAgC,CAAA"}
package/src/common.js DELETED
@@ -1,4 +0,0 @@
1
- import { Platform } from 'react-native';
2
- export const isWeb = Platform.OS === 'web';
3
- export const isIOS = Platform.OS === 'ios';
4
- export const isAndroid = Platform.OS === 'android';
@@ -1,6 +0,0 @@
1
- import React, {} from 'react';
2
- export const createUnistylesComponent = (Component, mappings) => {
3
- return (props) => {
4
- return React.createElement(Component, { ...props });
5
- };
6
- };
@@ -1,31 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
3
- export const createUnistylesComponent = (Component, mappings) => {
4
- return (props) => {
5
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
6
- const [, setRt] = useState(0);
7
- useEffect(() => {
8
- const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
9
- const componentDependencies = (props.style?.uni__dependencies || mappings(theme).style?.uni__dependencies);
10
- if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(UnistyleDependency.Theme))) {
11
- setTheme(UnistylesRuntime.getTheme());
12
- }
13
- if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
14
- setRt(prevState => prevState + 1);
15
- }
16
- });
17
- return () => {
18
- removeChangeListener();
19
- };
20
- }, []);
21
- const mergedProps = { ...mappings(theme) };
22
- Object.keys(props).forEach(key => {
23
- if (key in mergedProps) {
24
- mergedProps[key] = Object.assign(props[key], mergedProps[key]);
25
- return;
26
- }
27
- mergedProps[key] = props[key];
28
- });
29
- return React.createElement(Component, { ...mergedProps });
30
- };
31
- };
package/src/core/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { useBreakpoint } from './useBreakpoint';
2
- export { useTheme } from './useTheme';
3
- export { createUnistylesComponent } from './createUnistylesComponent';
@@ -1,14 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { UnistylesRuntime } from '../web';
3
- import { UnistylesListener } from '../web/listener';
4
- import { UnistyleDependency } from '../specs/NativePlatform';
5
- export const useBreakpoint = () => {
6
- const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
7
- useEffect(() => {
8
- const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Breakpoints], () => setBreakpoint(UnistylesRuntime.breakpoint));
9
- return () => {
10
- removeChangeListener();
11
- };
12
- }, []);
13
- return breakpoint;
14
- };
@@ -1,16 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
3
- export const useBreakpoint = () => {
4
- const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
5
- useEffect(() => {
6
- const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
7
- if (dependencies.includes(UnistyleDependency.Breakpoints)) {
8
- setBreakpoint(UnistylesRuntime.breakpoint);
9
- }
10
- });
11
- return () => {
12
- removeChangeListener();
13
- };
14
- }, []);
15
- return breakpoint;
16
- };
@@ -1,21 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
3
- import type { UnistylesStyleSheet } from '../specs'
4
-
5
- export const useBreakpoint = () => {
6
- const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint)
7
-
8
- useEffect(() => {
9
- const removeChangeListener = (StyleSheet as UnistylesStyleSheet).addChangeListener(dependencies => {
10
- if (dependencies.includes(UnistyleDependency.Breakpoints)) {
11
- setBreakpoint(UnistylesRuntime.breakpoint)
12
- }
13
- })
14
-
15
- return () => {
16
- removeChangeListener()
17
- }
18
- }, [])
19
-
20
- return breakpoint
21
- }
@@ -1,18 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import { UnistylesRuntime } from '../web'
3
- import { UnistylesListener } from '../web/listener'
4
- import { UnistyleDependency } from '../specs/NativePlatform'
5
-
6
- export const useBreakpoint = () => {
7
- const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint)
8
-
9
- useEffect(() => {
10
- const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Breakpoints], () => setBreakpoint(UnistylesRuntime.breakpoint))
11
-
12
- return () => {
13
- removeChangeListener()
14
- }
15
- }, [])
16
-
17
- return breakpoint
18
- }
@@ -1,14 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { UnistylesRuntime } from '../web';
3
- import { UnistylesListener } from '../web/listener';
4
- import { UnistyleDependency } from '../specs/NativePlatform';
5
- export const useTheme = () => {
6
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
7
- useEffect(() => {
8
- const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Theme], () => setTheme(UnistylesRuntime.getTheme()));
9
- return () => {
10
- removeChangeListener();
11
- };
12
- }, []);
13
- return theme;
14
- };
@@ -1,16 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
3
- export const useTheme = () => {
4
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
5
- useEffect(() => {
6
- const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
7
- if (dependencies.includes(UnistyleDependency.Theme)) {
8
- setTheme(UnistylesRuntime.getTheme());
9
- }
10
- });
11
- return () => {
12
- removeChangeListener();
13
- };
14
- }, []);
15
- return theme;
16
- };
@@ -1,22 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
3
- import type { UnistylesStyleSheet } from '../specs'
4
- import type { UnistylesTheme } from '../types'
5
-
6
- export const useTheme = (): UnistylesTheme => {
7
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme())
8
-
9
- useEffect(() => {
10
- const removeChangeListener = (StyleSheet as UnistylesStyleSheet).addChangeListener(dependencies => {
11
- if (dependencies.includes(UnistyleDependency.Theme)) {
12
- setTheme(UnistylesRuntime.getTheme())
13
- }
14
- })
15
-
16
- return () => {
17
- removeChangeListener()
18
- }
19
- }, [])
20
-
21
- return theme
22
- }
@@ -1,19 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import { UnistylesRuntime } from '../web'
3
- import { UnistylesListener } from '../web/listener'
4
- import { UnistyleDependency } from '../specs/NativePlatform'
5
- import type { UnistylesTheme } from '../types'
6
-
7
- export const useTheme = (): UnistylesTheme => {
8
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme())
9
-
10
- useEffect(() => {
11
- const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Theme], () => setTheme(UnistylesRuntime.getTheme()))
12
-
13
- return () => {
14
- removeChangeListener()
15
- }
16
- }, [])
17
-
18
- return theme
19
- }
package/src/global.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/src/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './specs';
2
- export { mq } from './mq';
3
- export { useTheme, useBreakpoint, createUnistylesComponent } from './core';
package/src/mq.js DELETED
@@ -1,38 +0,0 @@
1
- const getMQValue = (value) => {
2
- if (typeof value === 'number') {
3
- return value;
4
- }
5
- if (value === null) {
6
- return 0;
7
- }
8
- // todo take it from js
9
- const breakpoints = {
10
- xs: 0,
11
- sm: 300,
12
- md: 500,
13
- lg: 800,
14
- xl: 1200
15
- };
16
- // @ts-ignore
17
- return breakpoints[value] ?? 0;
18
- };
19
- /**
20
- * Utility to create cross-platform media queries
21
- * @returns - JavaScript symbol to be used in your stylesheet
22
- */
23
- export const mq = {
24
- only: {
25
- width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`,
26
- height: (hMin = 0, hMax = Infinity) => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
27
- },
28
- width: (wMin = 0, wMax = Infinity) => ({
29
- and: {
30
- height: (hMin = 0, hMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
31
- }
32
- }),
33
- height: (hMin = 0, hMax = Infinity) => ({
34
- and: {
35
- width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
36
- }
37
- })
38
- };
@@ -1,19 +0,0 @@
1
- import {} from '../types';
2
- export var UnistyleDependency;
3
- (function (UnistyleDependency) {
4
- UnistyleDependency[UnistyleDependency["Theme"] = 0] = "Theme";
5
- UnistyleDependency[UnistyleDependency["ThemeName"] = 1] = "ThemeName";
6
- UnistyleDependency[UnistyleDependency["AdaptiveThemes"] = 2] = "AdaptiveThemes";
7
- UnistyleDependency[UnistyleDependency["Breakpoints"] = 3] = "Breakpoints";
8
- UnistyleDependency[UnistyleDependency["Variants"] = 4] = "Variants";
9
- UnistyleDependency[UnistyleDependency["ColorScheme"] = 5] = "ColorScheme";
10
- UnistyleDependency[UnistyleDependency["Dimensions"] = 6] = "Dimensions";
11
- UnistyleDependency[UnistyleDependency["Orientation"] = 7] = "Orientation";
12
- UnistyleDependency[UnistyleDependency["ContentSizeCategory"] = 8] = "ContentSizeCategory";
13
- UnistyleDependency[UnistyleDependency["Insets"] = 9] = "Insets";
14
- UnistyleDependency[UnistyleDependency["PixelRatio"] = 10] = "PixelRatio";
15
- UnistyleDependency[UnistyleDependency["FontScale"] = 11] = "FontScale";
16
- UnistyleDependency[UnistyleDependency["StatusBar"] = 12] = "StatusBar";
17
- UnistyleDependency[UnistyleDependency["NavigationBar"] = 13] = "NavigationBar";
18
- UnistyleDependency[UnistyleDependency["Ime"] = 14] = "Ime";
19
- })(UnistyleDependency || (UnistyleDependency = {}));
@@ -1 +0,0 @@
1
- export { UnistyleDependency } from './NativePlatform.nitro';
@@ -1,9 +0,0 @@
1
- import { processColor } from 'react-native';
2
- export const attachNavigationBarJSMethods = (hybridObject) => {
3
- const privateHybrid = hybridObject;
4
- privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
5
- hybridObject.setBackgroundColor = (color) => {
6
- const parsedColor = processColor(color) ?? 0;
7
- privateHybrid._setBackgroundColor(parsedColor);
8
- };
9
- };
@@ -1 +0,0 @@
1
- export {};