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,39 +1,24 @@
1
1
  "use strict";
2
2
 
3
- import { deepMergeObjects, warn } from '../utils';
4
- import { validateShadow } from './shadow';
5
- import { BOX_SHADOW_STYLES } from './types';
6
- import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
3
+ import { deepMergeObjects } from '../../utils';
4
+ import { BOX_SHADOW_STYLES } from '../types';
5
+ import { extractShadowValue, normalizeColor, normalizeNumericValue } from '../utils';
6
+ import { getShadowBreakpoints } from './getShadowBreakpoints';
7
7
  const createBoxShadowValue = style => {
8
- // at this point every prop is present
9
8
  const {
10
9
  shadowColor,
11
10
  shadowOffset,
12
11
  shadowOpacity,
13
12
  shadowRadius
14
13
  } = style;
15
- const offsetX = normalizeNumericValue(shadowOffset.width);
16
- const offsetY = normalizeNumericValue(shadowOffset.height);
17
- const radius = normalizeNumericValue(shadowRadius);
18
- const color = normalizeColor(shadowColor, shadowOpacity);
14
+ const offsetX = normalizeNumericValue(shadowOffset?.width ?? 0);
15
+ const offsetY = normalizeNumericValue(shadowOffset?.height ?? 0);
16
+ const radius = normalizeNumericValue(shadowRadius ?? 0);
17
+ const color = normalizeColor(shadowColor ?? '#000000', shadowOpacity ?? 1);
19
18
  return `${offsetX} ${offsetY} ${radius} ${color}`;
20
19
  };
21
20
  export const getBoxShadowStyle = styles => {
22
- const missingStyles = BOX_SHADOW_STYLES.filter(key => !(key in styles));
23
- if (missingStyles.length) {
24
- warn(`can't apply box shadow as you miss these properties: ${missingStyles.join(', ')}`);
25
- return {};
26
- }
27
- const breakpointsSet = new Set();
28
- try {
29
- validateShadow(BOX_SHADOW_STYLES, styles, breakpointsSet);
30
- } catch (error) {
31
- if (typeof error === 'string') {
32
- warn(error);
33
- }
34
- return {};
35
- }
36
- const breakpoints = Array.from(breakpointsSet);
21
+ const breakpoints = getShadowBreakpoints(BOX_SHADOW_STYLES, styles);
37
22
 
38
23
  // If no breakpoints were used return styles without media queries
39
24
  if (breakpoints.length === 0) {
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deepMergeObjects","BOX_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","width","offsetY","height","radius","color","getBoxShadowStyle","styles","breakpoints","length","boxShadow","breakpointStyles","map","breakpoint","opacity"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/boxShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,iBAAiB,QAAwB,UAAU;AAC5D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AACpF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,oBAAoB,GAAIC,KAAgB,IAAK;EAC/C,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGJ,KAAK;EACxE,MAAMK,OAAO,GAAGR,qBAAqB,CAACK,YAAY,EAAEI,KAAK,IAAI,CAAC,CAAC;EAC/D,MAAMC,OAAO,GAAGV,qBAAqB,CAACK,YAAY,EAAEM,MAAM,IAAI,CAAC,CAAC;EAChE,MAAMC,MAAM,GAAGZ,qBAAqB,CAACO,YAAY,IAAI,CAAC,CAAC;EACvD,MAAMM,KAAK,GAAGd,cAAc,CAAEK,WAAW,IAAI,SAAS,EAAcE,aAAa,IAAI,CAAY,CAAC;EAElG,OAAO,GAAGE,OAAO,IAAIE,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAIC,MAA2B,IAAK;EAC9D,MAAMC,WAAW,GAAGf,oBAAoB,CAACJ,iBAAiB,EAAEkB,MAAM,CAAC;;EAEnE;EACA,IAAIC,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;IAC1B,OAAO;MACHC,SAAS,EAAEhB,oBAAoB,CAACa,MAAmB;IACvD,CAAC;EACL;;EAEA;EACA,MAAMI,gBAAgB,GAAGH,WAAW,CAACI,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMR,KAAK,GAAGf,kBAAkB,CAAC,aAAa,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IACnE,MAAM;MAAEN,KAAK;MAAEE;IAAO,CAAC,GAAGb,kBAAkB,CAAC,cAAc,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IAChF,MAAMH,MAAM,GAAGd,kBAAkB,CAAC,cAAc,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IACrE,MAAMO,OAAO,GAAGxB,kBAAkB,CAAC,eAAe,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IAEvE,OAAO;MACH,CAACM,UAAU,GAAG;QACVH,SAAS,EAAEhB,oBAAoB,CAAC;UAC5BE,WAAW,EAAES,KAAK;UAClBR,YAAY,EAAE;YACVI,KAAK;YACLE;UACJ,CAAC;UACDJ,YAAY,EAAEK,MAAM;UACpBN,aAAa,EAAEgB;QACnB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAO1B,gBAAgB,CAAC,GAAGuB,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ export const getShadowBreakpoints = (shadowProperties, styles) => {
4
+ const breakpoints = new Set();
5
+ shadowProperties.forEach(key => {
6
+ const value = styles[key];
7
+ if (typeof value !== 'object') {
8
+ return;
9
+ }
10
+ if (key === 'shadowOffset' || key === 'textShadowOffset') {
11
+ const {
12
+ width,
13
+ height
14
+ } = value;
15
+
16
+ // If shadowOffset.width has breakpoints
17
+ if (typeof width === 'object') {
18
+ Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
19
+ }
20
+
21
+ // If shadowOffset.height has breakpoints
22
+ if (typeof height === 'object') {
23
+ Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
24
+ }
25
+ return;
26
+ }
27
+
28
+ // Collect regular breakpoints
29
+ Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
30
+ });
31
+ return Array.from(breakpoints);
32
+ };
33
+ //# sourceMappingURL=getShadowBreakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getShadowBreakpoints","shadowProperties","styles","breakpoints","Set","forEach","key","value","width","height","Object","keys","breakpoint","add","Array","from"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/getShadowBreakpoints.ts"],"mappings":";;AAEA,OAAO,MAAMA,oBAAoB,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,KAAK;EAC1G,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EAErCH,gBAAgB,CAACI,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGL,MAAM,CAACI,GAAG,CAAC;IAEzB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3B;IACJ;IAEA,IAAID,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB,EAAE;MACtD,MAAM;QAAEE,KAAK;QAAEC;MAAO,CAAC,GAAGF,KAAqB;;MAE/C;MACA,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;QAC3BE,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC,CAACH,OAAO,CAACO,UAAU,IAAIT,WAAW,CAACU,GAAG,CAACD,UAAU,CAAC,CAAC;MACzE;;MAEA;MACA,IAAI,OAAOH,MAAM,KAAK,QAAQ,EAAE;QAC5BC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACJ,OAAO,CAACO,UAAU,IAAIT,WAAW,CAACU,GAAG,CAACD,UAAU,CAAC,CAAC;MAC1E;MAEA;IACJ;;IAEA;IACAF,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACF,OAAO,CAACO,UAAU,IAAIT,WAAW,CAACU,GAAG,CAACD,UAAU,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF,OAAOE,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC;AAClC,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export * from './boxShadow';
4
+ export * from './textShadow';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/index.ts"],"mappings":";;AAAA,cAAc,aAAa;AAC3B,cAAc,cAAc","ignoreList":[]}
@@ -1,37 +1,23 @@
1
1
  "use strict";
2
2
 
3
- import { deepMergeObjects, warn } from '../utils';
4
- import { validateShadow } from './shadow';
5
- import { TEXT_SHADOW_STYLES } from './types';
6
- import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
3
+ import { deepMergeObjects } from '../../utils';
4
+ import { TEXT_SHADOW_STYLES } from '../types';
5
+ import { extractShadowValue, normalizeColor, normalizeNumericValue } from '../utils';
6
+ import { getShadowBreakpoints } from './getShadowBreakpoints';
7
7
  const createTextShadowValue = style => {
8
8
  const {
9
9
  textShadowColor,
10
10
  textShadowOffset,
11
11
  textShadowRadius
12
12
  } = style;
13
- const offsetX = normalizeNumericValue(textShadowOffset.width);
14
- const offsetY = normalizeNumericValue(textShadowOffset.height);
15
- const radius = normalizeNumericValue(textShadowRadius);
16
- const color = normalizeColor(textShadowColor);
13
+ const offsetX = normalizeNumericValue(textShadowOffset?.width ?? 0);
14
+ const offsetY = normalizeNumericValue(textShadowOffset?.height ?? 0);
15
+ const radius = normalizeNumericValue(textShadowRadius ?? 0);
16
+ const color = normalizeColor(textShadowColor ?? '#000000');
17
17
  return `${offsetX} ${offsetY} ${radius} ${color}`;
18
18
  };
19
19
  export const getTextShadowStyle = styles => {
20
- const missingStyles = TEXT_SHADOW_STYLES.filter(key => !(key in styles));
21
- if (missingStyles.length) {
22
- warn(`can't apply text shadow as you miss these properties: ${missingStyles.join(', ')}`);
23
- return {};
24
- }
25
- const breakpointsSet = new Set();
26
- try {
27
- validateShadow(TEXT_SHADOW_STYLES, styles, breakpointsSet);
28
- } catch (error) {
29
- if (typeof error === 'string') {
30
- warn(error);
31
- }
32
- return {};
33
- }
34
- const breakpoints = Array.from(breakpointsSet);
20
+ const breakpoints = getShadowBreakpoints(TEXT_SHADOW_STYLES, styles);
35
21
 
36
22
  // If no breakpoints were used return styles without media queries
37
23
  if (breakpoints.length === 0) {
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deepMergeObjects","TEXT_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","color","getTextShadowStyle","styles","breakpoints","length","textShadow","breakpointStyles","map","breakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/textShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,kBAAkB,QAAyB,UAAU;AAC9D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AACpF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAGP,qBAAqB,CAACK,gBAAgB,EAAEG,KAAK,IAAI,CAAC,CAAC;EACnE,MAAMC,OAAO,GAAGT,qBAAqB,CAACK,gBAAgB,EAAEK,MAAM,IAAI,CAAC,CAAC;EACpE,MAAMC,MAAM,GAAGX,qBAAqB,CAACM,gBAAgB,IAAI,CAAC,CAAC;EAC3D,MAAMM,KAAK,GAAGb,cAAc,CAAEK,eAAe,IAAI,SAAoB,CAAC;EAEtE,OAAO,GAAGG,OAAO,IAAIE,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAIC,MAA2B,IAAK;EAC/D,MAAMC,WAAW,GAAGd,oBAAoB,CAACJ,kBAAkB,EAAEiB,MAAM,CAAC;;EAEpE;EACA,IAAIC,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;IAC1B,OAAO;MACHC,UAAU,EAAEf,qBAAqB,CAACY,MAAoB;IAC1D,CAAC;EACL;;EAEA;EACA,MAAMI,gBAAgB,GAAGH,WAAW,CAACI,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMR,KAAK,GAAGd,kBAAkB,CAAC,iBAAiB,EAAEsB,UAAU,EAAEN,MAAM,CAAC;IACvE,MAAM;MAAEN,KAAK;MAAEE;IAAO,CAAC,GAAGZ,kBAAkB,CAAC,kBAAkB,EAAEsB,UAAU,EAAEN,MAAM,CAAC;IACpF,MAAMH,MAAM,GAAGb,kBAAkB,CAAC,kBAAkB,EAAEsB,UAAU,EAAEN,MAAM,CAAC;IAEzE,OAAO;MACH,CAACM,UAAU,GAAG;QACVH,UAAU,EAAEf,qBAAqB,CAAC;UAC9BE,eAAe,EAAEQ,KAAK;UACtBP,gBAAgB,EAAE;YACdG,KAAK;YACLE;UACJ,CAAC;UACDJ,gBAAgB,EAAEK;QACtB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAOf,gBAAgB,CAAC,GAAGsB,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
@@ -6,8 +6,10 @@ import normalizeColors from '@react-native/normalize-colors';
6
6
  import { BOX_SHADOW_STYLES, TEXT_SHADOW_STYLES } from './types';
7
7
  export const isTransform = (key, value) => key === 'transform' && Array.isArray(value);
8
8
  export const isTextShadow = key => TEXT_SHADOW_STYLES.includes(key);
9
- export const isBoxShadow = key => BOX_SHADOW_STYLES.includes(key);
10
- export const normalizeNumericValue = value => value ? `${value}px` : value;
9
+ export const isShadow = key => BOX_SHADOW_STYLES.includes(key);
10
+ export const isFilter = (key, value) => key === 'filter' && Array.isArray(value);
11
+ export const isBoxShadow = (key, value) => key === 'boxShadow' && Array.isArray(value);
12
+ export const normalizeNumericValue = value => value && typeof value === 'number' ? `${value}px` : value;
11
13
  export const normalizeColor = (color, opacity = 1) => {
12
14
  // If the opacity is 1 there's no need to normalize the color
13
15
  if (opacity === 1) {
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeColors","BOX_SHADOW_STYLES","TEXT_SHADOW_STYLES","isTransform","key","value","Array","isArray","isTextShadow","includes","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAC5D,SAASC,iBAAiB,EAAEC,kBAAkB,QAA4C,SAAS;AAEnG,OAAO,MAAMC,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAA0CD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAExI,OAAO,MAAMG,YAAY,GAAIJ,GAAW,IAAKF,kBAAkB,CAACO,QAAQ,CAACL,GAAwC,CAAC;AAElH,OAAO,MAAMM,WAAW,GAAIN,GAAW,IAAKH,iBAAiB,CAACQ,QAAQ,CAACL,GAAuC,CAAC;AAE/G,OAAO,MAAMO,qBAAqB,GAAIN,KAAa,IAAKA,KAAK,GAAG,GAAGA,KAAK,IAAI,GAAGA,KAAK;AAEpF,OAAO,MAAMO,cAAc,GAAGA,CAACC,KAAa,EAAEC,OAAe,GAAG,CAAC,KAAK;EAClE;EACA,IAAIA,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EAEA,MAAME,OAAO,G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C2B,UAAU,CAAC,GAAG3B,KAAK;AAChE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["normalizeColors","BOX_SHADOW_STYLES","TEXT_SHADOW_STYLES","isTransform","key","value","Array","isArray","isTextShadow","includes","isShadow","isFilter","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAC5D,SAASC,iBAAiB,EAAEC,kBAAkB,QAA0D,SAAS;AAIjH,OAAO,MAAMC,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAsCD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAEpI,OAAO,MAAMG,YAAY,GAAIJ,GAAW,IAAKF,kBAAkB,CAACO,QAAQ,CAACL,GAAwC,CAAC;AAElH,OAAO,MAAMM,QAAQ,GAAIN,GAAW,IAAKH,iBAAiB,CAACQ,QAAQ,CAACL,GAAuC,CAAC;AAE5G,OAAO,MAAMO,QAAQ,GAAGA,CAACP,GAAW,EAAEC,KAAU,KAA8BD,GAAG,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAEtH,OAAO,MAAMO,WAAW,GAAGA,CAACR,GAAW,EAAEC,KAAU,KAAqCD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAEnI,OAAO,MAAMQ,qBAAqB,GAAIR,KAAsB,IAAKA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAAG,GAAGA,KAAK,IAAI,GAAGA,KAAK;AAE1H,OAAO,MAAMS,cAAc,GAAGA,CAACC,KAAa,EAAEC,OAAO,GAAG,CAAC,KAAK;EAC1D;EACA,IAAIA,OAAO,KAAK,CAAC,EAAE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,OAAOhC,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAAC6B,UAAU,CAAC,GAAG7B,KAAK;AAChE,CAAC","ignoreList":[]}
@@ -7,7 +7,11 @@ class UnistylesListenerBuilder {
7
7
  listeners = Array.from({
8
8
  length: Object.keys(UnistyleDependency).length / 2
9
9
  }, () => new Set());
10
+ stylesheetListeners = Array.from({
11
+ length: Object.keys(UnistyleDependency).length / 2
12
+ }, () => new Set());
10
13
  emitChange = dependency => {
14
+ this.stylesheetListeners[dependency]?.forEach(listener => listener());
11
15
  this.listeners[dependency]?.forEach(listener => listener());
12
16
  };
13
17
  initListeners = () => {
@@ -26,6 +30,12 @@ class UnistylesListenerBuilder {
26
30
  dependencies.forEach(dependency => this.listeners[dependency]?.delete(listener));
27
31
  };
28
32
  };
33
+ addStylesheetListeners = (dependencies, listener) => {
34
+ dependencies.forEach(dependency => this.stylesheetListeners[dependency]?.add(listener));
35
+ return () => {
36
+ dependencies.forEach(dependency => this.stylesheetListeners[dependency]?.delete(listener));
37
+ };
38
+ };
29
39
  }
30
40
  export const UnistylesListener = new UnistylesListenerBuilder();
31
41
  //# sourceMappingURL=listener.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","UnistylesListener"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,MAAMC,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAA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nistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,MAAMC,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;EAC7GC,mBAAmB,GAAGN,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;EAE/HE,UAAU,GAAIC,UAA8B,IAAK;IAC7C,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;IACrE,IAAI,CAACX,SAAS,CAACS,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;EAC/D,CAAC;EAEDC,aAAa,GAAGA,CAAA,KAAM;IAClB,IAAI,IAAI,CAACb,aAAa,EAAE;MACpB;IACJ;IAEA,IAAI,CAACA,aAAa,GAAG,IAAI;IACzBF,gBAAgB,CAACgB,SAAS,EAAEC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACZ,kBAAkB,CAACmB,WAAW,CAAC,CAAC;IAC7GlB,gBAAgB,CAACmB,UAAU,EAAEF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACZ,kBAAkB,CAACmB,WAAW,CAAC,CAAC;IAC9GE,MAAM,CAACH,gBAAgB,CAAC,mBAAmB,EAAE,MAAM,IAAI,CAACN,UAAU,CAACZ,kBAAkB,CAACsB,WAAW,CAAC,CAAC;IACnGD,MAAM,CAACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACZ,kBAAkB,CAACuB,UAAU,CAAC,CAAC;EAC3F,CAAC;EAEDC,YAAY,GAAGA,CAACC,YAAuC,EAAEV,QAAsB,KAAK;IAChFU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACT,SAAS,CAACS,UAAU,CAAC,EAAEa,GAAG,CAACX,QAAQ,CAAC,CAAC;IAE7E,OAAO,MAAM;MACTU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACT,SAAS,CAACS,UAAU,CAAC,EAAEc,MAAM,CAACZ,QAAQ,CAAC,CAAC;IACpF,CAAC;EACL,CAAC;EAEDa,sBAAsB,GAAGA,CAACH,YAAuC,EAAEV,QAAsB,KAAK;IAC1FU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEa,GAAG,CAACX,QAAQ,CAAC,CAAC;IAEvF,OAAO,MAAM;MACTU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEc,MAAM,CAACZ,QAAQ,CAAC,CAAC;IAC9F,CAAC;EACL,CAAC;AACL;AAEA,OAAO,MAAMc,iBAAiB,GAAG,IAAI3B,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { UnistylesRuntime } from './runtime';
4
- import { extractMediaQueryValue, keyInObject, getMediaQuery, generateHash, extractUnistyleDependencies, deepMergeObjects } from './utils';
4
+ import { extractMediaQueryValue, keyInObject, getMediaQuery, generateHash, extractUnistyleDependencies } from './utils';
5
5
  import { UnistylesListener } from './listener';
6
6
  import { convertUnistyles } from './convert';
7
- import { getVariants } from './variants';
8
7
  class UnistylesRegistryBuilder {
9
8
  stylesheets = new Map();
10
9
  stylesCounter = new Map();
@@ -40,46 +39,31 @@ class UnistylesRegistryBuilder {
40
39
  this.disposeListenersMap.get(stylesheet)?.();
41
40
  const dependenciesMap = this.dependenciesMap.get(stylesheet) ?? new Set(dependencies);
42
41
  dependencies.forEach(dependency => dependenciesMap.add(dependency));
43
- const dispose = UnistylesListener.addListeners(Array.from(dependenciesMap), () => {
42
+ const dispose = UnistylesListener.addStylesheetListeners(Array.from(dependenciesMap), () => {
44
43
  const newComputedStylesheet = stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime);
45
44
  this.stylesheets.set(stylesheet, newComputedStylesheet);
46
45
  });
47
46
  this.dependenciesMap.set(stylesheet, dependenciesMap);
48
47
  this.disposeListenersMap.set(stylesheet, dispose);
49
48
  };
50
- add = ({
51
- key,
52
- value,
53
- stylesheet,
54
- args,
55
- variants
56
- }) => {
49
+ add = value => {
57
50
  const hash = generateHash(value);
58
51
  const existingCounter = this.stylesCounter.get(hash);
59
52
  if (!existingCounter || existingCounter.size === 0) {
60
53
  const counter = new Set();
61
- const dependencies = extractUnistyleDependencies(value);
62
54
  counter.add(value);
63
55
  this.stylesCounter.set(hash, counter);
64
56
  this.applyStyles(hash, convertUnistyles(value));
65
- UnistylesListener.addListeners(dependencies, async () => {
66
- // Move this callback to the end of the event loop
67
- await Promise.resolve();
68
- const newComputedStyleSheet = this.getComputedStylesheet(stylesheet);
69
- const newValue = newComputedStyleSheet[key];
70
- const result = typeof newValue === 'function' ? newValue(...args) : newValue;
71
- const {
72
- variantsResult
73
- } = Object.fromEntries(getVariants({
74
- variantsResult: result
75
- }, variants));
76
- const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
77
- this.applyStyles(hash, convertUnistyles(resultWithVariants));
78
- });
79
- return hash;
57
+ return {
58
+ hash,
59
+ existingHash: false
60
+ };
80
61
  }
81
62
  existingCounter.add(value);
82
- return hash;
63
+ return {
64
+ hash,
65
+ existingHash: true
66
+ };
83
67
  };
84
68
  applyStyles = (hash, styles) => {
85
69
  Object.entries(styles).forEach(([key, value]) => {
@@ -173,6 +157,9 @@ class UnistylesRegistryBuilder {
173
157
  existingStyles.delete(value);
174
158
  if (existingStyles.size === 0) {
175
159
  const ruleIndex = Array.from(this.styleTag.sheet?.cssRules ?? []).findIndex(rule => rule.cssText.includes(`.${hash}`));
160
+ if (ruleIndex === -1) {
161
+ return;
162
+ }
176
163
  this.styleTag.sheet?.deleteRule(ruleIndex);
177
164
  }
178
165
  };
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesRuntime","extractMediaQueryValue","keyInObject","getMediaQuery","generateHash","extractUnistyleDependencies","deepMergeObjects","UnistylesListener","convertUnistyles","getVariants","UnistylesRegistryBuilder","stylesheets","Map","stylesCounter","styleTag","disposeListenersMap","dependenciesMap","tag","newTag","document","createElement","id","head","appendChild","getComputedStylesheet","stylesheet","computedStylesheet","get","createdStylesheet","theme","miniRuntime","dependencies","Object","values","flatMap","value","addDependenciesToStylesheet","set","Set","forEach","dependency","add","dispose","addListeners","Array","from","newComputedStylesheet","key","args","variants","hash","existingCounter","size","counter","applyStyles","Promise","resolve","newComputedStyleSheet","newValue","result","variantsResult","fromEntries","resultWithVariants","styles","entries","sheet","startsWith","mediaQuery","cssRules","queryRule","find","rule","CSSMediaRule","media","item","includes","mediaQueryValue","ruleIndex","reduce","acc","ruleMediaQueryValue","conditionText","undefined","length","insertRule","mqKey","mqValue","applyRule","pseudoKey","pseudoValue","replace","CSSStyleRule","selectorText","style","remove","existingStyles","delete","findIndex","cssText","deleteRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAEA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SA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AACmD,KAAK,EAAEkC,UAAU,CAACtB,SAAS,CAAC;IAC9C;EACJ,CAAC;AACL;AAEA,OAAO,MAAMuB,iBAAiB,GAAG,IAAI1F,wBAAwB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesRuntime","extractMediaQueryValue","keyInObject","getMediaQuery","generateHash","extractUnistyleDependencies","UnistylesListener","convertUnistyles","UnistylesRegistryBuilder","stylesheets","Map","stylesCounter","styleTag","disposeListenersMap","dependenciesMap","tag","newTag","document","createElement","id","head","appendChild","getComputedStylesheet","stylesheet","computedStylesheet","get","createdStylesheet","theme","miniRuntime","dependencies","Object","values","flatMap","value","addDependenciesToStylesheet","set","Set","forEach","dependency","add","dispose","addStylesheetListeners","Array","from","newComputedStylesheet","hash","existingCounter","size","counter","applyStyles","existingHash","styles","entries","key","sheet","startsWith","mediaQuery","cssRules","queryRule","find","rule","CSSMediaRule","media","item","includes","mediaQueryValue","ruleIndex","reduce","acc","ruleMediaQueryValue","conditionText","undefined","length","insertRule","mqKey","mqValue","applyRule","pseudoKey","pseudoValue","replace","CSSStyleRule","selectorText","style","remove","existingStyles","delete","findIndex","cssText","deleteRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAEA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,sBAAsB,EAAEC,WAAW,EAAEC,aAAa,EAAEC,YAAY,EAAEC,2BAA2B,QAAQ,SAAS;AACvH,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,WAAW;AAa5C,MAAMC,wBAAwB,CAAC;EACVC,WAAW,GAAG,IAAIC,GAAG,CAAoD,CAAC;EAC1EC,aAAa,GAAG,IAAID,GAAG,CAA+B,CAAC;EACxE,CAACE,QAAQ,GAA4B,IAAI;EACxBC,mBAAmB,GAAG,IAAIH,GAAG,CAAuB,CAAC;EACrDI,eAAe,GAAG,IAAIJ,GAAG,CAAiE,CAAC;EAE5G,IAAYE,Q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IAAI,EAAE,CAAC,CAAC;MAEtH,IAAIqB,SAAS,KAAK,CAAC,CAAC,EAAE;QAClB;MACJ;MAEA,IAAI,CAACtD,QAAQ,CAAC0C,KAAK,EAAEkC,UAAU,CAACtB,SAAS,CAAC;IAC9C;EACJ,CAAC;AACL;AAEA,OAAO,MAAMuB,iBAAiB,GAAG,IAAIjF,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -44,6 +44,9 @@ class UnistylesRuntimeBuilder {
44
44
  get contentSizeCategory() {
45
45
  return WebContentSizeCategory.Unspecified;
46
46
  }
47
+ get breakpoints() {
48
+ return UnistylesState.breakpoints ?? {};
49
+ }
47
50
  get breakpoint() {
48
51
  return UnistylesState.breakpoint;
49
52
  }
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleDependency","ColorScheme","Orientation","WebContentSizeCategory","UnistylesListener","NavigationBar","StatusBar","UnistylesState","hexToRGBA","isServer","schemeToTheme","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","window","matchMedia","colorScheme","matches","Light","Dark","Unspecified","themeName","contentSizeCategory","breakpoint","orientation","Portrait","screen","type","includes","Landscape","theme","getTheme","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","rtl","document","documentElement","dir","hasAdaptiveThemes","navigationBar","miniRuntime","isLandscape","isPortrait","setTheme","UnistylesRuntime","emitChange","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","hex","alpha","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","themes","get","Error","set"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,WAAW,EAAEC,WAAW,QAA0C,gBAAgB;AAE3F,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,aAAa,EAAEC,SAAS,QAAQ,QAAQ;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istyleDependency","ColorScheme","Orientation","WebContentSizeCategory","UnistylesListener","NavigationBar","StatusBar","UnistylesState","hexToRGBA","isServer","schemeToTheme","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","window","matchMedia","colorScheme","matches","Light","Dark","Unspecified","themeName","contentSizeCategory","breakpoints","breakpoint","orientation","Portrait","screen","type","includes","Landscape","theme","getTheme","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","rtl","document","documentElement","dir","hasAdaptiveThemes","navigationBar","miniRuntime","isLandscape","isPortrait","setTheme","UnistylesRuntime","emitChange","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","hex","alpha","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","themes","get","Error","set"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,WAAW,EAAEC,WAAW,QAA0C,gBAAgB;AAE3F,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,aAAa,EAAEC,SAAS,QAAQ,QAAQ;AACjD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AAE5D,MAAMC,uBAAuB,CAAC;EAC1BC,UAAU,GAAG,IAAI,CAACC,aAAa,CAAC,CAAC;EACjCC,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;EAEvBF,aAAaA,CAAA,EAA0B;IAC3C,IAAIJ,QAAQ,CAAC,CAAC,EAAE;MACZ,OAAO,IAAI;IACf;IAEA,IAAI,CAAC,IAAI,CAACG,UAAU,EAAE;MAClB,IAAI,CAACA,UAAU,GAAGI,MAAM,CAACC,UAAU,CAAC,+BAA+B,CAAC;IACxE;IAEA,OAAO,IAAI,CAACL,UAAU;EAC1B;EAEQG,YAAY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gBAAgB,GAAGA,CAAA,KAAM,CAAC,CAAC;EAE3BC,WAAW,GAAGA,CAAChD,SAAuB,EAAEiD,OAA6C,KAAK;IACtF,MAAMC,QAAQ,GAAGlE,cAAc,CAACmE,MAAM,CAACC,GAAG,CAACpD,SAAS,CAAC;IAErD,IAAI,CAACkD,QAAQ,EAAE;MACX,MAAM,IAAIG,KAAK,CAAC,aAAarD,SAAS,sBAAsB,CAAC;IACjE;IAEAhB,cAAc,CAACmE,MAAM,CAACG,GAAG,CAACtD,SAAS,EAAEiD,OAAO,CAACC,QAAQ,CAAC,CAAC;EAC3D,CAAC;EAEDvC,QAAQ,GAAGA,CAACX,SAAS,GAAG,IAAI,CAACA,SAAS,KAAK;IACvC,IAAI,CAACA,SAAS,EAAE;MACZ,MAAM,IAAIqD,KAAK,CAAC,uBAAuB,CAAC;IAC5C;IAEA,MAAM3C,KAAK,GAAG1B,cAAc,CAACmE,MAAM,CAACC,GAAG,CAACpD,SAAS,CAAC;IAElD,IAAI,CAACU,KAAK,EAAE;MACR,MAAM,IAAI2C,KAAK,CAAC,aAAa,IAAI,CAACrD,SAAS,sBAAsB,CAAC;IACtE;IAEA,OAAOU,KAAK;EAChB,CAAC;AACL;AAEA,OAAO,MAAM0B,gBAAgB,GAAG,IAAIhD,uBAAuB,CAAC,CAAC","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ import { convertUnistyles } from './convert';
4
+ import { UnistylesListener } from './listener';
3
5
  import { UnistylesRegistry } from './registry';
4
- import { createDoubleMap, deepMergeObjects, equal, extractSecrets, extractUnistyleDependencies, isInDocument } from './utils';
6
+ import { deepMergeObjects, equal, extractSecrets, extractUnistyleDependencies, isInDocument } from './utils';
5
7
  import { getVariants } from './variants';
6
8
  class UnistylesShadowRegistryBuilder {
7
9
  // MOCKS
@@ -12,9 +14,12 @@ class UnistylesShadowRegistryBuilder {
12
14
  dispose = () => {};
13
15
  // END MOCKS
14
16
 
15
- resultsMap = createDoubleMap();
16
- classNamesMap = createDoubleMap();
17
- add = (ref, _style, _variants, _args) => {
17
+ resultsMap = new Map();
18
+ hashMap = new Map();
19
+ classNamesMap = new Map();
20
+ timeoutMap = new Map();
21
+ queuedResultMap = new Map();
22
+ add = (ref, _style, _variants, _args) => new Promise(resolve => {
18
23
  // Style is not provided
19
24
  if (!_style) {
20
25
  return;
@@ -35,16 +40,15 @@ class UnistylesShadowRegistryBuilder {
35
40
  if (ref === null) {
36
41
  const secrets = extractSecrets(_style);
37
42
  secrets.forEach(({
38
- __uni__refs,
39
- __uni__key
43
+ __uni__refs
40
44
  }) => {
41
45
  __uni__refs.forEach(ref => {
42
46
  if (isInDocument(ref)) {
43
47
  return;
44
48
  }
45
- const oldResult = this.resultsMap.get(ref, __uni__key);
46
- this.resultsMap.delete(ref, __uni__key);
47
- this.classNamesMap.delete(ref, __uni__key);
49
+ const oldResult = this.resultsMap.get(ref);
50
+ this.resultsMap.delete(ref);
51
+ this.classNamesMap.delete(ref);
48
52
  if (oldResult) {
49
53
  UnistylesRegistry.remove(oldResult);
50
54
  }
@@ -76,42 +80,78 @@ class UnistylesShadowRegistryBuilder {
76
80
  variantsResult: result
77
81
  }, variants));
78
82
  const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
79
- const oldResult = this.resultsMap.get(ref, __uni__key);
80
83
 
81
- // If results are the same do nothing
82
- if (equal(oldResult, resultWithVariants)) {
83
- return;
84
- }
85
- const oldClassNames = this.classNamesMap.get(ref, __uni__key);
84
+ // Get stored result from queue
85
+ const storedResult = this.queuedResultMap.get(ref) ?? {};
86
+ // Merge stored result with new result
87
+ const newResult = deepMergeObjects(storedResult, resultWithVariants);
88
+ const timeout = this.timeoutMap.get(ref);
89
+
90
+ // Add callback to the queue and remove old one
91
+ this.queuedResultMap.set(ref, newResult);
92
+ clearTimeout(timeout);
93
+ this.timeoutMap.set(ref, setTimeout(() => {
94
+ const oldResult = this.resultsMap.get(ref);
95
+
96
+ // If results are the same do nothing
97
+ if (equal(oldResult, newResult)) {
98
+ return;
99
+ }
100
+ const oldClassNames = this.classNamesMap.get(ref);
101
+
102
+ // Remove old styles
103
+ if (oldResult) {
104
+ UnistylesRegistry.remove(oldResult);
105
+ }
106
+
107
+ // Remove old classnames from the ref
108
+ oldClassNames?.forEach(className => ref.classList.remove(className));
109
+ this.resultsMap.set(ref, newResult);
110
+ const {
111
+ hash,
112
+ existingHash
113
+ } = UnistylesRegistry.add(newResult);
114
+ const injectedClassNames = newResult?._web?._classNames ?? [];
115
+ const newClassNames = injectedClassNames.concat(hash);
116
+ const dependencies = extractUnistyleDependencies(newResult);
117
+ if (typeof __uni__stylesheet === 'function') {
118
+ // Add dependencies from dynamic styles to stylesheet
119
+ UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
120
+ }
121
+ __uni__refs.add(ref);
122
+ this.classNamesMap.set(ref, newClassNames);
123
+ // Add new classnames to the ref
124
+ ref.classList.add(...newClassNames);
125
+ resolve(newClassNames);
126
+
127
+ // If it is new hash add it to the map to use for the listener
128
+ if (!existingHash) {
129
+ this.hashMap.set(ref, hash);
130
+ }
131
+ }, 0));
86
132
 
87
- // Remove old styles
88
- if (oldResult) {
89
- UnistylesRegistry.remove(oldResult);
90
- }
133
+ // Listen for theme / runtime changes
134
+ const dispose = UnistylesListener.addListeners(extractUnistyleDependencies(newResult), () => {
135
+ const hash = this.hashMap.get(ref);
91
136
 
92
- // Remove old classnames from the ref
93
- oldClassNames?.forEach(className => ref.classList.remove(className));
94
- this.resultsMap.set(ref, __uni__key, resultWithVariants);
95
- const className = UnistylesRegistry.add({
96
- key: __uni__key,
97
- args,
98
- stylesheet: __uni__stylesheet,
99
- value: resultWithVariants,
100
- variants
137
+ // Dispose listener if there is no hash
138
+ if (!hash) {
139
+ dispose();
140
+ return;
141
+ }
142
+ const newComputedStyleSheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
143
+ const newValue = newComputedStyleSheet[__uni__key];
144
+ const result = typeof newValue === 'function' ? newValue(...args) : newValue;
145
+ const {
146
+ variantsResult
147
+ } = Object.fromEntries(getVariants({
148
+ variantsResult: result
149
+ }, variants));
150
+ const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
151
+ UnistylesRegistry.applyStyles(hash, convertUnistyles(resultWithVariants));
101
152
  });
102
- const injectedClassNames = resultWithVariants?._web?._classNames ?? [];
103
- const newClassNames = injectedClassNames.concat(className);
104
- const dependencies = extractUnistyleDependencies(resultWithVariants);
105
- if (typeof __uni__stylesheet === 'function') {
106
- // Add dependencies from dynamic styles to stylesheet
107
- UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
108
- }
109
- __uni__refs.add(ref);
110
- this.classNamesMap.set(ref, __uni__key, newClassNames);
111
- // Add new classnames to the ref
112
- ref.classList.add(...newClassNames);
113
153
  });
114
- };
154
+ });
115
155
  remove = () => {};
116
156
  }
117
157
  export const UnistylesShadowRegistry = new UnistylesShadowRegistryBuilder();
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesRegistry","createDoubleMap","deepMergeObjects","equal","extractSecrets","extractUnistyleDependencies","isInDocument","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","classNamesMap","add","ref","_style","_variants","_args","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","__uni__refs","__uni__key","oldResult","get","delete","remove","HTMLElement","secret","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","variants","length","result","variantsResult","fromEntries","resultWithVariants","oldClassNames","className","classList","set","stylesheet","value","injectedClassNames","_web","_classNames","newClassNames","concat","dependencies","addDependenciesToStylesheet","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,cAAc,EAAEC,2BAA2B,EAAEC,YAAY,QAAQ,SAAS;AAC7H,SAASC,W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GAAG,IAAIxD,8BAA8B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["convertUnistyles","UnistylesListener","UnistylesRegistry","deepMergeObjects","equal","extractSecrets","extractUnistyleDependencies","isInDocument","getVariants","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","__uni__refs","oldResult","get","delete","remove","HTMLElement","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","variants","length","result","variantsResult","fromEntries","resultWithVariants","storedResult","newResult","timeout","set","clearTimeout","setTimeout","oldClassNames","className","classList","hash","existingHash","injectedClassNames","_web","_classNames","newClassNames","concat","dependencies","addDependenciesToStylesheet","addListeners","newComputedStyleSheet","newValue","applyStyles","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,EAAEC,KAAK,EAAEC,cAAc,EAAEC,2BAA2B,EAAEC,YAAY,QAAQ,SAAS;AAC5G,SAASC,WAAW,QAAQ,YAAY;AAIxC,MAAMC,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,IAAI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