react-native-unistyles 3.0.0-nightly-20250329 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cxx/core/UnistylesCommitHook.cpp +2 -2
- package/cxx/core/UnistylesRegistry.cpp +24 -20
- package/cxx/hybridObjects/HybridStyleSheet.cpp +15 -11
- package/cxx/parser/Parser.cpp +11 -8
- package/cxx/shadowTree/ShadowTrafficController.h +7 -9
- package/lib/commonjs/components/native/Image.js +26 -1
- package/lib/commonjs/components/native/Image.js.map +1 -1
- package/lib/commonjs/components/native/Image.native.js +10 -0
- package/lib/commonjs/components/native/Image.native.js.map +1 -0
- package/lib/commonjs/components/native/ImageBackground.js +16 -28
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +7 -4
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +3 -19
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +6 -4
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +7 -5
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/passForwardRef.js +3 -5
- package/lib/commonjs/core/passForwardRef.js.map +1 -1
- package/lib/commonjs/server/serialize.js +1 -1
- package/lib/commonjs/server/serialize.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/web/utils/createUnistylesRef.js +28 -0
- package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -0
- package/lib/commonjs/web/utils/index.js +11 -0
- package/lib/commonjs/web/utils/index.js.map +1 -1
- package/lib/module/components/native/Image.js +25 -2
- package/lib/module/components/native/Image.js.map +1 -1
- package/lib/module/components/native/Image.native.js +6 -0
- package/lib/module/components/native/Image.native.js.map +1 -0
- package/lib/module/components/native/ImageBackground.js +17 -29
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +7 -4
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +4 -20
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +6 -4
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +7 -5
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/passForwardRef.js +3 -5
- package/lib/module/core/passForwardRef.js.map +1 -1
- package/lib/module/server/serialize.js +1 -1
- package/lib/module/server/serialize.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +2 -2
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/web/utils/createUnistylesRef.js +23 -0
- package/lib/module/web/utils/createUnistylesRef.js.map +1 -0
- package/lib/module/web/utils/index.js +1 -0
- package/lib/module/web/utils/index.js.map +1 -1
- package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Image.native.d.ts +2 -0
- package/lib/typescript/src/components/native/Image.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/passForwardRef.d.ts +1 -1
- package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/createUnistylesRef.d.ts +8 -0
- package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/index.d.ts +1 -0
- package/lib/typescript/src/web/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/native/Image.native.tsx +4 -0
- package/src/components/native/Image.tsx +35 -3
- package/src/components/native/ImageBackground.tsx +17 -33
- package/src/components/native/Pressable.native.tsx +12 -4
- package/src/core/createUnistylesElement.native.tsx +12 -6
- package/src/core/createUnistylesElement.tsx +6 -24
- package/src/core/createUnistylesImageBackground.tsx +16 -10
- package/src/core/passForwardRef.ts +5 -5
- package/src/server/serialize.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +1 -2
- package/src/web/utils/createUnistylesRef.ts +29 -0
- package/src/web/utils/index.ts +1 -0
package/README.md
CHANGED
@@ -29,7 +29,7 @@ yarn add react-native-edge-to-edge react-native-nitro-modules@0.25.2
|
|
29
29
|
| react-native-unistyles | react-native-nitro-modules |
|
30
30
|
|------------------------|----------------------------|
|
31
31
|
| 3.0.0.beta.8 | 0.24.1, 0.25.2 |
|
32
|
-
| 3.0.0-nightly-
|
32
|
+
| 3.0.0-nightly-20250329 | 0.24.1, 0.25.2 |
|
33
33
|
|
34
34
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
35
35
|
|
@@ -29,7 +29,7 @@ RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
|
|
29
29
|
// this is React Native / Reanimated commit
|
30
30
|
// merge Unistyles updates before it completes
|
31
31
|
auto& registry = core::UnistylesRegistry::get();
|
32
|
-
|
32
|
+
|
33
33
|
return registry.trafficController.withLock([&](){
|
34
34
|
auto& shadowLeafUpdates = registry.trafficController.getUpdates();
|
35
35
|
|
@@ -41,7 +41,7 @@ RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
|
|
41
41
|
auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(*rootNode, shadowLeafUpdates);
|
42
42
|
|
43
43
|
registry.trafficController.stopUnistylesTraffic();
|
44
|
-
|
44
|
+
|
45
45
|
// we have few updates, so merge it
|
46
46
|
return std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
|
47
47
|
*rootNode,
|
@@ -73,17 +73,19 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
|
|
73
73
|
const ShadowNodeFamily* shadowNodeFamily,
|
74
74
|
std::vector<std::shared_ptr<UnistyleData>>& unistylesData
|
75
75
|
) {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
std::for_each(unistylesData.begin(), unistylesData.end(), [this, &rt, shadowNodeFamily](std::shared_ptr<UnistyleData> unistyleData){
|
80
|
-
this->_shadowRegistry[&rt][shadowNodeFamily].emplace_back(unistyleData);
|
81
|
-
});
|
76
|
+
this->trafficController.withLock([this, &rt, &unistylesData, shadowNodeFamily](){
|
77
|
+
shadow::ShadowLeafUpdates updates;
|
78
|
+
auto parser = parser::Parser(nullptr);
|
82
79
|
|
83
|
-
|
80
|
+
std::for_each(unistylesData.begin(), unistylesData.end(), [this, &rt, shadowNodeFamily](std::shared_ptr<UnistyleData> unistyleData){
|
81
|
+
this->_shadowRegistry[&rt][shadowNodeFamily].emplace_back(unistyleData);
|
82
|
+
});
|
84
83
|
|
85
|
-
|
86
|
-
|
84
|
+
updates[shadowNodeFamily] = parser.parseStylesToShadowTreeStyles(rt, unistylesData);
|
85
|
+
|
86
|
+
this->trafficController.setUpdates(updates);
|
87
|
+
this->trafficController.resumeUnistylesTraffic();
|
88
|
+
});
|
87
89
|
}
|
88
90
|
|
89
91
|
void core::UnistylesRegistry::removeDuplicatedUnistyles(jsi::Runtime& rt, const ShadowNodeFamily *shadowNodeFamily, std::vector<core::Unistyle::Shared>& unistyles) {
|
@@ -111,7 +113,7 @@ void core::UnistylesRegistry::unlinkShadowNodeWithUnistyles(jsi::Runtime& rt, co
|
|
111
113
|
this->trafficController.withLock([this, &rt, shadowNodeFamily](){
|
112
114
|
this->_shadowRegistry[&rt].erase(shadowNodeFamily);
|
113
115
|
this->trafficController.removeShadowNode(shadowNodeFamily);
|
114
|
-
|
116
|
+
|
115
117
|
if (this->_shadowRegistry[&rt].empty()) {
|
116
118
|
this->_shadowRegistry.erase(&rt);
|
117
119
|
}
|
@@ -159,20 +161,22 @@ core::DependencyMap core::UnistylesRegistry::buildDependencyMap(jsi::Runtime& rt
|
|
159
161
|
// so we need to rebuild all instances as they may have different variants
|
160
162
|
void core::UnistylesRegistry::shadowLeafUpdateFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, jsi::Value& maybePressableId) {
|
161
163
|
shadow::ShadowLeafUpdates updates;
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
164
|
+
this->trafficController.withLock([this, &rt, &maybePressableId, unistyle, &updates](){
|
165
|
+
auto parser = parser::Parser(nullptr);
|
166
|
+
std::optional<std::string> pressableId = maybePressableId.isString()
|
167
|
+
? std::make_optional(maybePressableId.asString(rt).utf8(rt))
|
168
|
+
: std::nullopt;
|
166
169
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
170
|
+
for (const auto& [family, unistyles] : this->_shadowRegistry[&rt]) {
|
171
|
+
for (const auto& unistyleData : unistyles) {
|
172
|
+
if (unistyleData->unistyle == unistyle) {
|
173
|
+
updates[family] = parser.parseStylesToShadowTreeStyles(rt, { unistyleData });
|
174
|
+
}
|
171
175
|
}
|
172
176
|
}
|
173
|
-
}
|
174
177
|
|
175
|
-
|
178
|
+
this->trafficController.setUpdates(updates);
|
179
|
+
});
|
176
180
|
}
|
177
181
|
|
178
182
|
std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyleSheetsToRefresh(jsi::Runtime& rt, std::vector<UnistyleDependency>& unistylesDependencies) {
|
@@ -80,7 +80,7 @@ jsi::Value HybridStyleSheet::init(jsi::Runtime &rt, const jsi::Value &thisVal, c
|
|
80
80
|
if (this->isInitialized) {
|
81
81
|
return jsi::Value::undefined();
|
82
82
|
}
|
83
|
-
|
83
|
+
|
84
84
|
// create new state
|
85
85
|
auto& registry = core::UnistylesRegistry::get();
|
86
86
|
|
@@ -88,7 +88,7 @@ jsi::Value HybridStyleSheet::init(jsi::Runtime &rt, const jsi::Value &thisVal, c
|
|
88
88
|
|
89
89
|
loadExternalMethods(thisVal, rt);
|
90
90
|
registerHooks(rt);
|
91
|
-
|
91
|
+
|
92
92
|
this->isInitialized = true;
|
93
93
|
|
94
94
|
return jsi::Value::undefined();
|
@@ -127,18 +127,18 @@ void HybridStyleSheet::parseSettings(jsi::Runtime &rt, jsi::Object settings) {
|
|
127
127
|
if (propertyName == "CSSVars") {
|
128
128
|
return;
|
129
129
|
}
|
130
|
-
|
130
|
+
|
131
131
|
if (propertyName == "nativeBreakpointsMode") {
|
132
132
|
helpers::assertThat(rt, propertyValue.isString(), "StyleSheet.configure's nativeBreakpointsMode must be a string");
|
133
|
-
|
133
|
+
|
134
134
|
auto mode = propertyValue.asString(rt).utf8(rt);
|
135
|
-
|
135
|
+
|
136
136
|
helpers::assertThat(rt, mode == "pixels" || mode == "points", "StyleSheet.configure's nativeBreakpointsMode must be one of: pixels or points");
|
137
|
-
|
137
|
+
|
138
138
|
if (mode == "points") {
|
139
139
|
registry.shouldUsePointsForBreakpoints = true;
|
140
140
|
}
|
141
|
-
|
141
|
+
|
142
142
|
return;
|
143
143
|
}
|
144
144
|
|
@@ -156,12 +156,12 @@ void HybridStyleSheet::parseBreakpoints(jsi::Runtime &rt, jsi::Object breakpoint
|
|
156
156
|
auto& state = registry.getState(rt);
|
157
157
|
|
158
158
|
registry.registerBreakpoints(rt, sortedBreakpoints);
|
159
|
-
|
159
|
+
|
160
160
|
auto rawWidth = this->_unistylesRuntime->getScreen().width;
|
161
161
|
auto width = registry.shouldUsePointsForBreakpoints
|
162
162
|
? rawWidth / this->_unistylesRuntime->getPixelRatio()
|
163
163
|
: rawWidth;
|
164
|
-
|
164
|
+
|
165
165
|
state.computeCurrentBreakpoint(width);
|
166
166
|
}
|
167
167
|
|
@@ -258,7 +258,11 @@ void HybridStyleSheet::loadExternalMethods(const jsi::Value& thisValue, jsi::Run
|
|
258
258
|
|
259
259
|
void HybridStyleSheet::registerHooks(jsi::Runtime& rt) {
|
260
260
|
// cleanup Shadow updates
|
261
|
-
core::UnistylesRegistry::get()
|
261
|
+
auto& registry = core::UnistylesRegistry::get();
|
262
|
+
|
263
|
+
registry.trafficController.withLock([®istry](){
|
264
|
+
registry.trafficController.restore();
|
265
|
+
});
|
262
266
|
|
263
267
|
this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(this->_uiManager);
|
264
268
|
this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager);
|
@@ -317,7 +321,7 @@ void HybridStyleSheet::onPlatformNativeDependenciesChange(std::vector<UnistyleDe
|
|
317
321
|
auto width = registry.shouldUsePointsForBreakpoints
|
318
322
|
? rawWidth / this->_unistylesRuntime->getPixelRatio()
|
319
323
|
: rawWidth;
|
320
|
-
|
324
|
+
|
321
325
|
registry.getState(rt).computeCurrentBreakpoint(width);
|
322
326
|
}
|
323
327
|
|
package/cxx/parser/Parser.cpp
CHANGED
@@ -370,18 +370,21 @@ void parser::Parser::rebuildUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle
|
|
370
370
|
|
371
371
|
// convert dependency map to shadow tree updates
|
372
372
|
void parser::Parser::rebuildShadowLeafUpdates(jsi::Runtime& rt, core::DependencyMap& dependencyMap) {
|
373
|
-
shadow::ShadowLeafUpdates updates;
|
374
373
|
auto& registry = core::UnistylesRegistry::get();
|
375
374
|
|
376
|
-
|
377
|
-
|
378
|
-
|
375
|
+
registry.trafficController.withLock([this, &rt, &dependencyMap, ®istry](){
|
376
|
+
shadow::ShadowLeafUpdates updates;
|
377
|
+
|
378
|
+
for (const auto& [shadowNode, unistyles] : dependencyMap) {
|
379
|
+
// this step is required to parse string colors eg. #000000 to int representation
|
380
|
+
auto rawProps = this->parseStylesToShadowTreeStyles(rt, unistyles);
|
379
381
|
|
380
|
-
|
381
|
-
|
382
|
+
updates.emplace(shadowNode, std::move(rawProps));
|
383
|
+
}
|
382
384
|
|
383
|
-
|
384
|
-
|
385
|
+
registry.trafficController.setUpdates(updates);
|
386
|
+
registry.trafficController.resumeUnistylesTraffic();
|
387
|
+
});
|
385
388
|
}
|
386
389
|
|
387
390
|
// first level of StyleSheet, we can expect here different properties than on second level
|
@@ -22,13 +22,11 @@ struct ShadowTrafficController {
|
|
22
22
|
|
23
23
|
inline shadow::ShadowLeafUpdates& getUpdates() {
|
24
24
|
// call it only within withLock!
|
25
|
-
|
26
25
|
return _unistylesUpdates;
|
27
26
|
}
|
28
27
|
|
29
28
|
inline void setUpdates(shadow::ShadowLeafUpdates& newUpdates) {
|
30
|
-
|
31
|
-
|
29
|
+
// call it only within withLock!
|
32
30
|
auto& targetUpdates = _unistylesUpdates;
|
33
31
|
|
34
32
|
// this is important as overriding updates may skip some interim changes
|
@@ -43,7 +41,7 @@ struct ShadowTrafficController {
|
|
43
41
|
targetUpdates.emplace(pair.first, std::move(pair.second));
|
44
42
|
});
|
45
43
|
}
|
46
|
-
|
44
|
+
|
47
45
|
inline void removeShadowNode(const ShadowNodeFamily* shadowNodeFamily) {
|
48
46
|
// call it only within withLock!
|
49
47
|
if (_unistylesUpdates.contains(shadowNodeFamily)) {
|
@@ -52,19 +50,19 @@ struct ShadowTrafficController {
|
|
52
50
|
}
|
53
51
|
|
54
52
|
inline void restore() {
|
55
|
-
|
56
|
-
|
53
|
+
// call it only within withLock!
|
54
|
+
|
57
55
|
_unistylesUpdates = {};
|
58
56
|
_canCommit = false;
|
59
57
|
}
|
60
|
-
|
58
|
+
|
61
59
|
template <typename F>
|
62
60
|
inline auto withLock(F&& func) {
|
63
61
|
std::lock_guard<std::mutex> lock(_mutex);
|
64
|
-
|
62
|
+
|
65
63
|
return std::forward<F>(func)();
|
66
64
|
}
|
67
|
-
|
65
|
+
|
68
66
|
private:
|
69
67
|
std::atomic<bool> _canCommit = false;
|
70
68
|
shadow::ShadowLeafUpdates _unistylesUpdates{};
|
@@ -4,7 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.Image = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
7
8
|
var _reactNative = require("react-native");
|
8
9
|
var _core = require("../../core");
|
9
|
-
|
10
|
+
var _warn = require("../../core/warn");
|
11
|
+
var _utils = require("../../utils");
|
12
|
+
var _utils2 = require("../../web/utils");
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
14
|
+
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); }
|
15
|
+
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; }
|
16
|
+
const UnistylesImage = /*#__PURE__*/(0, _react.forwardRef)((props, forwardedRef) => {
|
17
|
+
const classNames = (0, _core.getClassName)(props.style);
|
18
|
+
const ref = (0, _utils2.createUnistylesRef)(classNames, forwardedRef);
|
19
|
+
const hasWidthStyle = typeof props.style === 'object' && (0, _utils2.keyInObject)(props.style, 'width');
|
20
|
+
const hasHeightStyle = typeof props.style === 'object' && (0, _utils2.keyInObject)(props.style, 'height');
|
21
|
+
(0, _warn.maybeWarnAboutMultipleUnistyles)(props.style, 'Image');
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
23
|
+
...props,
|
24
|
+
style: [classNames,
|
25
|
+
// Clear inline width and height extracted from source
|
26
|
+
hasWidthStyle && {
|
27
|
+
width: ''
|
28
|
+
}, hasHeightStyle && {
|
29
|
+
height: ''
|
30
|
+
}],
|
31
|
+
ref: ref
|
32
|
+
});
|
33
|
+
});
|
34
|
+
const Image = exports.Image = (0, _utils.copyComponentProperties)(_reactNative.Image, UnistylesImage);
|
10
35
|
//# sourceMappingURL=Image.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_warn","_utils","_utils2","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnistylesImage","forwardRef","props","forwardedRef","classNames","getClassName","style","ref","createUnistylesRef","hasWidthStyle","keyInObject","hasHeightStyle","maybeWarnAboutMultipleUnistyles","jsx","Image","width","height","exports","copyComponentProperties","NativeImage"],"sourceRoot":"../../../../src","sources":["components/native/Image.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAiE,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAA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AK,EAAe,OAAO,CAAC;EAElE,oBACI,IAAA3B,WAAA,CAAAkC,GAAA,EAACvC,YAAA,CAAAwC,KAAW;IAAA,GACJZ,KAAK;IACTI,KAAK,EAAE,CACHF,UAAU;IACV;IACAK,aAAa,IAAI;MAAEM,KAAK,EAAE;IAAG,CAAC,EAC9BJ,cAAc,IAAI;MAAEK,MAAM,EAAE;IAAG,CAAC,CACT;IAC3BT,GAAG,EAAEA;EAAI,CACZ,CAAC;AAEV,CAAC,CAAC;AAEK,MAAMO,KAAK,GAAAG,OAAA,CAAAH,KAAA,GAAG,IAAAI,8BAAuB,EAACC,kBAAW,EAAEnB,cAAc,CAAC","ignoreList":[]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Image = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
var _core = require("../../core");
|
9
|
+
const Image = exports.Image = (0, _core.createUnistylesElement)(_reactNative.Image);
|
10
|
+
//# sourceMappingURL=Image.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_core","Image","exports","createUnistylesElement","NativeImage"],"sourceRoot":"../../../../src","sources":["components/native/Image.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEO,MAAME,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,IAAAE,4BAAsB,EAACC,kBAAW,CAAC","ignoreList":[]}
|
@@ -7,45 +7,33 @@ exports.ImageBackground = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
8
8
|
var _reactNative = require("react-native");
|
9
9
|
var _core = require("../../core");
|
10
|
+
var _warn = require("../../core/warn");
|
10
11
|
var _utils = require("../../utils");
|
11
|
-
var _web = require("../../web");
|
12
12
|
var _utils2 = require("../../web/utils");
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
14
14
|
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); }
|
15
15
|
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; }
|
16
16
|
const UnistylesImageBackground = /*#__PURE__*/(0, _react.forwardRef)((props, forwardedRef) => {
|
17
|
-
let storedRef = null;
|
18
|
-
let storedImageRef = null;
|
19
17
|
const styleClassNames = (0, _core.getClassName)(props.style);
|
20
18
|
const imageClassNames = (0, _core.getClassName)(props.imageStyle);
|
19
|
+
const ref = (0, _utils2.createUnistylesRef)(styleClassNames, forwardedRef);
|
20
|
+
const imageRef = (0, _utils2.createUnistylesRef)(imageClassNames);
|
21
|
+
const hasWidthStyle = typeof props.imageStyle === 'object' && (0, _utils2.keyInObject)(props.imageStyle, 'width');
|
22
|
+
const hasHeightStyle = typeof props.imageStyle === 'object' && (0, _utils2.keyInObject)(props.imageStyle, 'height');
|
23
|
+
(0, _warn.maybeWarnAboutMultipleUnistyles)(props.style, 'ImageBackground');
|
24
|
+
(0, _warn.maybeWarnAboutMultipleUnistyles)(props.imageStyle, 'ImageBackground');
|
21
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ImageBackground, {
|
22
26
|
...props,
|
23
27
|
style: styleClassNames,
|
24
|
-
imageStyle: imageClassNames,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if (typeof forwardedRef === 'function') {
|
34
|
-
return forwardedRef(ref);
|
35
|
-
}
|
36
|
-
if (forwardedRef) {
|
37
|
-
forwardedRef.current = ref;
|
38
|
-
}
|
39
|
-
},
|
40
|
-
imageRef: (0, _utils2.isServer)() ? undefined : ref => {
|
41
|
-
if (!ref) {
|
42
|
-
// @ts-expect-error hidden from TS
|
43
|
-
_web.UnistylesShadowRegistry.remove(storedImageRef, imageClassNames?.hash);
|
44
|
-
}
|
45
|
-
storedImageRef = ref;
|
46
|
-
// @ts-expect-error hidden from TS
|
47
|
-
_web.UnistylesShadowRegistry.add(ref, imageClassNames?.hash);
|
48
|
-
}
|
28
|
+
imageStyle: [imageClassNames,
|
29
|
+
// Clear inline width and height extracted from source
|
30
|
+
hasWidthStyle && {
|
31
|
+
width: ''
|
32
|
+
}, hasHeightStyle && {
|
33
|
+
height: ''
|
34
|
+
}],
|
35
|
+
ref: ref,
|
36
|
+
imageRef: imageRef
|
49
37
|
});
|
50
38
|
});
|
51
39
|
const ImageBackground = exports.ImageBackground = (0, _utils.copyComponentProperties)(_reactNative.ImageBackground, UnistylesImageBackground);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_warn","_utils","_utils2","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnistylesImageBackground","forwardRef","props","forwardedRef","styleClassNames","getClassName","style","imageClassNames","imageStyle","ref","createUnistylesRef","imageRef","hasWidthStyle","keyInObject","hasHeightStyle","maybeWarnAboutMultipleUnistyles","jsx","ImageBackground","width","height","exports","copyComponentProperties","NativeImageBackground"],"sourceRoot":"../../../../src","sources":["components/native/ImageBackground.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uB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tB,wBAAwB,CAAC","ignoreList":[]}
|
@@ -47,10 +47,13 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
47
47
|
if (ref) {
|
48
48
|
storedRef.current = ref;
|
49
49
|
}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
return (0, _core.passForwardedRef)(ref, forwardedRef, () => {
|
51
|
+
// @ts-expect-error - this is hidden from TS
|
52
|
+
_specs.UnistylesShadowRegistry.add(ref, unistyles);
|
53
|
+
}, () => {
|
54
|
+
// @ts-expect-error - this is hidden from TS
|
55
|
+
_specs.UnistylesShadowRegistry.remove(ref);
|
56
|
+
});
|
54
57
|
},
|
55
58
|
style: state => {
|
56
59
|
const isPropStyleAFunction = typeof style === 'function';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getStyles","styleProps","unistyleKey","keys","find","key","startsWith","uni__getStyles","Pressable","exports","forwardRef","variants","style","props","forwardedRef","storedRef","useRef","scopedTheme","UnistylesShadowRegistry","getScopedTheme","useLayoutEffect","current","remove","jsx","ref","isPropStyleAFunction","unistyles","pressed","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getStyles","styleProps","unistyleKey","keys","find","key","startsWith","uni__getStyles","Pressable","exports","forwardRef","variants","style","props","forwardedRef","storedRef","useRef","scopedTheme","UnistylesShadowRegistry","getScopedTheme","useLayoutEffect","current","remove","jsx","ref","isPropStyleAFunction","unistyles","pressed","passForwardedRef","add","state","previousScopedTheme","setScopedTheme"],"sourceRoot":"../../../../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,CAACY,KAAuC,CAAC;MAExD,IAAIY,GAAG,EAAE;QACLT,SAAS,CAACM,OAAO,GAAGG,GAAG;MAC3B;MAEA,OAAO,IAAAI,sBAAgB,EACnBJ,GAAG,EACHV,YAAY,EACZ,MAAM;QACF;QACAI,8BAAuB,CAACW,GAAG,CAACL,GAAG,EAAEE,SAAS,CAAC;MAC/C,CAAC,EACD,MAAM;QACF;QACAR,8BAAuB,CAACI,MAAM,CAACE,GAAG,CAAC;MACvC,CACJ,CAAC;IACL,CAAE;IACFZ,KAAK,EAAEkB,KAAK,IAAI;MACZ,MAAML,oBAAoB,GAAG,OAAOb,KAAK,KAAK,UAAU;MACxD,MAAMmB,mBAAmB,GAAGb,8BAAuB,CAACC,cAAc,CAAC,CAAC;MAEpED,8BAAuB,CAACc,cAAc,CAACf,WAAW,CAAC;MAEnD,MAAMS,SAAS,GAAGD,oBAAoB,GAChCb,KAAK,CAACf,IAAI,CAACe,KAAK,EAAEkB,KAAK,CAAC,GACxB9B,SAAS,CAACY,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACM,OAAO,EAAE;QACpB,OAAOK,SAAS;MACpB;;MAEA;MACAR,8BAAuB,CAACI,MAAM,CAACP,SAAS,CAACM,OAAO,CAAC;;MAEjD;MACAH,8BAAuB,CAACW,GAAG,CAACd,SAAS,CAACM,OAAO,EAAEK,SAAS,CAAC;MAEzDR,8BAAuB,CAACc,cAAc,CAACD,mBAAmB,CAAC;MAE3D,OAAOL,SAAS;IACpB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.createUnistylesElement = void 0;
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
8
8
|
var _utils = require("../utils");
|
9
|
-
var _web = require("../web");
|
10
9
|
var _utils2 = require("../web/utils");
|
11
10
|
var _getClassname = require("./getClassname");
|
12
11
|
var _warn = require("./warn");
|
@@ -14,28 +13,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
14
|
const createUnistylesElement = Component => {
|
16
15
|
const UnistylesComponent = /*#__PURE__*/_react.default.forwardRef((props, forwardedRef) => {
|
17
|
-
let storedRef = null;
|
18
16
|
const classNames = (0, _getClassname.getClassName)(props.style);
|
17
|
+
const ref = (0, _utils2.createUnistylesRef)(classNames, forwardedRef);
|
18
|
+
(0, _warn.maybeWarnAboutMultipleUnistyles)(props.style, Component.displayName);
|
19
19
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
20
20
|
...props,
|
21
21
|
style: classNames,
|
22
|
-
ref:
|
23
|
-
// @ts-ignore we don't know the type of the component
|
24
|
-
(0, _warn.maybeWarnAboutMultipleUnistyles)(props.style, Component.displayName);
|
25
|
-
if (!ref) {
|
26
|
-
// @ts-expect-error hidden from TS
|
27
|
-
_web.UnistylesShadowRegistry.remove(storedRef, classNames?.hash);
|
28
|
-
}
|
29
|
-
storedRef = ref;
|
30
|
-
// @ts-expect-error hidden from TS
|
31
|
-
_web.UnistylesShadowRegistry.add(ref, classNames?.hash);
|
32
|
-
if (typeof forwardedRef === 'function') {
|
33
|
-
return forwardedRef(ref);
|
34
|
-
}
|
35
|
-
if (forwardedRef) {
|
36
|
-
forwardedRef.current = ref;
|
37
|
-
}
|
38
|
-
}
|
22
|
+
ref: ref
|
39
23
|
});
|
40
24
|
});
|
41
25
|
return (0, _utils.copyComponentProperties)(Component, UnistylesComponent);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_utils","
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_utils","_utils2","_getClassname","_warn","_jsxRuntime","e","__esModule","default","createUnistylesElement","Component","UnistylesComponent","React","forwardRef","props","forwardedRef","classNames","getClassName","style","ref","createUnistylesRef","maybeWarnAboutMultipleUnistyles","displayName","jsx","copyComponentProperties","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesElement.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAwD,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD,MAAMG,sBAAsB,GAAIC,SAAc,IAAK;EACtD,MAAMC,kBAAkB,gBAAGC,cAAK,CAACC,UAAU,CAA0B,CAACC,KAAK,EAAEC,YAAY,KAAK;IAC1F,MAAMC,UAAU,GAAG,IAAAC,0BAAY,EAACH,KAAK,CAACI,KAAK,CAAC;IAC5C,MAAMC,GAAG,GAAG,IAAAC,0BAAkB,EAACJ,UAAU,EAAED,YAAY,CAAC;IAExD,IAAAM,qCAA+B,EAACP,KAAK,CAACI,KAAK,EAAeR,SAAS,CAACY,WAAW,CAAC;IAEhF,oBACI,IAAAjB,WAAA,CAAAkB,GAAA,EAACb,SAAS;MAAA,GACFI,KAAK;MACTI,KAAK,EAAEF,UAAW;MAClBG,GAAG,EAAEA;IAAI,CACZ,CAAC;EAEV,CAAC,CAAC;EAEF,OAAO,IAAAK,8BAAuB,EAACd,SAAS,EAAEC,kBAAkB,CAAC;AACjE,CAAC;AAAAc,OAAA,CAAAhB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -41,14 +41,16 @@ const createUnistylesElement = Component => {
|
|
41
41
|
if (ref) {
|
42
42
|
storedRef.current = getNativeRef(Component, ref);
|
43
43
|
}
|
44
|
-
(0, _passForwardRef.passForwardedRef)(props, ref, forwardedRef);
|
45
44
|
|
46
45
|
// @ts-ignore we don't know the type of the component
|
47
46
|
(0, _warn.maybeWarnAboutMultipleUnistyles)(props.style, Component.displayName);
|
48
|
-
return () => {
|
49
|
-
// @ts-ignore
|
47
|
+
return (0, _passForwardRef.passForwardedRef)(ref, forwardedRef, () => {
|
48
|
+
// @ts-ignore this is hidden from TS
|
49
|
+
_specs.UnistylesShadowRegistry.add(ref, props.style);
|
50
|
+
}, () => {
|
51
|
+
// @ts-ignore this is hidden from TS
|
50
52
|
_specs.UnistylesShadowRegistry.remove(ref);
|
51
|
-
};
|
53
|
+
});
|
52
54
|
}
|
53
55
|
});
|
54
56
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_utils","_passForwardRef","_warn","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getNativeRef","Component","ref","name","viewRef","current","getNativeScrollRef","getScrollRef","createUnistylesElement","UnistylesComponent","React","forwardRef","props","forwardedRef","storedRef","useRef","useLayoutEffect","UnistylesShadowRegistry","remove","jsx","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_utils","_passForwardRef","_warn","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getNativeRef","Component","ref","name","viewRef","current","getNativeScrollRef","getScrollRef","createUnistylesElement","UnistylesComponent","React","forwardRef","props","forwardedRef","storedRef","useRef","useLayoutEffect","UnistylesShadowRegistry","remove","jsx","maybeWarnAboutMultipleUnistyles","style","displayName","passForwardedRef","add","copyComponentProperties","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesElement.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IA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AAkB,CAAC;AACjE,CAAC;AAAAiB,OAAA,CAAAlB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -31,15 +31,17 @@ const createUnistylesImageBackground = Component => {
|
|
31
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
32
32
|
...props,
|
33
33
|
ref: ref => {
|
34
|
-
(0, _passForwardRef.passForwardedRef)(
|
35
|
-
|
36
|
-
|
34
|
+
return (0, _passForwardRef.passForwardedRef)(ref, forwardedRef, () => {
|
35
|
+
// @ts-expect-error - this is hidden from TS
|
36
|
+
_specs.UnistylesShadowRegistry.add(ref, props.style);
|
37
|
+
}, () => {
|
38
|
+
// @ts-expect-error - this is hidden from TS
|
37
39
|
_specs.UnistylesShadowRegistry.remove(ref);
|
38
40
|
if (storedImageRef.current) {
|
39
|
-
// @ts-
|
41
|
+
// @ts-expect-error - this is hidden from TS
|
40
42
|
_specs.UnistylesShadowRegistry.remove(storedImageRef.current);
|
41
43
|
}
|
42
|
-
};
|
44
|
+
});
|
43
45
|
},
|
44
46
|
imageRef: ref => {
|
45
47
|
if (ref) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_utils","_passForwardRef","_warn","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createUnistylesImageBackground","Component","UnistylesImageBackground","React","forwardRef","props","forwardedRef","storedImageRef","useRef","useLayoutEffect","current","UnistylesShadowRegistry","remove","maybeWarnAboutMultipleUnistyles","style","imageStyle","jsx","ref","passForwardedRef","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_utils","_passForwardRef","_warn","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createUnistylesImageBackground","Component","UnistylesImageBackground","React","forwardRef","props","forwardedRef","storedImageRef","useRef","useLayoutEffect","current","UnistylesShadowRegistry","remove","maybeWarnAboutMultipleUnistyles","style","imageStyle","jsx","ref","passForwardedRef","add","imageRef","copyComponentProperties","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesImageBackground.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAwD,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAA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L,CAAE;MACFU,QAAQ,EAAEH,GAAG,IAAI;QACb,IAAIA,GAAG,EAAE;UACLV,cAAc,CAACG,OAAO,GAAGO,GAAG;QAChC;;QAEA;QACAN,8BAAuB,CAACQ,GAAG,CAACF,GAAG,EAAEZ,KAAK,CAACU,UAAU,CAAC;MACtD;IAAE,CACL,CAAC;EAEV,CAAC,CAAC;EAEF,OAAO,IAAAM,8BAAuB,EAACpB,SAAS,EAAEC,wBAAwB,CAAC;AACvE,CAAC;AAAAoB,OAAA,CAAAtB,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.passForwardedRef = void 0;
|
7
|
-
|
8
|
-
const passForwardedRef = (props, ref, forwardedRef) => {
|
7
|
+
const passForwardedRef = (ref, forwardedRef, onMount, onUnmount) => {
|
9
8
|
const passForwardedRef = () => {
|
10
9
|
if (typeof forwardedRef === 'function') {
|
11
10
|
return forwardedRef(ref);
|
@@ -16,11 +15,10 @@ const passForwardedRef = (props, ref, forwardedRef) => {
|
|
16
15
|
return () => {};
|
17
16
|
};
|
18
17
|
const forwardedRefReturnFn = passForwardedRef();
|
19
|
-
|
20
|
-
// @ts-expect-error hidden from TS
|
21
|
-
_specs.UnistylesShadowRegistry.add(ref, props.style);
|
18
|
+
onMount?.();
|
22
19
|
return () => {
|
23
20
|
forwardedRefReturnFn?.();
|
21
|
+
onUnmount?.();
|
24
22
|
};
|
25
23
|
};
|
26
24
|
exports.passForwardedRef = passForwardedRef;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["passForwardedRef","ref","forwardedRef","onMount","onUnmount","current","forwardedRefReturnFn","exports"],"sourceRoot":"../../../src","sources":["core/passForwardRef.ts"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAGA,CAC5BC,GAAM,EACNC,YAAmC,EACnCC,OAAoB,EACpBC,SAAsB,KACrB;EACD,MAAMJ,gBAAgB,GAAGA,CAAA,KAAM;IAC3B,IAAI,OAAOE,YAAY,KAAK,UAAU,EAAE;MACpC,OAAOA,YAAY,CAACD,GAAG,CAAC;IAC5B;IAEA,IAAIC,YAAY,EAAE;MACdA,YAAY,CAACG,OAAO,GAAGJ,GAAG;IAC9B;IAEA,OAAO,MAAM,CAAC,CAAC;EACnB,CAAC;EACD,MAAMK,oBAAoB,GAAGN,gBAAgB,CAAC,CAAC;EAE/CG,OAAO,GAAG,CAAC;EAEX,OAAO,MAAM;IACTG,oBAAoB,GAAG,CAAC;IACxBF,SAAS,GAAG,CAAC;EACjB,CAAC;AACL,CAAC;AAAAG,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|