@tamagui/core 2.0.0-rc.4 → 2.0.0-rc.5-1770352331483
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/dist/native.cjs +272 -113
- package/dist/test.native.cjs +261 -102
- package/package.json +10 -10
package/dist/native.cjs
CHANGED
|
@@ -569,7 +569,7 @@ var LayoutHandlers = /* @__PURE__ */ new WeakMap(), LayoutDisableKey = /* @__PUR
|
|
|
569
569
|
children
|
|
570
570
|
});
|
|
571
571
|
};
|
|
572
|
-
function setOnLayoutStrategy(
|
|
572
|
+
function setOnLayoutStrategy(state2) {
|
|
573
573
|
}
|
|
574
574
|
var NodeRectCache = /* @__PURE__ */ new WeakMap(), LastChangeTime = /* @__PURE__ */ new WeakMap(), avoidUpdates = true, queuedUpdates = /* @__PURE__ */ new Map();
|
|
575
575
|
function enable() {
|
|
@@ -5050,11 +5050,11 @@ class StateSafePureComponent extends React__namespace.PureComponent {
|
|
|
5050
5050
|
this._installSetStateHooks();
|
|
5051
5051
|
}
|
|
5052
5052
|
setState(partialState, callback) {
|
|
5053
|
-
typeof partialState == "function" ? super.setState((
|
|
5053
|
+
typeof partialState == "function" ? super.setState((state2, props) => {
|
|
5054
5054
|
this._inAsyncStateUpdate = true;
|
|
5055
5055
|
let ret;
|
|
5056
5056
|
try {
|
|
5057
|
-
ret = partialState(
|
|
5057
|
+
ret = partialState(state2, props);
|
|
5058
5058
|
} catch (err) {
|
|
5059
5059
|
throw err;
|
|
5060
5060
|
} finally {
|
|
@@ -5065,7 +5065,7 @@ class StateSafePureComponent extends React__namespace.PureComponent {
|
|
|
5065
5065
|
}
|
|
5066
5066
|
_installSetStateHooks() {
|
|
5067
5067
|
const that = this;
|
|
5068
|
-
let { props, state } = this;
|
|
5068
|
+
let { props, state: state2 } = this;
|
|
5069
5069
|
Object.defineProperty(this, "props", {
|
|
5070
5070
|
get() {
|
|
5071
5071
|
return invariant(
|
|
@@ -5081,10 +5081,10 @@ class StateSafePureComponent extends React__namespace.PureComponent {
|
|
|
5081
5081
|
return invariant(
|
|
5082
5082
|
!that._inAsyncStateUpdate,
|
|
5083
5083
|
'"this.state" should not be acceessed during state updates'
|
|
5084
|
-
),
|
|
5084
|
+
), state2;
|
|
5085
5085
|
},
|
|
5086
5086
|
set(newState) {
|
|
5087
|
-
|
|
5087
|
+
state2 = newState;
|
|
5088
5088
|
}
|
|
5089
5089
|
});
|
|
5090
5090
|
}
|
|
@@ -5269,8 +5269,8 @@ class CellRenderer extends React__namespace.Component {
|
|
|
5269
5269
|
};
|
|
5270
5270
|
}
|
|
5271
5271
|
updateSeparatorProps(newProps) {
|
|
5272
|
-
this.setState((
|
|
5273
|
-
separatorProps: __spreadValues(__spreadValues({},
|
|
5272
|
+
this.setState((state2) => ({
|
|
5273
|
+
separatorProps: __spreadValues(__spreadValues({}, state2.separatorProps), newProps)
|
|
5274
5274
|
}));
|
|
5275
5275
|
}
|
|
5276
5276
|
componentWillUnmount() {
|
|
@@ -5875,10 +5875,10 @@ const Image$1 = React__namespace.forwardRef((props, ref) => {
|
|
|
5875
5875
|
"source",
|
|
5876
5876
|
"style"
|
|
5877
5877
|
]);
|
|
5878
|
-
const [
|
|
5878
|
+
const [state2, updateState] = React__namespace.useState(() => {
|
|
5879
5879
|
const uri2 = resolveAssetUri$1(source);
|
|
5880
5880
|
return uri2 != null && ImageLoader.has(uri2) ? LOADED$1 : IDLE$1;
|
|
5881
|
-
}), [layout, updateLayout] = React__namespace.useState({}), hasTextAncestor = React__namespace.useContext(TextAncestorContext), hiddenImageRef = React__namespace.useRef(null), filterRef = React__namespace.useRef(_filterId$1++), requestRef = React__namespace.useRef(null), shouldDisplaySource =
|
|
5881
|
+
}), [layout, updateLayout] = React__namespace.useState({}), hasTextAncestor = React__namespace.useContext(TextAncestorContext), hiddenImageRef = React__namespace.useRef(null), filterRef = React__namespace.useRef(_filterId$1++), requestRef = React__namespace.useRef(null), shouldDisplaySource = state2 === LOADED$1 || state2 === LOADING$1 && defaultSource == null, [flatStyle, _resizeMode, filter, tintColor] = getFlatStyle$1(
|
|
5882
5882
|
{},
|
|
5883
5883
|
blurRadius,
|
|
5884
5884
|
filterRef.current
|
|
@@ -7045,10 +7045,10 @@ const Image = React__namespace.forwardRef((props, ref) => {
|
|
|
7045
7045
|
"source",
|
|
7046
7046
|
"style"
|
|
7047
7047
|
]);
|
|
7048
|
-
const [
|
|
7048
|
+
const [state2, updateState] = React__namespace.useState(() => {
|
|
7049
7049
|
const uri2 = resolveAssetUri(source);
|
|
7050
7050
|
return uri2 != null && ImageLoader.has(uri2) ? LOADED : IDLE;
|
|
7051
|
-
}), [layout, updateLayout] = React__namespace.useState({}), hasTextAncestor = React__namespace.useContext(TextAncestorContext), hiddenImageRef = React__namespace.useRef(null), filterRef = React__namespace.useRef(_filterId++), requestRef = React__namespace.useRef(null), shouldDisplaySource =
|
|
7051
|
+
}), [layout, updateLayout] = React__namespace.useState({}), hasTextAncestor = React__namespace.useContext(TextAncestorContext), hiddenImageRef = React__namespace.useRef(null), filterRef = React__namespace.useRef(_filterId++), requestRef = React__namespace.useRef(null), shouldDisplaySource = state2 === LOADED || state2 === LOADING && defaultSource == null, [flatStyle, _resizeMode, filter, tintColor] = getFlatStyle({}, blurRadius, filterRef.current), resizeMode = props.resizeMode || _resizeMode || "cover", selectedSource = shouldDisplaySource ? source : defaultSource, displayImageUri = resolveAssetUri(selectedSource), imageSizeStyle = resolveAssetDimensions(selectedSource), backgroundImage = displayImageUri ? `url("${displayImageUri}")` : null, backgroundSize = getBackgroundSize(), hiddenImage = displayImageUri ? createElement$1("img", {
|
|
7052
7052
|
alt: accessibilityLabel || "",
|
|
7053
7053
|
style: styles$6.accessibilityImage$raw,
|
|
7054
7054
|
draggable: draggable || false,
|
|
@@ -8381,6 +8381,28 @@ function loadAnimationDriver(name, driver) {
|
|
|
8381
8381
|
[name]: driver
|
|
8382
8382
|
};
|
|
8383
8383
|
}
|
|
8384
|
+
function camelToHyphen(str) {
|
|
8385
|
+
return str.replace(/[A-Z]/g, function(m) {
|
|
8386
|
+
return `-${m.toLowerCase()}`;
|
|
8387
|
+
}).toLowerCase();
|
|
8388
|
+
}
|
|
8389
|
+
var cache$4 = /* @__PURE__ */ new WeakMap();
|
|
8390
|
+
function mediaObjectToString(query2) {
|
|
8391
|
+
if (typeof query2 == "string") return query2;
|
|
8392
|
+
if (cache$4.has(query2)) return cache$4.get(query2);
|
|
8393
|
+
var res = Object.entries(query2).map(function(param) {
|
|
8394
|
+
var [feature, value] = param;
|
|
8395
|
+
return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
|
|
8396
|
+
}).join(" and ");
|
|
8397
|
+
return cache$4.set(query2, res), res;
|
|
8398
|
+
}
|
|
8399
|
+
exports.mediaState = // development only safeguard
|
|
8400
|
+
{};
|
|
8401
|
+
var setMediaState = function(next) {
|
|
8402
|
+
exports.mediaState = next;
|
|
8403
|
+
}, mediaQueryConfig = {}, getMedia = function() {
|
|
8404
|
+
return exports.mediaState;
|
|
8405
|
+
}, mediaKeys = /* @__PURE__ */ new Set();
|
|
8384
8406
|
function kebabToCamel(str) {
|
|
8385
8407
|
return str.replace(/-([a-z])/g, function(_2, c) {
|
|
8386
8408
|
return c.toUpperCase();
|
|
@@ -8462,11 +8484,7 @@ function matchMediaFallback(query2) {
|
|
|
8462
8484
|
function setupMatchMedia(_2) {
|
|
8463
8485
|
matchMediaImpl = _2, globalThis.matchMedia = _2;
|
|
8464
8486
|
}
|
|
8465
|
-
|
|
8466
|
-
{};
|
|
8467
|
-
var mediaQueryConfig = {}, getMedia = function() {
|
|
8468
|
-
return exports.mediaState;
|
|
8469
|
-
}, mediaKeys = /* @__PURE__ */ new Set(), mediaKeyRegex = /\$(platform|theme|group)-/, getMediaKey = function(key) {
|
|
8487
|
+
var mediaKeyRegex = /\$(platform|theme|group)-/, getMediaKey = function(key) {
|
|
8470
8488
|
if (key[0] !== "$") return false;
|
|
8471
8489
|
if (mediaKeys.has(key)) return true;
|
|
8472
8490
|
var match = key.match(mediaKeyRegex);
|
|
@@ -8479,8 +8497,8 @@ var mediaQueryConfig = {}, getMedia = function() {
|
|
|
8479
8497
|
} = config, mediaQueryDefaultActive = getSetting("mediaQueryDefaultActive");
|
|
8480
8498
|
if (media) {
|
|
8481
8499
|
mediaVersion++, resetMediaStyleCache();
|
|
8482
|
-
for (var key in media)
|
|
8483
|
-
Object.assign(mediaQueryConfig, media), initState = __spreadValues({},
|
|
8500
|
+
for (var key in media) getMedia()[key] = (mediaQueryDefaultActive == null ? void 0 : mediaQueryDefaultActive[key]) || false, mediaKeys.add(`$${key}`);
|
|
8501
|
+
Object.assign(mediaQueryConfig, media), initState = __spreadValues({}, getMedia()), mediaKeysOrdered = Object.keys(media), setupMediaListeners();
|
|
8484
8502
|
}
|
|
8485
8503
|
};
|
|
8486
8504
|
function unlisten() {
|
|
@@ -8500,9 +8518,9 @@ function setupMediaListeners() {
|
|
|
8500
8518
|
});
|
|
8501
8519
|
function update2() {
|
|
8502
8520
|
var next = !!getMatch().matches;
|
|
8503
|
-
next !==
|
|
8521
|
+
next !== getMedia()[key2] && (setMediaState(__spreadProps(__spreadValues({}, getMedia()), {
|
|
8504
8522
|
[key2]: next
|
|
8505
|
-
}), updateMediaListeners());
|
|
8523
|
+
})), updateMediaListeners());
|
|
8506
8524
|
}
|
|
8507
8525
|
update2();
|
|
8508
8526
|
};
|
|
@@ -8514,7 +8532,7 @@ function setupMediaListeners() {
|
|
|
8514
8532
|
var listeners = /* @__PURE__ */ new Set();
|
|
8515
8533
|
function updateMediaListeners() {
|
|
8516
8534
|
listeners.forEach(function(cb) {
|
|
8517
|
-
return cb(
|
|
8535
|
+
return cb(getMedia());
|
|
8518
8536
|
});
|
|
8519
8537
|
}
|
|
8520
8538
|
var States = /* @__PURE__ */ new WeakMap();
|
|
@@ -8534,23 +8552,23 @@ function useMedia(componentContext, debug) {
|
|
|
8534
8552
|
var componentState = componentContext ? States.get(componentContext) : null, internalRef = React.useRef(null);
|
|
8535
8553
|
internalRef.current || (internalRef.current = {
|
|
8536
8554
|
keys: /* @__PURE__ */ new Set(),
|
|
8537
|
-
lastState:
|
|
8555
|
+
lastState: getMedia()
|
|
8538
8556
|
}), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
|
|
8539
8557
|
var {
|
|
8540
8558
|
keys
|
|
8541
8559
|
} = internalRef.current;
|
|
8542
8560
|
keys.size && keys.clear();
|
|
8543
|
-
var
|
|
8561
|
+
var state2 = React.useSyncExternalStore(subscribe, function() {
|
|
8544
8562
|
var curKeys2 = (componentState == null ? void 0 : componentState.keys) || keys, {
|
|
8545
8563
|
lastState,
|
|
8546
8564
|
pendingState
|
|
8547
8565
|
} = internalRef.current;
|
|
8548
8566
|
if (!curKeys2.size) return lastState;
|
|
8549
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
8567
|
+
var ms = getMedia(), _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
8550
8568
|
try {
|
|
8551
8569
|
for (var _iterator = curKeys2[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
8552
8570
|
var key = _step.value;
|
|
8553
|
-
if (
|
|
8571
|
+
if (ms[key] !== (pendingState || lastState)[key]) return false, (componentContext == null ? void 0 : componentContext.mediaEmit) ? (componentContext.mediaEmit(ms), internalRef.current.pendingState = ms, lastState) : (internalRef.current.lastState = ms, ms);
|
|
8554
8572
|
}
|
|
8555
8573
|
} catch (err) {
|
|
8556
8574
|
_didIteratorError = true, _iteratorError = err;
|
|
@@ -8563,9 +8581,9 @@ function useMedia(componentContext, debug) {
|
|
|
8563
8581
|
}
|
|
8564
8582
|
return lastState;
|
|
8565
8583
|
}, getServerSnapshot);
|
|
8566
|
-
return new Proxy(
|
|
8584
|
+
return new Proxy(state2, {
|
|
8567
8585
|
get(_2, key) {
|
|
8568
|
-
return !disableMediaTouch && typeof key == "string" && keys.add(key), Reflect.get(
|
|
8586
|
+
return !disableMediaTouch && typeof key == "string" && keys.add(key), Reflect.get(state2, key);
|
|
8569
8587
|
}
|
|
8570
8588
|
});
|
|
8571
8589
|
}
|
|
@@ -8591,21 +8609,6 @@ var getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSi
|
|
|
8591
8609
|
var importance = isSizeMedia ? getMediaKeyImportance(mediaKey) : defaultMediaImportance, usedKeys = styleState.usedKeys;
|
|
8592
8610
|
return !usedKeys[key] || importance > usedKeys[key] ? importance : null;
|
|
8593
8611
|
};
|
|
8594
|
-
function camelToHyphen(str) {
|
|
8595
|
-
return str.replace(/[A-Z]/g, function(m) {
|
|
8596
|
-
return `-${m.toLowerCase()}`;
|
|
8597
|
-
}).toLowerCase();
|
|
8598
|
-
}
|
|
8599
|
-
var cache$4 = /* @__PURE__ */ new WeakMap();
|
|
8600
|
-
function mediaObjectToString(query2, key) {
|
|
8601
|
-
if (typeof query2 == "string") return query2;
|
|
8602
|
-
if (cache$4.has(query2)) return cache$4.get(query2);
|
|
8603
|
-
var res = Object.entries(query2).map(function(param) {
|
|
8604
|
-
var [feature, value] = param;
|
|
8605
|
-
return feature = camelToHyphen(feature), typeof value == "string" ? `(${feature}: ${value})` : (typeof value == "number" && /[height|width]$/.test(feature) && (value = `${value}px`), `(${feature}: ${value})`);
|
|
8606
|
-
}).join(" and ");
|
|
8607
|
-
return cache$4.set(query2, res), res;
|
|
8608
|
-
}
|
|
8609
8612
|
function mediaKeyMatch(key, dimensions2) {
|
|
8610
8613
|
var mediaQueries = mediaQueryConfig[key], result = Object.keys(mediaQueries).every(function(query2) {
|
|
8611
8614
|
var expectedVal = +mediaQueries[query2], isMax = query2.startsWith("max"), isWidth = query2.endsWith("Width"), givenVal = dimensions2[isWidth ? "width" : "height"];
|
|
@@ -9142,7 +9145,7 @@ var ThemeStateContext = React.createContext(""), allListeners = /* @__PURE__ */
|
|
|
9142
9145
|
var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate, local = localStates.get(id2), parentState = states.get(parentId), isSchemeOnlyChange = isIos && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name), _keys_current_size, keysSize = (_keys_current_size = keys == null || (_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) !== null && _keys_current_size !== void 0 ? _keys_current_size : 0, _schemeKeys_current_size, schemeKeysSize = (_schemeKeys_current_size = schemeKeys == null || (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) !== null && _schemeKeys_current_size !== void 0 ? _schemeKeys_current_size : 0, allKeysSchemeOptimized = schemeKeysSize === keysSize && keysSize > 0, canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized, needsUpdate = props.passThrough ? false : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : HasRenderedOnce.get(keys) ? canSkipForSchemeChange ? false : !(keys == null || (_keys_current1 = keys.current) === null || _keys_current1 === void 0) && _keys_current1.size ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props) : true, [rerender, next] = getNextState(local, props, propsKey, isRoot, id2, parentId, needsUpdate, PendingUpdate.get(id2));
|
|
9143
9146
|
return PendingUpdate.delete(id2), (!local || rerender) && (local = __spreadValues({}, next), localStates.set(id2, local)), Object.assign(local, next), local.id = id2, states.set(id2, next), local;
|
|
9144
9147
|
};
|
|
9145
|
-
var
|
|
9148
|
+
var state2 = React.useSyncExternalStore(subscribe2, getSnapshot, getSnapshot);
|
|
9146
9149
|
return useIsomorphicLayoutEffect(function() {
|
|
9147
9150
|
if (!HasRenderedOnce.get(keys)) {
|
|
9148
9151
|
HasRenderedOnce.set(keys, true);
|
|
@@ -9153,7 +9156,7 @@ var ThemeStateContext = React.createContext(""), allListeners = /* @__PURE__ */
|
|
|
9153
9156
|
return;
|
|
9154
9157
|
}
|
|
9155
9158
|
scheduleUpdate(id2), HadTheme.set(keys, true);
|
|
9156
|
-
}, [keys, propsKey]),
|
|
9159
|
+
}, [keys, propsKey]), state2;
|
|
9157
9160
|
}, getNextState = function(lastState, props, propsKey) {
|
|
9158
9161
|
var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, id2 = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0, {
|
|
9159
9162
|
debug
|
|
@@ -9438,36 +9441,44 @@ var defaultComponentState = {
|
|
|
9438
9441
|
}), defaultComponentStateShouldEnter = __spreadProps(__spreadValues({}, defaultComponentState), {
|
|
9439
9442
|
unmounted: "should-enter"
|
|
9440
9443
|
});
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
}
|
|
9444
|
+
function createGlobalState(key, defaultValue2) {
|
|
9445
|
+
var GLOBAL_KEY = `__tamagui_${key}__`;
|
|
9446
|
+
function getGlobalState() {
|
|
9447
|
+
var g = globalThis;
|
|
9448
|
+
return g[GLOBAL_KEY] || (g[GLOBAL_KEY] = defaultValue2), g[GLOBAL_KEY];
|
|
9449
|
+
}
|
|
9450
|
+
function setGlobalState(newState) {
|
|
9451
|
+
globalThis[GLOBAL_KEY] = newState;
|
|
9452
|
+
}
|
|
9453
|
+
return {
|
|
9454
|
+
get: getGlobalState,
|
|
9455
|
+
set: setGlobalState
|
|
9456
|
+
};
|
|
9450
9457
|
}
|
|
9458
|
+
var state = createGlobalState("gesture", {
|
|
9459
|
+
enabled: false,
|
|
9460
|
+
Gesture: null,
|
|
9461
|
+
GestureDetector: null,
|
|
9462
|
+
ScrollView: null
|
|
9463
|
+
});
|
|
9451
9464
|
function getGestureHandler() {
|
|
9452
9465
|
return {
|
|
9453
9466
|
get isEnabled() {
|
|
9454
|
-
return
|
|
9467
|
+
return state.get().enabled;
|
|
9455
9468
|
},
|
|
9456
9469
|
get state() {
|
|
9457
|
-
return
|
|
9470
|
+
return state.get();
|
|
9458
9471
|
},
|
|
9459
9472
|
set(updates) {
|
|
9460
|
-
|
|
9461
|
-
Object.assign(state, updates);
|
|
9473
|
+
Object.assign(state.get(), updates);
|
|
9462
9474
|
},
|
|
9463
9475
|
disable() {
|
|
9464
|
-
|
|
9465
|
-
state.enabled = false;
|
|
9476
|
+
state.get().enabled = false;
|
|
9466
9477
|
},
|
|
9467
9478
|
createPressGesture(config) {
|
|
9468
9479
|
var {
|
|
9469
9480
|
Gesture
|
|
9470
|
-
} =
|
|
9481
|
+
} = state.get();
|
|
9471
9482
|
if (!Gesture) return null;
|
|
9472
9483
|
var _config_delayLongPress, longPressDuration = (_config_delayLongPress = config.delayLongPress) !== null && _config_delayLongPress !== void 0 ? _config_delayLongPress : 500, tap = Gesture.Tap().runOnJS(true).maxDuration(1e4).onBegin(function(e) {
|
|
9473
9484
|
var _config_onPressIn;
|
|
@@ -9862,6 +9873,111 @@ function normalizeStyle$1(style) {
|
|
|
9862
9873
|
}
|
|
9863
9874
|
return fixStyles(res), res;
|
|
9864
9875
|
}
|
|
9876
|
+
function parseNativeStyle(key, cssString, tokenMap) {
|
|
9877
|
+
switch (key) {
|
|
9878
|
+
case "backgroundImage":
|
|
9879
|
+
return parseBackgroundImage(cssString, tokenMap);
|
|
9880
|
+
case "boxShadow":
|
|
9881
|
+
return parseBoxShadow(cssString, tokenMap);
|
|
9882
|
+
case "textShadow":
|
|
9883
|
+
return parseTextShadow(cssString, tokenMap);
|
|
9884
|
+
default:
|
|
9885
|
+
return;
|
|
9886
|
+
}
|
|
9887
|
+
}
|
|
9888
|
+
function resolveColor(raw, tokenMap) {
|
|
9889
|
+
return tokenMap && tokenMap.has(raw) ? tokenMap.get(raw) : raw;
|
|
9890
|
+
}
|
|
9891
|
+
function parseBackgroundImage(css, tokenMap) {
|
|
9892
|
+
var match = css.match(RegExp("^linear-gradient\\((.+)\\)$", "s"));
|
|
9893
|
+
if (match) {
|
|
9894
|
+
var inner = match[1], parts = splitOutsideParens(inner);
|
|
9895
|
+
if (!(parts.length < 2)) {
|
|
9896
|
+
var direction, startIdx = 0, firstPart = parts[0].trim();
|
|
9897
|
+
(firstPart.startsWith("to ") || /^\d+(\.\d+)?(deg|rad|turn|grad)$/.test(firstPart)) && (direction = firstPart, startIdx = 1);
|
|
9898
|
+
for (var colorStops = [], i = startIdx; i < parts.length; i++) {
|
|
9899
|
+
var stopParts = parts[i].trim().split(/\s+/), colorRaw = stopParts[0], color = resolveColor(colorRaw, tokenMap), positions = stopParts.slice(1), stop = {
|
|
9900
|
+
color
|
|
9901
|
+
};
|
|
9902
|
+
positions.length > 0 && (stop.positions = positions), colorStops.push(stop);
|
|
9903
|
+
}
|
|
9904
|
+
var gradient = {
|
|
9905
|
+
type: "linearGradient",
|
|
9906
|
+
colorStops
|
|
9907
|
+
};
|
|
9908
|
+
return direction && (gradient.direction = direction), [gradient];
|
|
9909
|
+
}
|
|
9910
|
+
}
|
|
9911
|
+
}
|
|
9912
|
+
function parseBoxShadow(css, tokenMap) {
|
|
9913
|
+
var shadowStrings = splitOutsideParens(css), shadows = [], _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
9914
|
+
try {
|
|
9915
|
+
for (var _iterator = shadowStrings[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
9916
|
+
var raw = _step.value, s = raw.trim();
|
|
9917
|
+
if (s) {
|
|
9918
|
+
var tokens = s.split(/\s+/);
|
|
9919
|
+
if (tokens.length < 2) return;
|
|
9920
|
+
var startIdx = 0, inset = false;
|
|
9921
|
+
tokens[0] === "inset" && (inset = true, startIdx = 1);
|
|
9922
|
+
for (var numericParts = [], colorParts = [], i = startIdx; i < tokens.length; i++) {
|
|
9923
|
+
var n = parseDimension(tokens[i]);
|
|
9924
|
+
if (n !== void 0) numericParts.push(n);
|
|
9925
|
+
else {
|
|
9926
|
+
colorParts = tokens.slice(i);
|
|
9927
|
+
break;
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9930
|
+
if (numericParts.length < 2) return;
|
|
9931
|
+
var shadow = {
|
|
9932
|
+
offsetX: numericParts[0],
|
|
9933
|
+
offsetY: numericParts[1]
|
|
9934
|
+
};
|
|
9935
|
+
if (inset && (shadow.inset = true), numericParts.length >= 3 && (shadow.blurRadius = numericParts[2]), numericParts.length >= 4 && (shadow.spreadDistance = numericParts[3]), colorParts.length > 0) {
|
|
9936
|
+
var colorStr = colorParts.join(" ");
|
|
9937
|
+
shadow.color = resolveColor(colorStr, tokenMap);
|
|
9938
|
+
}
|
|
9939
|
+
shadows.push(shadow);
|
|
9940
|
+
}
|
|
9941
|
+
}
|
|
9942
|
+
} catch (err) {
|
|
9943
|
+
_didIteratorError = true, _iteratorError = err;
|
|
9944
|
+
} finally {
|
|
9945
|
+
try {
|
|
9946
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
9947
|
+
} finally {
|
|
9948
|
+
if (_didIteratorError) throw _iteratorError;
|
|
9949
|
+
}
|
|
9950
|
+
}
|
|
9951
|
+
return shadows.length > 0 ? shadows : void 0;
|
|
9952
|
+
}
|
|
9953
|
+
function parseTextShadow(css, tokenMap) {
|
|
9954
|
+
var tokens = css.trim().split(/\s+/);
|
|
9955
|
+
if (!(tokens.length < 3)) {
|
|
9956
|
+
var offsetX = parseDimension(tokens[0]), offsetY = parseDimension(tokens[1]), blur = parseDimension(tokens[2]);
|
|
9957
|
+
if (!(offsetX === void 0 || offsetY === void 0 || blur === void 0)) {
|
|
9958
|
+
var result = [["textShadowOffset", {
|
|
9959
|
+
width: offsetX,
|
|
9960
|
+
height: offsetY
|
|
9961
|
+
}], ["textShadowRadius", blur]];
|
|
9962
|
+
if (tokens.length >= 4) {
|
|
9963
|
+
var colorStr = tokens.slice(3).join(" ");
|
|
9964
|
+
result.push(["textShadowColor", resolveColor(colorStr, tokenMap)]);
|
|
9965
|
+
}
|
|
9966
|
+
return result;
|
|
9967
|
+
}
|
|
9968
|
+
}
|
|
9969
|
+
}
|
|
9970
|
+
function parseDimension(s) {
|
|
9971
|
+
var cleaned = s.replace(/px$|dp$/, ""), n = Number(cleaned);
|
|
9972
|
+
return Number.isFinite(n) ? n : void 0;
|
|
9973
|
+
}
|
|
9974
|
+
function splitOutsideParens(s) {
|
|
9975
|
+
for (var parts = [], depth = 0, current = "", i = 0; i < s.length; i++) {
|
|
9976
|
+
var ch = s[i];
|
|
9977
|
+
ch === "(" ? depth++ : ch === ")" && depth--, ch === "," && depth === 0 ? (parts.push(current), current = "") : current += ch;
|
|
9978
|
+
}
|
|
9979
|
+
return current && parts.push(current), parts;
|
|
9980
|
+
}
|
|
9865
9981
|
var remRegex = /(-?[\d.]+)rem/g;
|
|
9866
9982
|
function resolveRem(value) {
|
|
9867
9983
|
var _config_settings, config = getConfig(), _config_settings_remBaseFontSize, baseFontSize = (_config_settings_remBaseFontSize = config == null || (_config_settings = config.settings) === null || _config_settings === void 0 ? void 0 : _config_settings.remBaseFontSize) !== null && _config_settings_remBaseFontSize !== void 0 ? _config_settings_remBaseFontSize : 16;
|
|
@@ -9964,15 +10080,57 @@ var propMapper = function(key, value, styleState, disabled, map) {
|
|
|
9964
10080
|
}
|
|
9965
10081
|
styleProps2.disableExpandShorthands || key in conf2.shorthands && (key = conf2.shorthands[key]);
|
|
9966
10082
|
var originalValue = value;
|
|
9967
|
-
if (value != null
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
10083
|
+
if (value != null) if (typeof value == "string" && value[0] === "$") value = getTokenForKey(key, value, styleProps2, styleState);
|
|
10084
|
+
else if ((key === "boxShadow" || key === "textShadow" || key === "filter" || key === "backgroundImage" || key === "border") && typeof value == "string" && value.includes("$")) {
|
|
10085
|
+
if (key === "backgroundImage" || key === "boxShadow" || key === "textShadow") {
|
|
10086
|
+
var tokenMap = /* @__PURE__ */ new Map(), placeholderIdx = 0, withPlaceholders = value.replace(/(\$[\w.-]+)/g, function(t) {
|
|
10087
|
+
var r = getTokenForKey("size", t, styleProps2, styleState);
|
|
10088
|
+
if (r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r == null) return t;
|
|
10089
|
+
if (typeof r != "string" && typeof r != "number") {
|
|
10090
|
+
var placeholder = `__tk${placeholderIdx++}__`;
|
|
10091
|
+
return tokenMap.set(placeholder, r), placeholder;
|
|
10092
|
+
}
|
|
10093
|
+
return String(r);
|
|
10094
|
+
}), parsed = parseNativeStyle(key, withPlaceholders, tokenMap);
|
|
10095
|
+
parsed ? value = parsed : value = value.replace(/(\$[\w.-]+)/g, function(t) {
|
|
10096
|
+
var r = getTokenForKey("size", t, styleProps2, styleState);
|
|
10097
|
+
return r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r != null ? String(r) : t;
|
|
10098
|
+
});
|
|
10099
|
+
} else value = value.replace(/(\$[\w.-]+)/g, function(t) {
|
|
10100
|
+
var r = getTokenForKey("size", t, styleProps2, styleState);
|
|
10101
|
+
return r == null && (r = getTokenForKey("color", t, styleProps2, styleState)), r != null ? String(r) : t;
|
|
10102
|
+
});
|
|
10103
|
+
} else isVariable(value) ? value = resolveVariableValue(key, value, styleProps2.resolveValues) : isRemValue(value) && (value = resolveRem(value));
|
|
10104
|
+
if (value != null && typeof value == "string" && (key === "backgroundImage" || key === "boxShadow" || key === "textShadow")) {
|
|
10105
|
+
var parsed1 = parseNativeStyle(key, value);
|
|
10106
|
+
if (parsed1) {
|
|
10107
|
+
if (key === "textShadow" && Array.isArray(parsed1) && Array.isArray(parsed1[0])) {
|
|
10108
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
10109
|
+
try {
|
|
10110
|
+
for (var _iterator = parsed1[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
10111
|
+
var [nkey, nvalue] = _step.value;
|
|
10112
|
+
map(nkey, nvalue, originalValue);
|
|
10113
|
+
}
|
|
10114
|
+
} catch (err) {
|
|
10115
|
+
_didIteratorError = true, _iteratorError = err;
|
|
10116
|
+
} finally {
|
|
10117
|
+
try {
|
|
10118
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
10119
|
+
} finally {
|
|
10120
|
+
if (_didIteratorError) throw _iteratorError;
|
|
10121
|
+
}
|
|
10122
|
+
}
|
|
10123
|
+
return;
|
|
10124
|
+
}
|
|
10125
|
+
value = parsed1;
|
|
10126
|
+
}
|
|
10127
|
+
}
|
|
10128
|
+
if (value != null) {
|
|
9971
10129
|
key === "fontFamily" && lastFontFamilyToken && (styleState.fontFamily = lastFontFamilyToken);
|
|
9972
10130
|
var expanded = styleProps2.noExpand ? null : expandStyle(key, value);
|
|
9973
10131
|
if (expanded) for (var max = expanded.length, i = 0; i < max; i++) {
|
|
9974
|
-
var [
|
|
9975
|
-
map(
|
|
10132
|
+
var [nkey1, nvalue1] = expanded[i];
|
|
10133
|
+
map(nkey1, nvalue1, originalValue);
|
|
9976
10134
|
}
|
|
9977
10135
|
else map(key, value, originalValue);
|
|
9978
10136
|
}
|
|
@@ -10267,7 +10425,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10267
10425
|
viewProps[key4] = val2;
|
|
10268
10426
|
return;
|
|
10269
10427
|
}
|
|
10270
|
-
if (val2 != null) {
|
|
10428
|
+
if (false, val2 != null) {
|
|
10271
10429
|
if (key4 === "pointerEvents") {
|
|
10272
10430
|
viewProps[key4] = val2;
|
|
10273
10431
|
return;
|
|
@@ -10282,13 +10440,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10282
10440
|
}
|
|
10283
10441
|
var shouldPassThrough2 = styleProps2.noExpand && isPseudo || isHOC && (isMediaOrPseudo || (parentStaticConfig == null || (_parentStaticConfig_variants = parentStaticConfig.variants) === null || _parentStaticConfig_variants === void 0 ? void 0 : _parentStaticConfig_variants[keyInit]));
|
|
10284
10442
|
if (shouldPassThrough2) {
|
|
10285
|
-
passDownProp(viewProps, key4, val2, isMediaOrPseudo);
|
|
10443
|
+
passDownProp(viewProps, key4, val2, isMediaOrPseudo), false;
|
|
10286
10444
|
return;
|
|
10287
10445
|
}
|
|
10288
10446
|
if (isPseudo) {
|
|
10289
10447
|
if (!val2) return;
|
|
10290
10448
|
var pseudoStyleObject = getSubStyle(styleState, key4, val2, styleProps2.noClass && process.env.IS_STATIC !== "is_static");
|
|
10291
|
-
{
|
|
10449
|
+
if (!shouldDoClasses || process.env.IS_STATIC === "is_static") {
|
|
10292
10450
|
var _pseudos, _key;
|
|
10293
10451
|
if (pseudos || (pseudos = {}), (_pseudos = pseudos)[_key = key4] || (_pseudos[_key] = {}), process.env.IS_STATIC === "is_static") {
|
|
10294
10452
|
Object.assign(pseudos[key4], pseudoStyleObject);
|
|
@@ -10297,9 +10455,11 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10297
10455
|
}
|
|
10298
10456
|
var descriptor = pseudoDescriptors[key4], isEnter = key4 === "enterStyle", isExit = key4 === "exitStyle";
|
|
10299
10457
|
if (!descriptor) return;
|
|
10300
|
-
|
|
10458
|
+
var pseudoStyles, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, psuedoStyle, fullKey;
|
|
10459
|
+
if (shouldDoClasses && !isExit) ;
|
|
10460
|
+
if (!shouldDoClasses || isExit || isEnter) {
|
|
10301
10461
|
var descriptorKey = descriptor.stateKey || descriptor.name, isDisabled2 = componentState[descriptorKey] === false;
|
|
10302
|
-
isExit && (isDisabled2 = !styleProps2.isExiting), isEnter && componentState.unmounted === false && (isDisabled2 = true);
|
|
10462
|
+
isExit && (isDisabled2 = !styleProps2.isExiting), isEnter && componentState.unmounted === false && (isDisabled2 = true), false;
|
|
10303
10463
|
var importance = descriptor.priority, pseudoOriginalValues = styleOriginalValues.get(pseudoStyleObject);
|
|
10304
10464
|
for (var pkey in pseudoStyleObject) {
|
|
10305
10465
|
var _$val = pseudoStyleObject[pkey];
|
|
@@ -10326,14 +10486,13 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10326
10486
|
if (!val2) return;
|
|
10327
10487
|
var mediaKeyShort = key4.slice(isMedia == "theme" ? 7 : 1);
|
|
10328
10488
|
hasMedia || (hasMedia = true);
|
|
10329
|
-
val2.space;
|
|
10330
|
-
if ((!hasMedia || typeof hasMedia == "boolean") && (hasMedia = /* @__PURE__ */ new Set()), hasMedia.add(mediaKeyShort), isMedia === "platform" && !isActivePlatform(key4)) return;
|
|
10489
|
+
var hasSpace = val2.space;
|
|
10490
|
+
if ((hasSpace || !shouldDoClasses || styleProps2.willBeAnimated) && ((!hasMedia || typeof hasMedia == "boolean") && (hasMedia = /* @__PURE__ */ new Set()), hasMedia.add(mediaKeyShort)), isMedia === "platform" && !isActivePlatform(key4)) return;
|
|
10331
10491
|
var priority = mediaStylesSeen;
|
|
10332
10492
|
mediaStylesSeen += 1;
|
|
10333
|
-
var shouldDoClassesForThisMedia = isWeb;
|
|
10493
|
+
var shouldDoClassesForThisMedia = shouldDoClasses || isWeb && isMedia === "theme";
|
|
10334
10494
|
if (shouldDoClassesForThisMedia) {
|
|
10335
|
-
getSubStyle(styleState, key4, val2, false);
|
|
10336
|
-
var mediaStyles = getCSSStylesAtomic(), _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
|
|
10495
|
+
var mediaStyle = getSubStyle(styleState, key4, val2, false), mediaStyles = getCSSStylesAtomic(mediaStyle), _iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = void 0;
|
|
10337
10496
|
try {
|
|
10338
10497
|
for (var _iterator12 = mediaStyles[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
|
|
10339
10498
|
var style3 = _step12.value, property = style3[StyleObjectProperty], isSubStyle = property[0] === "$";
|
|
@@ -10359,7 +10518,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10359
10518
|
var didMerge = mergeMediaByImportance(styleState, mediaKeyShort, key5, val3, mediaState[mediaKeyShort], importanceBump, debug, originalVal2);
|
|
10360
10519
|
didMerge && key5 === "fontFamily" && (styleState.fontFamily = mediaStyle1.fontFamily);
|
|
10361
10520
|
};
|
|
10362
|
-
var isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group", isPlatformMedia = isMedia === "platform";
|
|
10521
|
+
var mergeMediaStyle = mergeMediaStyle2, isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group", isPlatformMedia = isMedia === "platform";
|
|
10363
10522
|
if (!isThemeMedia && !isPlatformMedia && !isGroupMedia) {
|
|
10364
10523
|
if (!mediaState[mediaKeyShort]) {
|
|
10365
10524
|
return;
|
|
@@ -10391,14 +10550,14 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10391
10550
|
} else if (isGroupMedia) {
|
|
10392
10551
|
var _groupContext_groupName, _componentState_group, groupInfo = getGroupPropParts(mediaKeyShort), groupName = groupInfo.name, groupState = groupContext == null || (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state, groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media;
|
|
10393
10552
|
if (!groupState) {
|
|
10394
|
-
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
10553
|
+
false, pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
10395
10554
|
return;
|
|
10396
10555
|
}
|
|
10397
10556
|
var componentGroupState = (_componentState_group = componentState.group) === null || _componentState_group === void 0 ? void 0 : _componentState_group[groupName];
|
|
10398
10557
|
if (groupMediaKey) {
|
|
10399
10558
|
mediaGroups || (mediaGroups = /* @__PURE__ */ new Set()), mediaGroups.add(groupMediaKey);
|
|
10400
10559
|
var mediaState1 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState1 == null ? void 0 : mediaState1[groupMediaKey];
|
|
10401
|
-
if (!mediaState1 && groupState.layout && (isActive = mediaKeyMatch(groupMediaKey, groupState.layout)), !isActive) {
|
|
10560
|
+
if (!mediaState1 && groupState.layout && (isActive = mediaKeyMatch(groupMediaKey, groupState.layout)), false, !isActive) {
|
|
10402
10561
|
for (var pkey1 in mediaStyle1) applyDefaultStyle(pkey1, styleState);
|
|
10403
10562
|
return;
|
|
10404
10563
|
}
|
|
@@ -10408,7 +10567,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10408
10567
|
var _this;
|
|
10409
10568
|
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set()), pseudoGroups.add(groupName);
|
|
10410
10569
|
var componentGroupPseudoState = (_this = componentGroupState || (groupContext == null ? void 0 : groupContext[groupName].state)) === null || _this === void 0 ? void 0 : _this.pseudo, isActive1 = componentGroupPseudoState == null ? void 0 : componentGroupPseudoState[groupPseudoKey], priority1 = pseudoPriorities[groupPseudoKey];
|
|
10411
|
-
if (!isActive1) {
|
|
10570
|
+
if (false, !isActive1) {
|
|
10412
10571
|
for (var pkey2 in mediaStyle1) applyDefaultStyle(pkey2, styleState);
|
|
10413
10572
|
return;
|
|
10414
10573
|
}
|
|
@@ -10446,7 +10605,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
10446
10605
|
inlineWhenUnflattened,
|
|
10447
10606
|
parentStaticConfig,
|
|
10448
10607
|
acceptsClassName
|
|
10449
|
-
} = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, rulesToInsert = void 0, classNames = {};
|
|
10608
|
+
} = staticConfig, viewProps = {}, mediaState = styleProps2.mediaState || exports.mediaState, shouldDoClasses = acceptsClassName && isWeb, rulesToInsert = void 0, classNames = {};
|
|
10450
10609
|
props.space;
|
|
10451
10610
|
var pseudos = null, hasMedia = false, dynamicThemeAccess, pseudoGroups, mediaGroups;
|
|
10452
10611
|
props.className || "";
|
|
@@ -10591,7 +10750,7 @@ var getSubStyle = function(styleState, subKey, styleIn, avoidMergeTransform) {
|
|
|
10591
10750
|
var shouldSkip = !staticConfig.isHOC && key1 in skipProps && !styleProps2.noSkip;
|
|
10592
10751
|
if (shouldSkip) return key = key1, "continue";
|
|
10593
10752
|
propMapper(key1, val, styleState, false, function(skey, sval, originalVal) {
|
|
10594
|
-
originalVal !== void 0 && (originalValues || (originalValues = {}), originalValues[skey] = originalVal), skey in validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps2.noNormalize ? sval : normalizeValueWithProperty(sval);
|
|
10753
|
+
originalVal !== void 0 && (originalValues || (originalValues = {}), originalValues[skey] = originalVal), skey in validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps2.noNormalize ? sval : normalizeValueWithProperty(sval, key1);
|
|
10595
10754
|
}), key = key1;
|
|
10596
10755
|
}, {
|
|
10597
10756
|
staticConfig,
|
|
@@ -10903,7 +11062,7 @@ function getThemedChildren(themeState, children, props) {
|
|
|
10903
11062
|
var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, stateRef = arguments.length > 4 ? arguments[4] : void 0, passThrough = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : false, {
|
|
10904
11063
|
shallow,
|
|
10905
11064
|
forceClassName
|
|
10906
|
-
} = props,
|
|
11065
|
+
} = props, state2 = stateRef.current, hasEverThemed = state2.hasEverThemed, shouldRenderChildrenWithTheme = hasEverThemed || themeState.isNew || isRoot || hasThemeUpdatingProps(props);
|
|
10907
11066
|
if (!shouldRenderChildrenWithTheme) return children;
|
|
10908
11067
|
children = /* @__PURE__ */ jsxRuntime.jsx(ThemeStateContext.Provider, {
|
|
10909
11068
|
value: themeState.id,
|
|
@@ -10913,9 +11072,9 @@ function getThemedChildren(themeState, children, props) {
|
|
|
10913
11072
|
isInverse,
|
|
10914
11073
|
name
|
|
10915
11074
|
} = themeState, requiresExtraWrapper = isInverse || forceClassName;
|
|
10916
|
-
if (
|
|
11075
|
+
if (state2.hasEverThemed || (state2.hasEverThemed = true), (requiresExtraWrapper || // if the theme is exactly dark or light, its likely to change between dark/light
|
|
10917
11076
|
// and that would require wrapping which would re-parent, so to avoid re-parenting do this
|
|
10918
|
-
themeState.name === "dark" || themeState.name === "light") && (
|
|
11077
|
+
themeState.name === "dark" || themeState.name === "light") && (state2.hasEverThemed = "wrapped"), shallow && themeState.parentId) {
|
|
10919
11078
|
var parentState = getThemeState(themeState.isNew ? themeState.id : themeState.parentId);
|
|
10920
11079
|
if (!parentState) throw new Error("‼️010");
|
|
10921
11080
|
children = React.Children.toArray(children).map(function(child) {
|
|
@@ -11024,11 +11183,11 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
11024
11183
|
canImmediatelyEnter ? defaultComponentStateShouldEnter : defaultComponentState
|
|
11025
11184
|
) : defaultComponentStateMounted, disabled = isDisabled(props);
|
|
11026
11185
|
disabled != null && (initialState.disabled = disabled);
|
|
11027
|
-
var states2 = React.useState(initialState),
|
|
11186
|
+
var states2 = React.useState(initialState), state2 = props.forceStyle ? __spreadProps(__spreadValues({}, states2[0]), {
|
|
11028
11187
|
[props.forceStyle]: true
|
|
11029
11188
|
}) : states2[0], setState = states2[1], isAnimated = willBeAnimated;
|
|
11030
|
-
disabled !==
|
|
11031
|
-
return __spreadValues({},
|
|
11189
|
+
disabled !== state2.disabled && (disabled && Object.assign(state2, defaultComponentStateMounted), state2.disabled = disabled, setState(function(_2) {
|
|
11190
|
+
return __spreadValues({}, state2);
|
|
11032
11191
|
}));
|
|
11033
11192
|
var groupName = props.group, setStateShallow = useCreateShallowSetState(setState, props.debug);
|
|
11034
11193
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
@@ -11040,7 +11199,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
11040
11199
|
} = presenceState;
|
|
11041
11200
|
isObj(custom) && Object.assign(props, custom);
|
|
11042
11201
|
var exv = exitVariant != null ? exitVariant : enterExitVariant, env = enterVariant != null ? enterVariant : enterExitVariant;
|
|
11043
|
-
|
|
11202
|
+
state2.unmounted && env && staticConfig.variants[env] ? props[env] = true : isExiting && exv && (props[exv] = exitVariant !== enterExitVariant);
|
|
11044
11203
|
}
|
|
11045
11204
|
var noClass = !isWeb;
|
|
11046
11205
|
return {
|
|
@@ -11058,7 +11217,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
11058
11217
|
setState,
|
|
11059
11218
|
setStateShallow,
|
|
11060
11219
|
noClass,
|
|
11061
|
-
state,
|
|
11220
|
+
state: state2,
|
|
11062
11221
|
stateRef,
|
|
11063
11222
|
supportsCSS,
|
|
11064
11223
|
willBeAnimated,
|
|
@@ -11159,7 +11318,7 @@ function createComponent(staticConfig) {
|
|
|
11159
11318
|
presenceState,
|
|
11160
11319
|
setState,
|
|
11161
11320
|
noClass,
|
|
11162
|
-
state,
|
|
11321
|
+
state: state2,
|
|
11163
11322
|
stateRef,
|
|
11164
11323
|
supportsCSS,
|
|
11165
11324
|
willBeAnimated,
|
|
@@ -11176,9 +11335,9 @@ function createComponent(staticConfig) {
|
|
|
11176
11335
|
var listeners2 = /* @__PURE__ */ new Set();
|
|
11177
11336
|
return (_stateRef_current_group = stateRef.current.group) === null || _stateRef_current_group === void 0 || (_stateRef_current_group_listeners = _stateRef_current_group.listeners) === null || _stateRef_current_group_listeners === void 0 || _stateRef_current_group_listeners.clear(), stateRef.current.group = {
|
|
11178
11337
|
listeners: listeners2,
|
|
11179
|
-
emit(
|
|
11338
|
+
emit(state22) {
|
|
11180
11339
|
listeners2.forEach(function(l) {
|
|
11181
|
-
return l(
|
|
11340
|
+
return l(state22);
|
|
11182
11341
|
});
|
|
11183
11342
|
},
|
|
11184
11343
|
subscribe(cb) {
|
|
@@ -11227,7 +11386,7 @@ function createComponent(staticConfig) {
|
|
|
11227
11386
|
setDidGetVariableValue(false);
|
|
11228
11387
|
var resolveValues = (
|
|
11229
11388
|
// if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
|
|
11230
|
-
isAnimated && !supportsCSS || isHOC &&
|
|
11389
|
+
isAnimated && !supportsCSS || isHOC && state2.unmounted == false && hasAnimationProp ? "value" : "auto"
|
|
11231
11390
|
), styleProps2 = {
|
|
11232
11391
|
mediaState,
|
|
11233
11392
|
noClass,
|
|
@@ -11237,7 +11396,7 @@ function createComponent(staticConfig) {
|
|
|
11237
11396
|
willBeAnimated,
|
|
11238
11397
|
styledContext: styledContextValue
|
|
11239
11398
|
}, themeName = (themeState == null ? void 0 : themeState.name) || "";
|
|
11240
|
-
var splitStyles = useSplitStyles(props, staticConfig, theme, themeName,
|
|
11399
|
+
var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state2, styleProps2, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
|
|
11241
11400
|
if (splitStyles == null ? void 0 : splitStyles.overriddenContextProps) {
|
|
11242
11401
|
var _staticConfig_parentStaticConfig, contextForProps = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
|
|
11243
11402
|
if (contextForProps) {
|
|
@@ -11283,7 +11442,7 @@ function createComponent(staticConfig) {
|
|
|
11283
11442
|
pendingState && (stateRef.current.nextState = void 0, ogSetStateShallow(pendingState));
|
|
11284
11443
|
return;
|
|
11285
11444
|
}
|
|
11286
|
-
var updatedState = stateRef.current.nextState ||
|
|
11445
|
+
var updatedState = stateRef.current.nextState || state2, mediaState2 = stateRef.current.nextMedia, nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? __spreadProps(__spreadValues({}, styleProps2), {
|
|
11287
11446
|
mediaState: mediaState2
|
|
11288
11447
|
}) : styleProps2, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
|
|
11289
11448
|
useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
|
|
@@ -11314,7 +11473,7 @@ function createComponent(staticConfig) {
|
|
|
11314
11473
|
}
|
|
11315
11474
|
}
|
|
11316
11475
|
}), stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
11317
|
-
var prev = stateRef.current.nextState ||
|
|
11476
|
+
var prev = stateRef.current.nextState || state2, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
11318
11477
|
if (!(next === prev || isEqualShallow(prev, next))) {
|
|
11319
11478
|
var canAvoidReRender = Object.keys(next).every(function(key3) {
|
|
11320
11479
|
return avoidReRenderKeys.has(key3);
|
|
@@ -11324,9 +11483,9 @@ function createComponent(staticConfig) {
|
|
|
11324
11483
|
updateGroupListeners2(), (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
|
|
11325
11484
|
} else ogSetStateShallow(next);
|
|
11326
11485
|
}
|
|
11327
|
-
}, setStateShallow = function(
|
|
11486
|
+
}, setStateShallow = function(state22) {
|
|
11328
11487
|
var _stateRef_current_setStateShallow, _stateRef_current;
|
|
11329
|
-
(_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current,
|
|
11488
|
+
(_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, state22);
|
|
11330
11489
|
};
|
|
11331
11490
|
}
|
|
11332
11491
|
if (splitStyles) {
|
|
@@ -11408,7 +11567,7 @@ function createComponent(staticConfig) {
|
|
|
11408
11567
|
styleState: splitStyles,
|
|
11409
11568
|
useStyleEmitter,
|
|
11410
11569
|
presence,
|
|
11411
|
-
componentState:
|
|
11570
|
+
componentState: state2,
|
|
11412
11571
|
styleProps: styleProps2,
|
|
11413
11572
|
theme,
|
|
11414
11573
|
themeName,
|
|
@@ -11416,7 +11575,7 @@ function createComponent(staticConfig) {
|
|
|
11416
11575
|
staticConfig,
|
|
11417
11576
|
stateRef
|
|
11418
11577
|
});
|
|
11419
|
-
animations && (animations.ref && (animatedRef = animations.ref), isHydrated && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = `${
|
|
11578
|
+
animations && (animations.ref && (animatedRef = animations.ref), isHydrated && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = `${state2.unmounted === "should-enter" ? "t_unmounted " : ""}${viewProps.className || ""} ${animations.className}`)));
|
|
11420
11579
|
}
|
|
11421
11580
|
!isPassthrough && groupContext && // avoids onLayout if we don't need it
|
|
11422
11581
|
props.containerType !== "normal" && (nonTamaguiProps.onLayout = composeEventHandlers(nonTamaguiProps.onLayout, function(e) {
|
|
@@ -11436,13 +11595,13 @@ function createComponent(staticConfig) {
|
|
|
11436
11595
|
});
|
|
11437
11596
|
};
|
|
11438
11597
|
useIsomorphicLayoutEffect(function() {
|
|
11439
|
-
if (
|
|
11598
|
+
if (state2.unmounted === true && hasEnterStyle) {
|
|
11440
11599
|
setStateShallow({
|
|
11441
11600
|
unmounted: "should-enter"
|
|
11442
11601
|
});
|
|
11443
11602
|
return;
|
|
11444
11603
|
}
|
|
11445
|
-
if (
|
|
11604
|
+
if (state2.unmounted) {
|
|
11446
11605
|
if (supportsCSS) {
|
|
11447
11606
|
var cancelled = false;
|
|
11448
11607
|
return requestAnimationFrame(function() {
|
|
@@ -11463,7 +11622,7 @@ function createComponent(staticConfig) {
|
|
|
11463
11622
|
var _stateRef_current_mediaEmitCleanup, _stateRef_current;
|
|
11464
11623
|
componentSetStates.delete(setState), (_stateRef_current_mediaEmitCleanup = (_stateRef_current = stateRef.current).mediaEmitCleanup) === null || _stateRef_current_mediaEmitCleanup === void 0 || _stateRef_current_mediaEmitCleanup.call(_stateRef_current);
|
|
11465
11624
|
};
|
|
11466
|
-
}, [
|
|
11625
|
+
}, [state2.unmounted, supportsCSS]), useIsomorphicLayoutEffect(function() {
|
|
11467
11626
|
if (!disabled && !(!pseudoGroups && !mediaGroups) && allGroupContexts) return subscribeToContextGroup({
|
|
11468
11627
|
groupContext: allGroupContexts,
|
|
11469
11628
|
setStateShallow,
|
|
@@ -11473,9 +11632,9 @@ function createComponent(staticConfig) {
|
|
|
11473
11632
|
}, [allGroupContexts, disabled, pseudoGroups ? objectIdentityKey(pseudoGroups) : 0, mediaGroups ? objectIdentityKey(mediaGroups) : 0]);
|
|
11474
11633
|
var groupEmitter = stateRef.current.group;
|
|
11475
11634
|
useIsomorphicLayoutEffect(function() {
|
|
11476
|
-
!groupContext || !groupEmitter || notifyGroupSubscribers(groupContext, groupEmitter,
|
|
11477
|
-
}, [groupContext, groupEmitter,
|
|
11478
|
-
var runtimePressStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusStyle), runtimeFocusVisibleStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusVisibleStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur || componentContext.setParentFocusState), hasDynamicGroupChildren = !!(groupName &&
|
|
11635
|
+
!groupContext || !groupEmitter || notifyGroupSubscribers(groupContext, groupEmitter, state2);
|
|
11636
|
+
}, [groupContext, groupEmitter, state2]);
|
|
11637
|
+
var runtimePressStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusStyle), runtimeFocusVisibleStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusVisibleStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur || componentContext.setParentFocusState), hasDynamicGroupChildren = !!(groupName && state2.hasDynGroupChildren), attachPress = !!(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos == null ? void 0 : pseudos.focusVisibleStyle)), runtimeHoverStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = !!(hasDynamicGroupChildren || runtimeHoverStyle), attachHover = isWeb, shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle), needsPressState = !!(hasDynamicGroupChildren || runtimePressStyle);
|
|
11479
11638
|
var events = shouldAttach ? __spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
11480
11639
|
onPressOut: attachPress ? function(e) {
|
|
11481
11640
|
unPress(), onPressOut == null ? void 0 : onPressOut(e), onMouseUp == null ? void 0 : onMouseUp(e);
|
|
@@ -11483,7 +11642,7 @@ function createComponent(staticConfig) {
|
|
|
11483
11642
|
}, attachPress && {
|
|
11484
11643
|
onMouseEnter: function(e) {
|
|
11485
11644
|
var next = {};
|
|
11486
|
-
needsHoverState && true && (next.hover = true), needsPressState &&
|
|
11645
|
+
needsHoverState && true && (next.hover = true), needsPressState && state2.pressIn && (next.press = true), setStateShallow(next), onHoverIn == null ? void 0 : onHoverIn(e), onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
11487
11646
|
},
|
|
11488
11647
|
onMouseLeave: function(e) {
|
|
11489
11648
|
var next = {};
|
|
@@ -11549,7 +11708,7 @@ function createComponent(staticConfig) {
|
|
|
11549
11708
|
var renderProps = __spreadProps(__spreadValues({}, viewProps), {
|
|
11550
11709
|
children: content
|
|
11551
11710
|
});
|
|
11552
|
-
content = renderProp(renderProps,
|
|
11711
|
+
content = renderProp(renderProps, state2);
|
|
11553
11712
|
} else if (renderProp && (typeof renderProp > "u" ? "undefined" : _type_of$1(renderProp)) === "object" && /* @__PURE__ */ React.isValidElement(renderProp)) {
|
|
11554
11713
|
var elementProps = renderProp.props || {}, mergedProps = mergeRenderElementProps(elementProps, viewProps, content);
|
|
11555
11714
|
content = /* @__PURE__ */ React.cloneElement(renderProp, mergedProps);
|
|
@@ -12327,13 +12486,13 @@ function usePropsAndStyle(props, opts2) {
|
|
|
12327
12486
|
return true;
|
|
12328
12487
|
}
|
|
12329
12488
|
}), componentContext = React.useContext(ComponentContext), groupContext = React.useContext(GroupContext), {
|
|
12330
|
-
state,
|
|
12489
|
+
state: state2,
|
|
12331
12490
|
disabled,
|
|
12332
12491
|
setStateShallow
|
|
12333
12492
|
} = useComponentState(props, componentContext.animationDriver, staticConfig, getConfig()), mediaStateNow = (opts2 == null ? void 0 : opts2.noMedia) ? (
|
|
12334
12493
|
// not safe to use mediaState but really marginal to hit this
|
|
12335
12494
|
exports.mediaState
|
|
12336
|
-
) : useMedia(), splitStyles = useSplitStyles(props, staticConfig, theme, (themeState == null ? void 0 : themeState.name) || "",
|
|
12495
|
+
) : useMedia(), splitStyles = useSplitStyles(props, staticConfig, theme, (themeState == null ? void 0 : themeState.name) || "", state2, __spreadValues({
|
|
12337
12496
|
isAnimated: false,
|
|
12338
12497
|
mediaState: mediaStateNow,
|
|
12339
12498
|
noSkip: true,
|
|
@@ -12346,7 +12505,7 @@ function usePropsAndStyle(props, opts2) {
|
|
|
12346
12505
|
} = splitStyles || {};
|
|
12347
12506
|
return useIsomorphicLayoutEffect(function() {
|
|
12348
12507
|
if (!disabled) {
|
|
12349
|
-
if (
|
|
12508
|
+
if (state2.unmounted) {
|
|
12350
12509
|
setStateShallow({
|
|
12351
12510
|
unmounted: false
|
|
12352
12511
|
});
|