react-native-unistyles 3.0.0-alpha.21 → 3.0.0-alpha.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. package/cxx/core/UnistylesRegistry.cpp +26 -0
  2. package/cxx/core/UnistylesRegistry.h +1 -0
  3. package/cxx/hybridObjects/HybridStyleSheet.cpp +11 -5
  4. package/cxx/hybridObjects/HybridStyleSheet.h +1 -1
  5. package/cxx/parser/Parser.cpp +27 -1
  6. package/cxx/parser/Parser.h +1 -1
  7. package/lib/commonjs/web/convert/boxShadow.js +13 -13
  8. package/lib/commonjs/web/convert/boxShadow.js.map +1 -1
  9. package/lib/commonjs/web/convert/index.js +9 -11
  10. package/lib/commonjs/web/convert/index.js.map +1 -1
  11. package/lib/commonjs/web/convert/pseudo.js.map +1 -0
  12. package/lib/commonjs/web/convert/style.js +11 -7
  13. package/lib/commonjs/web/convert/style.js.map +1 -1
  14. package/lib/commonjs/web/convert/textShadow.js +12 -12
  15. package/lib/commonjs/web/convert/textShadow.js.map +1 -1
  16. package/lib/commonjs/web/convert/transform.js +5 -5
  17. package/lib/commonjs/web/convert/transform.js.map +1 -1
  18. package/lib/commonjs/web/{listener/listener.js → listener.js} +2 -2
  19. package/lib/commonjs/web/listener.js.map +1 -0
  20. package/lib/commonjs/web/mq.js.map +1 -1
  21. package/lib/commonjs/web/registry.js +159 -21
  22. package/lib/commonjs/web/registry.js.map +1 -1
  23. package/lib/commonjs/web/shadowRegistry.js +50 -48
  24. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  25. package/lib/commonjs/web/state.js +8 -16
  26. package/lib/commonjs/web/state.js.map +1 -1
  27. package/lib/commonjs/web/{utils.js → utils/common.js} +9 -47
  28. package/lib/commonjs/web/utils/common.js.map +1 -0
  29. package/lib/commonjs/web/utils/index.js +28 -0
  30. package/lib/commonjs/web/utils/index.js.map +1 -0
  31. package/lib/commonjs/web/utils/unistyle.js +82 -0
  32. package/lib/commonjs/web/utils/unistyle.js.map +1 -0
  33. package/lib/module/web/convert/boxShadow.js +13 -13
  34. package/lib/module/web/convert/boxShadow.js.map +1 -1
  35. package/lib/module/web/convert/index.js +7 -9
  36. package/lib/module/web/convert/index.js.map +1 -1
  37. package/lib/module/web/convert/pseudo.js.map +1 -0
  38. package/lib/module/web/convert/style.js +11 -7
  39. package/lib/module/web/convert/style.js.map +1 -1
  40. package/lib/module/web/convert/textShadow.js +12 -12
  41. package/lib/module/web/convert/textShadow.js.map +1 -1
  42. package/lib/module/web/convert/transform.js +5 -5
  43. package/lib/module/web/convert/transform.js.map +1 -1
  44. package/lib/module/web/{listener/listener.js → listener.js} +2 -2
  45. package/lib/module/web/listener.js.map +1 -0
  46. package/lib/module/web/mq.js.map +1 -1
  47. package/lib/module/web/registry.js +160 -22
  48. package/lib/module/web/registry.js.map +1 -1
  49. package/lib/module/web/shadowRegistry.js +51 -49
  50. package/lib/module/web/shadowRegistry.js.map +1 -1
  51. package/lib/module/web/state.js +8 -16
  52. package/lib/module/web/state.js.map +1 -1
  53. package/lib/module/web/{utils.js → utils/common.js} +7 -39
  54. package/lib/module/web/utils/common.js.map +1 -0
  55. package/lib/module/web/utils/index.js +5 -0
  56. package/lib/module/web/utils/index.js.map +1 -0
  57. package/lib/module/web/utils/unistyle.js +69 -0
  58. package/lib/module/web/utils/unistyle.js.map +1 -0
  59. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
  60. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  61. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  62. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  63. package/lib/typescript/src/web/convert/boxShadow.d.ts +7 -2
  64. package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -1
  65. package/lib/typescript/src/web/convert/index.d.ts +1 -2
  66. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  67. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
  68. package/lib/typescript/src/web/convert/style.d.ts +1 -2
  69. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  70. package/lib/typescript/src/web/convert/textShadow.d.ts +7 -2
  71. package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -1
  72. package/lib/typescript/src/web/convert/transform.d.ts +1 -2
  73. package/lib/typescript/src/web/convert/transform.d.ts.map +1 -1
  74. package/lib/typescript/src/web/{listener/listener.d.ts → listener.d.ts} +1 -1
  75. package/lib/typescript/src/web/listener.d.ts.map +1 -0
  76. package/lib/typescript/src/web/mq.d.ts +6 -2
  77. package/lib/typescript/src/web/mq.d.ts.map +1 -1
  78. package/lib/typescript/src/web/registry.d.ts +21 -8
  79. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  80. package/lib/typescript/src/web/shadowRegistry.d.ts +3 -4
  81. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  82. package/lib/typescript/src/web/state.d.ts +2 -2
  83. package/lib/typescript/src/web/state.d.ts.map +1 -1
  84. package/lib/typescript/src/web/{utils.d.ts → utils/common.d.ts} +2 -20
  85. package/lib/typescript/src/web/utils/common.d.ts.map +1 -0
  86. package/lib/typescript/src/web/utils/index.d.ts +3 -0
  87. package/lib/typescript/src/web/utils/index.d.ts.map +1 -0
  88. package/lib/typescript/src/web/utils/unistyle.d.ts +20 -0
  89. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
  90. package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
  91. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +8 -8
  92. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +22 -22
  93. package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
  94. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +2 -2
  96. package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +2 -2
  97. package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
  98. package/nitrogen/generated/ios/Unistyles+autolinking.rb +5 -3
  99. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
  100. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +32 -32
  101. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -29
  102. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +0 -12
  103. package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +134 -110
  104. package/nitrogen/generated/shared/c++/ColorScheme.hpp +2 -2
  105. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
  106. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
  107. package/nitrogen/generated/shared/c++/Orientation.hpp +2 -2
  108. package/package.json +4 -15
  109. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
  110. package/src/types/stylesheet.ts +1 -1
  111. package/src/web/convert/boxShadow.ts +14 -15
  112. package/src/web/convert/index.ts +6 -13
  113. package/src/web/convert/style.ts +61 -10
  114. package/src/web/convert/textShadow.ts +13 -14
  115. package/src/web/convert/transform.ts +7 -8
  116. package/src/web/{listener/listener.ts → listener.ts} +2 -2
  117. package/src/web/mq.ts +1 -3
  118. package/src/web/registry.ts +202 -23
  119. package/src/web/shadowRegistry.ts +49 -49
  120. package/src/web/state.ts +13 -23
  121. package/src/web/{utils.ts → utils/common.ts} +6 -68
  122. package/src/web/utils/index.ts +2 -0
  123. package/src/web/utils/unistyle.ts +104 -0
  124. package/lib/commonjs/web/convert/breakpoint.js +0 -25
  125. package/lib/commonjs/web/convert/breakpoint.js.map +0 -1
  126. package/lib/commonjs/web/createUnistylesComponent.js +0 -61
  127. package/lib/commonjs/web/createUnistylesComponent.js.map +0 -1
  128. package/lib/commonjs/web/listener/index.js +0 -20
  129. package/lib/commonjs/web/listener/index.js.map +0 -1
  130. package/lib/commonjs/web/listener/listenToDependencies.js +0 -38
  131. package/lib/commonjs/web/listener/listenToDependencies.js.map +0 -1
  132. package/lib/commonjs/web/listener/listener.js.map +0 -1
  133. package/lib/commonjs/web/pseudo.js.map +0 -1
  134. package/lib/commonjs/web/utils.js.map +0 -1
  135. package/lib/module/web/convert/breakpoint.js +0 -20
  136. package/lib/module/web/convert/breakpoint.js.map +0 -1
  137. package/lib/module/web/createUnistylesComponent.js +0 -54
  138. package/lib/module/web/createUnistylesComponent.js.map +0 -1
  139. package/lib/module/web/listener/index.js +0 -5
  140. package/lib/module/web/listener/index.js.map +0 -1
  141. package/lib/module/web/listener/listenToDependencies.js +0 -33
  142. package/lib/module/web/listener/listenToDependencies.js.map +0 -1
  143. package/lib/module/web/listener/listener.js.map +0 -1
  144. package/lib/module/web/pseudo.js.map +0 -1
  145. package/lib/module/web/utils.js.map +0 -1
  146. package/lib/typescript/src/web/convert/breakpoint.d.ts +0 -3
  147. package/lib/typescript/src/web/convert/breakpoint.d.ts.map +0 -1
  148. package/lib/typescript/src/web/createUnistylesComponent.d.ts +0 -3
  149. package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +0 -1
  150. package/lib/typescript/src/web/listener/index.d.ts +0 -3
  151. package/lib/typescript/src/web/listener/index.d.ts.map +0 -1
  152. package/lib/typescript/src/web/listener/listenToDependencies.d.ts +0 -12
  153. package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +0 -1
  154. package/lib/typescript/src/web/listener/listener.d.ts.map +0 -1
  155. package/lib/typescript/src/web/pseudo.d.ts.map +0 -1
  156. package/lib/typescript/src/web/utils.d.ts.map +0 -1
  157. package/src/web/convert/breakpoint.ts +0 -21
  158. package/src/web/createUnistylesComponent.tsx +0 -54
  159. package/src/web/listener/index.ts +0 -2
  160. package/src/web/listener/listenToDependencies.ts +0 -45
  161. /package/lib/commonjs/web/{pseudo.js → convert/pseudo.js} +0 -0
  162. /package/lib/module/web/{pseudo.js → convert/pseudo.js} +0 -0
  163. /package/lib/typescript/src/web/{pseudo.d.ts → convert/pseudo.d.ts} +0 -0
  164. /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
  165. /package/src/web/{pseudo.ts → convert/pseudo.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["createTypeStyle","convertToTypeStyle","UnistylesRuntime","keyInObject","UnistylesListener","UnistylesRegistryBuilder","stylesheets","Map","getComputedStylesheet","stylesheet","computedStylesheet","get","createdStylesheet","theme","miniRuntime","dependencies","Object","values","flatMap","value","uni__dependencies","addListeners","newComputedStylesheet","set","createStyles","key","unistyles","typestyleStylesheet","className","style","$debugName","Math","random","toString","slice","updateStyles","reinit","cssRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAmB,WAAW;AAEtD,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,SAAS;AACrC,SAASC,iBAAiB,QAAQ,YAAY;AAE9C,MAAMC,wBAAwB,CAAC;EACnBC,WAAW,GAAG,IAAIC,GAAG,CAAoD,CAAC;EAElFC,qBAAqB,GAAIC,UAAiD,IAAK;IAC3E,IAAI,OAAOA,UAAU,KAAK,UAAU,EAAE;MAClC,OAAOA,UAAU;IACrB;IAEA,MAAMC,kBAAkB,GAAG,IAAI,CAACJ,WAAW,CAACK,GAAG,CAACF,UAAU,CAAC;IAE3D,IAAIC,kBAAkB,EAAE;MACpB,OAAOA,kBAAkB;IAC7B;IAEA,MAAME,iBAAiB,GAAGH,UAAU,CAACP,gBAAgB,CAACW,KAAK,EAAEX,gBAAgB,CAACY,WAAW,CAAC;IAC1F;IACA,MAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAACL,iBAAiB,CAAC,CAACM,OAAO,CAACC,KAAK,IAAIhB,WAAW,CAACgB,KAAK,EAAE,mBAA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ateHash","extractUnistyleDependencies","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,SAASC,sBAAsB,EAAEC,WAAW,EAAEC,aAAa,EAAEC,YAAY,EAAEC,2BAA2B,QAAQ,SAAS;AACvH,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,WAAW;AAG5C,SAASC,WAAW,QAAQ,YAAY;AAmBxC,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,QAAQA,CAAA,EAAG;IACnB,MAAMG,GAAG,GAAG,IAAI,CAAC,CAACH,QAAQ;IAE1B,IAAI,CAACG,GAAG,EAAE;MACN,MAAMC,MAAM,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AACsB,KAAK,CAAC9C,GAAG,CAAwC,GAAGZ,KAAK;EAClE,CAAC;EAED2D,MAAM,GAAI3D,KAAsB,IAAK;IACjC,MAAMe,IAAI,GAAG7C,YAAY,CAAC8B,KAAK,CAAC;IAChC,MAAM4D,cAAc,GAAG,IAAI,CAAClF,aAAa,CAACc,GAAG,CAACuB,IAAI,CAAC;IAEnD,IAAI,CAAC6C,cAAc,EAAE;MACjB;IACJ;IAEAA,cAAc,CAACC,MAAM,CAAC7D,KAAK,CAAC;IAE5B,IAAI4D,cAAc,CAAC3C,IAAI,KAAK,CAAC,EAAE;MAC3B,MAAMyB,SAAS,GAAGjC,KAAK,CAACC,IAAI,CAAC,IAAI,CAAC/B,QAAQ,CAACmD,KAAK,EAAEG,QAAQ,IAAI,EAAE,CAAC,CAAC6B,SAAS,CAAC1B,IAAI,IAAIA,IAAI,CAAC2B,OAAO,CAACvB,QAAQ,CAAC,IAAIzB,IAAI,EAAE,CAAC,CAAC;MAEtH,IAAI,CAACpC,QAAQ,CAACmD,KAAK,EAAEkC,UAAU,CAACtB,SAAS,CAAC;IAC9C;EACJ,CAAC;AACL;AAEA,OAAO,MAAMuB,iBAAiB,GAAG,IAAI1F,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import { listenToDependencies } from './listener';
4
3
  import { UnistylesRegistry } from './registry';
5
- import { createDoubleMap, extractHiddenProperties, extractSecrets, isInDocument } from './utils';
4
+ import { createDoubleMap, equal, extractSecrets, extractUnistyleDependencies, isInDocument } from './utils';
6
5
  import { getVariants } from './variants';
7
6
  class UnistylesShadowRegistryBuilder {
8
7
  // MOCKS
@@ -13,9 +12,8 @@ class UnistylesShadowRegistryBuilder {
13
12
  dispose = () => {};
14
13
  // END MOCKS
15
14
 
16
- webUnistylesMap = createDoubleMap();
17
- disposeMap = createDoubleMap();
18
- stylesMap = createDoubleMap();
15
+ resultsMap = createDoubleMap();
16
+ classNamesMap = createDoubleMap();
19
17
  add = (ref, _style, _variants, _args) => {
20
18
  // Style is not provided
21
19
  if (!_style) {
@@ -37,13 +35,19 @@ class UnistylesShadowRegistryBuilder {
37
35
  if (ref === null) {
38
36
  const secrets = extractSecrets(_style);
39
37
  secrets.forEach(({
40
- __uni__refs
38
+ __uni__refs,
39
+ __uni__key
41
40
  }) => {
42
41
  __uni__refs.forEach(ref => {
43
42
  if (isInDocument(ref)) {
44
43
  return;
45
44
  }
46
- this.remove(ref, _style);
45
+ const oldResult = this.resultsMap.get(ref, __uni__key);
46
+ this.resultsMap.delete(ref, __uni__key);
47
+ this.classNamesMap.delete(ref, __uni__key);
48
+ if (oldResult) {
49
+ UnistylesRegistry.remove(oldResult);
50
+ }
47
51
  });
48
52
  });
49
53
  return;
@@ -57,63 +61,61 @@ class UnistylesShadowRegistryBuilder {
57
61
  const {
58
62
  __uni__key,
59
63
  __uni__stylesheet,
60
- __uni__refs,
61
64
  __uni__variants,
62
- __uni__args = []
65
+ __uni__args = [],
66
+ __uni__refs
63
67
  } = secret;
64
68
  const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
65
69
  const style = newComputedStylesheet[__uni__key];
66
70
  const args = _args ?? __uni__args;
67
- const resultHidden = typeof style === 'function' ? style(...args) : style;
68
- const result = extractHiddenProperties(resultHidden);
71
+ const variants = _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants;
72
+ const result = typeof style === 'function' ? style(...args) : style;
69
73
  const {
70
- variants
74
+ variantsResult
71
75
  } = Object.fromEntries(getVariants({
72
- variants: result
73
- }, _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants));
76
+ variantsResult: result
77
+ }, variants));
74
78
  const resultWithVariants = {
75
79
  ...result,
76
- ...variants
80
+ ...variantsResult
77
81
  };
78
- const storedWebUnistyle = this.webUnistylesMap.get(ref, __uni__key);
79
- const webUnistyle = storedWebUnistyle ?? UnistylesRegistry.createStyles(resultWithVariants, __uni__key);
80
- this.webUnistylesMap.set(ref, __uni__key, webUnistyle);
81
- this.disposeMap.get(ref, __uni__key)?.();
82
- this.disposeMap.set(ref, __uni__key, listenToDependencies({
82
+ const oldResult = this.resultsMap.get(ref, __uni__key);
83
+
84
+ // If results are the same do nothing
85
+ if (equal(oldResult, resultWithVariants)) {
86
+ return;
87
+ }
88
+ const oldClassNames = this.classNamesMap.get(ref, __uni__key);
89
+
90
+ // Remove old styles
91
+ if (oldResult) {
92
+ UnistylesRegistry.remove(oldResult);
93
+ }
94
+
95
+ // Remove old classnames from the ref
96
+ oldClassNames?.forEach(className => ref.classList.remove(className));
97
+ this.resultsMap.set(ref, __uni__key, resultWithVariants);
98
+ const className = UnistylesRegistry.add({
83
99
  key: __uni__key,
84
- stylesheet: __uni__stylesheet,
85
100
  args,
86
- className: webUnistyle.className,
87
- unistyles: webUnistyle.unistyles
88
- }));
89
- if (!storedWebUnistyle) {
90
- const styleTag = document.createElement('style');
91
- const additionalClasses = resultWithVariants?._web?._classNames;
92
- if (additionalClasses) {
93
- ref.classList.add(...(Array.isArray(additionalClasses) ? additionalClasses : [additionalClasses]));
94
- }
95
- ref.classList.add(webUnistyle.className);
96
- webUnistyle.unistyles.setStylesTarget(styleTag);
97
- document.head.appendChild(styleTag);
98
- __uni__refs.add(ref);
99
- this.stylesMap.set(ref, __uni__key, styleTag);
100
- }
101
- if (storedWebUnistyle) {
102
- UnistylesRegistry.updateStyles(webUnistyle.unistyles, resultWithVariants, webUnistyle.className);
101
+ stylesheet: __uni__stylesheet,
102
+ value: resultWithVariants,
103
+ variants
104
+ });
105
+ const injectedClassNames = resultWithVariants?._web?._classNames ?? [];
106
+ const newClassNames = injectedClassNames.concat(className);
107
+ const dependencies = extractUnistyleDependencies(resultWithVariants);
108
+ if (typeof __uni__stylesheet === 'function') {
109
+ // Add dependencies from dynamic styles to stylesheet
110
+ UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
103
111
  }
112
+ __uni__refs.add(ref);
113
+ this.classNamesMap.set(ref, __uni__key, newClassNames);
114
+ // Add new classnames to the ref
115
+ ref.classList.add(...newClassNames);
104
116
  });
105
117
  };
106
- remove = (ref, style) => {
107
- extractSecrets(style).forEach(({
108
- __uni__key
109
- }) => {
110
- this.webUnistylesMap.delete(ref, __uni__key);
111
- this.disposeMap.get(ref, __uni__key)?.();
112
- this.disposeMap.delete(ref, __uni__key);
113
- this.stylesMap.get(ref, __uni__key)?.remove();
114
- this.stylesMap.delete(ref, __uni__key);
115
- });
116
- };
118
+ remove = () => {};
117
119
  }
118
120
  export const UnistylesShadowRegistry = new UnistylesShadowRegistryBuilder();
119
121
  //# sourceMappingURL=shadowRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["listenToDependencies","UnistylesRegistry","createDoubleMap","extractHiddenProperties","extractSecrets","isInDocument","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","webUnistylesMap","disposeMap","stylesMap","add","ref","_style","_variants","_args","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","__uni__refs","remove","HTMLElement","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","resultHidden","result","variants","fromEntries","length","resultWithVariants","storedWebUnistyle","get","webUnistyle","createStyles","set","stylesheet","className","unistyles","styleTag","document","createElement","additionalClasses","_web","_classNames","classList","setStylesTarget","head","appendChild","updateStyles","delete","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,eAAe,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,YAAY,QAAQ,SAAS;AAChG,SAASC,WAAW,QAAQ,YAAY;AAMxC,MAAMC,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,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xC,IAAI,CAACrB,UAAU,CAACqD,MAAM,CAAClD,GAAG,EAAEkB,UAAU,CAAC;MACvC,IAAI,CAACpB,SAAS,CAACkC,GAAG,CAAChC,GAAG,EAAEkB,UAAU,CAAC,EAAEH,MAAM,CAAC,CAAC;MAC7C,IAAI,CAACjB,SAAS,CAACoD,MAAM,CAAClD,GAAG,EAAEkB,UAAU,CAAC;IAC1C,CAAC,CAAC;EACN,CAAC;AACL;AAEA,OAAO,MAAMiC,uBAAuB,GAAG,IAAI7D,8BAA8B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesRegistry","createDoubleMap","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,KAAK,EAAEC,cAAc,EAAEC,2BAA2B,EAAEC,YAAY,QAAQ,SAAS;AAC3G,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,GAAGZ,eAAe,CAAuC,CAAC;EACpEa,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gB,SAAS,CAAC,CAAC;MACpE,IAAI,CAACtC,UAAU,CAACwC,GAAG,CAACrC,GAAG,EAAEe,UAAU,EAAEkB,kBAAkB,CAAC;MAExD,MAAME,SAAS,GAAGnD,iBAAiB,CAACe,GAAG,CAAC;QACpCY,GAAG,EAAEI,UAAU;QACfY,IAAI;QACJW,UAAU,EAAEhB,iBAAiB;QAC7BiB,KAAK,EAAEN,kBAAkB;QACzBL;MACJ,CAAC,CAAC;MACF,MAAMY,kBAAiC,GAAGP,kBAAkB,EAAEQ,IAAI,EAAEC,WAAW,IAAI,EAAE;MACrF,MAAMC,aAAa,GAAGH,kBAAkB,CAACI,MAAM,CAACT,SAAS,CAAC;MAC1D,MAAMU,YAAY,GAAGzD,2BAA2B,CAAC6C,kBAAkB,CAAC;MAEpE,IAAI,OAAOX,iBAAiB,KAAK,UAAU,EAAE;QACzC;QACAtC,iBAAiB,CAAC8D,2BAA2B,CAACxB,iBAAiB,EAAEuB,YAAY,CAAC;MAClF;MAEA/B,WAAW,CAACf,GAAG,CAACC,GAAG,CAAC;MACpB,IAAI,CAACF,aAAa,CAACuC,GAAG,CAACrC,GAAG,EAAEe,UAAU,EAAE4B,aAAa,CAAC;MACtD;MACA3C,GAAG,CAACoC,SAAS,CAACrC,GAAG,CAAC,GAAG4C,aAAa,CAAC;IACvC,CAAC,CAAC;EACN,CAAC;EAEDxB,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEA,OAAO,MAAM4B,uBAAuB,GAAG,IAAIxD,8BAA8B,CAAC,CAAC","ignoreList":[]}
@@ -5,14 +5,18 @@ import { isServer, schemeToTheme } from './utils';
5
5
  import { UnistylesListener } from './listener';
6
6
  import { UnistyleDependency } from '../specs/NativePlatform';
7
7
  class UnistylesStateBuilder {
8
- isSSR = isServer();
9
8
  themes = new Map();
9
+ matchingBreakpoints = new Map();
10
+ get breakpoint() {
11
+ const [currentBreakpoint] = Array.from(this.matchingBreakpoints).reverse().find(([_key, value]) => value) ?? [];
12
+ return currentBreakpoint;
13
+ }
10
14
  hasAdaptiveThemes = false;
11
15
  init = config => {
12
16
  this.initThemes(config.themes);
13
17
  this.initBreakpoints(config.breakpoints);
14
18
  this.initSettings(config.settings);
15
- if (this.isSSR) {
19
+ if (isServer()) {
16
20
  return;
17
21
  }
18
22
  UnistylesListener.initListeners();
@@ -47,27 +51,15 @@ class UnistylesStateBuilder {
47
51
  this.themeName = typeof settings.initialTheme === 'function' ? settings.initialTheme() : settings.initialTheme;
48
52
  };
49
53
  initBreakpoints = (breakpoints = {}) => {
50
- const breakpointsMap = new Map();
51
54
  this.breakpoints = breakpoints;
52
55
  Object.entries(breakpoints).sort(([, a], [, b]) => a - b).forEach(([breakpoint, value]) => {
53
56
  if (isServer()) {
54
57
  return;
55
58
  }
56
59
  const mediaQuery = window.matchMedia(`(min-width: ${value}px)`);
57
- breakpointsMap.set(breakpoint, mediaQuery);
58
- if (mediaQuery.matches) {
59
- this.breakpoint = breakpoint;
60
- }
60
+ this.matchingBreakpoints.set(breakpoint, mediaQuery.matches);
61
61
  mediaQuery.addEventListener('change', event => {
62
- if (!event.matches) {
63
- const [currentBreakpoint] = Array.from(breakpointsMap).find(([, mq]) => mq.matches) ?? [];
64
- if (currentBreakpoint) {
65
- this.breakpoint = currentBreakpoint;
66
- UnistylesListener.emitChange(UnistyleDependency.Breakpoints);
67
- }
68
- return;
69
- }
70
- this.breakpoint = breakpoint;
62
+ this.matchingBreakpoints.set(breakpoint, event.matches);
71
63
  UnistylesListener.emitChange(UnistyleDependency.Breakpoints);
72
64
  });
73
65
  });
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesRuntime","isServer","schemeToTheme","UnistylesListener","UnistyleDependency","UnistylesStateBuilder","isSSR","themes","Map","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","initSettings","settings","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","themeNames","Array","from","keys","initialTheme","length","Error","colorScheme","breakpointsMap","sort","a","b","breakpoint","value","mediaQuery","window","matchMedia","matches","addEventListener","event","currentBreakpoint","find","mq","emitChange","Breakpoints","UnistylesState"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;AAIA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,qBAAqB,CAAC;EACPC,KAAK,GAAGL,QAAQ,CAAC,CAAC;EAEnCM,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAM1CC,iBAAiB,GAAG,KAAK;EAEzBC,IAAI,GAAIC,MAAuB,IAAK;IAChC,IAAI,CAACC,UAAU,CAACD,MAAM,CAACJ,MAAM,CAAC;IAC9B,IAAI,CAACM,eAAe,CAACF,MAAM,CAACG,WAAW,CAAC;IACxC,IAAI,CAACC,YAAY,CAACJ,MAAM,CAACK,QAAQ,CAAC;IAElC,IAAI,IAAI,CAACV,KAAK,EAAE;MACZ;IACJ;IAEAH,iBAAiB,CAACc,aAAa,CAAC,CAAC;EACrC,CAAC;EAEOL,UAAU,GAAGA,CAACL,MAAM,GAAG,CAAC,CAAoB,KAAK;IACrDW,MAAM,CAACC,OAAO,CAACZ,MAAM,CAAC,CAACa,OAAO,CAAC,CAAC,CAACC,SAAS,EAAEC,KAAK,CAAC,KAAK;MACnD,IAAI,CAACf,MAAM,CAACgB,GAAG,CAACF,SAAS,EAAEC,KAAK,CAAC;IACrC,CAAC,CAAC;EACN,CAAC;EAEOP,YAAY,GAAIC,QAAqC,IAAK;IAC9D,IAAI,CAACP,iBAAiB,GAAGO,QAAQ,EAAEQ,cAAc,IAAI,KAAK;IAC1D,MAAMC,UAAU,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACpB,MAAM,CAACqB,IAAI,CAAC,CAAC,CAAwB;;IAExE;IACA,IAAI,CAACZ,QAAQ,EAAEQ,cAAc,IAAI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Q,EAAEC,KAAK,IAAI;QAC3C,IAAI,CAACA,KAAK,CAACF,OAAO,EAAE;UAChB,MAAM,CAACG,iBAAiB,CAAC,GAAGnB,KAAK,CAACC,IAAI,CAACM,cAAc,CAAC,CAACa,IAAI,CAAC,CAAC,GAAEC,EAAE,CAAC,KAAKA,EAAE,CAACL,OAAO,CAAC,IAAI,EAAE;UAExF,IAAIG,iBAAiB,EAAE;YACnB,IAAI,CAACR,UAAU,GAAGQ,iBAAkC;YACpD1C,iBAAiB,CAAC6C,UAAU,CAAC5C,kBAAkB,CAAC6C,WAAW,CAAC;UAChE;UAEA;QACJ;QAEA,IAAI,CAACZ,UAAU,GAAGA,UAA2B;QAC7ClC,iBAAiB,CAAC6C,UAAU,CAAC5C,kBAAkB,CAAC6C,WAAW,CAAC;MAChE,CAAC,CAAC;IACN,CAAC,CAAC;EACV,CAAC;AACL;AAEA,OAAO,MAAMC,cAAc,GAAG,IAAI7C,qBAAqB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesRuntime","isServer","schemeToTheme","UnistylesListener","UnistyleDependency","UnistylesStateBuilder","themes","Map","matchingBreakpoints","breakpoint","currentBreakpoint","Array","from","reverse","find","_key","value","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","initSettings","settings","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","themeNames","keys","initialTheme","length","Error","colorScheme","sort","a","b","mediaQuery","window","matchMedia","matches","addEventListener","event","emitChange","Breakpoints","UnistylesState"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;AAIA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,qBAAqB,CAAC;EACxBC,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAGlCC,mBAAmB,GAAG,IAAID,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CAAC,CAAC;EACV,CAAC;AACL;AAEA,OAAO,MAAMC,cAAc,GAAG,IAAI7C,qBAAqB,CAAC,CAAC","ignoreList":[]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import { ColorScheme } from '../specs/types';
4
3
  export const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
5
4
  export const keyInObject = (obj, key) => key in obj;
6
- export const schemeToTheme = scheme => {
7
- switch (scheme) {
8
- case ColorScheme.Dark:
9
- return 'dark';
10
- case ColorScheme.Light:
11
- default:
12
- return 'light';
13
- }
14
- };
15
- export const hexToRGBA = (hex, opacity) => hex.replace('#', '').split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num)).reduce((acc, color) => `${acc}${color},`, 'rgba(').concat(`${opacity})`);
16
5
  export const isServer = () => typeof window === 'undefined';
17
6
 
18
7
  /**
@@ -50,28 +39,12 @@ export const equal = (a, b) => {
50
39
  }
51
40
  return keysA.every(key => Object.is(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
52
41
  };
53
- export const assignSecrets = (object, secrets) => {
54
- // @ts-expect-error - assign secrets to object
55
- object[`__uni__secrets__${Math.random().toString(16).slice(2)}`] = secrets;
56
- return object;
57
- };
58
- export const extractSecrets = object => {
59
- const secrets = Object.entries(object).reduce((acc, [key, value]) => {
60
- if (key.startsWith('__uni__secrets__')) {
61
- acc.push(value);
62
- }
63
- return acc;
64
- }, []);
65
- return secrets;
66
- };
67
- export const getStyles = values => {
68
- const returnValue = {};
69
- Object.defineProperties(returnValue, reduceObject(values, value => ({
70
- value,
71
- enumerable: false,
72
- configurable: true
73
- })));
74
- return returnValue;
42
+ export const generateHash = value => {
43
+ const str = JSON.stringify(value);
44
+ let hasher = 5381;
45
+ let length = str.length;
46
+ while (length--) hasher = hasher * 33 ^ str.charCodeAt(length);
47
+ return `unistyles-${(hasher >>> 0).toString(36)}`;
75
48
  };
76
49
  export const createDoubleMap = () => {
77
50
  const map = new Map();
@@ -104,9 +77,4 @@ export const createDoubleMap = () => {
104
77
  }
105
78
  };
106
79
  };
107
- export const extractHiddenProperties = object => {
108
- const hiddenProperties = Object.getOwnPropertyNames(object);
109
- return Object.fromEntries(hiddenProperties.filter(key => !key.startsWith('__uni__')).map(key => [key, object[key]]));
110
- };
111
- export const isInDocument = element => document.body.contains(element);
112
- //# sourceMappingURL=utils.js.map
80
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","keyInObject","isServer","window","deepMergeObjects","sources","target","forEach","source","keys","sourceValue","targetValue","warn","message","console","equal","a","b","is","keysA","length","every","prototype","hasOwnProperty","call","generateHash","str","JSON","stringify","hasher","charCodeAt","toString","createDoubleMap","Map","get","secondKey","mapForKey","undefined","set","delete","callback"],"sourceRoot":"../../../../src","sources":["web/utils/common.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAGA,CACxBC,GAAS,EACTC,OAA+D,KAC9DC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACJ,GAAG,CAAC,CAACK,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK,CAACD,GAAG,EAAEL,OAAO,CAACM,KAAK,EAAsBD,GAAG,CAAC,CAAC,CAAC,CAAoC;AAErJ,OAAO,MAAME,WAAW,GAAGA,CAAgCR,GAAM,EAAEM,GAAgB,KAAqBA,GAAG,IAAIN,GAAG;AAElH,OAAO,MAAMS,QAAQ,GAAGA,CAAA,KAAM,OAAOC,MAAM,KAAK,WAAW;;AAE3D;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CAACE,OAAO,CAACC,MAAM,IAAI;IACtBb,MAAM,CAACc,IAAI,CAACD,MAAM,CAAC,CAACD,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SAAS,EAAE;QACZ;MACJ;MAEAA,SAAS,CAACG,MAAM,CAACJ,SAAS,CAAC;IAC/B,CAAC;IACD5B,OAAO,EAAGiC,QAAmE,IAAK;MAC9E1C,GAAG,CAACS,OAAO,CAAC,CAAC6B,SAAS,EAAErC,GAAG,KAAK;QAC5BqC,SAAS,CAAC7B,OAAO,CAAC,CAACP,KAAK,EAAEmC,SAAS,KAAK;UACpCK,QAAQ,CAACzC,GAAG,EAAEoC,SAAS,EAAEnC,KAAK,CAAC;QACnC,CAAC,CAAC;MACN,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export * from './common';
4
+ export * from './unistyle';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["web/utils/index.ts"],"mappings":";;AAAA,cAAc,UAAU;AACxB,cAAc,YAAY","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ import { ColorScheme, Orientation } from '../../specs/types';
4
+ import { isUnistylesMq, parseMq } from '../mq';
5
+ import { UnistylesState } from '../state';
6
+ import { keyInObject, reduceObject } from './common';
7
+ export const schemeToTheme = scheme => {
8
+ switch (scheme) {
9
+ case ColorScheme.Dark:
10
+ return 'dark';
11
+ case ColorScheme.Light:
12
+ default:
13
+ return 'light';
14
+ }
15
+ };
16
+ export const hexToRGBA = (hex, opacity) => hex.replace('#', '').split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num)).reduce((acc, color) => `${acc}${color},`, 'rgba(').concat(`${opacity})`);
17
+ export const assignSecrets = (object, secrets) => {
18
+ // @ts-expect-error - assign secrets to object
19
+ object[`__uni__secrets__${Math.random().toString(16).slice(2)}`] = secrets;
20
+ return object;
21
+ };
22
+ export const extractSecrets = object => {
23
+ const secrets = Object.entries(object).reduce((acc, [key, value]) => {
24
+ if (key.startsWith('__uni__secrets__')) {
25
+ acc.push(value);
26
+ }
27
+ return acc;
28
+ }, []);
29
+ return secrets;
30
+ };
31
+ export const getStyles = values => {
32
+ const returnValue = {};
33
+ Object.defineProperties(returnValue, reduceObject(values, value => ({
34
+ value,
35
+ enumerable: false,
36
+ configurable: true
37
+ })));
38
+ return returnValue;
39
+ };
40
+ export const isInDocument = element => document.body.contains(element);
41
+ export const extractMediaQueryValue = query => {
42
+ const [_, px] = query.match(/(\d+)px/) ?? [];
43
+ if (!px) {
44
+ return undefined;
45
+ }
46
+ const value = Number(px);
47
+ return isNaN(value) ? undefined : value;
48
+ };
49
+ export const getMediaQuery = query => {
50
+ if (Object.values(Orientation).includes(query)) {
51
+ return `(orientation: ${query})`;
52
+ }
53
+ if (isUnistylesMq(query)) {
54
+ const {
55
+ minWidth,
56
+ maxWidth,
57
+ minHeight,
58
+ maxHeight
59
+ } = parseMq(query);
60
+ return [minWidth ? `(min-width: ${minWidth}px)` : undefined, maxWidth ? `(max-width: ${maxWidth}px)` : undefined, minHeight ? `(min-height: ${minHeight}px)` : undefined, maxHeight ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
61
+ }
62
+ const minWidth = UnistylesState.breakpoints && keyInObject(UnistylesState.breakpoints, query) ? UnistylesState.breakpoints[query] : undefined;
63
+ return `(min-width: ${minWidth ?? 0}px)`;
64
+ };
65
+ export const extractUnistyleDependencies = value => {
66
+ const dependencies = keyInObject(value, 'uni__dependencies') ? value.uni__dependencies : [];
67
+ return dependencies;
68
+ };
69
+ //# sourceMappingURL=unistyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ColorScheme","Orientation","isUnistylesMq","parseMq","UnistylesState","keyInObject","reduceObject","schemeToTheme","scheme","Dark","Light","hexToRGBA","hex","opacity","replace","split","map","x","parseInt","filter","num","isNaN","reduce","acc","color","concat","assignSecrets","object","secrets","Math","random","toString","slice","extractSecrets","Object","entries","key","value","startsWith","push","getStyles","values","returnValue","defineProperties","enumerable","configurable","isInDocument","element","document","body","contains","extractMediaQueryValue","query","_","px","match","undefined","Number","getMediaQuery","includes","minWidth","maxWidth","minHeight","maxHeight","Boolean","join","breakpoints","extractUnistyleDependencies","dependencies","uni__dependencies"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;AACA,SAASA,WAAW,EAAEC,WAAW,QAA2B,mBAAmB;AAE/E,SAASC,aAAa,EAAEC,OAAO,QAAQ,OAAO;AAC9C,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,WAAW,EAAEC,YAAY,QAAQ,UAAU;AAEpD,OAAO,MAAMC,aAAa,GAAIC,MAAmB,IAAmB;EAChE,QAAQA,MAAM;IACV,KAAKR,WAAW,CAACS,IAAI;MACjB,OAAO,MAAM;IACjB,KAAKT,WAAW,CAACU,KAAK;IACtB;MACI,OAAO,OAAO;EACtB;AACJ,CAAC;AAED,OAAO,MAAMC,SAAS,GAAGA,CAACC,GAAW,EAAEC,OAAe,KAAKD,GAAG,CACzDE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAChBC,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,CAACD,CAAC,EAAE,EAAE,CAAC,CAAC,CACzBE,MAAM,CAACC,GAAG,IAAI,CAACC,KAAK,CAACD,GAAG,CAAC,CAAC,CAC1BE,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK,GAAGD,GAAG,GAAGC,KAAK,GAAG,EAAE,OAAO,CAAC,CAClDC,MAAM,CAAC,GAAGZ,OAAO,GAAG,CAAC;AAU1B,OAAO,MAAMa,aAAa,GAAGA,CAAIC,MAAS,EAAEC,OAAwB,KAAK;EACrE;EACAD,MAAM,CAAC,mBAAmBE,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAGJ,OAAO;EAE1E,OAAOD,MAAM;AACjB,CAAC;AAED,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,OAAO,iBAAiBA,KAAK,GAAG;EACpC;EAEA,IAAIlD,aAAa,CAACkD,KAAK,CAAC,EAAE;IACtB,MAAM;MAAEQ,QAAQ;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAAU,CAAC,GAAG5D,OAAO,CAACiD,KAAK,CAAC;IAEnE,OAAO,CACHQ,QAAQ,GAAG,eAAeA,QAAQ,KAAK,GAAGJ,SAAS,EACnDK,QAAQ,GAAG,eAAeA,QAAQ,KAAK,GAAGL,SAAS,EACnDM,SAAS,GAAG,gBAAgBA,SAAS,KAAK,GAAGN,SAAS,EACtDO,SAAS,GAAG,gBAAgBA,SAAS,KAAK,GAAGP,SAAS,CACzD,CAACrC,MAAM,CAAC6C,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;EACnC;EAEA,MAAML,QAAQ,GAAGxD,cAAc,CAAC8D,WAAW,IAAI7D,WAAW,CAACD,cAAc,CAAC8D,WAAW,EAAEd,KAAK,CAAC,GAAGhD,cAAc,CAAC8D,WAAW,CAACd,KAAK,CAAC,GAAGI,SAAS;EAE7I,OAAO,eAAeI,QAAQ,IAAI,CAAC,KAAK;AAC5C,CAAC;AAED,OAAO,MAAMO,2BAA2B,GAAI9B,KAAU,IAAK;EACvD,MAAM+B,YAAuC,GAAG/D,WAAW,CAACgC,KAAK,EAAE,mBAAmB,CAAC,GAAGA,KAAK,CAACgC,iBAAiB,GAAG,EAAE;EAEtH,OAAOD,YAAY;AACvB,CAAC","ignoreList":[]}
@@ -4,6 +4,6 @@ export interface UnistylesStyleSheet extends HybridObject<{
4
4
  android: 'c++';
5
5
  }> {
6
6
  readonly hairlineWidth: number;
7
- readonly __unid: number;
7
+ readonly unid: number;
8
8
  }
9
9
  //# sourceMappingURL=UnistylesStyleSheet.nitro.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesStyleSheet.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;IACrF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAC1B"}
1
+ {"version":3,"file":"UnistylesStyleSheet.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;IACrF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACxB"}
@@ -5,7 +5,7 @@ import type { UnistylesMiniRuntime } from '../specs';
5
5
  import type { ReactNativeStyleSheet } from './breakpoints';
6
6
  import type { ExtractVariantNames } from './variants';
7
7
  import type { CSSProperties } from 'react';
8
- import type { Pseudo } from '../web/pseudo';
8
+ import type { Pseudo } from '../web/convert/pseudo';
9
9
  type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset';
10
10
  export type UnistyleView = Omit<ViewStyle, NestedKeys>;
11
11
  export type UnistyleText = Omit<TextStyle, NestedKeys>;
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,Q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1
- import type { NestedCSSProperties } from 'typestyle/lib/types';
2
- export declare const getBoxShadowStyle: (styles: Record<string, any>) => NestedCSSProperties;
1
+ export declare const getBoxShadowStyle: (styles: Record<string, any>) => {
2
+ [x: string]: {
3
+ boxShadow: string;
4
+ };
5
+ } | {
6
+ boxShadow: string;
7
+ };
3
8
  //# sourceMappingURL=boxShadow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boxShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/boxShadow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAkB9D,eAAO,MAAM,iBAAiB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,mBAoD/D,CAAA"}
1
+ {"version":3,"file":"boxShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/boxShadow.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;CAsD5D,CAAA"}
@@ -1,4 +1,3 @@
1
- import type { NestedCSSProperties } from 'typestyle/lib/types';
2
1
  import type { UnistylesValues } from '../../types';
3
- export declare const convertToTypeStyle: (value: UnistylesValues) => NestedCSSProperties;
2
+ export declare const convertUnistyles: (value: UnistylesValues) => Record<string, any>;
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAWlD,eAAO,MAAM,kBAAkB,UAAW,eAAe,wBAiExD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AASlD,eAAO,MAAM,gBAAgB,UAAW,eAAe,wBA6DtD,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pseudo.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/pseudo.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,ssEAiIV,CAAA;AAEV,eAAO,MAAM,QAAQ,aAAc,MAAM,YAAwD,CAAA;AAEjG,KAAK,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,MAAM,GAAG,GAAG,CAAC,CAAA;AAE3F,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA"}
@@ -1,3 +1,2 @@
1
- import type { NestedCSSProperties } from 'typestyle/lib/types';
2
- export declare const getStyle: (key: string, value: any) => NestedCSSProperties;
1
+ export declare const getStyle: (key: string, value: any) => Record<string, any>;
3
2
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAgF9D,eAAO,MAAM,QAAQ,QAAS,MAAM,SAAS,GAAG,wBAY/C,CAAA"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/style.ts"],"names":[],"mappings":"AAoIA,eAAO,MAAM,QAAQ,QAAS,MAAM,SAAS,GAAG,wBAY/C,CAAA"}
@@ -1,3 +1,8 @@
1
- import type { NestedCSSProperties } from 'typestyle/lib/types';
2
- export declare const getTextShadowStyle: (styles: Record<string, any>) => NestedCSSProperties;
1
+ export declare const getTextShadowStyle: (styles: Record<string, any>) => {
2
+ [x: string]: {
3
+ textShadow: string;
4
+ };
5
+ } | {
6
+ textShadow: string;
7
+ };
3
8
  //# sourceMappingURL=textShadow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/textShadow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAiB9D,eAAO,MAAM,kBAAkB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,mBAkDhE,CAAA"}
1
+ {"version":3,"file":"textShadow.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/textShadow.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,kBAAkB,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;CAoD7D,CAAA"}
@@ -1,5 +1,4 @@
1
- import type { NestedCSSProperties } from 'typestyle/lib/types';
2
1
  type Transforms = Array<Record<string, any>>;
3
- export declare const getTransformStyle: (transforms: Transforms) => NestedCSSProperties;
2
+ export declare const getTransformStyle: (transforms: Transforms) => Record<string, any>;
4
3
  export {};
5
4
  //# sourceMappingURL=transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAK9D,KAAK,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;AAmC5C,eAAO,MAAM,iBAAiB,eAAgB,UAAU,KAAG,mBA+C1D,CAAA"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../src/web/convert/transform.ts"],"names":[],"mappings":"AAGA,KAAK,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;AAmC5C,eAAO,MAAM,iBAAiB,eAAgB,UAAU,wBAiDvD,CAAA"}
@@ -1,4 +1,4 @@
1
- import { UnistyleDependency } from '../../specs/NativePlatform';
1
+ import { UnistyleDependency } from '../specs/NativePlatform';
2
2
  declare class UnistylesListenerBuilder {
3
3
  private isInitialized;
4
4
  private listeners;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/web/listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAG5D,cAAM,wBAAwB;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAoG;IAErH,UAAU,eAAgB,kBAAkB,UAE3C;IAED,aAAa,aAUZ;IAED,YAAY,iBAAkB,KAAK,CAAC,kBAAkB,CAAC,YAAY,YAAY,gBAM9E;CACJ;AAED,eAAO,MAAM,iBAAiB,0BAAiC,CAAA"}
@@ -1,4 +1,8 @@
1
- import type { MediaQuery } from 'typestyle/lib/types';
2
- export declare const parseMq: (mq: string) => MediaQuery;
1
+ export declare const parseMq: (mq: string) => {
2
+ minWidth: number | undefined;
3
+ maxWidth: number | undefined;
4
+ minHeight: number | undefined;
5
+ maxHeight: number | undefined;
6
+ };
3
7
  export declare const isUnistylesMq: (mq: string) => boolean;
4
8
  //# sourceMappingURL=mq.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/web/mq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAMrD,eAAO,MAAM,OAAO,OAAQ,MAAM,KAAG,UAUpC,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,YAAgC,CAAA"}
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"}