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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) 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.map +1 -2
  39. package/lib/commonjs/specs/ShadowRegistry/types.js +0 -4
  40. package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
  41. package/lib/commonjs/specs/StatusBar/index.js.map +1 -2
  42. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +4 -2
  43. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
  44. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +3 -1
  45. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -2
  46. package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -1
  47. package/lib/commonjs/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
  48. package/lib/commonjs/specs/index.web.js.map +1 -2
  49. package/lib/commonjs/specs/types.js +10 -10
  50. package/lib/commonjs/specs/types.js.map +1 -1
  51. package/lib/commonjs/types/accessibility.js +9 -9
  52. package/lib/commonjs/types/accessibility.js.map +1 -1
  53. package/lib/commonjs/types/breakpoints.js.map +1 -1
  54. package/lib/commonjs/types/common.js +0 -4
  55. package/lib/commonjs/types/common.js.map +1 -1
  56. package/lib/commonjs/types/core.js.map +1 -1
  57. package/lib/commonjs/types/index.js.map +1 -2
  58. package/lib/commonjs/types/stylesheet.js +2 -1
  59. package/lib/commonjs/types/stylesheet.js.map +1 -2
  60. package/lib/commonjs/web/convert/index.js +7 -1
  61. package/lib/commonjs/web/convert/index.js.map +1 -2
  62. package/lib/commonjs/web/convert/pseudo.js.map +1 -2
  63. package/lib/commonjs/web/convert/shadow.js +5 -1
  64. package/lib/commonjs/web/convert/shadow.js.map +1 -2
  65. package/lib/commonjs/web/convert/style.js.map +1 -2
  66. package/lib/commonjs/web/convert/textShadow.js.map +1 -2
  67. package/lib/commonjs/web/convert/transform.js.map +1 -2
  68. package/lib/commonjs/web/convert/types.js.map +1 -1
  69. package/lib/commonjs/web/convert/utils.js +2 -1
  70. package/lib/commonjs/web/convert/utils.js.map +1 -2
  71. package/lib/commonjs/web/index.js.map +1 -2
  72. package/lib/commonjs/web/listener.js.map +1 -2
  73. package/lib/commonjs/web/mock.js.map +1 -2
  74. package/lib/commonjs/web/runtime.js.map +1 -2
  75. package/lib/commonjs/web/shadowRegistry.js +9 -1
  76. package/lib/commonjs/web/shadowRegistry.js.map +1 -2
  77. package/lib/commonjs/web/state.js +5 -1
  78. package/lib/commonjs/web/utils/common.js +3 -1
  79. package/lib/commonjs/web/utils/common.js.map +1 -2
  80. package/lib/commonjs/web/utils/index.js.map +1 -1
  81. package/lib/commonjs/web/utils/unistyle.js +1 -1
  82. package/lib/commonjs/web/variants/index.js.map +1 -1
  83. package/lib/module/common.js.map +1 -1
  84. package/lib/module/components/Display.js +13 -0
  85. package/lib/module/components/Display.js.map +1 -0
  86. package/lib/module/components/Hide.js +13 -0
  87. package/lib/module/components/Hide.js.map +1 -0
  88. package/lib/module/components/index.js +5 -0
  89. package/lib/module/components/index.js.map +1 -0
  90. package/lib/module/components/useMedia.js +54 -0
  91. package/lib/module/components/useMedia.js.map +1 -0
  92. package/lib/module/core/createUnistylesComponent.js +2 -1
  93. package/lib/module/core/createUnistylesComponent.js.map +1 -1
  94. package/lib/module/core/createUnistylesComponent.native.js +41 -3
  95. package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
  96. package/lib/module/core/index.js +0 -2
  97. package/lib/module/core/index.js.map +1 -1
  98. package/lib/module/global.js +1 -1
  99. package/lib/module/global.js.map +0 -1
  100. package/lib/module/index.js +2 -1
  101. package/lib/module/index.js.map +1 -1
  102. package/lib/module/mq.js +21 -11
  103. package/lib/module/mq.js.map +1 -1
  104. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
  105. package/lib/module/specs/NativePlatform/index.js.map +1 -1
  106. package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +0 -1
  107. package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +0 -1
  108. package/lib/module/specs/ShadowRegistry/types.js +0 -2
  109. package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
  110. package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
  111. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
  112. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +0 -1
  113. package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +0 -1
  114. package/lib/module/specs/index.web.js.map +1 -2
  115. package/lib/module/specs/types.js.map +0 -1
  116. package/lib/module/types/accessibility.js +1 -1
  117. package/lib/module/types/accessibility.js.map +0 -1
  118. package/lib/module/types/breakpoints.js.map +0 -1
  119. package/lib/module/types/common.js +1 -1
  120. package/lib/module/types/common.js.map +0 -1
  121. package/lib/module/types/core.js.map +0 -1
  122. package/lib/module/types/index.js.map +1 -2
  123. package/lib/module/types/stylesheet.js +2 -2
  124. package/lib/module/types/stylesheet.js.map +1 -2
  125. package/lib/module/types/variants.js.map +0 -1
  126. package/lib/module/web/convert/boxShadow.js +4 -1
  127. package/lib/module/web/convert/boxShadow.js.map +1 -2
  128. package/lib/module/web/convert/index.js +7 -1
  129. package/lib/module/web/convert/shadow.js +5 -1
  130. package/lib/module/web/convert/shadow.js.map +1 -2
  131. package/lib/module/web/convert/textShadow.js +4 -1
  132. package/lib/module/web/convert/utils.js +2 -1
  133. package/lib/module/web/convert/utils.js.map +1 -2
  134. package/lib/module/web/create.js +5 -1
  135. package/lib/module/web/create.js.map +1 -2
  136. package/lib/module/web/index.js +2 -1
  137. package/lib/module/web/index.js.map +1 -2
  138. package/lib/module/web/listener.js.map +1 -2
  139. package/lib/module/web/registry.js +3 -1
  140. package/lib/module/web/shadowRegistry.js +9 -1
  141. package/lib/module/web/shadowRegistry.js.map +1 -2
  142. package/lib/module/web/state.js +5 -1
  143. package/lib/module/web/state.js.map +1 -2
  144. package/lib/module/web/utils/common.js +3 -1
  145. package/lib/module/web/utils/common.js.map +1 -2
  146. package/lib/module/web/utils/unistyle.js +1 -1
  147. package/lib/module/web/utils/unistyle.js.map +1 -1
  148. package/lib/module/web/variants/getVariants.js.map +1 -2
  149. package/lib/module/web/variants/index.js.map +1 -1
  150. package/lib/typescript/src/components/Display.d.ts +7 -0
  151. package/lib/typescript/src/components/Display.d.ts.map +1 -0
  152. package/lib/typescript/src/components/Hide.d.ts +7 -0
  153. package/lib/typescript/src/components/Hide.d.ts.map +1 -0
  154. package/lib/typescript/src/components/index.d.ts +3 -0
  155. package/lib/typescript/src/components/index.d.ts.map +1 -0
  156. package/lib/typescript/src/components/useMedia.d.ts +6 -0
  157. package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
  158. package/lib/typescript/src/core/createUnistylesComponent.d.ts +3 -2
  159. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
  160. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +3 -2
  161. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
  162. package/lib/typescript/src/core/index.d.ts +0 -2
  163. package/lib/typescript/src/core/index.d.ts.map +1 -1
  164. package/lib/typescript/src/index.d.ts +2 -1
  165. package/lib/typescript/src/index.d.ts.map +1 -1
  166. package/lib/typescript/src/mq.d.ts +8 -0
  167. package/lib/typescript/src/mq.d.ts.map +1 -1
  168. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -0
  169. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  170. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
  171. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +2 -0
  172. package/package.json +1 -1
  173. package/plugin/ref.js +4 -4
  174. package/plugin/style.js +15 -3
  175. package/src/components/Display.tsx +12 -0
  176. package/src/components/Hide.tsx +12 -0
  177. package/src/components/index.ts +2 -0
  178. package/src/components/useMedia.ts +64 -0
  179. package/src/core/createUnistylesComponent.native.tsx +48 -4
  180. package/src/core/createUnistylesComponent.tsx +4 -2
  181. package/src/core/index.ts +0 -2
  182. package/src/index.ts +2 -1
  183. package/src/mq.ts +27 -9
  184. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -0
  185. package/src/web/utils/unistyle.ts +1 -1
  186. package/lib/commonjs/core/useBreakpoint.js +0 -22
  187. package/lib/commonjs/core/useBreakpoint.js.map +0 -1
  188. package/lib/commonjs/core/useBreakpoint.native.js +0 -24
  189. package/lib/commonjs/core/useBreakpoint.native.js.map +0 -1
  190. package/lib/commonjs/core/useTheme.js +0 -22
  191. package/lib/commonjs/core/useTheme.js.map +0 -2
  192. package/lib/commonjs/core/useTheme.native.js +0 -24
  193. package/lib/commonjs/core/useTheme.native.js.map +0 -1
  194. package/lib/commonjs/web/mq.js +0 -23
  195. package/lib/commonjs/web/mq.js.map +0 -1
  196. package/lib/module/core/useBreakpoint.js +0 -17
  197. package/lib/module/core/useBreakpoint.js.map +0 -1
  198. package/lib/module/core/useBreakpoint.native.js +0 -19
  199. package/lib/module/core/useBreakpoint.native.js.map +0 -2
  200. package/lib/module/core/useTheme.js +0 -17
  201. package/lib/module/core/useTheme.js.map +0 -2
  202. package/lib/module/core/useTheme.native.js +0 -19
  203. package/lib/module/core/useTheme.native.js.map +0 -1
  204. package/lib/module/web/mq.js +0 -17
  205. package/lib/module/web/mq.js.map +0 -1
  206. package/lib/typescript/src/core/useBreakpoint.d.ts +0 -2
  207. package/lib/typescript/src/core/useBreakpoint.d.ts.map +0 -1
  208. package/lib/typescript/src/core/useBreakpoint.native.d.ts +0 -2
  209. package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +0 -1
  210. package/lib/typescript/src/core/useTheme.d.ts +0 -3
  211. package/lib/typescript/src/core/useTheme.d.ts.map +0 -1
  212. package/lib/typescript/src/core/useTheme.native.d.ts +0 -3
  213. package/lib/typescript/src/core/useTheme.native.d.ts.map +0 -1
  214. package/lib/typescript/src/web/mq.d.ts +0 -8
  215. package/lib/typescript/src/web/mq.d.ts.map +0 -1
  216. package/src/common.js +0 -4
  217. package/src/core/createUnistylesComponent.js +0 -6
  218. package/src/core/createUnistylesComponent.native.js +0 -31
  219. package/src/core/index.js +0 -3
  220. package/src/core/useBreakpoint.js +0 -14
  221. package/src/core/useBreakpoint.native.js +0 -16
  222. package/src/core/useBreakpoint.native.ts +0 -21
  223. package/src/core/useBreakpoint.ts +0 -18
  224. package/src/core/useTheme.js +0 -14
  225. package/src/core/useTheme.native.js +0 -16
  226. package/src/core/useTheme.native.ts +0 -22
  227. package/src/core/useTheme.ts +0 -19
  228. package/src/global.js +0 -1
  229. package/src/index.js +0 -3
  230. package/src/mq.js +0 -38
  231. package/src/specs/NativePlatform/NativePlatform.nitro.js +0 -19
  232. package/src/specs/NativePlatform/index.js +0 -1
  233. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +0 -1
  234. package/src/specs/NavigtionBar/index.js +0 -9
  235. package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +0 -1
  236. package/src/specs/ShadowRegistry/index.js +0 -26
  237. package/src/specs/ShadowRegistry/types.js +0 -1
  238. package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +0 -1
  239. package/src/specs/StatusBar/index.js +0 -25
  240. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +0 -1
  241. package/src/specs/StyleSheet/index.js +0 -13
  242. package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +0 -2
  243. package/src/specs/TurboUnistyles/index.js +0 -1
  244. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +0 -1
  245. package/src/specs/UnistylesRuntime/index.js +0 -20
  246. package/src/specs/index.js +0 -8
  247. package/src/specs/index.web.js +0 -2
  248. package/src/specs/types.js +0 -17
  249. package/src/types/accessibility.js +0 -30
  250. package/src/types/breakpoints.js +0 -1
  251. package/src/types/common.js +0 -1
  252. package/src/types/core.js +0 -1
  253. package/src/types/index.js +0 -1
  254. package/src/types/stylesheet.js +0 -2
  255. package/src/types/variants.js +0 -1
  256. package/src/web/convert/boxShadow.js +0 -59
  257. package/src/web/convert/index.js +0 -56
  258. package/src/web/convert/pseudo.js +0 -131
  259. package/src/web/convert/shadow.js +0 -50
  260. package/src/web/convert/style.js +0 -137
  261. package/src/web/convert/textShadow.js +0 -56
  262. package/src/web/convert/transform.js +0 -65
  263. package/src/web/convert/types.js +0 -2
  264. package/src/web/convert/utils.js +0 -39
  265. package/src/web/create.js +0 -36
  266. package/src/web/index.js +0 -22
  267. package/src/web/listener.js +0 -26
  268. package/src/web/mock.js +0 -21
  269. package/src/web/mq.js +0 -14
  270. package/src/web/mq.ts +0 -17
  271. package/src/web/registry.js +0 -165
  272. package/src/web/runtime.js +0 -160
  273. package/src/web/shadowRegistry.js +0 -96
  274. package/src/web/state.js +0 -68
  275. package/src/web/utils/common.js +0 -79
  276. package/src/web/utils/index.js +0 -2
  277. package/src/web/utils/unistyle.js +0 -72
  278. package/src/web/variants/getVariants.js +0 -26
  279. package/src/web/variants/index.js +0 -2
  280. package/src/web/variants/useVariants.js +0 -50
@@ -1,20 +0,0 @@
1
- import { processColor } from 'react-native';
2
- import { NitroModules } from 'react-native-nitro-modules';
3
- import { attachStatusBarJSMethods } from '../StatusBar';
4
- import { attachNavigationBarJSMethods } from '../NavigtionBar';
5
- import { isIOS } from '../../common';
6
- const HybridUnistylesRuntime = NitroModules
7
- .createHybridObject('UnistylesRuntime');
8
- HybridUnistylesRuntime.statusBar = HybridUnistylesRuntime.createHybridStatusBar();
9
- HybridUnistylesRuntime.navigationBar = HybridUnistylesRuntime.createHybridNavigationBar();
10
- HybridUnistylesRuntime._setRootViewBackgroundColor = HybridUnistylesRuntime.setRootViewBackgroundColor;
11
- HybridUnistylesRuntime.setRootViewBackgroundColor = (color) => {
12
- const parsedColor = processColor(color) ?? 0;
13
- HybridUnistylesRuntime._setRootViewBackgroundColor(parsedColor);
14
- };
15
- if (isIOS) {
16
- HybridUnistylesRuntime.setImmersiveMode = (isEnabled) => HybridUnistylesRuntime.statusBar.setHidden(isEnabled, 'fade');
17
- }
18
- attachStatusBarJSMethods(HybridUnistylesRuntime.statusBar);
19
- attachNavigationBarJSMethods(HybridUnistylesRuntime.navigationBar);
20
- export const Runtime = HybridUnistylesRuntime;
@@ -1,8 +0,0 @@
1
- import './TurboUnistyles';
2
- import { Runtime } from './UnistylesRuntime';
3
- import { StyleSheet } from './StyleSheet';
4
- import { UnistylesShadowRegistry } from './ShadowRegistry';
5
- import { StatusBarStyle, ColorScheme, Orientation } from './types';
6
- import { UnistyleDependency } from './NativePlatform';
7
- export { StatusBarStyle, ColorScheme, Orientation, UnistyleDependency };
8
- export { UnistylesShadowRegistry, Runtime as UnistylesRuntime, StyleSheet, };
@@ -1,2 +0,0 @@
1
- export const getSSRUnistyles = () => [];
2
- export * from '../web';
@@ -1,17 +0,0 @@
1
- export var ColorScheme;
2
- (function (ColorScheme) {
3
- ColorScheme["Light"] = "light";
4
- ColorScheme["Dark"] = "dark";
5
- ColorScheme["Unspecified"] = "unspecified";
6
- })(ColorScheme || (ColorScheme = {}));
7
- export var Orientation;
8
- (function (Orientation) {
9
- Orientation["Portrait"] = "portrait";
10
- Orientation["Landscape"] = "landscape";
11
- })(Orientation || (Orientation = {}));
12
- export var StatusBarStyle;
13
- (function (StatusBarStyle) {
14
- StatusBarStyle["Default"] = "default";
15
- StatusBarStyle["Light"] = "light";
16
- StatusBarStyle["Dark"] = "dark";
17
- })(StatusBarStyle || (StatusBarStyle = {}));
@@ -1,30 +0,0 @@
1
- export var IOSContentSizeCategory;
2
- (function (IOSContentSizeCategory) {
3
- IOSContentSizeCategory["AccessibilityExtraExtraExtraLarge"] = "accessibilityExtraExtraExtraLarge";
4
- IOSContentSizeCategory["AccessibilityExtraExtraLarge"] = "accessibilityExtraExtraLarge";
5
- IOSContentSizeCategory["AccessibilityExtraLarge"] = "accessibilityExtraLarge";
6
- IOSContentSizeCategory["AccessibilityLarge"] = "accessibilityLarge";
7
- IOSContentSizeCategory["AccessibilityMedium"] = "accessibilityMedium";
8
- IOSContentSizeCategory["ExtraExtraExtraLarge"] = "xxxLarge";
9
- IOSContentSizeCategory["ExtraExtraLarge"] = "xxLarge";
10
- IOSContentSizeCategory["ExtraLarge"] = "xLarge";
11
- IOSContentSizeCategory["Large"] = "Large";
12
- IOSContentSizeCategory["Medium"] = "Medium";
13
- IOSContentSizeCategory["Small"] = "Small";
14
- IOSContentSizeCategory["ExtraSmall"] = "xSmall";
15
- IOSContentSizeCategory["Unspecified"] = "unspecified";
16
- })(IOSContentSizeCategory || (IOSContentSizeCategory = {}));
17
- export var AndroidContentSizeCategory;
18
- (function (AndroidContentSizeCategory) {
19
- AndroidContentSizeCategory["Small"] = "Small";
20
- AndroidContentSizeCategory["Default"] = "Default";
21
- AndroidContentSizeCategory["Large"] = "Large";
22
- AndroidContentSizeCategory["ExtraLarge"] = "ExtraLarge";
23
- AndroidContentSizeCategory["Huge"] = "Huge";
24
- AndroidContentSizeCategory["ExtraHuge"] = "ExtraHuge";
25
- AndroidContentSizeCategory["ExtraExtraHuge"] = "ExtraExtraHuge";
26
- })(AndroidContentSizeCategory || (AndroidContentSizeCategory = {}));
27
- export var WebContentSizeCategory;
28
- (function (WebContentSizeCategory) {
29
- WebContentSizeCategory["Unspecified"] = "web-unspecified";
30
- })(WebContentSizeCategory || (WebContentSizeCategory = {}));
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/src/types/core.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { AndroidContentSizeCategory, IOSContentSizeCategory, WebContentSizeCategory } from './accessibility';
@@ -1,2 +0,0 @@
1
- const create = (stylesheet) => stylesheet;
2
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,59 +0,0 @@
1
- import { deepMergeObjects, warn } from '../utils';
2
- import { validateShadow } from './shadow';
3
- import { BOX_SHADOW_STYLES } from './types';
4
- import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
5
- const createBoxShadowValue = (style) => {
6
- // at this point every prop is present
7
- const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
8
- const offsetX = normalizeNumericValue(shadowOffset.width);
9
- const offsetY = normalizeNumericValue(shadowOffset.height);
10
- const radius = normalizeNumericValue(shadowRadius);
11
- const color = normalizeColor(shadowColor, shadowOpacity);
12
- return `${offsetX} ${offsetY} ${radius} ${color}`;
13
- };
14
- export const getBoxShadowStyle = (styles) => {
15
- const missingStyles = BOX_SHADOW_STYLES.filter(key => !(key in styles));
16
- if (missingStyles.length) {
17
- warn(`can't apply box shadow as you miss these properties: ${missingStyles.join(', ')}`);
18
- return {};
19
- }
20
- const breakpointsSet = new Set();
21
- try {
22
- validateShadow(BOX_SHADOW_STYLES, styles, breakpointsSet);
23
- }
24
- catch (error) {
25
- if (typeof error === 'string') {
26
- warn(error);
27
- }
28
- return {};
29
- }
30
- const breakpoints = Array.from(breakpointsSet);
31
- // If no breakpoints were used return styles without media queries
32
- if (breakpoints.length === 0) {
33
- return {
34
- boxShadow: createBoxShadowValue(styles)
35
- };
36
- }
37
- // Create boxShadow for each breakpoint
38
- const breakpointStyles = breakpoints.map(breakpoint => {
39
- const color = extractShadowValue('shadowColor', breakpoint, styles);
40
- const { width, height } = extractShadowValue('shadowOffset', breakpoint, styles);
41
- const radius = extractShadowValue('shadowRadius', breakpoint, styles);
42
- const opacity = extractShadowValue('shadowOpacity', breakpoint, styles);
43
- return {
44
- [breakpoint]: {
45
- boxShadow: createBoxShadowValue({
46
- shadowColor: color,
47
- shadowOffset: {
48
- width,
49
- height
50
- },
51
- shadowRadius: radius,
52
- shadowOpacity: opacity
53
- })
54
- }
55
- };
56
- });
57
- // Merge all breakpoints styles into one
58
- return deepMergeObjects(...breakpointStyles);
59
- };
@@ -1,56 +0,0 @@
1
- import { isPseudo } from './pseudo';
2
- import { getStyle } from './style';
3
- import { deepMergeObjects } from '../utils';
4
- import { getTransformStyle } from './transform';
5
- import { isBoxShadow, isTextShadow, isTransform } from './utils';
6
- import { getTextShadowStyle } from './textShadow';
7
- import { getBoxShadowStyle } from './boxShadow';
8
- export const convertUnistyles = (value) => {
9
- // Flag to mark if textShadow is already created
10
- let hasTextShadow = false;
11
- // Flag to mark if boxShadow is already created
12
- let hasBoxShadow = false;
13
- const stylesArray = Object.entries({
14
- ...value,
15
- ...value._web
16
- }).flatMap(([unistylesKey, unistylesValue]) => {
17
- // Keys to omit
18
- if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies', '__unistyles-secrets__'].includes(unistylesKey) || unistylesKey.startsWith('variant-')) {
19
- return [];
20
- }
21
- // Pseudo classes :hover, :before etc.
22
- if (isPseudo(unistylesKey)) {
23
- const flattenValues = convertUnistyles(unistylesValue);
24
- return { [unistylesKey]: flattenValues };
25
- }
26
- // Text shadow
27
- if (isTextShadow(unistylesKey)) {
28
- if (hasTextShadow) {
29
- return [];
30
- }
31
- hasTextShadow = true;
32
- return getTextShadowStyle(value);
33
- }
34
- // Box shadow
35
- if (isBoxShadow(unistylesKey)) {
36
- if (hasBoxShadow) {
37
- return [];
38
- }
39
- hasBoxShadow = true;
40
- return getBoxShadowStyle(value);
41
- }
42
- // Transforms
43
- if (isTransform(unistylesKey, unistylesValue)) {
44
- return getTransformStyle(unistylesValue);
45
- }
46
- // Breakpoints
47
- if (typeof unistylesValue === 'object' && unistylesValue !== null) {
48
- return Object.entries(unistylesValue).map(([breakpointKey, breakpointValue]) => {
49
- return { [breakpointKey]: getStyle(unistylesKey, breakpointValue) };
50
- });
51
- }
52
- // Regular styles
53
- return getStyle(unistylesKey, unistylesValue);
54
- });
55
- return deepMergeObjects(...stylesArray);
56
- };
@@ -1,131 +0,0 @@
1
- export const pseudos = [
2
- '_-moz-broken',
3
- '_-moz-drag-over',
4
- '_-moz-first-node',
5
- '_-moz-handler-blocked',
6
- '_-moz-handler-crashed',
7
- '_-moz-handler-disabled',
8
- '_-moz-last-node',
9
- '_-moz-loading',
10
- '_-moz-locale-dir(ltr)',
11
- '_-moz-locale-dir(rtl)',
12
- '_-moz-only-whitespace',
13
- '_-moz-submit-invalid',
14
- '_-moz-suppressed',
15
- '_-moz-user-disabled',
16
- '_-moz-window-inactive',
17
- '_active',
18
- '_any-link',
19
- '_autofill',
20
- '_blank',
21
- '_buffering',
22
- '_checked',
23
- '_current',
24
- '_default',
25
- '_defined',
26
- '_dir(',
27
- '_disabled',
28
- '_empty',
29
- '_enabled',
30
- '_first',
31
- '_first-child',
32
- '_first-of-type',
33
- '_focus',
34
- '_focus-visible',
35
- '_focus-within',
36
- '_fullscreen',
37
- '_future',
38
- '_has(',
39
- '_host',
40
- '_host-context(',
41
- '_host(',
42
- '_hover',
43
- '_in-range',
44
- '_indeterminate',
45
- '_invalid',
46
- '_is(',
47
- '_lang(',
48
- '_last-child',
49
- '_last-of-type',
50
- '_left',
51
- '_link',
52
- '_local-link',
53
- '_modal',
54
- '_muted',
55
- '_not(',
56
- '_nth-child(',
57
- '_nth-last-child(',
58
- '_nth-last-of-type(',
59
- '_nth-of-type(',
60
- '_only-child',
61
- '_only-of-type',
62
- '_optional',
63
- '_out-of-range',
64
- '_past',
65
- '_paused',
66
- '_picture-in-picture',
67
- '_placeholder-shown',
68
- '_playing',
69
- '_popover-open',
70
- '_read-only',
71
- '_read-write',
72
- '_required',
73
- '_right',
74
- '_scope',
75
- '_seeking',
76
- '_stalled',
77
- '_state(',
78
- '_target',
79
- '_target-within',
80
- '_user-invalid',
81
- '_user-valid',
82
- '_valid',
83
- '_visited',
84
- '_volume-locked',
85
- '_where(',
86
- '_-moz-color-swatch',
87
- '_-moz-focus-inner',
88
- '_-moz-list-bullet',
89
- '_-moz-list-number',
90
- '_-moz-meter-bar',
91
- '_-moz-progress-bar',
92
- '_-moz-range-progress',
93
- '_-moz-range-thumb',
94
- '_-moz-range-track',
95
- '_-webkit-inner-spin-button',
96
- '_-webkit-meter-barDeprecated',
97
- '_-webkit-meter-even-less-good-value',
98
- '_-webkit-meter-inner-element',
99
- '_-webkit-meter-optimum-value',
100
- '_-webkit-meter-suboptimum-value',
101
- '_-webkit-progress-bar',
102
- '_-webkit-progress-inner-element',
103
- '_-webkit-progress-value',
104
- '_-webkit-scrollbar',
105
- '_-webkit-search-cancel-button',
106
- '_-webkit-search-results-button',
107
- '_-webkit-slider-runnable-track',
108
- '_-webkit-slider-thumb',
109
- '_after',
110
- '_backdrop',
111
- '_before',
112
- '_cue',
113
- '_file-selector-button',
114
- '_first-letter',
115
- '_first-line',
116
- '_grammar-error',
117
- '_highlight(',
118
- '_marker',
119
- '_part(',
120
- '_placeholder',
121
- '_selection',
122
- '_slotted(',
123
- '_spelling-error',
124
- '_target-text',
125
- '_view-transition',
126
- '_view-transition-group',
127
- '_view-transition-image-pair',
128
- '_view-transition-new',
129
- '_view-transition-old',
130
- ];
131
- export const isPseudo = (selector) => pseudos.some(pseudo => selector.startsWith(pseudo));
@@ -1,50 +0,0 @@
1
- export const validateShadow = (shadowProperties, styles, breakpoints) => {
2
- // Collect breakpoints
3
- shadowProperties.forEach(key => {
4
- const value = styles[key];
5
- if (typeof value !== 'object') {
6
- return;
7
- }
8
- if (key === 'shadowOffset' || key === 'textShadowOffset') {
9
- const { width, height } = value;
10
- // If shadowOffset.width has breakpoints
11
- if (typeof width === 'object') {
12
- Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
13
- }
14
- // If shadowOffset.height has breakpoints
15
- if (typeof height === 'object') {
16
- Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
17
- }
18
- return;
19
- }
20
- // Collect regular breakpoints
21
- Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
22
- });
23
- // Validate if all breakpoints are present
24
- shadowProperties.forEach(key => {
25
- const value = styles[key];
26
- if (typeof value !== 'object') {
27
- return;
28
- }
29
- if (key === 'shadowOffset' || key === 'textShadowOffset') {
30
- const { width, height } = value;
31
- if (typeof width === 'object') {
32
- const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
33
- if (missingBreakpoints.length) {
34
- throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
35
- }
36
- }
37
- if (typeof height === 'object') {
38
- const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
39
- if (missingBreakpoints.length) {
40
- throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
41
- }
42
- }
43
- return;
44
- }
45
- const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
46
- if (missingBreakpoints.length) {
47
- throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
48
- }
49
- });
50
- };
@@ -1,137 +0,0 @@
1
- import { keyInObject } from '../utils';
2
- const SKIP_STYLES = [
3
- 'borderCurve',
4
- 'elevation',
5
- 'textAlignVertical',
6
- 'includeFontPadding',
7
- 'overlayColor',
8
- 'tintColor'
9
- ];
10
- const CSS_NUMBER_KEYS = [
11
- 'animationIterationCount',
12
- 'borderImageOutset',
13
- 'borderImageSlice',
14
- 'borderImageWidth',
15
- 'boxFlex',
16
- 'boxFlexGroup',
17
- 'boxOrdinalGroup',
18
- 'columnCount',
19
- 'columns',
20
- 'counterIncrement',
21
- 'counterReset',
22
- 'flex',
23
- 'flexGrow',
24
- 'flexPositive',
25
- 'flexShrink',
26
- 'flexNegative',
27
- 'flexOrder',
28
- 'fontWeight',
29
- 'gridArea',
30
- 'gridColumn',
31
- 'gridColumnEnd',
32
- 'gridColumnSpan',
33
- 'gridColumnStart',
34
- 'gridRow',
35
- 'gridRowEnd',
36
- 'gridRowSpan',
37
- 'gridRowStart',
38
- 'line-clamp',
39
- 'line-height',
40
- 'opacity',
41
- 'order',
42
- 'orphans',
43
- 'tabSize',
44
- 'widows',
45
- 'zIndex',
46
- 'zoom',
47
- 'fillOpacity',
48
- 'floodOpacity',
49
- 'stopOpacity',
50
- 'strokeDasharray',
51
- 'strokeDashoffset',
52
- 'strokeMiterlimit',
53
- 'strokeOpacity',
54
- 'strokeWidth'
55
- ];
56
- const convertMap = {
57
- marginHorizontal: (value) => ({
58
- marginInline: value
59
- }),
60
- marginVertical: (value) => ({
61
- marginBlock: value
62
- }),
63
- paddingHorizontal: (value) => ({
64
- paddingInline: value
65
- }),
66
- paddingVertical: (value) => ({
67
- paddingBlock: value
68
- }),
69
- writingDirection: (value) => ({
70
- direction: value
71
- }),
72
- borderBottomEndRadius: (value) => ({
73
- borderBottomRightRadius: value
74
- }),
75
- borderBottomStartRadius: (value) => ({
76
- borderBottomLeftRadius: value
77
- }),
78
- borderEndColor: (value) => ({
79
- borderInlineEndColor: value
80
- }),
81
- borderStartColor: (value) => ({
82
- borderInlineStartColor: value
83
- }),
84
- borderTopEndRadius: (value) => ({
85
- borderTopRightRadius: value
86
- }),
87
- borderTopStartRadius: (value) => ({
88
- borderTopLeftRadius: value
89
- }),
90
- borderEndWidth: (value) => ({
91
- borderInlineEndWidth: value
92
- }),
93
- borderStartWidth: (value) => ({
94
- borderInlineStartWidth: value
95
- }),
96
- end: (value) => ({
97
- right: value
98
- }),
99
- start: (value) => ({
100
- left: value
101
- }),
102
- marginEnd: (value) => ({
103
- marginRight: value
104
- }),
105
- marginStart: (value) => ({
106
- marginLeft: value
107
- }),
108
- paddingEnd: (value) => ({
109
- paddingRight: value
110
- }),
111
- paddingStart: (value) => ({
112
- paddingLeft: value
113
- }),
114
- transformMatrix: (value) => ({
115
- transform: `matrix(${value.join(', ')})`
116
- }),
117
- resizeMode: (value) => ({
118
- backgroundSize: value
119
- })
120
- };
121
- const convertNumber = (key, value) => {
122
- if (typeof value === 'number') {
123
- return CSS_NUMBER_KEYS.includes(key, value) ? value : `${value}px`;
124
- }
125
- return value;
126
- };
127
- export const getStyle = (key, value) => {
128
- if (SKIP_STYLES.includes(key)) {
129
- return {};
130
- }
131
- if (keyInObject(convertMap, key)) {
132
- return convertMap[key]?.(convertNumber(key, value)) ?? {};
133
- }
134
- return {
135
- [key]: convertNumber(key, value)
136
- };
137
- };
@@ -1,56 +0,0 @@
1
- import { deepMergeObjects, warn } from '../utils';
2
- import { validateShadow } from './shadow';
3
- import { TEXT_SHADOW_STYLES } from './types';
4
- import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
5
- const createTextShadowValue = (style) => {
6
- const { textShadowColor, textShadowOffset, textShadowRadius } = style;
7
- const offsetX = normalizeNumericValue(textShadowOffset.width);
8
- const offsetY = normalizeNumericValue(textShadowOffset.height);
9
- const radius = normalizeNumericValue(textShadowRadius);
10
- const color = normalizeColor(textShadowColor);
11
- return `${offsetX} ${offsetY} ${radius} ${color}`;
12
- };
13
- export const getTextShadowStyle = (styles) => {
14
- const missingStyles = TEXT_SHADOW_STYLES.filter(key => !(key in styles));
15
- if (missingStyles.length) {
16
- warn(`can't apply text shadow as you miss these properties: ${missingStyles.join(', ')}`);
17
- return {};
18
- }
19
- const breakpointsSet = new Set();
20
- try {
21
- validateShadow(TEXT_SHADOW_STYLES, styles, breakpointsSet);
22
- }
23
- catch (error) {
24
- if (typeof error === 'string') {
25
- warn(error);
26
- }
27
- return {};
28
- }
29
- const breakpoints = Array.from(breakpointsSet);
30
- // If no breakpoints were used return styles without media queries
31
- if (breakpoints.length === 0) {
32
- return {
33
- textShadow: createTextShadowValue(styles)
34
- };
35
- }
36
- // Create textShadow for each breakpoint
37
- const breakpointStyles = breakpoints.map(breakpoint => {
38
- const color = extractShadowValue('textShadowColor', breakpoint, styles);
39
- const { width, height } = extractShadowValue('textShadowOffset', breakpoint, styles);
40
- const radius = extractShadowValue('textShadowRadius', breakpoint, styles);
41
- return {
42
- [breakpoint]: {
43
- textShadow: createTextShadowValue({
44
- textShadowColor: color,
45
- textShadowOffset: {
46
- width,
47
- height
48
- },
49
- textShadowRadius: radius
50
- })
51
- }
52
- };
53
- });
54
- // Merge all breakpoints styles into one
55
- return deepMergeObjects(...breakpointStyles);
56
- };
@@ -1,65 +0,0 @@
1
- import { deepMergeObjects, keyInObject } from '../utils';
2
- import { normalizeNumericValue } from './utils';
3
- const normalizeTransform = (key, value) => {
4
- if (key.includes('scale')) {
5
- return value;
6
- }
7
- if (typeof value === 'number') {
8
- return normalizeNumericValue(value);
9
- }
10
- return value;
11
- };
12
- const createTransformValue = (transforms) => transforms
13
- .map(transform => {
14
- const [key] = Object.keys(transform);
15
- if (!key) {
16
- return undefined;
17
- }
18
- const value = transform[key];
19
- switch (key) {
20
- case 'matrix':
21
- case 'matrix3d':
22
- return `${key}(${value.join(',')})`;
23
- default:
24
- return `${key}(${normalizeTransform(key, value)})`;
25
- }
26
- })
27
- .filter(Boolean)
28
- .join(' ');
29
- export const getTransformStyle = (transforms) => {
30
- const breakpoints = new Set();
31
- const normalTransforms = [];
32
- transforms.forEach(transform => {
33
- const [property] = Object.keys(transform);
34
- if (!property) {
35
- return;
36
- }
37
- const value = transform[property];
38
- if (typeof value === 'object' && !Array.isArray(value)) {
39
- Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
40
- return;
41
- }
42
- normalTransforms.push(transform);
43
- });
44
- const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
45
- const transformsPerBreakpoint = transforms.flatMap(transform => {
46
- const [property] = Object.keys(transform);
47
- if (!property) {
48
- return [];
49
- }
50
- const value = transform[property];
51
- if (typeof value === 'object' && !Array.isArray(value)) {
52
- return keyInObject(value, breakpoint) ? [{ [property]: value[breakpoint] }] : [];
53
- }
54
- return [];
55
- });
56
- return [{
57
- [breakpoint]: {
58
- transform: createTransformValue(transformsPerBreakpoint)
59
- }
60
- }];
61
- });
62
- return deepMergeObjects({
63
- transform: createTransformValue(normalTransforms)
64
- }, ...breakpointTransforms);
65
- };
@@ -1,2 +0,0 @@
1
- export const TEXT_SHADOW_STYLES = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
2
- export const BOX_SHADOW_STYLES = ['shadowColor', 'shadowRadius', 'shadowOpacity', 'shadowOffset'];