@tamagui/web 1.125.2 → 1.125.4
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/cjs/createComponent.cjs +7 -6
- package/dist/cjs/createComponent.js +6 -6
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +7 -7
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/consoleLog.cjs +31 -0
- package/dist/cjs/helpers/consoleLog.js +24 -0
- package/dist/cjs/helpers/consoleLog.js.map +6 -0
- package/dist/cjs/helpers/consoleLog.native.js +30 -0
- package/dist/cjs/helpers/consoleLog.native.js.map +6 -0
- package/dist/cjs/helpers/getSplitStyles.cjs +37 -64
- package/dist/cjs/helpers/getSplitStyles.js +41 -79
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.native.js +57 -67
- package/dist/cjs/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/cjs/helpers/log.cjs +2 -0
- package/dist/cjs/helpers/log.js +2 -0
- package/dist/cjs/helpers/log.js.map +1 -1
- package/dist/cjs/helpers/log.native.js +2 -0
- package/dist/cjs/helpers/log.native.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.cjs +2 -22
- package/dist/cjs/helpers/normalizeValueWithProperty.js +2 -24
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +3 -23
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +2 -2
- package/dist/cjs/views/Theme.cjs +1 -1
- package/dist/cjs/views/Theme.js +1 -1
- package/dist/cjs/views/Theme.js.map +1 -1
- package/dist/cjs/views/Theme.native.js +1 -1
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/esm/createComponent.js +6 -5
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.mjs +7 -6
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +7 -6
- package/dist/esm/createComponent.native.js.map +2 -2
- package/dist/esm/helpers/consoleLog.js +8 -0
- package/dist/esm/helpers/consoleLog.js.map +6 -0
- package/dist/esm/helpers/consoleLog.mjs +6 -0
- package/dist/esm/helpers/consoleLog.mjs.map +1 -0
- package/dist/esm/helpers/consoleLog.native.js +8 -0
- package/dist/esm/helpers/consoleLog.native.js.map +6 -0
- package/dist/esm/helpers/getSplitStyles.js +43 -89
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs +39 -66
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +58 -67
- package/dist/esm/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/esm/helpers/log.js +2 -0
- package/dist/esm/helpers/log.js.map +1 -1
- package/dist/esm/helpers/log.mjs +2 -0
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js +2 -0
- package/dist/esm/helpers/log.native.js.map +2 -2
- package/dist/esm/helpers/normalizeValueWithProperty.js +1 -24
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.mjs +1 -20
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +1 -21
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +2 -2
- package/dist/esm/views/Theme.js +1 -1
- package/dist/esm/views/Theme.js.map +1 -1
- package/dist/esm/views/Theme.mjs +1 -1
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +1 -1
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/package.json +11 -11
- package/src/createComponent.tsx +9 -8
- package/src/helpers/consoleLog.ts +8 -0
- package/src/helpers/getSplitStyles.tsx +56 -153
- package/src/helpers/log.ts +2 -0
- package/src/helpers/normalizeValueWithProperty.ts +0 -46
- package/src/views/Theme.tsx +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/consoleLog.d.ts +16 -0
- package/types/helpers/consoleLog.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/log.d.ts.map +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts +0 -1
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
|
@@ -45,6 +45,7 @@ var import_constants = require("@tamagui/constants"),
|
|
|
45
45
|
import_constants2 = require("../constants/constants.cjs"),
|
|
46
46
|
import_isDevTools = require("../constants/isDevTools.cjs"),
|
|
47
47
|
import_useMedia = require("../hooks/useMedia.cjs"),
|
|
48
|
+
import_consoleLog = require("./consoleLog.cjs"),
|
|
48
49
|
import_createMediaStyle = require("./createMediaStyle.cjs"),
|
|
49
50
|
import_expandStyles = require("./expandStyles.cjs"),
|
|
50
51
|
import_getCSSStylesAtomic = require("./getCSSStylesAtomic.cjs"),
|
|
@@ -59,7 +60,6 @@ var import_constants = require("@tamagui/constants"),
|
|
|
59
60
|
import_skipProps = require("./skipProps.cjs"),
|
|
60
61
|
import_sortString = require("./sortString.cjs"),
|
|
61
62
|
import_transformsToString = require("./transformsToString.cjs");
|
|
62
|
-
const consoleGroupCollapsed = import_constants.isWeb ? console.groupCollapsed : console.info;
|
|
63
63
|
let conf;
|
|
64
64
|
const PROP_SPLIT = "-";
|
|
65
65
|
function isValidStyleKey(key, validStyles, accept) {
|
|
@@ -86,8 +86,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
86
86
|
usedKeys = {},
|
|
87
87
|
shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClass,
|
|
88
88
|
rulesToInsert = {},
|
|
89
|
-
classNames = {}
|
|
90
|
-
transforms = {};
|
|
89
|
+
classNames = {};
|
|
91
90
|
let pseudos = null,
|
|
92
91
|
space = props.space,
|
|
93
92
|
hasMedia = !1,
|
|
@@ -122,7 +121,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
122
121
|
}
|
|
123
122
|
}));
|
|
124
123
|
}
|
|
125
|
-
process.env.NODE_ENV === "development" && debug === "profile" && time`style-state`, process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (
|
|
124
|
+
process.env.NODE_ENV === "development" && debug === "profile" && time`style-state`, process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && ((0, import_consoleLog.groupCollapsed)("getSplitStyles (collapsed)"), (0, import_log.log)({
|
|
126
125
|
props,
|
|
127
126
|
staticConfig,
|
|
128
127
|
shouldDoClasses,
|
|
@@ -133,7 +132,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
133
132
|
theme: {
|
|
134
133
|
...theme
|
|
135
134
|
}
|
|
136
|
-
}),
|
|
135
|
+
}), (0, import_consoleLog.groupEnd)());
|
|
137
136
|
const {
|
|
138
137
|
asChild
|
|
139
138
|
} = props,
|
|
@@ -164,7 +163,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
164
163
|
continue;
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" &&
|
|
166
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_consoleLog.groupEnd)(), disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || asChild && import_constants2.webViewFlexCompatStyles[keyInit] === valInit) continue;
|
|
168
167
|
if (keyInit in import_skipProps.skipProps && !noSkip && !isHOC) {
|
|
169
168
|
if (keyInit === "group") {
|
|
170
169
|
const identifier = `t_group_${valInit}`,
|
|
@@ -179,17 +178,6 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
179
178
|
keyInit = keyInit.replace("data-", ""), viewProps.dataSet ||= {}, viewProps.dataSet[keyInit] = valInit;
|
|
180
179
|
continue;
|
|
181
180
|
}
|
|
182
|
-
if (isValidStyleKeyInit && valInitType === "string" && valInit[0] === "_") {
|
|
183
|
-
const isValidClassName = keyInit in validStyles,
|
|
184
|
-
isMediaOrPseudo2 = !isValidClassName &&
|
|
185
|
-
// media are flattened for some reason to color-hover keys,
|
|
186
|
-
// we should probably just leave them in place to avoid extra complexity
|
|
187
|
-
keyInit.includes(PROP_SPLIT) && validStyles[keyInit.split(PROP_SPLIT)[0]];
|
|
188
|
-
if (isValidClassName || isMediaOrPseudo2) {
|
|
189
|
-
shouldDoClasses ? (mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo2), styleState.style && delete styleState.style[keyInit]) : (styleState.style ||= {}, styleState.style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit), delete classNames[keyInit]);
|
|
190
|
-
continue;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
181
|
if (keyInit === "dataSet") {
|
|
194
182
|
for (const keyInit2 in valInit) viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
|
|
195
183
|
continue;
|
|
@@ -277,7 +265,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
277
265
|
parentVariant = parentVariants?.[keyInit],
|
|
278
266
|
isHOCShouldPassThrough = !!(isHOC && (isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in import_skipProps.skipProps)),
|
|
279
267
|
shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
280
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
268
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupEnd)(), (0, import_consoleLog.groupEnd)(), (0, import_consoleLog.groupCollapsed)(` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`), (0, import_log.log)({
|
|
281
269
|
isVariant,
|
|
282
270
|
valInit,
|
|
283
271
|
shouldPassProp
|
|
@@ -295,23 +283,23 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
295
283
|
viewProps[key] = val;
|
|
296
284
|
return;
|
|
297
285
|
}
|
|
298
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
286
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupCollapsed)(" \u{1F4A0} expanded", keyInit, "=>", key), (0, import_log.log)(val), (0, import_consoleLog.groupEnd)()), val == null || key in usedKeys) return;
|
|
299
287
|
if (!isHOC && isValidStyleKey(key, validStyles, accept)) {
|
|
300
288
|
mergeStyle(styleState, key, val);
|
|
301
289
|
return;
|
|
302
290
|
}
|
|
303
291
|
if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps?.has(key) || process.env.IS_STATIC === "is_static" && inlineWhenUnflattened?.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || parentStaticConfig?.variants?.[keyInit])) {
|
|
304
|
-
passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
292
|
+
passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupCollapsed)(` - passing down prop ${key}`), (0, import_log.log)({
|
|
305
293
|
val,
|
|
306
294
|
after: {
|
|
307
295
|
...viewProps[key]
|
|
308
296
|
}
|
|
309
|
-
}),
|
|
297
|
+
}), (0, import_consoleLog.groupEnd)());
|
|
310
298
|
return;
|
|
311
299
|
}
|
|
312
300
|
if (isPseudo) {
|
|
313
301
|
if (!val) return;
|
|
314
|
-
const pseudoStyleObject = getSubStyle(styleState, key, val, styleProps.noClass);
|
|
302
|
+
const pseudoStyleObject = getSubStyle(styleState, key, val, styleProps.noClass && process.env.IS_STATIC !== "is_static");
|
|
315
303
|
if ((!shouldDoClasses || process.env.IS_STATIC === "is_static") && (pseudos ||= {}, pseudos[key] ||= {}, process.env.IS_STATIC === "is_static")) {
|
|
316
304
|
Object.assign(pseudos[key], pseudoStyleObject);
|
|
317
305
|
return;
|
|
@@ -322,26 +310,23 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
322
310
|
if (!descriptor) return;
|
|
323
311
|
if (shouldDoClasses && !isExit) {
|
|
324
312
|
const pseudoStyles = (0, import_getCSSStylesAtomic.getStyleAtomic)(pseudoStyleObject, descriptor);
|
|
325
|
-
process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
326
|
-
pseudoStyleObject,
|
|
327
|
-
pseudoStyles
|
|
328
|
-
}), console.groupEnd());
|
|
313
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && console.info("pseudo:", key, pseudoStyleObject, pseudoStyles);
|
|
329
314
|
for (const psuedoStyle of pseudoStyles) {
|
|
330
315
|
const fullKey = `${psuedoStyle[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
|
|
331
|
-
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle),
|
|
316
|
+
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle), classNames[fullKey] = psuedoStyle[import_helpers.StyleObjectIdentifier]);
|
|
332
317
|
}
|
|
333
318
|
}
|
|
334
319
|
if (!shouldDoClasses || isExit || isEnter) {
|
|
335
320
|
const descriptorKey = descriptor.stateKey || descriptor.name;
|
|
336
321
|
let isDisabled = componentState[descriptorKey] === !1;
|
|
337
|
-
isExit && (isDisabled = !styleProps.isExiting), isEnter && componentState.unmounted === !1 && (isDisabled = !0), process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
322
|
+
isExit && (isDisabled = !styleProps.isExiting), isEnter && componentState.unmounted === !1 && (isDisabled = !0), process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupCollapsed)("pseudo", key, {
|
|
338
323
|
isDisabled
|
|
339
324
|
}), (0, import_log.log)({
|
|
340
325
|
pseudoStyleObject,
|
|
341
326
|
isDisabled,
|
|
342
327
|
descriptor,
|
|
343
328
|
componentState
|
|
344
|
-
}),
|
|
329
|
+
}), (0, import_consoleLog.groupEnd)());
|
|
345
330
|
const importance = descriptor.priority;
|
|
346
331
|
for (const pkey in pseudoStyleObject) {
|
|
347
332
|
const val2 = pseudoStyleObject[pkey];
|
|
@@ -393,7 +378,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
393
378
|
process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out);
|
|
394
379
|
const subKey = isSubStyle ? style[2] : "",
|
|
395
380
|
fullKey = `${style[import_helpers.StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style[import_helpers.StyleObjectPseudo] || ""}`;
|
|
396
|
-
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, out),
|
|
381
|
+
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, out), classNames[fullKey] = out[import_helpers.StyleObjectIdentifier]);
|
|
397
382
|
}
|
|
398
383
|
} else {
|
|
399
384
|
let mergeMediaStyle = function (key2, val2) {
|
|
@@ -467,18 +452,14 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
467
452
|
try {
|
|
468
453
|
(0, import_log.log)(" \u2714\uFE0F expand complete", keyInit), (0, import_log.log)("style", {
|
|
469
454
|
...styleState.style
|
|
470
|
-
}), (0, import_log.log)("transforms", {
|
|
471
|
-
...transforms
|
|
472
455
|
}), (0, import_log.log)("viewProps", {
|
|
473
456
|
...viewProps
|
|
474
457
|
});
|
|
475
458
|
} catch {}
|
|
476
|
-
|
|
459
|
+
(0, import_consoleLog.groupEnd)();
|
|
477
460
|
}
|
|
478
461
|
}
|
|
479
|
-
if (process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-propsend`, !(styleProps.noNormalize === !1) && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), !styleProps.noExpand && !styleProps.noMergeStyle && import_constants.isWeb && !isReactNative && (0, import_getCSSStylesAtomic.styleToCSS)(styleState.style)), styleState.flatTransforms && (styleState.style ||= {},
|
|
480
|
-
mergeTransform(styleState.style, key, val, !0);
|
|
481
|
-
})), parentSplitStyles)) {
|
|
462
|
+
if (process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-propsend`, !(styleProps.noNormalize === !1) && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), !styleProps.noExpand && !styleProps.noMergeStyle && import_constants.isWeb && !isReactNative && (0, import_getCSSStylesAtomic.styleToCSS)(styleState.style)), styleState.flatTransforms && (styleState.style ||= {}, mergeFlatTransforms(styleState.style, styleState.flatTransforms)), parentSplitStyles)) {
|
|
482
463
|
if (shouldDoClasses) for (const key in parentSplitStyles.classNames) {
|
|
483
464
|
const val = parentSplitStyles.classNames[key];
|
|
484
465
|
styleState.style && key in styleState.style || key in classNames || (classNames[key] = val);
|
|
@@ -494,22 +475,9 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
494
475
|
const [key, value, identifier] = atomicStyle,
|
|
495
476
|
isAnimatedAndAnimateOnly = styleProps.isAnimated && styleProps.noClass && props.animateOnly?.includes(key),
|
|
496
477
|
nonAnimatedAnimateOnly = !isAnimatedAndAnimateOnly && !styleProps.isAnimated && props.animateOnly?.includes(key);
|
|
497
|
-
isAnimatedAndAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = styleState.style[key]) : nonAnimatedAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = value, shouldRetain = !0) : (addStyleToInsertRules(rulesToInsert, atomicStyle),
|
|
498
|
-
}
|
|
499
|
-
process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupEnd(), consoleGroupCollapsed("\u{1F539} getSplitStyles final style object"), console.info(styleState.style), console.info("retainedStyles", retainedStyles), console.groupEnd()), (shouldRetain || process.env.IS_STATIC !== "is_static") && (styleState.style = retainedStyles || {});
|
|
500
|
-
}
|
|
501
|
-
if (transforms) for (const namespace in transforms) {
|
|
502
|
-
if (!transforms[namespace]) {
|
|
503
|
-
process.env.NODE_ENV === "development" && (0, import_log.log)("Error no transform", transforms, namespace);
|
|
504
|
-
continue;
|
|
505
|
-
}
|
|
506
|
-
const [hash, val] = transforms[namespace],
|
|
507
|
-
identifier = `_transform${hash}`;
|
|
508
|
-
if (import_constants.isClient && !import_insertStyleRule.insertedTransforms[identifier]) {
|
|
509
|
-
const rule = `.${identifier} { transform: ${val}; }`;
|
|
510
|
-
addStyleToInsertRules(rulesToInsert, [namespace, val, identifier, void 0, [rule]]);
|
|
478
|
+
isAnimatedAndAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = styleState.style[key]) : nonAnimatedAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = value, shouldRetain = !0) : (addStyleToInsertRules(rulesToInsert, atomicStyle), classNames[key] = identifier);
|
|
511
479
|
}
|
|
512
|
-
|
|
480
|
+
process.env.NODE_ENV === "development" && props.debug === "verbose" && ((0, import_consoleLog.groupEnd)(), (0, import_consoleLog.groupCollapsed)("\u{1F539} getSplitStyles final style object"), console.info(styleState.style), console.info("retainedStyles", retainedStyles), (0, import_consoleLog.groupEnd)()), (shouldRetain || process.env.IS_STATIC !== "is_static") && (styleState.style = retainedStyles || {});
|
|
513
481
|
}
|
|
514
482
|
}
|
|
515
483
|
if (isReactNative) viewProps.tabIndex === 0 && (viewProps.accessible ??= !0);else if (viewProps.tabIndex == null) {
|
|
@@ -570,42 +538,40 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
570
538
|
}
|
|
571
539
|
}
|
|
572
540
|
if (process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
|
|
573
|
-
|
|
541
|
+
(0, import_consoleLog.groupCollapsed)("\u{1F539} getSplitStyles ===>");
|
|
574
542
|
try {
|
|
575
543
|
const logs = {
|
|
576
544
|
...result,
|
|
577
545
|
className,
|
|
578
546
|
componentState,
|
|
579
|
-
transforms,
|
|
580
547
|
viewProps,
|
|
581
548
|
rulesToInsert,
|
|
582
549
|
parentSplitStyles
|
|
583
550
|
};
|
|
584
551
|
for (const key in logs) (0, import_log.log)(key, logs[key]);
|
|
585
552
|
} catch {}
|
|
586
|
-
|
|
553
|
+
(0, import_consoleLog.groupEnd)();
|
|
587
554
|
}
|
|
588
555
|
return process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-done`, result;
|
|
589
556
|
};
|
|
590
|
-
function
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
import_constants.isClient && !transform && ((0, import_insertStyleRule.scanAllSheets)(), transform = import_insertStyleRule.insertedTransforms[val], !transform && import_constants.isWeb && val[0] !== "_" && (transform = val)), transforms[ns] ||= ["", ""], transforms[ns][0] += val.replace("_transform", ""), transform && (transforms[ns][1] += transform);
|
|
595
|
-
} else classNames[key] = val;
|
|
557
|
+
function mergeFlatTransforms(target, flatTransforms) {
|
|
558
|
+
Object.entries(flatTransforms).sort(([a], [b]) => (0, import_sortString.sortString)(a, b)).forEach(([key, val]) => {
|
|
559
|
+
mergeTransform(target, key, val, !0);
|
|
560
|
+
});
|
|
596
561
|
}
|
|
597
562
|
function mergeStyle(styleState, key, val, disableNormalize = !1) {
|
|
598
563
|
const {
|
|
599
|
-
classNames,
|
|
600
564
|
viewProps,
|
|
601
|
-
usedKeys,
|
|
602
565
|
styleProps,
|
|
603
566
|
staticConfig
|
|
604
567
|
} = styleState;
|
|
605
|
-
if (
|
|
568
|
+
if (key in import_helpers.stylePropsTransform) styleState.flatTransforms ||= {}, styleState.flatTransforms[key] = val;else {
|
|
606
569
|
const out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
|
|
607
570
|
// accept is for props not styles
|
|
608
|
-
staticConfig.accept && key in staticConfig.accept ? viewProps[key] = out : (styleState.style ||= {}, styleState.style[key] =
|
|
571
|
+
staticConfig.accept && key in staticConfig.accept ? viewProps[key] = out : (styleState.style ||= {}, styleState.style[key] =
|
|
572
|
+
// if you dont do this you'll be passing props.transform arrays directly here and then mutating them
|
|
573
|
+
// if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
|
|
574
|
+
key === "transform" && Array.isArray(out) ? [...out] : out);
|
|
609
575
|
}
|
|
610
576
|
}
|
|
611
577
|
const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
@@ -621,6 +587,13 @@ const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
|
621
587
|
skey in import_helpers.validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
|
|
622
588
|
});
|
|
623
589
|
}
|
|
590
|
+
if (!avoidMergeTransform) {
|
|
591
|
+
if (Array.isArray(styleOut.transform)) {
|
|
592
|
+
const parentTransform = styleState.style?.transform;
|
|
593
|
+
parentTransform && (styleOut.transform = [...parentTransform, ...styleOut.transform]);
|
|
594
|
+
}
|
|
595
|
+
styleState.flatTransforms && mergeFlatTransforms(styleOut, styleState.flatTransforms);
|
|
596
|
+
}
|
|
624
597
|
return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
|
|
625
598
|
},
|
|
626
599
|
useInsertEffectCompat = import_constants.isWeb ? import_react.default.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {},
|
|
@@ -28,8 +28,7 @@ __export(getSplitStyles_exports, {
|
|
|
28
28
|
useSplitStyles: () => useSplitStyles
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(getSplitStyles_exports);
|
|
31
|
-
var import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_react = __toESM(require("react")), import_config = require("../config"), import_accessibilityDirectMap = require("../constants/accessibilityDirectMap"), import_constants2 = require("../constants/constants"), import_isDevTools = require("../constants/isDevTools"), import_useMedia = require("../hooks/useMedia"), import_createMediaStyle = require("./createMediaStyle"), import_expandStyles = require("./expandStyles"), import_getCSSStylesAtomic = require("./getCSSStylesAtomic"), import_getGroupPropParts = require("./getGroupPropParts"), import_insertStyleRule = require("./insertStyleRule"), import_isActivePlatform = require("./isActivePlatform"), import_isActiveTheme = require("./isActiveTheme"), import_log = require("./log"), import_normalizeValueWithProperty = require("./normalizeValueWithProperty"), import_propMapper = require("./propMapper"), import_pseudoDescriptors = require("./pseudoDescriptors"), import_skipProps = require("./skipProps"), import_sortString = require("./sortString"), import_transformsToString = require("./transformsToString");
|
|
32
|
-
const consoleGroupCollapsed = import_constants.isWeb ? console.groupCollapsed : console.info;
|
|
31
|
+
var import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_react = __toESM(require("react")), import_config = require("../config"), import_accessibilityDirectMap = require("../constants/accessibilityDirectMap"), import_constants2 = require("../constants/constants"), import_isDevTools = require("../constants/isDevTools"), import_useMedia = require("../hooks/useMedia"), import_consoleLog = require("./consoleLog"), import_createMediaStyle = require("./createMediaStyle"), import_expandStyles = require("./expandStyles"), import_getCSSStylesAtomic = require("./getCSSStylesAtomic"), import_getGroupPropParts = require("./getGroupPropParts"), import_insertStyleRule = require("./insertStyleRule"), import_isActivePlatform = require("./isActivePlatform"), import_isActiveTheme = require("./isActiveTheme"), import_log = require("./log"), import_normalizeValueWithProperty = require("./normalizeValueWithProperty"), import_propMapper = require("./propMapper"), import_pseudoDescriptors = require("./pseudoDescriptors"), import_skipProps = require("./skipProps"), import_sortString = require("./sortString"), import_transformsToString = require("./transformsToString");
|
|
33
32
|
let conf;
|
|
34
33
|
const PROP_SPLIT = "-";
|
|
35
34
|
function isValidStyleKey(key, validStyles, accept) {
|
|
@@ -47,7 +46,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
47
46
|
inlineWhenUnflattened,
|
|
48
47
|
parentStaticConfig,
|
|
49
48
|
acceptsClassName
|
|
50
|
-
} = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClass, rulesToInsert = {}, classNames = {}
|
|
49
|
+
} = staticConfig, viewProps = {}, mediaState = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClass, rulesToInsert = {}, classNames = {};
|
|
51
50
|
let pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0;
|
|
52
51
|
const validStyles = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles);
|
|
53
52
|
process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-setup`;
|
|
@@ -73,7 +72,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
73
72
|
}
|
|
74
73
|
}));
|
|
75
74
|
}
|
|
76
|
-
process.env.NODE_ENV === "development" && debug === "profile" && time`style-state`, process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (
|
|
75
|
+
process.env.NODE_ENV === "development" && debug === "profile" && time`style-state`, process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && ((0, import_consoleLog.groupCollapsed)("getSplitStyles (collapsed)"), (0, import_log.log)({
|
|
77
76
|
props,
|
|
78
77
|
staticConfig,
|
|
79
78
|
shouldDoClasses,
|
|
@@ -82,7 +81,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
82
81
|
componentState,
|
|
83
82
|
styleState,
|
|
84
83
|
theme: { ...theme }
|
|
85
|
-
}),
|
|
84
|
+
}), (0, import_consoleLog.groupEnd)());
|
|
86
85
|
const { asChild } = props, { accept } = staticConfig, { noSkip, disableExpandShorthands, noExpand } = styleProps, { webContainerType } = conf.settings, parentVariants = parentStaticConfig?.variants;
|
|
87
86
|
for (const keyOg in props) {
|
|
88
87
|
let keyInit = keyOg, valInit = props[keyInit];
|
|
@@ -99,7 +98,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
99
98
|
continue;
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" &&
|
|
101
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_consoleLog.groupEnd)(), disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || asChild && import_constants2.webViewFlexCompatStyles[keyInit] === valInit)
|
|
103
102
|
continue;
|
|
104
103
|
if (keyInit in import_skipProps.skipProps && !noSkip && !isHOC) {
|
|
105
104
|
if (keyInit === "group") {
|
|
@@ -122,15 +121,6 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
122
121
|
keyInit = keyInit.replace("data-", ""), viewProps.dataSet ||= {}, viewProps.dataSet[keyInit] = valInit;
|
|
123
122
|
continue;
|
|
124
123
|
}
|
|
125
|
-
if (isValidStyleKeyInit && valInitType === "string" && valInit[0] === "_") {
|
|
126
|
-
const isValidClassName = keyInit in validStyles, isMediaOrPseudo2 = !isValidClassName && // media are flattened for some reason to color-hover keys,
|
|
127
|
-
// we should probably just leave them in place to avoid extra complexity
|
|
128
|
-
keyInit.includes(PROP_SPLIT) && validStyles[keyInit.split(PROP_SPLIT)[0]];
|
|
129
|
-
if (isValidClassName || isMediaOrPseudo2) {
|
|
130
|
-
shouldDoClasses ? (mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo2), styleState.style && delete styleState.style[keyInit]) : (styleState.style ||= {}, styleState.style[keyInit] = (0, import_normalizeValueWithProperty.reverseMapClassNameToValue)(keyInit, valInit), delete classNames[keyInit]);
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
124
|
if (keyInit === "dataSet") {
|
|
135
125
|
for (const keyInit2 in valInit)
|
|
136
126
|
viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
|
|
@@ -211,7 +201,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
211
201
|
continue;
|
|
212
202
|
const shouldPassProp = !isStyleProp && isHOC || // is in parent variants
|
|
213
203
|
isHOC && parentVariants && keyInit in parentVariants || inlineProps?.has(keyInit), parentVariant = parentVariants?.[keyInit], isHOCShouldPassThrough = !!(isHOC && (isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in import_skipProps.skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
|
|
214
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
204
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupEnd)(), (0, import_consoleLog.groupEnd)(), (0, import_consoleLog.groupCollapsed)(
|
|
215
205
|
` \u{1F511} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""}`
|
|
216
206
|
), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
|
|
217
207
|
variants,
|
|
@@ -228,18 +218,23 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
228
218
|
viewProps[key] = val;
|
|
229
219
|
return;
|
|
230
220
|
}
|
|
231
|
-
if (process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
221
|
+
if (process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupCollapsed)(" \u{1F4A0} expanded", keyInit, "=>", key), (0, import_log.log)(val), (0, import_consoleLog.groupEnd)()), val == null || key in usedKeys) return;
|
|
232
222
|
if (!isHOC && isValidStyleKey(key, validStyles, accept)) {
|
|
233
223
|
mergeStyle(styleState, key, val);
|
|
234
224
|
return;
|
|
235
225
|
}
|
|
236
226
|
if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps?.has(key) || process.env.IS_STATIC === "is_static" && inlineWhenUnflattened?.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || parentStaticConfig?.variants?.[keyInit])) {
|
|
237
|
-
passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
227
|
+
passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupCollapsed)(` - passing down prop ${key}`), (0, import_log.log)({ val, after: { ...viewProps[key] } }), (0, import_consoleLog.groupEnd)());
|
|
238
228
|
return;
|
|
239
229
|
}
|
|
240
230
|
if (isPseudo) {
|
|
241
231
|
if (!val) return;
|
|
242
|
-
const pseudoStyleObject = getSubStyle(
|
|
232
|
+
const pseudoStyleObject = getSubStyle(
|
|
233
|
+
styleState,
|
|
234
|
+
key,
|
|
235
|
+
val,
|
|
236
|
+
styleProps.noClass && process.env.IS_STATIC !== "is_static"
|
|
237
|
+
);
|
|
243
238
|
if ((!shouldDoClasses || process.env.IS_STATIC === "is_static") && (pseudos ||= {}, pseudos[key] ||= {}, process.env.IS_STATIC === "is_static")) {
|
|
244
239
|
Object.assign(pseudos[key], pseudoStyleObject);
|
|
245
240
|
return;
|
|
@@ -249,23 +244,16 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
249
244
|
return;
|
|
250
245
|
if (shouldDoClasses && !isExit) {
|
|
251
246
|
const pseudoStyles = (0, import_getCSSStylesAtomic.getStyleAtomic)(pseudoStyleObject, descriptor);
|
|
252
|
-
process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
247
|
+
process.env.NODE_ENV === "development" && debug === "verbose" && console.info("pseudo:", key, pseudoStyleObject, pseudoStyles);
|
|
253
248
|
for (const psuedoStyle of pseudoStyles) {
|
|
254
249
|
const fullKey = `${psuedoStyle[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
|
|
255
|
-
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle),
|
|
256
|
-
transforms,
|
|
257
|
-
classNames,
|
|
258
|
-
fullKey,
|
|
259
|
-
psuedoStyle[import_helpers.StyleObjectIdentifier],
|
|
260
|
-
isMediaOrPseudo,
|
|
261
|
-
!0
|
|
262
|
-
));
|
|
250
|
+
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle), classNames[fullKey] = psuedoStyle[import_helpers.StyleObjectIdentifier]);
|
|
263
251
|
}
|
|
264
252
|
}
|
|
265
253
|
if (!shouldDoClasses || isExit || isEnter) {
|
|
266
254
|
const descriptorKey = descriptor.stateKey || descriptor.name;
|
|
267
255
|
let isDisabled = componentState[descriptorKey] === !1;
|
|
268
|
-
isExit && (isDisabled = !styleProps.isExiting), isEnter && componentState.unmounted === !1 && (isDisabled = !0), process.env.NODE_ENV === "development" && debug === "verbose" && (
|
|
256
|
+
isExit && (isDisabled = !styleProps.isExiting), isEnter && componentState.unmounted === !1 && (isDisabled = !0), process.env.NODE_ENV === "development" && debug === "verbose" && ((0, import_consoleLog.groupCollapsed)("pseudo", key, { isDisabled }), (0, import_log.log)({ pseudoStyleObject, isDisabled, descriptor, componentState }), (0, import_consoleLog.groupEnd)());
|
|
269
257
|
const importance = descriptor.priority;
|
|
270
258
|
for (const pkey in pseudoStyleObject) {
|
|
271
259
|
const val2 = pseudoStyleObject[pkey];
|
|
@@ -331,14 +319,7 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
331
319
|
);
|
|
332
320
|
process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out);
|
|
333
321
|
const subKey = isSubStyle ? style[2] : "", fullKey = `${style[import_helpers.StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style[import_helpers.StyleObjectPseudo] || ""}`;
|
|
334
|
-
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, out),
|
|
335
|
-
transforms,
|
|
336
|
-
classNames,
|
|
337
|
-
fullKey,
|
|
338
|
-
out[import_helpers.StyleObjectIdentifier],
|
|
339
|
-
!0,
|
|
340
|
-
!0
|
|
341
|
-
));
|
|
322
|
+
fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, out), classNames[fullKey] = out[import_helpers.StyleObjectIdentifier]);
|
|
342
323
|
}
|
|
343
324
|
} else {
|
|
344
325
|
let mergeMediaStyle = function(key2, val2) {
|
|
@@ -420,15 +401,13 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
420
401
|
}
|
|
421
402
|
}), process.env.NODE_ENV === "development" && debug === "verbose") {
|
|
422
403
|
try {
|
|
423
|
-
(0, import_log.log)(" \u2714\uFE0F expand complete", keyInit), (0, import_log.log)("style", { ...styleState.style }), (0, import_log.log)("
|
|
404
|
+
(0, import_log.log)(" \u2714\uFE0F expand complete", keyInit), (0, import_log.log)("style", { ...styleState.style }), (0, import_log.log)("viewProps", { ...viewProps });
|
|
424
405
|
} catch {
|
|
425
406
|
}
|
|
426
|
-
|
|
407
|
+
(0, import_consoleLog.groupEnd)();
|
|
427
408
|
}
|
|
428
409
|
}
|
|
429
|
-
if (process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-propsend`, !(styleProps.noNormalize === !1) && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), !styleProps.noExpand && !styleProps.noMergeStyle && import_constants.isWeb && !isReactNative && (0, import_getCSSStylesAtomic.styleToCSS)(styleState.style)), styleState.flatTransforms && (styleState.style ||= {},
|
|
430
|
-
mergeTransform(styleState.style, key, val, !0);
|
|
431
|
-
})), parentSplitStyles)) {
|
|
410
|
+
if (process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-propsend`, !(styleProps.noNormalize === !1) && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), !styleProps.noExpand && !styleProps.noMergeStyle && import_constants.isWeb && !isReactNative && (0, import_getCSSStylesAtomic.styleToCSS)(styleState.style)), styleState.flatTransforms && (styleState.style ||= {}, mergeFlatTransforms(styleState.style, styleState.flatTransforms)), parentSplitStyles)) {
|
|
432
411
|
if (shouldDoClasses)
|
|
433
412
|
for (const key in parentSplitStyles.classNames) {
|
|
434
413
|
const val = parentSplitStyles.classNames[key];
|
|
@@ -444,29 +423,10 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
444
423
|
const atomic = (0, import_getCSSStylesAtomic.getCSSStylesAtomic)(styleState.style);
|
|
445
424
|
for (const atomicStyle of atomic) {
|
|
446
425
|
const [key, value, identifier] = atomicStyle, isAnimatedAndAnimateOnly = styleProps.isAnimated && styleProps.noClass && props.animateOnly?.includes(key), nonAnimatedAnimateOnly = !isAnimatedAndAnimateOnly && !styleProps.isAnimated && props.animateOnly?.includes(key);
|
|
447
|
-
isAnimatedAndAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = styleState.style[key]) : nonAnimatedAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = value, shouldRetain = !0) : (addStyleToInsertRules(rulesToInsert, atomicStyle),
|
|
426
|
+
isAnimatedAndAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = styleState.style[key]) : nonAnimatedAnimateOnly ? (retainedStyles ||= {}, retainedStyles[key] = value, shouldRetain = !0) : (addStyleToInsertRules(rulesToInsert, atomicStyle), classNames[key] = identifier);
|
|
448
427
|
}
|
|
449
|
-
process.env.NODE_ENV === "development" && props.debug === "verbose" && (
|
|
428
|
+
process.env.NODE_ENV === "development" && props.debug === "verbose" && ((0, import_consoleLog.groupEnd)(), (0, import_consoleLog.groupCollapsed)("\u{1F539} getSplitStyles final style object"), console.info(styleState.style), console.info("retainedStyles", retainedStyles), (0, import_consoleLog.groupEnd)()), (shouldRetain || process.env.IS_STATIC !== "is_static") && (styleState.style = retainedStyles || {});
|
|
450
429
|
}
|
|
451
|
-
if (transforms)
|
|
452
|
-
for (const namespace in transforms) {
|
|
453
|
-
if (!transforms[namespace]) {
|
|
454
|
-
process.env.NODE_ENV === "development" && (0, import_log.log)("Error no transform", transforms, namespace);
|
|
455
|
-
continue;
|
|
456
|
-
}
|
|
457
|
-
const [hash, val] = transforms[namespace], identifier = `_transform${hash}`;
|
|
458
|
-
if (import_constants.isClient && !import_insertStyleRule.insertedTransforms[identifier]) {
|
|
459
|
-
const rule = `.${identifier} { transform: ${val}; }`;
|
|
460
|
-
addStyleToInsertRules(rulesToInsert, [
|
|
461
|
-
namespace,
|
|
462
|
-
val,
|
|
463
|
-
identifier,
|
|
464
|
-
void 0,
|
|
465
|
-
[rule]
|
|
466
|
-
]);
|
|
467
|
-
}
|
|
468
|
-
classNames[namespace] = identifier;
|
|
469
|
-
}
|
|
470
430
|
}
|
|
471
431
|
if (isReactNative)
|
|
472
432
|
viewProps.tabIndex === 0 && (viewProps.accessible ??= !0);
|
|
@@ -527,13 +487,12 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
527
487
|
}
|
|
528
488
|
}
|
|
529
489
|
if (process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
|
|
530
|
-
|
|
490
|
+
(0, import_consoleLog.groupCollapsed)("\u{1F539} getSplitStyles ===>");
|
|
531
491
|
try {
|
|
532
492
|
const logs = {
|
|
533
493
|
...result,
|
|
534
494
|
className,
|
|
535
495
|
componentState,
|
|
536
|
-
transforms,
|
|
537
496
|
viewProps,
|
|
538
497
|
rulesToInsert,
|
|
539
498
|
parentSplitStyles
|
|
@@ -542,29 +501,25 @@ const getSplitStyles = (props, staticConfig, theme, themeName, componentState, s
|
|
|
542
501
|
(0, import_log.log)(key, logs[key]);
|
|
543
502
|
} catch {
|
|
544
503
|
}
|
|
545
|
-
|
|
504
|
+
(0, import_consoleLog.groupEnd)();
|
|
546
505
|
}
|
|
547
506
|
return process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-done`, result;
|
|
548
507
|
};
|
|
549
|
-
function
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
let transform = import_insertStyleRule.insertedTransforms[val];
|
|
554
|
-
import_constants.isClient && !transform && ((0, import_insertStyleRule.scanAllSheets)(), transform = import_insertStyleRule.insertedTransforms[val], !transform && import_constants.isWeb && val[0] !== "_" && (transform = val)), transforms[ns] ||= ["", ""], transforms[ns][0] += val.replace("_transform", ""), transform && (transforms[ns][1] += transform);
|
|
555
|
-
} else
|
|
556
|
-
classNames[key] = val;
|
|
508
|
+
function mergeFlatTransforms(target, flatTransforms) {
|
|
509
|
+
Object.entries(flatTransforms).sort(([a], [b]) => (0, import_sortString.sortString)(a, b)).forEach(([key, val]) => {
|
|
510
|
+
mergeTransform(target, key, val, !0);
|
|
511
|
+
});
|
|
557
512
|
}
|
|
558
513
|
function mergeStyle(styleState, key, val, disableNormalize = !1) {
|
|
559
|
-
const {
|
|
560
|
-
if (
|
|
561
|
-
classNames[key] = val, usedKeys[key] ||= 1;
|
|
562
|
-
else if (key in import_helpers.stylePropsTransform)
|
|
514
|
+
const { viewProps, styleProps, staticConfig } = styleState;
|
|
515
|
+
if (key in import_helpers.stylePropsTransform)
|
|
563
516
|
styleState.flatTransforms ||= {}, styleState.flatTransforms[key] = val;
|
|
564
517
|
else {
|
|
565
518
|
const out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
|
|
566
519
|
// accept is for props not styles
|
|
567
|
-
staticConfig.accept && key in staticConfig.accept ? viewProps[key] = out : (styleState.style ||= {}, styleState.style[key] =
|
|
520
|
+
staticConfig.accept && key in staticConfig.accept ? viewProps[key] = out : (styleState.style ||= {}, styleState.style[key] = // if you dont do this you'll be passing props.transform arrays directly here and then mutating them
|
|
521
|
+
// if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
|
|
522
|
+
key === "transform" && Array.isArray(out) ? [...out] : out);
|
|
568
523
|
}
|
|
569
524
|
}
|
|
570
525
|
const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
@@ -575,6 +530,13 @@ const getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
|
|
|
575
530
|
skey in import_helpers.validPseudoKeys && (sval = getSubStyle(styleState, skey, sval, avoidMergeTransform)), !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
|
|
576
531
|
});
|
|
577
532
|
}
|
|
533
|
+
if (!avoidMergeTransform) {
|
|
534
|
+
if (Array.isArray(styleOut.transform)) {
|
|
535
|
+
const parentTransform = styleState.style?.transform;
|
|
536
|
+
parentTransform && (styleOut.transform = [...parentTransform, ...styleOut.transform]);
|
|
537
|
+
}
|
|
538
|
+
styleState.flatTransforms && mergeFlatTransforms(styleOut, styleState.flatTransforms);
|
|
539
|
+
}
|
|
578
540
|
return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
|
|
579
541
|
}, useInsertEffectCompat = import_constants.isWeb ? import_react.default.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
|
|
580
542
|
}, useSplitStyles = (a, b, c, d, e, f, g, h, i, j) => {
|