react-native-unistyles 3.0.0-alpha.29 → 3.0.0-alpha.30
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Helpers.h +11 -0
- package/cxx/core/HostStyle.cpp +1 -1
- package/cxx/core/UnistyleWrapper.h +9 -8
- package/cxx/core/UnistylesCommitHook.cpp +3 -14
- package/cxx/core/UnistylesCommitHook.h +5 -11
- package/cxx/core/UnistylesMountHook.cpp +0 -1
- package/cxx/core/UnistylesMountHook.h +0 -2
- package/cxx/core/UnistylesRegistry.cpp +1 -1
- package/cxx/core/UnistylesRegistry.h +1 -1
- package/cxx/hybridObjects/HybridStyleSheet.cpp +17 -11
- package/cxx/hybridObjects/HybridStyleSheet.h +1 -1
- package/cxx/parser/Parser.cpp +20 -14
- package/cxx/parser/Parser.h +1 -1
- package/cxx/shadowTree/ShadowTrafficController.h +4 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +3 -4
- package/cxx/shadowTree/ShadowTreeManager.h +1 -1
- package/ios/UnistylesModuleOnLoad.mm +4 -4
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.js +18 -0
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.native.js +45 -0
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +2 -0
- package/lib/commonjs/core/index.js +7 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/core/useBreakpoint.js.map +1 -1
- package/lib/commonjs/core/useBreakpoint.native.js.map +2 -1
- package/lib/commonjs/core/useTheme.js.map +2 -1
- package/lib/commonjs/core/useTheme.native.js.map +2 -1
- package/lib/commonjs/global.js +3 -0
- package/lib/commonjs/index.js +8 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +1 -4
- package/lib/commonjs/mq.js.map +2 -1
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +5 -4
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/commonjs/specs/NativePlatform/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +2 -1
- package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -2
- package/lib/commonjs/specs/index.web.js.map +1 -2
- package/lib/commonjs/specs/types.js +10 -10
- package/lib/commonjs/specs/types.js.map +2 -1
- package/lib/commonjs/types/accessibility.js +9 -9
- package/lib/commonjs/types/accessibility.js.map +1 -1
- package/lib/commonjs/types/common.js +3 -0
- package/lib/commonjs/types/core.js.map +1 -1
- package/lib/commonjs/types/index.js.map +2 -1
- package/lib/commonjs/types/stylesheet.js +1 -2
- package/lib/commonjs/web/convert/index.js +1 -7
- package/lib/commonjs/web/convert/index.js.map +2 -1
- package/lib/commonjs/web/convert/pseudo.js.map +2 -1
- package/lib/commonjs/web/convert/shadow.js.map +2 -1
- package/lib/commonjs/web/convert/style.js.map +2 -1
- package/lib/commonjs/web/convert/textShadow.js +1 -4
- package/lib/commonjs/web/convert/textShadow.js.map +2 -1
- package/lib/commonjs/web/convert/transform.js.map +2 -1
- package/lib/commonjs/web/convert/utils.js +1 -2
- package/lib/commonjs/web/convert/utils.js.map +2 -1
- package/lib/commonjs/web/index.js.map +2 -1
- package/lib/commonjs/web/listener.js.map +2 -1
- package/lib/commonjs/web/mock.js.map +2 -1
- package/lib/commonjs/web/mq.js.map +1 -1
- package/lib/commonjs/web/registry.js +1 -3
- package/lib/commonjs/web/registry.js.map +2 -1
- package/lib/commonjs/web/runtime.js.map +2 -1
- package/lib/commonjs/web/shadowRegistry.js +1 -9
- package/lib/commonjs/web/shadowRegistry.js.map +2 -1
- package/lib/commonjs/web/state.js +1 -5
- package/lib/commonjs/web/state.js.map +2 -1
- package/lib/commonjs/web/utils/common.js +1 -3
- package/lib/commonjs/web/utils/common.js.map +2 -1
- package/lib/commonjs/web/utils/index.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js.map +2 -1
- package/lib/commonjs/web/variants/index.js.map +1 -1
- package/lib/commonjs/web/variants/useVariants.js +1 -2
- package/lib/commonjs/web/variants/useVariants.js.map +2 -1
- package/lib/module/core/createUnistylesComponent.js +11 -0
- package/lib/module/core/createUnistylesComponent.js.map +2 -0
- package/lib/module/core/createUnistylesComponent.native.js +39 -0
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -0
- package/lib/module/core/index.js +1 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/useBreakpoint.js.map +1 -1
- package/lib/module/core/useBreakpoint.native.js.map +2 -1
- package/lib/module/core/useTheme.js.map +2 -1
- package/lib/module/core/useTheme.native.js.map +2 -1
- package/lib/module/global.js +1 -1
- package/lib/module/global.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +1 -4
- package/lib/module/mq.js.map +2 -1
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/module/specs/NativePlatform/index.js.map +1 -1
- package/lib/module/specs/NavigtionBar/index.js.map +2 -1
- package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -2
- package/lib/module/specs/ShadowRegistry/index.js.map +2 -1
- package/lib/module/specs/ShadowRegistry/types.js.map +2 -1
- package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -2
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +0 -1
- package/lib/module/specs/StyleSheet/index.js.map +2 -1
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +3 -2
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +2 -1
- package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +2 -1
- package/lib/module/specs/index.js.map +1 -2
- package/lib/module/specs/types.js.map +1 -2
- package/lib/module/types/accessibility.js +1 -1
- package/lib/module/types/accessibility.js.map +1 -0
- package/lib/module/types/breakpoints.js.map +1 -0
- package/lib/module/types/common.js +1 -1
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/core.js.map +1 -1
- package/lib/module/types/index.js.map +2 -1
- package/lib/module/types/variants.js.map +1 -0
- package/lib/module/web/convert/index.js.map +2 -1
- package/lib/module/web/convert/pseudo.js.map +2 -1
- package/lib/module/web/convert/shadow.js +1 -5
- package/lib/module/web/convert/utils.js +1 -2
- package/lib/module/web/index.js +1 -2
- package/lib/module/web/index.js.map +2 -1
- package/lib/module/web/listener.js.map +2 -1
- package/lib/module/web/mock.js.map +2 -1
- package/lib/module/web/state.js +1 -5
- package/lib/module/web/state.js.map +2 -1
- package/lib/module/web/variants/getVariants.js.map +2 -1
- package/lib/module/web/variants/index.js.map +1 -1
- package/lib/module/web/variants/useVariants.js +1 -2
- package/lib/module/web/variants/useVariants.js.map +2 -1
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +6 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +6 -0
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +1 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +3 -3
- package/nitrogen/generated/android/unistyles+autolinking.cmake +13 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +4 -10
- package/package.json +3 -3
- package/src/common.js +4 -0
- package/src/core/createUnistylesComponent.js +6 -0
- package/src/core/createUnistylesComponent.native.js +31 -0
- package/src/core/createUnistylesComponent.native.tsx +44 -0
- package/src/core/createUnistylesComponent.tsx +10 -0
- package/src/core/index.js +3 -0
- package/src/core/index.ts +1 -0
- package/src/core/useBreakpoint.js +14 -0
- package/src/core/useBreakpoint.native.js +16 -0
- package/src/core/useTheme.js +14 -0
- package/src/core/useTheme.native.js +16 -0
- package/src/global.js +1 -0
- package/src/index.js +3 -0
- package/src/index.ts +1 -1
- package/src/mq.js +38 -0
- package/src/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/src/types/accessibility.js +30 -0
- package/src/types/breakpoints.js +1 -0
- package/src/types/common.js +1 -0
- package/src/types/core.js +1 -0
- package/src/types/index.js +1 -0
- package/src/types/stylesheet.js +2 -0
- package/src/types/variants.js +1 -0
- package/src/web/convert/boxShadow.js +59 -0
- package/src/web/convert/index.js +56 -0
- package/src/web/convert/pseudo.js +131 -0
- package/src/web/convert/shadow.js +50 -0
- package/src/web/convert/style.js +137 -0
- package/src/web/convert/textShadow.js +56 -0
- package/src/web/convert/transform.js +65 -0
- package/src/web/convert/types.js +2 -0
- package/src/web/convert/utils.js +39 -0
- package/src/web/create.js +36 -0
- package/src/web/index.js +22 -0
- package/src/web/listener.js +26 -0
- package/src/web/mock.js +21 -0
- package/src/web/mq.js +14 -0
- package/src/web/registry.js +165 -0
- package/src/web/runtime.js +160 -0
- package/src/web/shadowRegistry.js +96 -0
- package/src/web/state.js +68 -0
- package/src/web/utils/common.js +79 -0
- package/src/web/utils/index.js +2 -0
- package/src/web/utils/unistyle.js +72 -0
- package/src/web/variants/getVariants.js +26 -0
- package/src/web/variants/index.js +2 -0
- package/src/web/variants/useVariants.js +50 -0
package/cxx/common/Helpers.h
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#include <jsi/jsi.h>
|
4
4
|
#include <jsi/JSIDynamic.h>
|
5
5
|
#include <folly/dynamic.h>
|
6
|
+
#include "Unistyles-Swift-Cxx-Umbrella.hpp"
|
6
7
|
#include <unordered_set>
|
7
8
|
|
8
9
|
using namespace facebook;
|
@@ -192,4 +193,14 @@ inline std::vector<folly::dynamic> parseDynamicFunctionArguments(jsi::Runtime& r
|
|
192
193
|
return parsedArgument;
|
193
194
|
}
|
194
195
|
|
196
|
+
inline static jsi::Array dependenciesToJSIArray(jsi::Runtime& rt, const std::vector<UnistyleDependency>& vec) {
|
197
|
+
jsi::Array result(rt, vec.size());
|
198
|
+
|
199
|
+
for (size_t i = 0; i < vec.size(); i++) {
|
200
|
+
result.setValueAtIndex(rt, i, jsi::Value(static_cast<int>(vec[i])));
|
201
|
+
}
|
202
|
+
|
203
|
+
return result;
|
204
|
+
}
|
205
|
+
|
195
206
|
}
|
package/cxx/core/HostStyle.cpp
CHANGED
@@ -22,7 +22,7 @@ jsi::Value HostStyle::get(jsi::Runtime& rt, const jsi::PropNameID& propNameId) {
|
|
22
22
|
if (propertyName == helpers::UNISTYLES_ID) {
|
23
23
|
return jsi::Value(this->_styleSheet->tag);
|
24
24
|
}
|
25
|
-
|
25
|
+
|
26
26
|
if (propertyName == helpers::ADD_VARIANTS_FN) {
|
27
27
|
return this->createAddVariantsProxyFunction(rt);
|
28
28
|
}
|
@@ -40,20 +40,20 @@ inline static std::vector<Unistyle::Shared> unistylesFromNonExistentNativeState(
|
|
40
40
|
}
|
41
41
|
|
42
42
|
throw jsi::JSError(rt, R"(Unistyles: Style is not bound!
|
43
|
-
|
43
|
+
|
44
44
|
Potential reasons:
|
45
45
|
- You likely used the spread operator on a Unistyle style outside of a JSX component
|
46
|
-
|
46
|
+
|
47
47
|
If you need to merge styles, do it within the style prop of your JSX component:
|
48
|
-
|
48
|
+
|
49
49
|
style={{...styles.container, ...styles.otherProp}}
|
50
|
-
or
|
50
|
+
or
|
51
51
|
style={[styles.container, styles.otherProp]}
|
52
52
|
|
53
53
|
If you pass computed style prop to component use array syntax:
|
54
54
|
|
55
55
|
customStyleProp={[styles.container, styles.otherProp]}
|
56
|
-
|
56
|
+
|
57
57
|
Copying a Unistyle style outside of a JSX element will remove its internal C++ state, leading to unexpected behavior.)");
|
58
58
|
}
|
59
59
|
|
@@ -77,10 +77,11 @@ inline static jsi::Value valueFromUnistyle(jsi::Runtime& rt, Unistyle::Shared un
|
|
77
77
|
|
78
78
|
if (unistyle->type == UnistyleType::Object) {
|
79
79
|
jsi::Object obj = jsi::Object(rt);
|
80
|
-
|
80
|
+
|
81
81
|
obj.setNativeState(rt, std::move(wrappedUnistyle));
|
82
82
|
obj.setProperty(rt, helpers::NAME_STYLE_KEY.c_str(), jsi::String::createFromUtf8(rt, unistyle->styleKey));
|
83
|
-
|
83
|
+
|
84
|
+
helpers::defineHiddenProperty(rt, obj, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
|
84
85
|
helpers::mergeJSIObjects(rt, obj, unistyle->parsedStyle.value());
|
85
86
|
|
86
87
|
return obj;
|
@@ -91,7 +92,7 @@ inline static jsi::Value valueFromUnistyle(jsi::Runtime& rt, Unistyle::Shared un
|
|
91
92
|
|
92
93
|
hostFn.setNativeState(rt, std::move(wrappedUnistyle));
|
93
94
|
hostFn.setProperty(rt, helpers::NAME_STYLE_KEY.c_str(), jsi::String::createFromUtf8(rt, unistyleFn->styleKey));
|
94
|
-
|
95
|
+
|
95
96
|
return std::move(hostFn);
|
96
97
|
}
|
97
98
|
|
@@ -32,7 +32,7 @@ RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
|
|
32
32
|
return newRootShadowNode;
|
33
33
|
}
|
34
34
|
|
35
|
-
auto shadowLeafUpdates =
|
35
|
+
auto& shadowLeafUpdates = registry.trafficController._unistylesUpdates;
|
36
36
|
|
37
37
|
if (shadowLeafUpdates.size() == 0) {
|
38
38
|
return newRootShadowNode;
|
@@ -41,22 +41,11 @@ RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
|
|
41
41
|
// this is required, otherwise we end up with old shadow tree in mount hook
|
42
42
|
registry.trafficController.stopUnistylesTraffic();
|
43
43
|
|
44
|
-
auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(*rootNode, shadowLeafUpdates);
|
44
|
+
auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(*rootNode, shadowLeafUpdates[_rt]);
|
45
45
|
|
46
46
|
return std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
|
47
|
-
*this->_rt,
|
48
47
|
*rootNode,
|
49
|
-
shadowLeafUpdates,
|
48
|
+
shadowLeafUpdates[_rt],
|
50
49
|
affectedNodes
|
51
50
|
));
|
52
51
|
}
|
53
|
-
|
54
|
-
shadow::ShadowLeafUpdates core::UnistylesCommitHook::getUnistylesUpdates() {
|
55
|
-
auto& registry = core::UnistylesRegistry::get();
|
56
|
-
auto parser = parser::Parser(this->_unistylesRuntime);
|
57
|
-
auto dependencyMap = registry.buildDependencyMap(*this->_rt);
|
58
|
-
|
59
|
-
// don't rebuild dependency map, at this point it's already done
|
60
|
-
|
61
|
-
return parser.dependencyMapToShadowLeafUpdates(dependencyMap);
|
62
|
-
}
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
#include <react/renderer/uimanager/UIManager.h>
|
4
4
|
#include <react/renderer/uimanager/UIManagerCommitHook.h>
|
5
|
-
#include "HybridUnistylesRuntime.h"
|
6
|
-
#include "Parser.h"
|
7
5
|
#include "ShadowTreeManager.h"
|
8
6
|
#include "ShadowTrafficController.h"
|
9
7
|
|
@@ -12,21 +10,17 @@ namespace margelo::nitro::unistyles::core {
|
|
12
10
|
using namespace facebook::react;
|
13
11
|
|
14
12
|
struct UnistylesCommitHook : public UIManagerCommitHook {
|
15
|
-
UnistylesCommitHook(std::shared_ptr<UIManager> uiManager,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
UnistylesCommitHook(std::shared_ptr<UIManager> uiManager, jsi::Runtime& rt) : _uiManager{uiManager}, _rt{&rt} {
|
14
|
+
_uiManager->registerCommitHook(*this);
|
15
|
+
}
|
16
|
+
|
20
17
|
~UnistylesCommitHook() noexcept override;
|
21
18
|
|
22
19
|
void commitHookWasRegistered(const UIManager &uiManager) noexcept override;
|
23
20
|
void commitHookWasUnregistered(const UIManager &uiManager) noexcept override;
|
24
21
|
RootShadowNode::Unshared shadowTreeWillCommit(const ShadowTree &shadowTree, const RootShadowNode::Shared &oldRootShadowNode, const RootShadowNode::Unshared &newRootShadowNode) noexcept override;
|
25
|
-
|
26
|
-
shadow::ShadowLeafUpdates getUnistylesUpdates();
|
27
|
-
|
22
|
+
|
28
23
|
private:
|
29
|
-
std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
|
30
24
|
std::shared_ptr<UIManager> _uiManager;
|
31
25
|
jsi::Runtime* _rt;
|
32
26
|
};
|
@@ -158,7 +158,7 @@ std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyle
|
|
158
158
|
std::for_each(styleSheets.begin(), styleSheets.end(), [&](std::pair<int, std::shared_ptr<core::StyleSheet>> pair){
|
159
159
|
auto& [_, styleSheet] = pair;
|
160
160
|
|
161
|
-
if (styleSheet->type == StyleSheetType::ThemableWithMiniRuntime && runtimeDidChange) {
|
161
|
+
if (styleSheet->type == StyleSheetType::ThemableWithMiniRuntime && (themeDidChange || runtimeDidChange)) {
|
162
162
|
stylesheetsToRefresh.emplace_back(styleSheet);
|
163
163
|
|
164
164
|
return;
|
@@ -44,7 +44,7 @@ struct UnistylesRegistry: public StyleSheetRegistry {
|
|
44
44
|
Unistyle::Shared findUnistyleFromKey(jsi::Runtime& rt, std::string styleKey, int tag);
|
45
45
|
DependencyMap buildDependencyMap(jsi::Runtime& rt);
|
46
46
|
shadow::ShadowTrafficController trafficController{};
|
47
|
-
|
47
|
+
|
48
48
|
private:
|
49
49
|
UnistylesRegistry() = default;
|
50
50
|
|
@@ -14,6 +14,10 @@ double HybridStyleSheet::getUnid() {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
jsi::Value HybridStyleSheet::create(jsi::Runtime& rt, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) {
|
17
|
+
if (count == 1) {
|
18
|
+
helpers::assertThat(rt, count == 2, "Unistyles is not initialized correctly. Please add babel plugin to your babel config.");
|
19
|
+
}
|
20
|
+
|
17
21
|
// second argument is hidden, so validation is perfectly fine
|
18
22
|
helpers::assertThat(rt, count == 2, "StyleSheet.create expected to be called with one argument.");
|
19
23
|
helpers::assertThat(rt, arguments[0].isObject(), "StyleSheet.create expected to be called with object or function.");
|
@@ -226,18 +230,19 @@ void HybridStyleSheet::loadExternalMethods(const jsi::Value& thisValue, jsi::Run
|
|
226
230
|
}
|
227
231
|
|
228
232
|
void HybridStyleSheet::registerHooks(jsi::Runtime& rt) {
|
229
|
-
this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(this->_uiManager,
|
233
|
+
this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(this->_uiManager, rt);
|
230
234
|
this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager);
|
231
235
|
}
|
232
236
|
|
233
|
-
void HybridStyleSheet::onPlatformDependenciesChange(std::vector<UnistyleDependency>
|
237
|
+
void HybridStyleSheet::onPlatformDependenciesChange(std::vector<UnistyleDependency> unistylesDependencies) {
|
234
238
|
if (this->_unistylesRuntime == nullptr) {
|
235
239
|
return;
|
236
240
|
}
|
237
241
|
|
238
|
-
this->_unistylesRuntime->runOnJSThread([this,
|
242
|
+
this->_unistylesRuntime->runOnJSThread([this, unistylesDependencies](jsi::Runtime& rt){
|
239
243
|
auto& registry = core::UnistylesRegistry::get();
|
240
244
|
auto parser = parser::Parser(this->_unistylesRuntime);
|
245
|
+
auto dependencies = std::move(unistylesDependencies);
|
241
246
|
|
242
247
|
// re-compute new breakpoint
|
243
248
|
auto dimensionsIt = std::find(dependencies.begin(), dependencies.end(), UnistyleDependency::DIMENSIONS);
|
@@ -259,22 +264,23 @@ void HybridStyleSheet::onPlatformDependenciesChange(std::vector<UnistyleDependen
|
|
259
264
|
this->_unistylesRuntime->includeDependenciesForColorSchemeChange(dependencies);
|
260
265
|
}
|
261
266
|
|
262
|
-
this->notifyJSListeners(dependencies);
|
263
|
-
|
264
267
|
auto dependencyMap = registry.buildDependencyMap(rt, dependencies);
|
265
268
|
|
266
269
|
if (dependencyMap.size() == 0) {
|
270
|
+
this->notifyJSListeners(dependencies);
|
271
|
+
|
267
272
|
return;
|
268
273
|
}
|
269
274
|
|
270
275
|
parser.rebuildUnistylesInDependencyMap(rt, dependencyMap, dependentStyleSheets);
|
271
276
|
|
277
|
+
this->notifyJSListeners(dependencies);
|
278
|
+
|
272
279
|
// this is required, otherwise shadow tree will ignore Unistyles commit
|
273
280
|
registry.trafficController.setHasUnistylesCommit(true);
|
281
|
+
parser.rebuildShadowLeafUpdates(dependencyMap);
|
274
282
|
|
275
|
-
|
276
|
-
|
277
|
-
shadow::ShadowTreeManager::updateShadowTree(rt, shadowLeafUpdates);
|
283
|
+
shadow::ShadowTreeManager::updateShadowTree(rt, registry.trafficController._unistylesUpdates[&rt]);
|
278
284
|
});
|
279
285
|
}
|
280
286
|
|
@@ -286,6 +292,7 @@ void HybridStyleSheet::onImeChange() {
|
|
286
292
|
this->_unistylesRuntime->runOnJSThread([this](jsi::Runtime& rt){
|
287
293
|
auto& registry = core::UnistylesRegistry::get();
|
288
294
|
auto parser = parser::Parser(this->_unistylesRuntime);
|
295
|
+
|
289
296
|
std::vector<UnistyleDependency> dependencies{UnistyleDependency::IME};
|
290
297
|
|
291
298
|
this->notifyJSListeners(dependencies);
|
@@ -300,10 +307,9 @@ void HybridStyleSheet::onImeChange() {
|
|
300
307
|
|
301
308
|
// this is required, otherwise shadow tree will ignore Unistyles commit
|
302
309
|
registry.trafficController.setHasUnistylesCommit(true);
|
310
|
+
parser.rebuildShadowLeafUpdates(dependencyMap);
|
303
311
|
|
304
|
-
|
305
|
-
|
306
|
-
shadow::ShadowTreeManager::updateShadowTree(rt, shadowLeafUpdates);
|
312
|
+
shadow::ShadowTreeManager::updateShadowTree(rt, registry.trafficController._unistylesUpdates[&rt]);
|
307
313
|
});
|
308
314
|
}
|
309
315
|
|
package/cxx/parser/Parser.cpp
CHANGED
@@ -122,7 +122,7 @@ void parser::Parser::rebuildUnistylesInDependencyMap(jsi::Runtime& rt, Dependenc
|
|
122
122
|
// for RN styles or inline styles, compute styles only once
|
123
123
|
if (unistyle->styleKey == helpers::EXOTIC_STYLE_KEY.c_str() && !unistyleData->parsedStyle.has_value()) {
|
124
124
|
unistyleData->parsedStyle = jsi::Value(rt, unistyle->rawValue).asObject(rt);
|
125
|
-
|
125
|
+
|
126
126
|
if (!parsedUnistyles.contains(unistyle)) {
|
127
127
|
parsedUnistyles.emplace(unistyle, true);
|
128
128
|
}
|
@@ -138,13 +138,13 @@ void parser::Parser::rebuildUnistylesInDependencyMap(jsi::Runtime& rt, Dependenc
|
|
138
138
|
unistyle->rawValue = parsedStyleSheets[styleSheet].asObject(rt).getProperty(rt, unistyle->styleKey.c_str()).asObject(rt);
|
139
139
|
this->rebuildUnistyle(rt, styleSheet, unistyle, unistyleData->variants, unistyleData->dynamicFunctionMetadata);
|
140
140
|
unistyleData->parsedStyle = jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
|
141
|
-
|
141
|
+
|
142
142
|
if (!parsedUnistyles.contains(unistyle)) {
|
143
143
|
parsedUnistyles.emplace(unistyle, true);
|
144
144
|
}
|
145
145
|
}
|
146
146
|
}
|
147
|
-
|
147
|
+
|
148
148
|
// parse whatever left in StyleSheets
|
149
149
|
for (auto styleSheet : styleSheets) {
|
150
150
|
for (auto& [_, unistyle] : styleSheet->unistyles) {
|
@@ -196,8 +196,9 @@ void parser::Parser::rebuildUnistyle(jsi::Runtime& rt, std::shared_ptr<StyleShee
|
|
196
196
|
}
|
197
197
|
|
198
198
|
// convert dependency map to shadow tree updates
|
199
|
-
|
199
|
+
void parser::Parser::rebuildShadowLeafUpdates(core::DependencyMap& dependencyMap) {
|
200
200
|
shadow::ShadowLeafUpdates updates;
|
201
|
+
auto& registry = core::UnistylesRegistry::get();
|
201
202
|
auto& rt = this->_unistylesRuntime->getRuntime();
|
202
203
|
|
203
204
|
for (const auto& [shadowNode, unistyles] : dependencyMap) {
|
@@ -206,7 +207,7 @@ shadow::ShadowLeafUpdates parser::Parser::dependencyMapToShadowLeafUpdates(core:
|
|
206
207
|
updates.emplace(shadowNode, std::move(rawProps));
|
207
208
|
}
|
208
209
|
|
209
|
-
|
210
|
+
registry.trafficController._unistylesUpdates[&rt] = std::move(updates);
|
210
211
|
}
|
211
212
|
|
212
213
|
// first level of StyleSheet, we can expect here different properties than on second level
|
@@ -269,13 +270,13 @@ jsi::Object parser::Parser::parseFirstLevel(jsi::Runtime& rt, Unistyle::Shared u
|
|
269
270
|
|
270
271
|
return;
|
271
272
|
}
|
272
|
-
|
273
|
+
|
273
274
|
if (propertyName == "boxShadow" && propertyValueObject.isArray(rt)) {
|
274
275
|
parsedStyle.setProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName), parseBoxShadow(rt, unistyle, propertyValueObject));
|
275
276
|
|
276
277
|
return;
|
277
278
|
}
|
278
|
-
|
279
|
+
|
279
280
|
if (propertyName == "filter" && propertyValueObject.isArray(rt)) {
|
280
281
|
parsedStyle.setProperty(rt, jsi::PropNameID::forUtf8(rt, propertyName), parseFilters(rt, unistyle, propertyValueObject));
|
281
282
|
|
@@ -353,7 +354,12 @@ jsi::Function parser::Parser::createDynamicFunctionProxy(jsi::Runtime& rt, Unist
|
|
353
354
|
unistyleFn->parsedStyle = this->parseFirstLevel(rt, unistyleFn, variants);
|
354
355
|
unistyleFn->seal();
|
355
356
|
|
356
|
-
|
357
|
+
// include dependencies for createUnistylesComponent
|
358
|
+
jsi::Object style = jsi::Value(rt, unistyleFn->parsedStyle.value()).asObject(rt);
|
359
|
+
|
360
|
+
helpers::defineHiddenProperty(rt, style, helpers::STYLE_DEPENDENCIES, helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
|
361
|
+
|
362
|
+
return style;
|
357
363
|
});
|
358
364
|
}
|
359
365
|
|
@@ -408,9 +414,9 @@ jsi::Value parser::Parser::parseTransforms(jsi::Runtime& rt, Unistyle::Shared un
|
|
408
414
|
// eg [{offsetX: 5, offsetY: 5, blurRadius: 5, spreadDistance: 0, color: ‘rgba(255, 0, 0, 0.5)’}]
|
409
415
|
jsi::Value parser::Parser::parseBoxShadow(jsi::Runtime &rt, Unistyle::Shared unistyle, jsi::Object &obj) {
|
410
416
|
std::vector<jsi::Value> parsedBoxShadows{};
|
411
|
-
|
417
|
+
|
412
418
|
parsedBoxShadows.reserve(2);
|
413
|
-
|
419
|
+
|
414
420
|
helpers::iterateJSIArray(rt, obj.asArray(rt), [&](size_t i, jsi::Value& value){
|
415
421
|
if (!value.isObject()) {
|
416
422
|
return;
|
@@ -420,7 +426,7 @@ jsi::Value parser::Parser::parseBoxShadow(jsi::Runtime &rt, Unistyle::Shared uni
|
|
420
426
|
|
421
427
|
parsedBoxShadows.emplace_back(std::move(parsedResult));
|
422
428
|
});
|
423
|
-
|
429
|
+
|
424
430
|
// create jsi::Array result with correct box shadows
|
425
431
|
jsi::Array result = jsi::Array(rt, parsedBoxShadows.size());
|
426
432
|
|
@@ -436,7 +442,7 @@ jsi::Value parser::Parser::parseFilters(jsi::Runtime &rt, Unistyle::Shared unist
|
|
436
442
|
std::vector<jsi::Value> parsedFilters{};
|
437
443
|
|
438
444
|
parsedFilters.reserve(2);
|
439
|
-
|
445
|
+
|
440
446
|
helpers::iterateJSIArray(rt, obj.asArray(rt), [&](size_t i, jsi::Value& value){
|
441
447
|
if (!value.isObject()) {
|
442
448
|
return;
|
@@ -447,7 +453,7 @@ jsi::Value parser::Parser::parseFilters(jsi::Runtime &rt, Unistyle::Shared unist
|
|
447
453
|
// take only one filter per object
|
448
454
|
jsi::Array propertyNames = parsedResult.asObject(rt).getPropertyNames(rt);
|
449
455
|
size_t length = propertyNames.size(rt);
|
450
|
-
|
456
|
+
|
451
457
|
// ignore no filters
|
452
458
|
if (length == 0) {
|
453
459
|
return;
|
@@ -455,7 +461,7 @@ jsi::Value parser::Parser::parseFilters(jsi::Runtime &rt, Unistyle::Shared unist
|
|
455
461
|
|
456
462
|
parsedFilters.emplace_back(std::move(parsedResult));
|
457
463
|
});
|
458
|
-
|
464
|
+
|
459
465
|
// create jsi::Array result with correct filters
|
460
466
|
jsi::Array result = jsi::Array(rt, parsedFilters.size());
|
461
467
|
|
package/cxx/parser/Parser.h
CHANGED
@@ -25,7 +25,7 @@ struct Parser {
|
|
25
25
|
void parseUnistyles(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet);
|
26
26
|
void rebuildUnistylesWithVariants(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet, Variants& variants);
|
27
27
|
void rebuildUnistylesInDependencyMap(jsi::Runtime& rt, core::DependencyMap& dependencyMap, std::vector<std::shared_ptr<core::StyleSheet>> styleSheets);
|
28
|
-
|
28
|
+
void rebuildShadowLeafUpdates(core::DependencyMap& dependencyMap);
|
29
29
|
|
30
30
|
private:
|
31
31
|
void rebuildUnistyle(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet, Unistyle::Shared unistyle, const Variants& variants, std::optional<std::vector<folly::dynamic>>);
|
@@ -1,5 +1,7 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#import "ShadowLeafUpdate.h"
|
4
|
+
|
3
5
|
namespace margelo::nitro::unistyles::shadow {
|
4
6
|
|
5
7
|
// Like a traffic officer managing a jam, this struct ensures everything
|
@@ -25,6 +27,8 @@ struct ShadowTrafficController {
|
|
25
27
|
this->_canCommit = true;
|
26
28
|
}
|
27
29
|
|
30
|
+
std::unordered_map<jsi::Runtime*, shadow::ShadowLeafUpdates> _unistylesUpdates{};
|
31
|
+
|
28
32
|
private:
|
29
33
|
bool _hasCommit = false;
|
30
34
|
bool _canCommit = false;
|
@@ -17,14 +17,13 @@ void shadow::ShadowTreeManager::updateShadowTree(facebook::jsi::Runtime& rt, sha
|
|
17
17
|
return;
|
18
18
|
}
|
19
19
|
|
20
|
-
shadowTreeRegistry.enumerate([&updates
|
20
|
+
shadowTreeRegistry.enumerate([&updates](const ShadowTree& shadowTree, bool& stop){
|
21
21
|
// we could iterate via updates and create multiple commits
|
22
22
|
// but it can cause performance issues for hundreds of nodes
|
23
23
|
// so let's mutate Shadow Tree in single transaction
|
24
24
|
auto transaction = [&](const RootShadowNode& oldRootShadowNode) {
|
25
25
|
auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(oldRootShadowNode, updates);
|
26
26
|
auto newRootNode = std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
|
27
|
-
rt,
|
28
27
|
oldRootShadowNode,
|
29
28
|
updates,
|
30
29
|
affectedNodes
|
@@ -90,7 +89,7 @@ AffectedNodes shadow::ShadowTreeManager::findAffectedNodes(const RootShadowNode&
|
|
90
89
|
|
91
90
|
// based on Reanimated algorithm
|
92
91
|
// clone affected nodes recursively, inject props and commit tree
|
93
|
-
ShadowNode::Unshared shadow::ShadowTreeManager::cloneShadowTree(
|
92
|
+
ShadowNode::Unshared shadow::ShadowTreeManager::cloneShadowTree(const ShadowNode &shadowNode, ShadowLeafUpdates& updates, AffectedNodes& affectedNodes) {
|
94
93
|
const auto family = &shadowNode.getFamily();
|
95
94
|
const auto rawPropsIt = updates.find(family);
|
96
95
|
const auto childrenIt = affectedNodes.find(family);
|
@@ -100,7 +99,7 @@ ShadowNode::Unshared shadow::ShadowTreeManager::cloneShadowTree(jsi::Runtime& rt
|
|
100
99
|
if (childrenIt != affectedNodes.end()) {
|
101
100
|
// get all indexes of children and clone it recursively
|
102
101
|
for (const auto index : childrenIt->second) {
|
103
|
-
children[index] = cloneShadowTree(
|
102
|
+
children[index] = cloneShadowTree(*children[index], updates, affectedNodes);
|
104
103
|
}
|
105
104
|
}
|
106
105
|
|
@@ -18,7 +18,7 @@ using AffectedNodes = std::unordered_map<const ShadowNodeFamily *, std::unordere
|
|
18
18
|
struct ShadowTreeManager {
|
19
19
|
static void updateShadowTree(jsi::Runtime& rt, shadow::ShadowLeafUpdates& updates);
|
20
20
|
static AffectedNodes findAffectedNodes(const RootShadowNode& rootNode, ShadowLeafUpdates& updates);
|
21
|
-
static ShadowNode::Unshared cloneShadowTree(
|
21
|
+
static ShadowNode::Unshared cloneShadowTree(const ShadowNode &shadowNode, ShadowLeafUpdates& updates, AffectedNodes& affectedNodes);
|
22
22
|
};
|
23
23
|
|
24
24
|
}
|
@@ -11,8 +11,7 @@ using namespace margelo::nitro;
|
|
11
11
|
RCT_EXPORT_MODULE(Unistyles)
|
12
12
|
|
13
13
|
__weak RCTSurfacePresenter* _surfacePresenter;
|
14
|
-
|
15
|
-
@synthesize runtimeExecutor = _runtimeExecutor;
|
14
|
+
@synthesize runtimeExecutor = _runtimeExecutor;
|
16
15
|
|
17
16
|
+ (BOOL)requiresMainQueueSetup {
|
18
17
|
return YES;
|
@@ -27,6 +26,8 @@ __weak RCTSurfacePresenter* _surfacePresenter;
|
|
27
26
|
// check if this is live reload, if so let's replace UnistylesRuntime with new runtime
|
28
27
|
auto hasUnistylesRuntime = HybridObjectRegistry::hasHybridObject("UnistylesRuntime");
|
29
28
|
|
29
|
+
auto& registry = core::UnistylesRegistry::get();
|
30
|
+
|
30
31
|
if (hasUnistylesRuntime) {
|
31
32
|
HybridObjectRegistry::unregisterHybridObjectConstructor("UnistylesRuntime");
|
32
33
|
HybridObjectRegistry::unregisterHybridObjectConstructor("UnistylesStyleSheet");
|
@@ -39,12 +40,11 @@ __weak RCTSurfacePresenter* _surfacePresenter;
|
|
39
40
|
- (void)createHybrids:(jsi::Runtime&)rt {
|
40
41
|
auto runOnJSThread = ([executor = _runtimeExecutor](std::function<void(jsi::Runtime& rt)> &&callback) {
|
41
42
|
__block auto objcCallback = callback;
|
42
|
-
|
43
|
+
|
43
44
|
[executor execute:^(jsi::Runtime& rt){
|
44
45
|
objcCallback(rt);
|
45
46
|
}];
|
46
47
|
});
|
47
|
-
|
48
48
|
auto nativePlatform = Unistyles::NativePlatform::create();
|
49
49
|
auto unistylesRuntime = std::make_shared<HybridUnistylesRuntime>(nativePlatform, rt, runOnJSThread);
|
50
50
|
auto uiManager = [_surfacePresenter scheduler].uiManager;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","isWeb","exports","Platform","OS","isIOS","isAndroid"],"sourceRoot":"../../src","sources":["common.
|
1
|
+
{"version":3,"names":["_reactNative","require","isWeb","exports","Platform","OS","isIOS","isAndroid"],"sourceRoot":"../../src","sources":["common.js"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAGE,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMC,KAAK,GAAAH,OAAA,CAAAG,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,SAAS,GAAAJ,OAAA,CAAAI,SAAA,GAAGH,qBAAQ,CAACC,EAAE,KAAK,SAAS","ignoreList":[]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createUnistylesComponent = void 0;
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
+
const createUnistylesComponent = (Component, _) => {
|
11
|
+
return props => {
|
12
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
13
|
+
...props
|
14
|
+
});
|
15
|
+
};
|
16
|
+
};
|
17
|
+
exports.createUnistylesComponent = createUnistylesComponent;
|
18
|
+
//# sourceMappingURL=createUnistylesComponent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","createUnistylesComponent","Component","_","props","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsE,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK/D,MAAMG,wBAAwB,GAAGA,CAA+BC,SAAY,EAAEC,CAAc,KAAK;EACpG,OAAQC,KAAwB,IAAK;IACjC,oBAAO,IAAAP,WAAA,CAAAQ,GAAA,EAACH,SAAS;MAAA,GAAKE;IAAK,CAAG,CAAC;EACnC,CAAC;AACL,CAAC;AAAAE,OAAA,CAAAL,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createUnistylesComponent = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _specs = require("../specs");
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
11
|
+
const createUnistylesComponent = (Component, mappings) => {
|
12
|
+
return props => {
|
13
|
+
const [theme, setTheme] = (0, _react.useState)(_specs.UnistylesRuntime.getTheme());
|
14
|
+
const [, setRt] = (0, _react.useState)(0);
|
15
|
+
(0, _react.useEffect)(() => {
|
16
|
+
const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
|
17
|
+
const componentDependencies = props.style?.uni__dependencies || mappings(theme).style?.uni__dependencies;
|
18
|
+
if (dependencies.includes(_specs.UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(_specs.UnistyleDependency.Theme))) {
|
19
|
+
setTheme(_specs.UnistylesRuntime.getTheme());
|
20
|
+
}
|
21
|
+
if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
|
22
|
+
setRt(prevState => prevState + 1);
|
23
|
+
}
|
24
|
+
});
|
25
|
+
return () => {
|
26
|
+
removeChangeListener();
|
27
|
+
};
|
28
|
+
}, []);
|
29
|
+
const mergedProps = {
|
30
|
+
...mappings(theme)
|
31
|
+
};
|
32
|
+
Object.keys(props).forEach(key => {
|
33
|
+
if (key in mergedProps) {
|
34
|
+
mergedProps[key] = Object.assign(props[key], mergedProps[key]);
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
mergedProps[key] = props[key];
|
38
|
+
});
|
39
|
+
return /*#__PURE__*/_react.default.createElement(Component, {
|
40
|
+
...mergedProps
|
41
|
+
});
|
42
|
+
};
|
43
|
+
};
|
44
|
+
exports.createUnistylesComponent = createUnistylesComponent;
|
45
|
+
//# sourceMappingURL=createUnistylesComponent.native.js.mapL=createUnistylesComponent.native.js.map
|
@@ -0,0 +1,2 @@
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createUnistylesComponent","Component","mappings","props","theme","setTheme","useState","UnistylesRuntime","getTheme","setRt","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","UnistyleDependency","Theme","some","dependency","prevState","mergedProps","keys","forEach","key","assign","React","createElement","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.js"],"mappings":"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","ignoreList":[]}
|
2
|
+
AA,GAAAA,wBAAA","ignoreList":[]}
|
@@ -3,6 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
Object.defineProperty(exports, "createUnistylesComponent", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _createUnistylesComponent.createUnistylesComponent;
|
10
|
+
}
|
11
|
+
});
|
6
12
|
Object.defineProperty(exports, "useBreakpoint", {
|
7
13
|
enumerable: true,
|
8
14
|
get: function () {
|
@@ -17,4 +23,5 @@ Object.defineProperty(exports, "useTheme", {
|
|
17
23
|
});
|
18
24
|
var _useBreakpoint = require("./useBreakpoint");
|
19
25
|
var _useTheme = require("./useTheme");
|
26
|
+
var _createUnistylesComponent = require("./createUnistylesComponent");
|
20
27
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_useBreakpoint","require","_useTheme"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_useBreakpoint","require","_useTheme","_createUnistylesComponent"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_web","_listener","_NativePlatform","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","UnistylesListener","addListeners","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.
|
1
|
+
{"version":3,"names":["_react","require","_web","_listener","_NativePlatform","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","UnistylesListener","addListeners","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACO,MAAMI,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACC,qBAAgB,CAACH,UAAU,CAAC;EACzE,IAAAI,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAGC,2BAAiB,CAACC,YAAY,CAAC,CAACC,kCAAkB,CAACC,WAAW,CAAC,EAAE,MAAMR,aAAa,CAACE,qBAAgB,CAACH,UAAU,CAAC,CAAC;IAC/I,OAAO,MAAM;MACTK,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOL,UAAU;AACrB,CAAC;AAACU,OAAA,CAAAX,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -1 +1,2 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_specs","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.native.
|
1
|
+
{"version":3,"names":["_react","require","_specs","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.native.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACO,MAAME,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACC,uBAAgB,CAACH,UAAU,CAAC;EACzE,IAAAI,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAGC,iBAAU,CAACC,iBAAiB,CAACC,YAAY,IAAI;MACtE,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,WAAW,CAAC,EAAE;QACvDV,aAAa,CAACE,uBAAgB,CAACH,UAAU,CAAC;MAC9C;IACJ,CAAC,CAAC;IACF,OAAO,MAAM;MACTK,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOL,UAAU;AACrB,CAAC;AAACY,OAAA,CAAAb,aAAA,GAAAA,aAAA","ignoreList":[]}
|
2
|
+
|