react-native-unistyles 2.0.0-alpha.10 → 2.0.0-alpha.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. package/cxx/UnistylesRuntime.cpp +55 -1
  2. package/cxx/UnistylesRuntime.h +10 -4
  3. package/ios/UnistylesModule.mm +12 -2
  4. package/lib/commonjs/common.js +19 -6
  5. package/lib/commonjs/common.js.map +1 -1
  6. package/lib/commonjs/core/UnistyleRegistry.js +49 -1
  7. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  8. package/lib/commonjs/core/UnistylesRuntime.js +12 -16
  9. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  10. package/lib/commonjs/hooks/useUnistyles.js +8 -2
  11. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/plugins/index.js +45 -0
  14. package/lib/commonjs/plugins/index.js.map +1 -0
  15. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
  16. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
  17. package/lib/commonjs/plugins/normalizer/index.js +32 -0
  18. package/lib/commonjs/plugins/normalizer/index.js.map +1 -0
  19. package/lib/commonjs/plugins/normalizer/module.d.js.map +1 -0
  20. package/lib/commonjs/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +5 -5
  21. package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +1 -0
  22. package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -0
  23. package/lib/commonjs/plugins/withPlugins.js +18 -0
  24. package/lib/commonjs/plugins/withPlugins.js.map +1 -0
  25. package/lib/commonjs/types/plugin.js +6 -0
  26. package/lib/{module/utils/module.d.js.map → commonjs/types/plugin.js.map} +1 -1
  27. package/lib/commonjs/types/variants.js +2 -0
  28. package/lib/commonjs/{utils/module.d.js.map → types/variants.js.map} +1 -1
  29. package/lib/commonjs/useStyles.js +5 -4
  30. package/lib/commonjs/useStyles.js.map +1 -1
  31. package/lib/commonjs/utils/breakpoints.js +15 -70
  32. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  33. package/lib/commonjs/utils/index.js +12 -52
  34. package/lib/commonjs/utils/index.js.map +1 -1
  35. package/lib/commonjs/utils/mq.js +1 -1
  36. package/lib/commonjs/utils/mq.js.map +1 -1
  37. package/lib/commonjs/utils/mqParser.js +4 -1
  38. package/lib/commonjs/utils/mqParser.js.map +1 -1
  39. package/lib/commonjs/utils/styles.js +22 -11
  40. package/lib/commonjs/utils/styles.js.map +1 -1
  41. package/lib/commonjs/utils/variants.js +2 -5
  42. package/lib/commonjs/utils/variants.js.map +1 -1
  43. package/lib/module/common.js +17 -7
  44. package/lib/module/common.js.map +1 -1
  45. package/lib/module/core/UnistyleRegistry.js +49 -1
  46. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  47. package/lib/module/core/UnistylesRuntime.js +12 -16
  48. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  49. package/lib/module/hooks/useUnistyles.js +8 -2
  50. package/lib/module/hooks/useUnistyles.js.map +1 -1
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/plugins/index.js +4 -0
  53. package/lib/module/plugins/index.js.map +1 -0
  54. package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
  55. package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
  56. package/lib/module/plugins/normalizer/index.js +3 -0
  57. package/lib/module/plugins/normalizer/index.js.map +1 -0
  58. package/lib/module/plugins/normalizer/module.d.js.map +1 -0
  59. package/lib/module/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +3 -3
  60. package/lib/module/plugins/normalizer/normalizeStyle.js.map +1 -0
  61. package/lib/module/plugins/normalizer/normalizer.js.map +1 -0
  62. package/lib/module/plugins/withPlugins.js +11 -0
  63. package/lib/module/plugins/withPlugins.js.map +1 -0
  64. package/lib/module/types/plugin.js +2 -0
  65. package/lib/module/types/plugin.js.map +1 -0
  66. package/lib/module/types/variants.js +2 -0
  67. package/lib/module/types/variants.js.map +1 -0
  68. package/lib/module/useStyles.js +5 -4
  69. package/lib/module/useStyles.js.map +1 -1
  70. package/lib/module/utils/breakpoints.js +13 -66
  71. package/lib/module/utils/breakpoints.js.map +1 -1
  72. package/lib/module/utils/index.js +2 -5
  73. package/lib/module/utils/index.js.map +1 -1
  74. package/lib/module/utils/mq.js +1 -1
  75. package/lib/module/utils/mq.js.map +1 -1
  76. package/lib/module/utils/mqParser.js +3 -3
  77. package/lib/module/utils/mqParser.js.map +1 -1
  78. package/lib/module/utils/styles.js +23 -12
  79. package/lib/module/utils/styles.js.map +1 -1
  80. package/lib/module/utils/variants.js +2 -5
  81. package/lib/module/utils/variants.js.map +1 -1
  82. package/lib/typescript/src/common.d.ts +16 -6
  83. package/lib/typescript/src/common.d.ts.map +1 -1
  84. package/lib/typescript/src/core/UnistyleRegistry.d.ts +7 -2
  85. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  86. package/lib/typescript/src/core/UnistylesRuntime.d.ts +7 -8
  87. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  88. package/lib/typescript/src/core/index.d.ts +1 -0
  89. package/lib/typescript/src/core/index.d.ts.map +1 -1
  90. package/lib/typescript/src/hooks/useUnistyles.d.ts +2 -1
  91. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
  92. package/lib/typescript/src/index.d.ts +4 -3
  93. package/lib/typescript/src/index.d.ts.map +1 -1
  94. package/lib/typescript/src/plugins/index.d.ts +4 -0
  95. package/lib/typescript/src/plugins/index.d.ts.map +1 -0
  96. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
  97. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
  98. package/lib/typescript/src/plugins/normalizer/index.d.ts +3 -0
  99. package/lib/typescript/src/plugins/normalizer/index.d.ts.map +1 -0
  100. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +3 -0
  101. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +1 -0
  102. package/lib/typescript/src/{utils → plugins/normalizer}/normalizer.d.ts +1 -1
  103. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -0
  104. package/lib/typescript/src/plugins/withPlugins.d.ts +3 -0
  105. package/lib/typescript/src/plugins/withPlugins.d.ts.map +1 -0
  106. package/lib/typescript/src/types/breakpoints.d.ts +3 -4
  107. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  108. package/lib/typescript/src/types/core.d.ts +4 -9
  109. package/lib/typescript/src/types/core.d.ts.map +1 -1
  110. package/lib/typescript/src/types/index.d.ts +3 -1
  111. package/lib/typescript/src/types/index.d.ts.map +1 -1
  112. package/lib/typescript/src/types/plugin.d.ts +7 -0
  113. package/lib/typescript/src/types/plugin.d.ts.map +1 -0
  114. package/lib/typescript/src/types/unistyles.d.ts +11 -2
  115. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  116. package/lib/typescript/src/types/variants.d.ts +8 -0
  117. package/lib/typescript/src/types/variants.d.ts.map +1 -0
  118. package/lib/typescript/src/useStyles.d.ts +2 -2
  119. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  120. package/lib/typescript/src/utils/breakpoints.d.ts +2 -5
  121. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  122. package/lib/typescript/src/utils/index.d.ts +2 -5
  123. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  124. package/lib/typescript/src/utils/mqParser.d.ts +12 -0
  125. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
  126. package/lib/typescript/src/utils/styles.d.ts +3 -3
  127. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  128. package/lib/typescript/src/utils/variants.d.ts +1 -1
  129. package/lib/typescript/src/utils/variants.d.ts.map +1 -1
  130. package/package.json +4 -1
  131. package/src/__tests__/mocks.ts +24 -0
  132. package/src/common.ts +22 -7
  133. package/src/core/UnistyleRegistry.ts +46 -2
  134. package/src/core/UnistylesRuntime.ts +14 -20
  135. package/src/core/index.ts +1 -0
  136. package/src/hooks/useUnistyles.ts +7 -2
  137. package/src/index.ts +3 -1
  138. package/src/plugins/index.ts +3 -0
  139. package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
  140. package/src/plugins/normalizer/index.ts +2 -0
  141. package/src/{utils/normalizeStyles.web.ts → plugins/normalizer/normalizeStyle.ts} +3 -3
  142. package/src/{utils → plugins/normalizer}/normalizer.ts +1 -1
  143. package/src/plugins/withPlugins.ts +17 -0
  144. package/src/types/breakpoints.ts +5 -4
  145. package/src/types/core.ts +5 -10
  146. package/src/types/index.ts +12 -1
  147. package/src/types/plugin.ts +7 -0
  148. package/src/types/unistyles.ts +14 -4
  149. package/src/types/variants.ts +11 -0
  150. package/src/useStyles.ts +12 -6
  151. package/src/utils/breakpoints.ts +10 -75
  152. package/src/utils/index.ts +2 -5
  153. package/src/utils/mq.ts +1 -1
  154. package/src/utils/mqParser.ts +4 -4
  155. package/src/utils/styles.ts +35 -20
  156. package/src/utils/variants.ts +5 -9
  157. package/lib/commonjs/utils/common.js +0 -25
  158. package/lib/commonjs/utils/common.js.map +0 -1
  159. package/lib/commonjs/utils/normalizeStyles.js +0 -10
  160. package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
  161. package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
  162. package/lib/commonjs/utils/normalizer.js.map +0 -1
  163. package/lib/module/utils/common.js +0 -17
  164. package/lib/module/utils/common.js.map +0 -1
  165. package/lib/module/utils/normalizeStyles.js +0 -3
  166. package/lib/module/utils/normalizeStyles.js.map +0 -1
  167. package/lib/module/utils/normalizeStyles.web.js.map +0 -1
  168. package/lib/module/utils/normalizer.js.map +0 -1
  169. package/lib/typescript/src/utils/common.d.ts +0 -12
  170. package/lib/typescript/src/utils/common.d.ts.map +0 -1
  171. package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
  172. package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
  173. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
  174. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
  175. package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
  176. package/src/utils/common.ts +0 -20
  177. package/src/utils/normalizeStyles.ts +0 -2
  178. /package/lib/commonjs/{utils → plugins/normalizer}/module.d.js +0 -0
  179. /package/lib/commonjs/{utils → plugins/normalizer}/normalizer.js +0 -0
  180. /package/lib/module/{utils → plugins/normalizer}/module.d.js +0 -0
  181. /package/lib/module/{utils → plugins/normalizer}/normalizer.js +0 -0
  182. /package/src/{utils → plugins/normalizer}/module.d.ts +0 -0
@@ -19,6 +19,9 @@ std::vector<jsi::PropNameID> UnistylesRuntime::getPropertyNames(jsi::Runtime& ru
19
19
  properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("useBreakpoints")));
20
20
  properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("useTheme")));
21
21
  properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("useAdaptiveThemes")));
22
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("addPlugin")));
23
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("removePlugin")));
24
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("enabledPlugins")));
22
25
 
23
26
  // setters
24
27
  properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("themes")));
@@ -57,6 +60,16 @@ jsi::Value UnistylesRuntime::get(jsi::Runtime& runtime, const jsi::PropNameID& p
57
60
  if (propName == "colorScheme") {
58
61
  return jsi::Value(jsi::String::createFromUtf8(runtime, this->colorScheme));
59
62
  }
63
+
64
+ if (propName == "enabledPlugins") {
65
+ auto jsiArray = facebook::jsi::Array(runtime, this->pluginNames.size());
66
+
67
+ for (size_t i = 0; i < this->pluginNames.size(); i++) {
68
+ jsiArray.setValueAtIndex(runtime, i, facebook::jsi::String::createFromUtf8(runtime, this->pluginNames[i]));
69
+ }
70
+
71
+ return jsiArray;
72
+ }
60
73
 
61
74
  if (propName == "sortedBreakpointPairs") {
62
75
  std::unique_ptr<jsi::Array> sortedBreakpointEntriesArray = std::make_unique<jsi::Array>(runtime, this->sortedBreakpointPairs.size());
@@ -72,6 +85,47 @@ jsi::Value UnistylesRuntime::get(jsi::Runtime& runtime, const jsi::PropNameID& p
72
85
 
73
86
  return jsi::Value(runtime, *sortedBreakpointEntriesArray);
74
87
  }
88
+
89
+ if (propName == "addPlugin") {
90
+ return jsi::Function::createFromHostFunction(
91
+ runtime,
92
+ jsi::PropNameID::forAscii(runtime, "addPlugin"),
93
+ 1,
94
+ [this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
95
+ std::string pluginName = arguments[0].asString(runtime).utf8(runtime);
96
+ bool notify = arguments[1].asBool();
97
+
98
+ this->pluginNames.push_back(pluginName);
99
+
100
+ // registry enabled plugins won't notify listeners
101
+ if (notify) {
102
+ this->onPluginChangeCallback();
103
+ }
104
+
105
+ return jsi::Value::undefined();
106
+ }
107
+ );
108
+ }
109
+
110
+ if (propName == "removePlugin") {
111
+ return jsi::Function::createFromHostFunction(
112
+ runtime,
113
+ jsi::PropNameID::forAscii(runtime, "removePlugin"),
114
+ 1,
115
+ [this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
116
+ std::string pluginName = arguments[0].asString(runtime).utf8(runtime);
117
+
118
+ auto it = std::find(this->pluginNames.begin(), this->pluginNames.end(), pluginName);
119
+
120
+ if (it != this->pluginNames.end()) {
121
+ this->pluginNames.erase(it);
122
+ this->onPluginChangeCallback();
123
+ }
124
+
125
+ return jsi::Value::undefined();
126
+ }
127
+ );
128
+ }
75
129
 
76
130
  if (propName == "useBreakpoints") {
77
131
  return jsi::Function::createFromHostFunction(
@@ -218,7 +272,7 @@ void UnistylesRuntime::handleScreenSizeChange(int width, int height) {
218
272
  this->screenWidth = width;
219
273
  this->screenHeight = height;
220
274
 
221
- int orientation = width > height
275
+ std::string orientation = width > height
222
276
  ? UnistylesOrientationLandscape
223
277
  : UnistylesOrientationPortrait;
224
278
 
@@ -5,8 +5,8 @@
5
5
 
6
6
  using namespace facebook;
7
7
 
8
- const int UnistylesOrientationPortrait = 1;
9
- const int UnistylesOrientationLandscape = 2;
8
+ const std::string UnistylesOrientationPortrait = "portrait";
9
+ const std::string UnistylesOrientationLandscape = "landscape";
10
10
 
11
11
  const std::string UnistylesDarkScheme = "dark";
12
12
  const std::string UnistylesLightScheme = "light";
@@ -19,7 +19,8 @@ const std::string UnistylesErrorThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CA
19
19
  class JSI_EXPORT UnistylesRuntime : public jsi::HostObject {
20
20
  private:
21
21
  std::function<void(std::string)> onThemeChangeCallback;
22
- std::function<void(std::string breakpoint, int layout, int screenWidth, int screenHeight)> onLayoutChangeCallback;
22
+ std::function<void(std::string breakpoint, std::string orientation, int screenWidth, int screenHeight)> onLayoutChangeCallback;
23
+ std::function<void()> onPluginChangeCallback;
23
24
 
24
25
  int screenWidth;
25
26
  int screenHeight;
@@ -37,6 +38,7 @@ public:
37
38
 
38
39
  std::string themeName;
39
40
  std::string breakpoint;
41
+ std::vector<std::string> pluginNames;
40
42
  std::vector<std::string> themes;
41
43
  std::vector<std::pair<std::string, double>> sortedBreakpointPairs;
42
44
 
@@ -44,9 +46,13 @@ public:
44
46
  this->onThemeChangeCallback = callback;
45
47
  }
46
48
 
47
- void onLayoutChange(std::function<void(std::string breakpoint, int layout, int screenWidth, int screenHeight)> callback) {
49
+ void onLayoutChange(std::function<void(std::string breakpoint, std::string orientation, int screenWidth, int screenHeight)> callback) {
48
50
  this->onLayoutChangeCallback = callback;
49
51
  }
52
+
53
+ void onPluginChange(std::function<void()> callback) {
54
+ this->onPluginChangeCallback = callback;
55
+ }
50
56
 
51
57
  jsi::Value get(jsi::Runtime&, const jsi::PropNameID& name) override;
52
58
  void set(jsi::Runtime& runtime, const jsi::PropNameID& propNameId, const jsi::Value& value) override;
@@ -130,12 +130,12 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
130
130
  [weakSelf emitEvent:@"onChange" withBody:body];
131
131
  });
132
132
 
133
- unistylesRuntime.get()->onLayoutChange([=](std::string breakpoint, int orientation, int width, int height) {
133
+ unistylesRuntime.get()->onLayoutChange([=](std::string breakpoint, std::string orientation, int width, int height) {
134
134
  NSDictionary *body = @{
135
135
  @"type": @"layout",
136
136
  @"payload": @{
137
137
  @"breakpoint": cxxStringToNSString(breakpoint),
138
- @"orientation": @(orientation),
138
+ @"orientation": cxxStringToNSString(orientation),
139
139
  @"screen": @{
140
140
  @"width": @(width),
141
141
  @"height": @(height)
@@ -145,6 +145,16 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
145
145
 
146
146
  [weakSelf emitEvent:@"onChange" withBody:body];
147
147
  });
148
+
149
+ unistylesRuntime.get()->onPluginChange([=]() {
150
+ NSDictionary *body = @{
151
+ @"type": @"plugin"
152
+ };
153
+
154
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
155
+ [weakSelf emitEvent:@"onChange" withBody:body];
156
+ });
157
+ });
148
158
 
149
159
  weakSelf.unistylesRuntime = unistylesRuntime.get();
150
160
 
@@ -3,10 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.UnistylesError = exports.ScreenOrientation = exports.CxxUnistylesEventTypes = void 0;
6
+ exports.warn = exports.isWeb = exports.isServer = exports.isMobile = exports.isIOS = exports.isAndroid = exports.UnistylesError = exports.ScreenOrientation = exports.CxxUnistylesEventTypes = void 0;
7
+ var _reactNative = require("react-native");
8
+ const warn = message => {
9
+ console.warn(`🦄 [react-native-unistyles]: ${message}`);
10
+ };
11
+ exports.warn = warn;
12
+ const isMobile = exports.isMobile = _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios';
13
+ const isWeb = exports.isWeb = _reactNative.Platform.OS === 'web';
14
+ const isIOS = exports.isIOS = _reactNative.Platform.OS === 'ios';
15
+ const isAndroid = exports.isAndroid = _reactNative.Platform.OS === 'android';
16
+ const isServer = exports.isServer = typeof window === 'undefined';
17
+ const ScreenOrientation = exports.ScreenOrientation = {
18
+ Landscape: 'landscape',
19
+ Portrait: 'portrait'
20
+ };
7
21
  let CxxUnistylesEventTypes = exports.CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
8
22
  CxxUnistylesEventTypes["Theme"] = "theme";
9
23
  CxxUnistylesEventTypes["Layout"] = "layout";
24
+ CxxUnistylesEventTypes["Plugin"] = "plugin";
10
25
  return CxxUnistylesEventTypes;
11
26
  }({});
12
27
  let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
@@ -16,11 +31,9 @@ let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesEr
16
31
  UnistylesError["ThemesCannotBeEmpty"] = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY";
17
32
  UnistylesError["BreakpointsCannotBeEmpty"] = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY";
18
33
  UnistylesError["BreakpointsMustStartFromZero"] = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO";
34
+ UnistylesError["InvalidPluginName"] = "UNISTYLES_ERROR_INVALID_PLUGIN_NAME";
35
+ UnistylesError["DuplicatePluginName"] = "UNISTYLES_ERROR_DUPLICATE_PLUGIN_NAME";
36
+ UnistylesError["CantRemoveInternalPlugin"] = "UNISTYLES_ERROR_CANT_REMOVE_INTERNAL_PLUGIN";
19
37
  return UnistylesError;
20
- }({}); // todo to string?
21
- let ScreenOrientation = exports.ScreenOrientation = /*#__PURE__*/function (ScreenOrientation) {
22
- ScreenOrientation[ScreenOrientation["Portrait"] = 1] = "Portrait";
23
- ScreenOrientation[ScreenOrientation["Landscape"] = 2] = "Landscape";
24
- return ScreenOrientation;
25
38
  }({});
26
39
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CxxUnistylesEventTypes","exports","UnistylesError","ScreenOrientation"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;IAAYA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IAKtBE,cAAc,GAAAD,OAAA,CAAAC,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA,OAS1B;AAAA,IACYC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA"}
1
+ {"version":3,"names":["_reactNative","require","warn","message","console","exports","isMobile","Platform","OS","isWeb","isIOS","isAndroid","isServer","window","ScreenOrientation","Landscape","Portrait","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEM,MAAMI,QAAQ,GAAAD,OAAA,CAAAC,QAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAID,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnE,MAAMC,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGH,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMG,SAAS,GAAAN,OAAA,CAAAM,SAAA,GAAGJ,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMI,QAAQ,GAAAP,OAAA,CAAAO,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW;AAE9C,MAAMC,iBAAiB,GAAAT,OAAA,CAAAS,iBAAA,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAAA,IAEEC,sBAAsB,GAAAZ,OAAA,CAAAY,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IAMtBC,cAAc,GAAAb,OAAA,CAAAa,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.UnistyleRegistry = void 0;
7
+ var _common = require("../common");
7
8
  class UnistyleRegistry {
8
9
  config = {};
10
+ plugins = [];
9
11
  themeNames = [];
10
12
  themes = {};
11
13
  breakpoints = {};
@@ -31,8 +33,54 @@ class UnistyleRegistry {
31
33
  if (config.adaptiveThemes) {
32
34
  this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes);
33
35
  }
34
- return this;
36
+ if (config.experimentalPlugins) {
37
+ config.experimentalPlugins.forEach(plugin => this.addPlugin(plugin, false));
38
+ }
39
+ if (config.initialTheme) {
40
+ this.unistylesBridge.useTheme(config.initialTheme);
41
+ }
42
+ };
43
+ getTheme = forName => {
44
+ if (this.themeNames.length === 0) {
45
+ return {};
46
+ }
47
+ if (!this.hasTheme(forName)) {
48
+ throw new Error(_common.UnistylesError.ThemeNotFound);
49
+ }
50
+ return this.themes[forName];
51
+ };
52
+ addPlugin = (() => {
53
+ var _this = this;
54
+ return function (plugin) {
55
+ let notify = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
56
+ if (plugin.name.startsWith('__unistyles')) {
57
+ throw new Error(_common.UnistylesError.InvalidPluginName);
58
+ }
59
+ if (_this.plugins.some(_ref => {
60
+ let {
61
+ name
62
+ } = _ref;
63
+ return name === plugin.name;
64
+ })) {
65
+ throw new Error(_common.UnistylesError.DuplicatePluginName);
66
+ }
67
+ _this.plugins = _this.plugins.concat([plugin]);
68
+ _this.unistylesBridge.addPlugin(plugin.name, notify);
69
+ };
70
+ })();
71
+ removePlugin = plugin => {
72
+ if (plugin.name.startsWith('__unistyles')) {
73
+ throw new Error(_common.UnistylesError.CantRemoveInternalPlugin);
74
+ }
75
+ this.plugins = this.plugins.filter(_ref2 => {
76
+ let {
77
+ name
78
+ } = _ref2;
79
+ return name !== plugin.name;
80
+ });
81
+ this.unistylesBridge.removePlugin(plugin.name);
35
82
  };
83
+ hasTheme = name => name in this.themes;
36
84
  }
37
85
  exports.UnistyleRegistry = UnistyleRegistry;
38
86
  //# sourceMappingURL=UnistyleRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleRegistry","config","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","useBreakpoints","addConfig","adaptiveThemes","useAdaptiveThemes","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAGO,MAAMA,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO,IAAI;EACf,CAAC;EAEME,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe,CAACK,cAAc,CAACR,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO,IAAI;EACf,CAAC;EAEMQ,SAAS,GAAIZ,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAIA,MAAM,CAACa,cAAc,EAAE;MACvB,IAAI,CAACP,eAAe,CAACQ,iBAAiB,CAACd,MAAM,CAACa,cAAc,CAAC;IACjE;IAEA,OAAO,IAAI;EACf,CAAC;AACL;AAACE,OAAA,CAAAhB,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_common","require","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","useBreakpoints","addConfig","adaptiveThemes","useAdaptiveThemes","experimentalPlugins","forEach","plugin","addPlugin","initialTheme","useTheme","getTheme","forName","length","hasTheme","Error","UnistylesError","ThemeNotFound","_this","notify","arguments","undefined","name","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","concat","removePlugin","CantRemoveInternalPlugin","filter","_ref2","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,gBAAgB,CAAC;EACnBC,MAAM,GAA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O,CAACyC,MAAM,CAACC,KAAA;MAAA,IAAC;QAAEV;MAAK,CAAC,GAAAU,KAAA;MAAA,OAAKV,IAAI,KAAKf,MAAM,CAACe,IAAI;IAAA,EAAC;IACtE,IAAI,CAAC1B,eAAe,CAACiC,YAAY,CAACtB,MAAM,CAACe,IAAI,CAAC;EAClD,CAAC;EAEMR,QAAQ,GAAIQ,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAC9B,MAAM;AAC1E;AAACyC,OAAA,CAAA7C,gBAAA,GAAAA,gBAAA"}
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.UnistylesRuntime = void 0;
7
7
  var _common = require("../common");
8
8
  class UnistylesRuntime {
9
- constructor(unistylesBridge, registry) {
9
+ constructor(unistylesBridge, unistylesRegistry) {
10
10
  this.unistylesBridge = unistylesBridge;
11
- this.registry = registry;
11
+ this.unistylesRegistry = unistylesRegistry;
12
12
  }
13
13
  get colorScheme() {
14
14
  return this.unistylesBridge.colorScheme;
@@ -16,15 +16,15 @@ class UnistylesRuntime {
16
16
  get hasAdaptiveThemes() {
17
17
  return this.unistylesBridge.hasAdaptiveThemes;
18
18
  }
19
- get sortedBreakpoints() {
20
- return this.registry.sortedBreakpointPairs;
21
- }
22
19
  get themeName() {
23
20
  return this.unistylesBridge.themeName;
24
21
  }
25
22
  get breakpoint() {
26
23
  return this.unistylesBridge.breakpoint;
27
24
  }
25
+ get enabledPlugins() {
26
+ return this.unistylesBridge.enabledPlugins;
27
+ }
28
28
  get screen() {
29
29
  return {
30
30
  width: this.unistylesBridge.screenWidth,
@@ -42,25 +42,21 @@ class UnistylesRuntime {
42
42
  return _common.ScreenOrientation.Portrait;
43
43
  }
44
44
  setTheme = name => {
45
- if (this.hasTheme(name)) {
45
+ if (this.unistylesRegistry.hasTheme(name)) {
46
46
  this.unistylesBridge.useTheme(name);
47
47
  return true;
48
48
  }
49
49
  throw new Error(_common.UnistylesError.ThemeNotRegistered);
50
50
  };
51
- getTheme = forName => {
52
- if (this.registry.themeNames.length === 0) {
53
- return {};
54
- }
55
- if (!this.hasTheme(forName)) {
56
- throw new Error(_common.UnistylesError.ThemeNotFound);
57
- }
58
- return this.registry.themes[forName];
59
- };
60
51
  setAdaptiveThemes = enable => {
61
52
  this.unistylesBridge.useAdaptiveThemes(enable);
62
53
  };
63
- hasTheme = name => name in this.registry.themes;
54
+ addPlugin = plugin => {
55
+ this.unistylesRegistry.addPlugin(plugin);
56
+ };
57
+ removePlugin = plugin => {
58
+ this.unistylesRegistry.removePlugin(plugin);
59
+ };
64
60
  }
65
61
  exports.UnistylesRuntime = UnistylesRuntime;
66
62
  //# sourceMappingURL=UnistylesRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","hasAdaptiveThemes","sortedBreakpoints","sortedBreakpointPairs","themeName","breakpoint","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","getTheme","forName","themeNames","length","ThemeNotFound","themes","setAdaptiveThemes","enable","useAdaptiveThemes","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,QAA0B,EAAE;IAAA,KAAtED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,QAA0B,GAA1BA,QAA0B;EAAG;EAE3F,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,QAAQ,CAACI,qBAAqB;EAC9C;EAEA,IAA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AAQ,GAAID,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAACjB,QAAQ,CAAC4B,MAAM;AACpF;AAACI,OAAA,CAAAnC,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;EAEpG,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACL,eAAe,CAACK,UAAU;EAC1C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACN,eAAe,CAACM,cAAc;EAC9C;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACR,eAAe,CAACS,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACV,eAAe,CAACW;IACjC,CAAC;EACL;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,MAAM;MAAEJ,KAAK;MAAEE;IAAO,CAAC,GAAG,IAAI,CAACH,MAAM;IAErC,IAAIC,KAAK,GAAGE,MAAM,EAAE;MAChB,OAAOG,yBAAiB,CAACC,SAAS;IACtC;IAEA,OAAOD,yBAAiB,CAACE,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAI,IAAI,CAAChB,iBAAiB,CAACiB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACjB,eAAe,CAACmB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;EACtD,CAAC;EAEMC,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAACxB,eAAe,CAACyB,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEME,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAC1B,iBAAiB,CAACyB,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;EAEMC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC1B,iBAAiB,CAAC2B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAA/B,gBAAA,GAAAA,gBAAA"}
@@ -10,7 +10,8 @@ var _core = require("../core");
10
10
  var _common = require("../common");
11
11
  const unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
12
12
  const useUnistyles = () => {
13
- const [theme, setTheme] = (0, _react.useState)(_core.unistyles.runtime.getTheme(_core.unistyles.runtime.themeName));
13
+ const [plugins, setPlugins] = (0, _react.useState)(_core.unistyles.runtime.enabledPlugins);
14
+ const [theme, setTheme] = (0, _react.useState)(_core.unistyles.registry.getTheme(_core.unistyles.runtime.themeName));
14
15
  const [layout, setLayout] = (0, _react.useState)({
15
16
  breakpoint: _core.unistyles.runtime.breakpoint,
16
17
  orientation: _core.unistyles.runtime.orientation,
@@ -25,7 +26,7 @@ const useUnistyles = () => {
25
26
  case _common.CxxUnistylesEventTypes.Theme:
26
27
  {
27
28
  const themeEvent = event;
28
- return setTheme(_core.unistyles.runtime.getTheme(themeEvent.payload.themeName));
29
+ return setTheme(_core.unistyles.registry.getTheme(themeEvent.payload.themeName));
29
30
  }
30
31
  case _common.CxxUnistylesEventTypes.Layout:
31
32
  {
@@ -39,6 +40,10 @@ const useUnistyles = () => {
39
40
  }
40
41
  });
41
42
  }
43
+ case _common.CxxUnistylesEventTypes.Plugin:
44
+ {
45
+ return setPlugins(_core.unistyles.runtime.enabledPlugins);
46
+ }
42
47
  default:
43
48
  return;
44
49
  }
@@ -46,6 +51,7 @@ const useUnistyles = () => {
46
51
  return subscription.remove;
47
52
  }, []);
48
53
  return {
54
+ plugins,
49
55
  theme,
50
56
  layout
51
57
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","theme","setTheme","useState","unistyles","runtime","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","CxxUnistylesEventTypes","Theme","themeEvent","payload","Layout","layoutEvent","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAGA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,eAAS,CAACC,OAAO,CAACC,QAAQ,CAACF,eAAS,CAACC,OAAO,CAACE,SAAS,CAAC,CAAC;EAC3F,MAAM,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names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","CxxUnistylesEventTypes","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAGA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAACC,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAL,eAAQ,EAACC,eAAS,CAACK,QAAQ,CAACC,QAAQ,CAACN,eAAS,CAACC,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAV,eAAQ,EAAC;IACjCW,UAAU,EAAEV,eAAS,CAACC,OAAO,CAACS,UAAU;IACxCC,WAAW,EAAEX,eAAS,CAACC,OAAO,CAACU,WAAW;IAC1CC,UAAU,EAAE;MACRC,KAAK,EAAEb,eAAS,CAACC,OAAO,CAACa,MAAM,CAACD,KAAK;MACrCE,MAAM,EAAEf,eAAS,CAACC,OAAO,CAACa,MAAM,CAACC;IACrC;EACJ,CAAC,CAAC;EAEF,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGzB,eAAe,CAAC0B,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKC,8BAAsB,CAACC,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGJ,KAA4B;YAE/C,OAAOf,QAAQ,CAACJ,eAAS,CAACK,QAAQ,CAACC,QAAQ,CAACiB,UAAU,CAACC,OAAO,CAACjB,SAAS,CAAC,CAAC;UAC9E;QACA,KAAKc,8BAAsB,CAACI,MAAM;UAAE;YAChC,MAAMC,WAAW,GAAGP,KAAmC;YAEvD,OAAOV,SAAS,CAAC;cACbC,UAAU,EAAEgB,WAAW,CAACF,OAAO,CAACd,UAAU;cAC1CC,WAAW,EAAEe,WAAW,CAACF,OAAO,CAACb,WAAW;cAC5CC,UAAU,EAAE;gBACRC,KAAK,EAAEa,WAAW,CAACF,OAAO,CAACV,MAAM,CAACD,KAAK;gBACvCE,MAAM,EAAEW,WAAW,CAACF,OAAO,CAACV,MAAM,CAACC;cACvC;YACJ,CAAC,CAAC;UACN;QACA,KAAKM,8BAAsB,CAACM,MAAM;UAAE;YAChC,OAAO7B,UAAU,CAACE,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;UACvD;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOe,YAAY,CAACW,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH/B,OAAO;IACPM,KAAK;IACLK;EACJ,CAAC;AACL,CAAC;AAAAqB,OAAA,CAAAjC,YAAA,GAAAA,YAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_core","require","_utils","_hooks","_common","_useStyles","_createStyleSheet","UnistylesRegistry","exports","addThemes","unistyles","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAEA,MAAMM,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EACtBE,SAAS,EAAEC,eAAS,CAACC,QAAQ,CAACF,SAAS;EACvCG,cAAc,EAAEF,eAAS,CAACC,QAAQ,CAACC,cAAc;EACjDC,SAAS,EAAEH,eAAS,CAACC,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAAN,OAAA,CAAAM,gBAAA,GAAGJ,eAAS,CAACK,OAAO"}
1
+ {"version":3,"names":["_core","require","_utils","_hooks","_common","_useStyles","_createStyleSheet","UnistylesRegistry","exports","addThemes","unistyles","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAEA,MAAMM,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EACtBE,SAAS,EAAEC,eAAS,CAACC,QAAQ,CAACF,SAAS;EACvCG,cAAc,EAAEF,eAAS,CAACC,QAAQ,CAACC,cAAc;EACjDC,SAAS,EAAEH,eAAS,CAACC,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAAN,OAAA,CAAAM,gBAAA,GAAGJ,eAAS,CAACK,OAAO"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "normalizeColor", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _normalizer.normalizeColor;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "normalizeNumericValue", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _normalizer.normalizeNumericValue;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "normalizeStyle", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _normalizer.normalizeStyle;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "normalizeWebStylesPlugin", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _normalizeWebStylesPlugin.normalizeWebStylesPlugin;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "preprocessor", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _normalizer.preprocessor;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "withPlugins", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _withPlugins.withPlugins;
40
+ }
41
+ });
42
+ var _normalizeWebStylesPlugin = require("./normalizeWebStylesPlugin");
43
+ var _normalizer = require("./normalizer");
44
+ var _withPlugins = require("./withPlugins");
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeWebStylesPlugin","require","_normalizer","_withPlugins"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeWebStylesPlugin = void 0;
7
+ var _normalizer = require("./normalizer");
8
+ const normalizeWebStylesPlugin = exports.normalizeWebStylesPlugin = {
9
+ name: '__unistylesNormalizeWebStyles',
10
+ onParsedStyle: (_key, styles) => (0, _normalizer.normalizeStyle)(styles)
11
+ };
12
+ //# sourceMappingURL=normalizeWebStylesPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizer","require","normalizeWebStylesPlugin","exports","name","onParsedStyle","_key","styles","normalizeStyle"],"sourceRoot":"../../../src","sources":["plugins/normalizeWebStylesPlugin.ts"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,wBAAyC,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACrDE,IAAI,EAAE,+BAA+B;EACrCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,KAAK,IAAAC,0BAAc,EAACD,MAAM;AAC1D,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "normalizeColor", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _normalizer.normalizeColor;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "normalizeNumericValue", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _normalizer.normalizeNumericValue;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "normalizeStyle", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _normalizeStyle.normalizeStyle;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "preprocessor", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _normalizer.preprocessor;
28
+ }
29
+ });
30
+ var _normalizeStyle = require("./normalizeStyle");
31
+ var _normalizer = require("./normalizer");
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeStyle","require","_normalizer"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["plugins/normalizer/module.d.ts"],"mappings":""}
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.normalizeStyles = void 0;
7
- var _common = require("./common");
6
+ exports.normalizeStyle = void 0;
8
7
  var _normalizer = require("./normalizer");
8
+ var _common = require("../../common");
9
9
  const normalizeBoxShadow = style => {
10
10
  const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
11
11
  if (!requiredBoxShadowProperties.every(prop => prop in style)) {
@@ -42,7 +42,7 @@ const normalizeTextShadow = style => {
42
42
  textShadowRadius: undefined
43
43
  };
44
44
  };
45
- const normalizeStyles = style => {
45
+ const normalizeStyle = style => {
46
46
  const normalizedTransform = 'transform' in style && Array.isArray(style.transform) ? {
47
47
  transform: _normalizer.preprocessor.createTransformValue(style.transform)
48
48
  } : {};
@@ -55,5 +55,5 @@ const normalizeStyles = style => {
55
55
  ...normalizedTextShadow
56
56
  };
57
57
  };
58
- exports.normalizeStyles = normalizeStyles;
59
- //# sourceMappingURL=normalizeStyles.web.js.map
58
+ exports.normalizeStyle = normalizeStyle;
59
+ //# sourceMappingURL=normalizeStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizer","require","_common","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","preprocessor","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyle","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow","exports"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/normalizeStyle.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,MAAME,kBAAkB,GAAyBC,KAAQ,IAA0B;EAC/E,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2B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b,wBAAY,CAACc,oBAAoB,CAAC1B,KAAK,CAACyB,SAAS;EAAE,CAAC,GACjE,CAAC,CAAC;EAER,MAAME,mBAAmB,GACrB,aAAa,IAAI3B,KAAK,IACtB,cAAc,IAAIA,KAAK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM4B,oBAAoB,GACtB,iBAAiB,IAAI5B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3Bc,mBAAmB,CAACd,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGsB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,cAAA,GAAAA,cAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeColors","_interopRequireDefault","require","obj","__esModule","default","normalizeColor","color","opacity","arguments","length","undefined","integer","normalizeColors","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","exports","normalizeNumericValue","value","normalizeTransform","key","includes","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","createBoxShadowValue","shadowColor","shadowOffset","shadowOpacity","shadowRadius","createTransformValue","transforms","transform","Object","keys","join","Boolean","preprocessor"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/normalizer.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAF5D;AACA;;AAUO,MAAMG,cAAc,GAAG,SAAAA,CAACC,KAAa,EAA0B;EAAA,IAAxBC,OAAe,GAAAC,SAAA,CAAAC,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AAK,GAAGqB,SAAS,CAACnB,GAAG,CAA2B;EAEtD,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAQ,GAAEA,GAAI,IAAIF,KAAK,CAAmBwB,IAAI,CAAC,GAAG,CAAE,GAAE;IAC1D;MACI,OAAQ,GAAEtB,GAAI,IAAGD,kBAAkB,CAACC,GAAG,EAAEF,KAAK,CAAE,GAAE;EAC1D;AACJ,CAAC,CAAC,CACDL,MAAM,CAAC8B,OAAO,CAAC,CACfD,IAAI,CAAC,GAAG,CAAC;AAEP,MAAME,YAA0B,GAAA5B,OAAA,CAAA4B,YAAA,GAAG;EACtCtB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withPlugins = void 0;
7
+ var _normalizeWebStylesPlugin = require("./normalizeWebStylesPlugin");
8
+ var _common = require("../common");
9
+ var _core = require("../core");
10
+ const UNISTYLES_PLUGINS = _common.isWeb ? [_normalizeWebStylesPlugin.normalizeWebStylesPlugin] : [];
11
+ const withPlugins = (key, style) => _core.unistyles.registry.plugins.concat(UNISTYLES_PLUGINS).reduce((acc, plugin) => {
12
+ if (plugin.onParsedStyle) {
13
+ return plugin.onParsedStyle(key, acc, _core.unistyles.runtime);
14
+ }
15
+ return acc;
16
+ }, style);
17
+ exports.withPlugins = withPlugins;
18
+ //# sourceMappingURL=withPlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeWebStylesPlugin","require","_common","_core","UNISTYLES_PLUGINS","isWeb","normalizeWebStylesPlugin","withPlugins","key","style","unistyles","registry","plugins","concat","reduce","acc","plugin","onParsedStyle","runtime","exports"],"sourceRoot":"../../../src","sources":["plugins/withPlugins.ts"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,MAAMG,iBAAiB,GAAGC,aAAK,GACzB,CAACC,kDAAwB,CAAC,GAC1B,EAAE;AAED,MAAMC,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAc,KAAKC,eAAS,CAACC,QAAQ,CAACC,OAAO,CAACC,MAAM,CAACT,iBAAiB,CAAC,CAC3GU,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACrB,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACT,GAAG,EAAEO,GAAG,EAAEL,eAAS,CAACQ,OAAO,CAAC;EAC5D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEN,KAAK,CAAC;AAAAU,OAAA,CAAAZ,WAAA,GAAAA,WAAA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/module.d.ts"],"mappings":""}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/plugin.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=variants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/module.d.ts"],"mappings":""}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/variants.ts"],"mappings":""}