@tamagui/web 3.0.0-beta.1133.1 → 3.0.0-beta.1141.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helpers/getSplitStyles.cjs +56 -17
- package/dist/cjs/helpers/getSplitStyles.native.cjs +65 -29
- package/dist/cjs/helpers/getSplitStyles.native.js +65 -29
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +56 -17
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +65 -29
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/package.json +17 -17
- package/src/helpers/getSplitStyles.tsx +115 -17
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
|
@@ -418,10 +418,28 @@ function contributeProp(pass, keyOg, valOg, originalOg = valOg, disabled = false
|
|
|
418
418
|
}
|
|
419
419
|
const styleOriginals = shouldTrackStyleTokenProvenance ? import_styleOriginalValues.styleOriginalValues.get(style) : void 0;
|
|
420
420
|
for (const key in style) {
|
|
421
|
-
|
|
422
|
-
if (
|
|
423
|
-
|
|
424
|
-
|
|
421
|
+
const value = style[key];
|
|
422
|
+
if (value == null) continue;
|
|
423
|
+
let inline = !styleState.styleProps.stylePieceEntries;
|
|
424
|
+
if (key === "containerName") {
|
|
425
|
+
pass[passContainerName] = value;
|
|
426
|
+
inline = false;
|
|
427
|
+
} else if (key === "containerType") {
|
|
428
|
+
pass[passContainerType] = value;
|
|
429
|
+
inline = false;
|
|
430
|
+
}
|
|
431
|
+
if (inline) {
|
|
432
|
+
if (typeof value === "string") {
|
|
433
|
+
const [segments] = (0, import_grammarConfig.getConfigRevisionState)(conf).parseFlatValue(value);
|
|
434
|
+
for (let index2 = 4; index2 < segments.length; index2 += 5) if (!(segments[index2] & 1)) {
|
|
435
|
+
inline = false;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
} else if (value && typeof value === "object" && !Array.isArray(value) && !(0, import_createVariable.isVariable)(value) && classifyConditionalObject(value, styleState) !== 0) inline = false;
|
|
439
|
+
}
|
|
440
|
+
styleState.flatInlineStyleProp = inline;
|
|
441
|
+
contributeValue(styleState, key, value, styleOriginals?.[key]);
|
|
442
|
+
styleState.flatInlineStyleProp = false;
|
|
425
443
|
}
|
|
426
444
|
}
|
|
427
445
|
pass[passSourceLayer] = layerBeforeStyle;
|
|
@@ -1004,7 +1022,10 @@ function writeCapturedStyleRecord(slots, slot, source, sourceLayer) {
|
|
|
1004
1022
|
for (let index = 0; index < list.length; index++) {
|
|
1005
1023
|
const entry = list[index];
|
|
1006
1024
|
const entryFlags = entry[7] & 31;
|
|
1007
|
-
if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS)))
|
|
1025
|
+
if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) {
|
|
1026
|
+
if (sourceLayer === sourceLayerStyle && entry[7] >> 5 === sourceLayerStyle && entry[0] === source[0] && !condition && !entry[2]) list.splice(index--, 1);
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1008
1029
|
if (entry[0] !== source[0]) continue;
|
|
1009
1030
|
if (flags & recordDefault) {
|
|
1010
1031
|
if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
|
|
@@ -1127,9 +1148,20 @@ function writeStyleRecord(state, property, value, cursor, original, flags, condi
|
|
|
1127
1148
|
const identity = cursor ? cursor[conditionKey] : "";
|
|
1128
1149
|
const direct = state;
|
|
1129
1150
|
const slots = direct.flatSlots ||= /* @__PURE__ */ new Map();
|
|
1130
|
-
const
|
|
1151
|
+
const sourceLayer = direct.flatPass?.[passSourceLayer] || 0;
|
|
1152
|
+
if (direct.flatInlineStyleProp) flags |= recordInline;
|
|
1153
|
+
const cssSlot = import_getCSSStylesAtomic.canGenerateCSS && (state.flatShouldDoClasses || flags & recordCSS) ? styleSlot(property) : property.startsWith("transition") ? "transition" : property;
|
|
1154
|
+
const slot = flags & recordInline && cssSlot !== property ? property : cssSlot;
|
|
1131
1155
|
let list = slots.get(slot);
|
|
1132
1156
|
if (!list) slots.set(slot, list = []);
|
|
1157
|
+
if (sourceLayer === sourceLayerStyle && !condition) {
|
|
1158
|
+
const other = slot === cssSlot ? list : slots.get(flags & recordInline ? cssSlot : property);
|
|
1159
|
+
if (other) for (let index = 0; index < other.length; index++) {
|
|
1160
|
+
const entry = other[index];
|
|
1161
|
+
const entryFlags = entry[7];
|
|
1162
|
+
if (entry[0] === property && !entry[2] && entryFlags >> 5 === sourceLayerStyle && (entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) other.splice(index--, 1);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1133
1165
|
for (let index = 0; index < list.length; index++) {
|
|
1134
1166
|
const entry = list[index];
|
|
1135
1167
|
const entryFlags = entry[7];
|
|
@@ -1154,7 +1186,7 @@ function writeStyleRecord(state, property, value, cursor, original, flags, condi
|
|
|
1154
1186
|
cursor ? cursor[conditionSelector] : "",
|
|
1155
1187
|
cursor ? cursor[conditionWrappers] : void 0,
|
|
1156
1188
|
original,
|
|
1157
|
-
flags |
|
|
1189
|
+
flags | sourceLayer << 5
|
|
1158
1190
|
]);
|
|
1159
1191
|
}
|
|
1160
1192
|
function streamWriteInline(state, property, value, cursor, original, normalize = property === "lineHeight", conditionOverride = -1, force = false) {
|
|
@@ -1265,7 +1297,7 @@ const cssWideColorKeywords = /* @__PURE__ */ new Set([
|
|
|
1265
1297
|
"currentcolor",
|
|
1266
1298
|
"transparent"
|
|
1267
1299
|
]);
|
|
1268
|
-
function configuredValue(state, property, raw, embedded = false) {
|
|
1300
|
+
function configuredValue(state, property, raw, embedded = false, nativeColors) {
|
|
1269
1301
|
const grammar = (0, import_grammarConfig.getConfigRevisionState)(state.conf);
|
|
1270
1302
|
let name = raw;
|
|
1271
1303
|
let opacity;
|
|
@@ -1285,7 +1317,7 @@ function configuredValue(state, property, raw, embedded = false) {
|
|
|
1285
1317
|
const fontProperty = property.startsWith("font") || property === "lineHeight" || property === "letterSpacing";
|
|
1286
1318
|
const resolveValues = state.styleProps.resolveValues;
|
|
1287
1319
|
let byRaw;
|
|
1288
|
-
if (!fontProperty) {
|
|
1320
|
+
if (!fontProperty && !nativeColors) {
|
|
1289
1321
|
const revision = grammar.revision;
|
|
1290
1322
|
if (state.conf !== valueCacheConf || revision !== valueCacheRevision) {
|
|
1291
1323
|
valueCacheConf = state.conf;
|
|
@@ -1400,15 +1432,20 @@ function configuredValue(state, property, raw, embedded = false) {
|
|
|
1400
1432
|
}
|
|
1401
1433
|
let out = raw;
|
|
1402
1434
|
if ((0, import_createVariable.isVariable)(value)) {
|
|
1403
|
-
out = resolveValues === "except-theme" && fromTheme ? `${import_themeRef.THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : (0, import_resolveVariableValue.resolveVariableValue)(property, value, resolveValues);
|
|
1435
|
+
out = resolveValues === "except-theme" && fromTheme ? `${import_themeRef.THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : (0, import_resolveVariableValue.resolveVariableValue)(nativeColors ? "color" : property, value, resolveValues);
|
|
1404
1436
|
if (opacity !== void 0) out = `color-mix(in srgb, ${out} ${opacity}%, transparent)`;
|
|
1405
1437
|
}
|
|
1438
|
+
if (nativeColors && out && typeof out === "object") {
|
|
1439
|
+
const reference = `__tamagui_native_color_${nativeColors.size}`;
|
|
1440
|
+
nativeColors.set(reference, out);
|
|
1441
|
+
out = reference;
|
|
1442
|
+
}
|
|
1406
1443
|
if (embedded && out === raw) {
|
|
1407
1444
|
const usedSafeArea = state.flatUsesSafeArea;
|
|
1408
|
-
out = grammar.embeddedTokens(raw, (word) => configuredValue(state, property, word));
|
|
1445
|
+
out = grammar.embeddedTokens(raw, (word) => configuredValue(state, property, word, false, nativeColors));
|
|
1409
1446
|
if (!usedSafeArea && state.flatUsesSafeArea) return out;
|
|
1410
1447
|
}
|
|
1411
|
-
if (!fontProperty && !fromTheme) if (valueCacheEntries > 8192) {
|
|
1448
|
+
if (!fontProperty && !fromTheme && !nativeColors) if (valueCacheEntries > 8192) {
|
|
1412
1449
|
valueCaches = /* @__PURE__ */ new WeakMap();
|
|
1413
1450
|
valueCacheEntries = 0;
|
|
1414
1451
|
} else {
|
|
@@ -1476,8 +1513,8 @@ function resolveNumericValue(value) {
|
|
|
1476
1513
|
function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
|
|
1477
1514
|
emitProperty(state, property, resolveValue(state, property, raw), cursor, originalValue, contextOnly);
|
|
1478
1515
|
}
|
|
1479
|
-
function resolveValue(state, property, raw) {
|
|
1480
|
-
let value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
|
|
1516
|
+
function resolveValue(state, property, raw, nativeColors) {
|
|
1517
|
+
let value = typeof raw === "string" ? configuredValue(state, property, raw, true, nativeColors) : raw;
|
|
1481
1518
|
if (!state.flatShouldDoClasses && typeof value === "string" && value !== "" && property !== "lineHeight") value = resolveNumericValue(value);
|
|
1482
1519
|
return value;
|
|
1483
1520
|
}
|
|
@@ -1586,7 +1623,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
|
|
|
1586
1623
|
else emitProperty(state, property, raw, cursor, originalValue, contextOnly);
|
|
1587
1624
|
return;
|
|
1588
1625
|
}
|
|
1589
|
-
let value = resolveValue(state, property, raw);
|
|
1626
|
+
let value = resolveValue(state, property, raw, void 0);
|
|
1590
1627
|
if (import_getCSSStylesAtomic.canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
|
|
1591
1628
|
state.flatBoxShadow = value;
|
|
1592
1629
|
state.flatBoxShadowSequence = frameSequence + 1;
|
|
@@ -1717,19 +1754,21 @@ function contributeValue(state, property, value, originalValue, contextOnly = fa
|
|
|
1717
1754
|
}
|
|
1718
1755
|
function clearDirectStyle(state, property) {
|
|
1719
1756
|
const direct = state;
|
|
1757
|
+
if (direct.flatDynamicColors) delete direct.flatDynamicColors[property];
|
|
1720
1758
|
property = webStyleProperty(property);
|
|
1721
1759
|
const propertyKind = (0, import_grammarConfig.getConfigRevisionState)(state.conf).propertyKind(property);
|
|
1722
1760
|
const atomicKey = property.startsWith("transition") ? "transition" : propertyKind > 0 && propertyKind < 5 ? "boxShadow" : propertyKind === 6 ? "textShadow" : propertyKind === 5 ? "transform" : property;
|
|
1723
1761
|
const slot = styleSlot(atomicKey);
|
|
1724
1762
|
direct.flatAtomics?.delete(slot);
|
|
1725
1763
|
if (direct.flatSlots) {
|
|
1726
|
-
if (slot !== atomicKey) {
|
|
1764
|
+
if (slot !== atomicKey || atomicKey === "flex") {
|
|
1727
1765
|
const entries = direct.flatSlots.get(slot);
|
|
1728
1766
|
if (entries) {
|
|
1729
1767
|
for (let index = entries.length; index--;) if (entries[index][0] === atomicKey) entries.splice(index, 1);
|
|
1768
|
+
if (!entries.length) direct.flatSlots.delete(slot);
|
|
1730
1769
|
}
|
|
1731
1770
|
}
|
|
1732
|
-
direct.flatSlots.delete(atomicKey);
|
|
1771
|
+
if (atomicKey !== "flex") direct.flatSlots.delete(atomicKey);
|
|
1733
1772
|
}
|
|
1734
1773
|
if (atomicKey === "transform") state.transformAccumulator = void 0;
|
|
1735
1774
|
if (state.style) delete state.style[atomicKey];
|
|
@@ -478,8 +478,21 @@ function contributeProp(pass, keyOg, valOg) {
|
|
|
478
478
|
}
|
|
479
479
|
var styleOriginals = shouldTrackStyleTokenProvenance ? import_styleOriginalValues.styleOriginalValues.get(style) : void 0;
|
|
480
480
|
for (var key1 in style) {
|
|
481
|
-
|
|
482
|
-
|
|
481
|
+
var value1 = style[key1];
|
|
482
|
+
if (value1 == null) continue;
|
|
483
|
+
var inline = !styleState.styleProps.stylePieceEntries;
|
|
484
|
+
if (inline) {
|
|
485
|
+
if (typeof value1 === "string") {
|
|
486
|
+
var [segments] = (0, import_grammarConfig.getConfigRevisionState)(conf).parseFlatValue(value1);
|
|
487
|
+
for (var index2 = 4; index2 < segments.length; index2 += 5) if (!(segments[index2] & 1)) {
|
|
488
|
+
inline = false;
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
} else if (value1 && typeof value1 === "object" && !Array.isArray(value1) && !(0, import_createVariable.isVariable)(value1) && classifyConditionalObject(value1, styleState) !== 0) inline = false;
|
|
492
|
+
}
|
|
493
|
+
styleState.flatInlineStyleProp = inline;
|
|
494
|
+
contributeValue(styleState, key1, value1, styleOriginals === null || styleOriginals === void 0 ? void 0 : styleOriginals[key1]);
|
|
495
|
+
styleState.flatInlineStyleProp = false;
|
|
483
496
|
}
|
|
484
497
|
}
|
|
485
498
|
pass[passSourceLayer] = layerBeforeStyle;
|
|
@@ -588,7 +601,7 @@ function contributeProp(pass, keyOg, valOg) {
|
|
|
588
601
|
if (valInit === "unset") {
|
|
589
602
|
var expanded = (0, import_expandStyle.expandStyle)(keyInit, valInit, conf.settings.styleCompat || "web");
|
|
590
603
|
clearDirectStyle(styleState, keyInit);
|
|
591
|
-
if (expanded) for (var
|
|
604
|
+
if (expanded) for (var index3 = 0; index3 < expanded.length; index3++) clearDirectStyle(styleState, expanded[index3][0]);
|
|
592
605
|
} else contributeValue(styleState, keyInit, valInit, originalOg, !isHostStyleKey);
|
|
593
606
|
return;
|
|
594
607
|
}
|
|
@@ -972,7 +985,10 @@ function writeCapturedStyleRecord(slots, slot, source, sourceLayer) {
|
|
|
972
985
|
for (var index = 0; index < list.length; index++) {
|
|
973
986
|
var entry = list[index];
|
|
974
987
|
var entryFlags = entry[7] & 31;
|
|
975
|
-
if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS)))
|
|
988
|
+
if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) {
|
|
989
|
+
if (sourceLayer === sourceLayerStyle && entry[7] >> 5 === sourceLayerStyle && entry[0] === source[0] && !condition && !entry[2]) list.splice(index--, 1);
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
976
992
|
if (entry[0] !== source[0]) continue;
|
|
977
993
|
if (flags & recordDefault) {
|
|
978
994
|
if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
|
|
@@ -1082,27 +1098,39 @@ var recordDefault = 8;
|
|
|
1082
1098
|
var recordCSS = 16;
|
|
1083
1099
|
function writeStyleRecord(state, property, value, cursor, original, flags) {
|
|
1084
1100
|
var conditionOverride = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : -1;
|
|
1085
|
-
var
|
|
1101
|
+
var _direct_flatPass;
|
|
1086
1102
|
var _direct;
|
|
1087
1103
|
var condition = conditionOverride !== -1 ? conditionOverride : cursor ? cursor[conditionValue] : 0;
|
|
1088
1104
|
var identity = cursor ? cursor[conditionKey] : "";
|
|
1089
|
-
var
|
|
1090
|
-
var
|
|
1105
|
+
var direct = state;
|
|
1106
|
+
var slots = (_direct = direct).flatSlots || (_direct.flatSlots = /* @__PURE__ */ new Map());
|
|
1107
|
+
var sourceLayer = ((_direct_flatPass = direct.flatPass) === null || _direct_flatPass === void 0 ? void 0 : _direct_flatPass[passSourceLayer]) || 0;
|
|
1108
|
+
if (direct.flatInlineStyleProp) flags |= recordInline;
|
|
1109
|
+
var cssSlot = property.startsWith("transition") ? "transition" : property;
|
|
1110
|
+
var slot = flags & recordInline && cssSlot !== property ? property : cssSlot;
|
|
1091
1111
|
var list = slots.get(slot);
|
|
1092
1112
|
if (!list) slots.set(slot, list = []);
|
|
1093
|
-
|
|
1094
|
-
var
|
|
1095
|
-
var
|
|
1096
|
-
|
|
1097
|
-
|
|
1113
|
+
if (sourceLayer === sourceLayerStyle && !condition) {
|
|
1114
|
+
var other = slot === cssSlot ? list : slots.get(flags & recordInline ? cssSlot : property);
|
|
1115
|
+
if (other) for (var index = 0; index < other.length; index++) {
|
|
1116
|
+
var entry = other[index];
|
|
1117
|
+
var entryFlags = entry[7];
|
|
1118
|
+
if (entry[0] === property && !entry[2] && entryFlags >> 5 === sourceLayerStyle && (entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) other.splice(index--, 1);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
for (var index1 = 0; index1 < list.length; index1++) {
|
|
1122
|
+
var entry1 = list[index1];
|
|
1123
|
+
var entryFlags1 = entry1[7];
|
|
1124
|
+
if ((entryFlags1 & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
|
|
1125
|
+
if (entry1[0] !== property) continue;
|
|
1098
1126
|
if (flags & recordDefault) {
|
|
1099
|
-
if (!(
|
|
1100
|
-
} else if (
|
|
1101
|
-
list.splice(
|
|
1127
|
+
if (!(entryFlags1 & recordDefault) && (!entry1[2] || entry1[3] === identity)) return;
|
|
1128
|
+
} else if (entryFlags1 & recordDefault && (!condition || entry1[3] === identity)) {
|
|
1129
|
+
list.splice(index1--, 1);
|
|
1102
1130
|
continue;
|
|
1103
1131
|
}
|
|
1104
|
-
if (
|
|
1105
|
-
list.splice(
|
|
1132
|
+
if (entry1[3] === identity) {
|
|
1133
|
+
list.splice(index1, 1);
|
|
1106
1134
|
break;
|
|
1107
1135
|
}
|
|
1108
1136
|
}
|
|
@@ -1114,7 +1142,7 @@ function writeStyleRecord(state, property, value, cursor, original, flags) {
|
|
|
1114
1142
|
cursor ? cursor[conditionSelector] : "",
|
|
1115
1143
|
cursor ? cursor[conditionWrappers] : void 0,
|
|
1116
1144
|
original,
|
|
1117
|
-
flags |
|
|
1145
|
+
flags | sourceLayer << 5
|
|
1118
1146
|
]);
|
|
1119
1147
|
}
|
|
1120
1148
|
function streamWriteInline(state, property, value, cursor, original) {
|
|
@@ -1289,7 +1317,7 @@ var cssWideColorKeywords = /* @__PURE__ */ new Set([
|
|
|
1289
1317
|
"transparent"
|
|
1290
1318
|
]);
|
|
1291
1319
|
function configuredValue(state, property, raw) {
|
|
1292
|
-
var embedded = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
|
|
1320
|
+
var embedded = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, nativeColors = arguments.length > 4 ? arguments[4] : void 0;
|
|
1293
1321
|
var grammar = (0, import_grammarConfig.getConfigRevisionState)(state.conf);
|
|
1294
1322
|
var name = raw;
|
|
1295
1323
|
var opacity;
|
|
@@ -1309,7 +1337,7 @@ function configuredValue(state, property, raw) {
|
|
|
1309
1337
|
var fontProperty = property.startsWith("font") || property === "lineHeight" || property === "letterSpacing";
|
|
1310
1338
|
var resolveValues = state.styleProps.resolveValues;
|
|
1311
1339
|
var byRaw;
|
|
1312
|
-
if (!fontProperty) {
|
|
1340
|
+
if (!fontProperty && !nativeColors) {
|
|
1313
1341
|
var _maps;
|
|
1314
1342
|
var revision = grammar.revision;
|
|
1315
1343
|
if (state.conf !== valueCacheConf || revision !== valueCacheRevision) {
|
|
@@ -1450,20 +1478,25 @@ function configuredValue(state, property, raw) {
|
|
|
1450
1478
|
}
|
|
1451
1479
|
var out = raw;
|
|
1452
1480
|
if ((0, import_createVariable.isVariable)(value)) {
|
|
1453
|
-
out = resolveValues === "except-theme" && fromTheme ? `${import_themeRef.THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : (0, import_resolveVariableValue.resolveVariableValue)(property, value, resolveValues);
|
|
1481
|
+
out = resolveValues === "except-theme" && fromTheme ? `${import_themeRef.THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : (0, import_resolveVariableValue.resolveVariableValue)(nativeColors ? "color" : property, value, resolveValues);
|
|
1454
1482
|
if (opacity !== void 0) {
|
|
1455
1483
|
var _normalizeColor;
|
|
1456
1484
|
out = (_normalizeColor = (0, import_normalizeColor.normalizeColor)(out, opacity / 100)) !== null && _normalizeColor !== void 0 ? _normalizeColor : out;
|
|
1457
1485
|
}
|
|
1458
1486
|
}
|
|
1487
|
+
if (nativeColors && out && typeof out === "object") {
|
|
1488
|
+
var reference = `__tamagui_native_color_${nativeColors.size}`;
|
|
1489
|
+
nativeColors.set(reference, out);
|
|
1490
|
+
out = reference;
|
|
1491
|
+
}
|
|
1459
1492
|
if (embedded && out === raw) {
|
|
1460
1493
|
var usedSafeArea = state.flatUsesSafeArea;
|
|
1461
1494
|
out = grammar.embeddedTokens(raw, function(word) {
|
|
1462
|
-
return configuredValue(state, property, word);
|
|
1495
|
+
return configuredValue(state, property, word, false, nativeColors);
|
|
1463
1496
|
});
|
|
1464
1497
|
if (!usedSafeArea && state.flatUsesSafeArea) return out;
|
|
1465
1498
|
}
|
|
1466
|
-
if (!fontProperty && !fromTheme) if (valueCacheEntries > 8192) {
|
|
1499
|
+
if (!fontProperty && !fromTheme && !nativeColors) if (valueCacheEntries > 8192) {
|
|
1467
1500
|
valueCaches = /* @__PURE__ */ new WeakMap();
|
|
1468
1501
|
valueCacheEntries = 0;
|
|
1469
1502
|
} else {
|
|
@@ -1626,8 +1659,8 @@ function emitTextDecoration(state, raw, cursor, originalValue, contextOnly) {
|
|
|
1626
1659
|
function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
|
|
1627
1660
|
emitProperty(state, property, resolveValue(state, property, raw), cursor, originalValue, contextOnly);
|
|
1628
1661
|
}
|
|
1629
|
-
function resolveValue(state, property, raw) {
|
|
1630
|
-
var value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
|
|
1662
|
+
function resolveValue(state, property, raw, nativeColors) {
|
|
1663
|
+
var value = typeof raw === "string" ? configuredValue(state, property, raw, true, nativeColors) : raw;
|
|
1631
1664
|
if (typeof value === "string" && value !== "" && true) value = resolveNumericValue(value);
|
|
1632
1665
|
return value;
|
|
1633
1666
|
}
|
|
@@ -1720,13 +1753,14 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
|
|
|
1720
1753
|
}
|
|
1721
1754
|
return;
|
|
1722
1755
|
}
|
|
1723
|
-
var
|
|
1756
|
+
var nativeColors = typeof raw === "string" && (property === "backgroundImage" || property === "boxShadow" || property === "textShadow") ? /* @__PURE__ */ new Map() : void 0;
|
|
1757
|
+
var value3 = resolveValue(state, property, raw, nativeColors);
|
|
1724
1758
|
if (import_getCSSStylesAtomic.canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
|
|
1725
1759
|
state.flatBoxShadow = value3;
|
|
1726
1760
|
state.flatBoxShadowSequence = frameSequence + 1;
|
|
1727
1761
|
}
|
|
1728
1762
|
if (typeof value3 === "string" && (property === "backgroundImage" || property === "boxShadow" || property === "textShadow")) {
|
|
1729
|
-
var parsed = (0, import_parseNativeStyle.parseNativeStyle)(property, value3);
|
|
1763
|
+
var parsed = (0, import_parseNativeStyle.parseNativeStyle)(property, value3, nativeColors);
|
|
1730
1764
|
if (parsed) {
|
|
1731
1765
|
if (property === "textShadow") {
|
|
1732
1766
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
@@ -1926,18 +1960,20 @@ function contributeValue(state, property, value, originalValue) {
|
|
|
1926
1960
|
function clearDirectStyle(state, property) {
|
|
1927
1961
|
var _direct_flatAtomics;
|
|
1928
1962
|
var direct = state;
|
|
1963
|
+
if (direct.flatDynamicColors) delete direct.flatDynamicColors[property];
|
|
1929
1964
|
var propertyKind = (0, import_grammarConfig.getConfigRevisionState)(state.conf).propertyKind(property);
|
|
1930
1965
|
var atomicKey = property.startsWith("transition") ? "transition" : propertyKind > 0 && propertyKind < 5 ? "boxShadow" : propertyKind === 6 ? "textShadow" : propertyKind === 5 ? "transform" : property;
|
|
1931
1966
|
var slot = atomicKey;
|
|
1932
1967
|
(_direct_flatAtomics = direct.flatAtomics) === null || _direct_flatAtomics === void 0 || _direct_flatAtomics.delete(slot);
|
|
1933
1968
|
if (direct.flatSlots) {
|
|
1934
|
-
if (slot !== atomicKey) {
|
|
1969
|
+
if (slot !== atomicKey || atomicKey === "flex") {
|
|
1935
1970
|
var entries = direct.flatSlots.get(slot);
|
|
1936
1971
|
if (entries) {
|
|
1937
1972
|
for (var index = entries.length; index--;) if (entries[index][0] === atomicKey) entries.splice(index, 1);
|
|
1973
|
+
if (!entries.length) direct.flatSlots.delete(slot);
|
|
1938
1974
|
}
|
|
1939
1975
|
}
|
|
1940
|
-
direct.flatSlots.delete(atomicKey);
|
|
1976
|
+
if (atomicKey !== "flex") direct.flatSlots.delete(atomicKey);
|
|
1941
1977
|
}
|
|
1942
1978
|
if (atomicKey === "transform") state.transformAccumulator = void 0;
|
|
1943
1979
|
if (state.style) delete state.style[atomicKey];
|
|
@@ -478,8 +478,21 @@ function contributeProp(pass, keyOg, valOg) {
|
|
|
478
478
|
}
|
|
479
479
|
var styleOriginals = shouldTrackStyleTokenProvenance ? import_styleOriginalValues.styleOriginalValues.get(style) : void 0;
|
|
480
480
|
for (var key1 in style) {
|
|
481
|
-
|
|
482
|
-
|
|
481
|
+
var value1 = style[key1];
|
|
482
|
+
if (value1 == null) continue;
|
|
483
|
+
var inline = !styleState.styleProps.stylePieceEntries;
|
|
484
|
+
if (inline) {
|
|
485
|
+
if (typeof value1 === "string") {
|
|
486
|
+
var [segments] = (0, import_grammarConfig.getConfigRevisionState)(conf).parseFlatValue(value1);
|
|
487
|
+
for (var index2 = 4; index2 < segments.length; index2 += 5) if (!(segments[index2] & 1)) {
|
|
488
|
+
inline = false;
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
} else if (value1 && typeof value1 === "object" && !Array.isArray(value1) && !(0, import_createVariable.isVariable)(value1) && classifyConditionalObject(value1, styleState) !== 0) inline = false;
|
|
492
|
+
}
|
|
493
|
+
styleState.flatInlineStyleProp = inline;
|
|
494
|
+
contributeValue(styleState, key1, value1, styleOriginals === null || styleOriginals === void 0 ? void 0 : styleOriginals[key1]);
|
|
495
|
+
styleState.flatInlineStyleProp = false;
|
|
483
496
|
}
|
|
484
497
|
}
|
|
485
498
|
pass[passSourceLayer] = layerBeforeStyle;
|
|
@@ -588,7 +601,7 @@ function contributeProp(pass, keyOg, valOg) {
|
|
|
588
601
|
if (valInit === "unset") {
|
|
589
602
|
var expanded = (0, import_expandStyle.expandStyle)(keyInit, valInit, conf.settings.styleCompat || "web");
|
|
590
603
|
clearDirectStyle(styleState, keyInit);
|
|
591
|
-
if (expanded) for (var
|
|
604
|
+
if (expanded) for (var index3 = 0; index3 < expanded.length; index3++) clearDirectStyle(styleState, expanded[index3][0]);
|
|
592
605
|
} else contributeValue(styleState, keyInit, valInit, originalOg, !isHostStyleKey);
|
|
593
606
|
return;
|
|
594
607
|
}
|
|
@@ -972,7 +985,10 @@ function writeCapturedStyleRecord(slots, slot, source, sourceLayer) {
|
|
|
972
985
|
for (var index = 0; index < list.length; index++) {
|
|
973
986
|
var entry = list[index];
|
|
974
987
|
var entryFlags = entry[7] & 31;
|
|
975
|
-
if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS)))
|
|
988
|
+
if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) {
|
|
989
|
+
if (sourceLayer === sourceLayerStyle && entry[7] >> 5 === sourceLayerStyle && entry[0] === source[0] && !condition && !entry[2]) list.splice(index--, 1);
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
976
992
|
if (entry[0] !== source[0]) continue;
|
|
977
993
|
if (flags & recordDefault) {
|
|
978
994
|
if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
|
|
@@ -1082,27 +1098,39 @@ var recordDefault = 8;
|
|
|
1082
1098
|
var recordCSS = 16;
|
|
1083
1099
|
function writeStyleRecord(state, property, value, cursor, original, flags) {
|
|
1084
1100
|
var conditionOverride = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : -1;
|
|
1085
|
-
var
|
|
1101
|
+
var _direct_flatPass;
|
|
1086
1102
|
var _direct;
|
|
1087
1103
|
var condition = conditionOverride !== -1 ? conditionOverride : cursor ? cursor[conditionValue] : 0;
|
|
1088
1104
|
var identity = cursor ? cursor[conditionKey] : "";
|
|
1089
|
-
var
|
|
1090
|
-
var
|
|
1105
|
+
var direct = state;
|
|
1106
|
+
var slots = (_direct = direct).flatSlots || (_direct.flatSlots = /* @__PURE__ */ new Map());
|
|
1107
|
+
var sourceLayer = ((_direct_flatPass = direct.flatPass) === null || _direct_flatPass === void 0 ? void 0 : _direct_flatPass[passSourceLayer]) || 0;
|
|
1108
|
+
if (direct.flatInlineStyleProp) flags |= recordInline;
|
|
1109
|
+
var cssSlot = property.startsWith("transition") ? "transition" : property;
|
|
1110
|
+
var slot = flags & recordInline && cssSlot !== property ? property : cssSlot;
|
|
1091
1111
|
var list = slots.get(slot);
|
|
1092
1112
|
if (!list) slots.set(slot, list = []);
|
|
1093
|
-
|
|
1094
|
-
var
|
|
1095
|
-
var
|
|
1096
|
-
|
|
1097
|
-
|
|
1113
|
+
if (sourceLayer === sourceLayerStyle && !condition) {
|
|
1114
|
+
var other = slot === cssSlot ? list : slots.get(flags & recordInline ? cssSlot : property);
|
|
1115
|
+
if (other) for (var index = 0; index < other.length; index++) {
|
|
1116
|
+
var entry = other[index];
|
|
1117
|
+
var entryFlags = entry[7];
|
|
1118
|
+
if (entry[0] === property && !entry[2] && entryFlags >> 5 === sourceLayerStyle && (entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) other.splice(index--, 1);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
for (var index1 = 0; index1 < list.length; index1++) {
|
|
1122
|
+
var entry1 = list[index1];
|
|
1123
|
+
var entryFlags1 = entry1[7];
|
|
1124
|
+
if ((entryFlags1 & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
|
|
1125
|
+
if (entry1[0] !== property) continue;
|
|
1098
1126
|
if (flags & recordDefault) {
|
|
1099
|
-
if (!(
|
|
1100
|
-
} else if (
|
|
1101
|
-
list.splice(
|
|
1127
|
+
if (!(entryFlags1 & recordDefault) && (!entry1[2] || entry1[3] === identity)) return;
|
|
1128
|
+
} else if (entryFlags1 & recordDefault && (!condition || entry1[3] === identity)) {
|
|
1129
|
+
list.splice(index1--, 1);
|
|
1102
1130
|
continue;
|
|
1103
1131
|
}
|
|
1104
|
-
if (
|
|
1105
|
-
list.splice(
|
|
1132
|
+
if (entry1[3] === identity) {
|
|
1133
|
+
list.splice(index1, 1);
|
|
1106
1134
|
break;
|
|
1107
1135
|
}
|
|
1108
1136
|
}
|
|
@@ -1114,7 +1142,7 @@ function writeStyleRecord(state, property, value, cursor, original, flags) {
|
|
|
1114
1142
|
cursor ? cursor[conditionSelector] : "",
|
|
1115
1143
|
cursor ? cursor[conditionWrappers] : void 0,
|
|
1116
1144
|
original,
|
|
1117
|
-
flags |
|
|
1145
|
+
flags | sourceLayer << 5
|
|
1118
1146
|
]);
|
|
1119
1147
|
}
|
|
1120
1148
|
function streamWriteInline(state, property, value, cursor, original) {
|
|
@@ -1289,7 +1317,7 @@ var cssWideColorKeywords = /* @__PURE__ */ new Set([
|
|
|
1289
1317
|
"transparent"
|
|
1290
1318
|
]);
|
|
1291
1319
|
function configuredValue(state, property, raw) {
|
|
1292
|
-
var embedded = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
|
|
1320
|
+
var embedded = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, nativeColors = arguments.length > 4 ? arguments[4] : void 0;
|
|
1293
1321
|
var grammar = (0, import_grammarConfig.getConfigRevisionState)(state.conf);
|
|
1294
1322
|
var name = raw;
|
|
1295
1323
|
var opacity;
|
|
@@ -1309,7 +1337,7 @@ function configuredValue(state, property, raw) {
|
|
|
1309
1337
|
var fontProperty = property.startsWith("font") || property === "lineHeight" || property === "letterSpacing";
|
|
1310
1338
|
var resolveValues = state.styleProps.resolveValues;
|
|
1311
1339
|
var byRaw;
|
|
1312
|
-
if (!fontProperty) {
|
|
1340
|
+
if (!fontProperty && !nativeColors) {
|
|
1313
1341
|
var _maps;
|
|
1314
1342
|
var revision = grammar.revision;
|
|
1315
1343
|
if (state.conf !== valueCacheConf || revision !== valueCacheRevision) {
|
|
@@ -1450,20 +1478,25 @@ function configuredValue(state, property, raw) {
|
|
|
1450
1478
|
}
|
|
1451
1479
|
var out = raw;
|
|
1452
1480
|
if ((0, import_createVariable.isVariable)(value)) {
|
|
1453
|
-
out = resolveValues === "except-theme" && fromTheme ? `${import_themeRef.THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : (0, import_resolveVariableValue.resolveVariableValue)(property, value, resolveValues);
|
|
1481
|
+
out = resolveValues === "except-theme" && fromTheme ? `${import_themeRef.THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : (0, import_resolveVariableValue.resolveVariableValue)(nativeColors ? "color" : property, value, resolveValues);
|
|
1454
1482
|
if (opacity !== void 0) {
|
|
1455
1483
|
var _normalizeColor;
|
|
1456
1484
|
out = (_normalizeColor = (0, import_normalizeColor.normalizeColor)(out, opacity / 100)) !== null && _normalizeColor !== void 0 ? _normalizeColor : out;
|
|
1457
1485
|
}
|
|
1458
1486
|
}
|
|
1487
|
+
if (nativeColors && out && typeof out === "object") {
|
|
1488
|
+
var reference = `__tamagui_native_color_${nativeColors.size}`;
|
|
1489
|
+
nativeColors.set(reference, out);
|
|
1490
|
+
out = reference;
|
|
1491
|
+
}
|
|
1459
1492
|
if (embedded && out === raw) {
|
|
1460
1493
|
var usedSafeArea = state.flatUsesSafeArea;
|
|
1461
1494
|
out = grammar.embeddedTokens(raw, function(word) {
|
|
1462
|
-
return configuredValue(state, property, word);
|
|
1495
|
+
return configuredValue(state, property, word, false, nativeColors);
|
|
1463
1496
|
});
|
|
1464
1497
|
if (!usedSafeArea && state.flatUsesSafeArea) return out;
|
|
1465
1498
|
}
|
|
1466
|
-
if (!fontProperty && !fromTheme) if (valueCacheEntries > 8192) {
|
|
1499
|
+
if (!fontProperty && !fromTheme && !nativeColors) if (valueCacheEntries > 8192) {
|
|
1467
1500
|
valueCaches = /* @__PURE__ */ new WeakMap();
|
|
1468
1501
|
valueCacheEntries = 0;
|
|
1469
1502
|
} else {
|
|
@@ -1626,8 +1659,8 @@ function emitTextDecoration(state, raw, cursor, originalValue, contextOnly) {
|
|
|
1626
1659
|
function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
|
|
1627
1660
|
emitProperty(state, property, resolveValue(state, property, raw), cursor, originalValue, contextOnly);
|
|
1628
1661
|
}
|
|
1629
|
-
function resolveValue(state, property, raw) {
|
|
1630
|
-
var value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
|
|
1662
|
+
function resolveValue(state, property, raw, nativeColors) {
|
|
1663
|
+
var value = typeof raw === "string" ? configuredValue(state, property, raw, true, nativeColors) : raw;
|
|
1631
1664
|
if (typeof value === "string" && value !== "" && true) value = resolveNumericValue(value);
|
|
1632
1665
|
return value;
|
|
1633
1666
|
}
|
|
@@ -1720,13 +1753,14 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
|
|
|
1720
1753
|
}
|
|
1721
1754
|
return;
|
|
1722
1755
|
}
|
|
1723
|
-
var
|
|
1756
|
+
var nativeColors = typeof raw === "string" && (property === "backgroundImage" || property === "boxShadow" || property === "textShadow") ? /* @__PURE__ */ new Map() : void 0;
|
|
1757
|
+
var value3 = resolveValue(state, property, raw, nativeColors);
|
|
1724
1758
|
if (import_getCSSStylesAtomic.canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
|
|
1725
1759
|
state.flatBoxShadow = value3;
|
|
1726
1760
|
state.flatBoxShadowSequence = frameSequence + 1;
|
|
1727
1761
|
}
|
|
1728
1762
|
if (typeof value3 === "string" && (property === "backgroundImage" || property === "boxShadow" || property === "textShadow")) {
|
|
1729
|
-
var parsed = (0, import_parseNativeStyle.parseNativeStyle)(property, value3);
|
|
1763
|
+
var parsed = (0, import_parseNativeStyle.parseNativeStyle)(property, value3, nativeColors);
|
|
1730
1764
|
if (parsed) {
|
|
1731
1765
|
if (property === "textShadow") {
|
|
1732
1766
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
@@ -1926,18 +1960,20 @@ function contributeValue(state, property, value, originalValue) {
|
|
|
1926
1960
|
function clearDirectStyle(state, property) {
|
|
1927
1961
|
var _direct_flatAtomics;
|
|
1928
1962
|
var direct = state;
|
|
1963
|
+
if (direct.flatDynamicColors) delete direct.flatDynamicColors[property];
|
|
1929
1964
|
var propertyKind = (0, import_grammarConfig.getConfigRevisionState)(state.conf).propertyKind(property);
|
|
1930
1965
|
var atomicKey = property.startsWith("transition") ? "transition" : propertyKind > 0 && propertyKind < 5 ? "boxShadow" : propertyKind === 6 ? "textShadow" : propertyKind === 5 ? "transform" : property;
|
|
1931
1966
|
var slot = atomicKey;
|
|
1932
1967
|
(_direct_flatAtomics = direct.flatAtomics) === null || _direct_flatAtomics === void 0 || _direct_flatAtomics.delete(slot);
|
|
1933
1968
|
if (direct.flatSlots) {
|
|
1934
|
-
if (slot !== atomicKey) {
|
|
1969
|
+
if (slot !== atomicKey || atomicKey === "flex") {
|
|
1935
1970
|
var entries = direct.flatSlots.get(slot);
|
|
1936
1971
|
if (entries) {
|
|
1937
1972
|
for (var index = entries.length; index--;) if (entries[index][0] === atomicKey) entries.splice(index, 1);
|
|
1973
|
+
if (!entries.length) direct.flatSlots.delete(slot);
|
|
1938
1974
|
}
|
|
1939
1975
|
}
|
|
1940
|
-
direct.flatSlots.delete(atomicKey);
|
|
1976
|
+
if (atomicKey !== "flex") direct.flatSlots.delete(atomicKey);
|
|
1941
1977
|
}
|
|
1942
1978
|
if (atomicKey === "transform") state.transformAccumulator = void 0;
|
|
1943
1979
|
if (state.style) delete state.style[atomicKey];
|