@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.
@@ -443,8 +443,21 @@ function contributeProp(pass, keyOg, valOg) {
443
443
  }
444
444
  var styleOriginals = shouldTrackStyleTokenProvenance ? styleOriginalValues.get(style) : void 0;
445
445
  for (var key1 in style) {
446
- if (style[key1] == null) continue;
447
- contributeValue(styleState, key1, style[key1], styleOriginals === null || styleOriginals === void 0 ? void 0 : styleOriginals[key1]);
446
+ var value1 = style[key1];
447
+ if (value1 == null) continue;
448
+ var inline = !styleState.styleProps.stylePieceEntries;
449
+ if (inline) {
450
+ if (typeof value1 === "string") {
451
+ var [segments] = getConfigRevisionState(conf).parseFlatValue(value1);
452
+ for (var index2 = 4; index2 < segments.length; index2 += 5) if (!(segments[index2] & 1)) {
453
+ inline = false;
454
+ break;
455
+ }
456
+ } else if (value1 && typeof value1 === "object" && !Array.isArray(value1) && !isVariable(value1) && classifyConditionalObject(value1, styleState) !== 0) inline = false;
457
+ }
458
+ styleState.flatInlineStyleProp = inline;
459
+ contributeValue(styleState, key1, value1, styleOriginals === null || styleOriginals === void 0 ? void 0 : styleOriginals[key1]);
460
+ styleState.flatInlineStyleProp = false;
448
461
  }
449
462
  }
450
463
  pass[passSourceLayer] = layerBeforeStyle;
@@ -553,7 +566,7 @@ function contributeProp(pass, keyOg, valOg) {
553
566
  if (valInit === "unset") {
554
567
  var expanded = expandStyle(keyInit, valInit, conf.settings.styleCompat || "web");
555
568
  clearDirectStyle(styleState, keyInit);
556
- if (expanded) for (var index2 = 0; index2 < expanded.length; index2++) clearDirectStyle(styleState, expanded[index2][0]);
569
+ if (expanded) for (var index3 = 0; index3 < expanded.length; index3++) clearDirectStyle(styleState, expanded[index3][0]);
557
570
  } else contributeValue(styleState, keyInit, valInit, originalOg, !isHostStyleKey);
558
571
  return;
559
572
  }
@@ -937,7 +950,10 @@ function writeCapturedStyleRecord(slots, slot, source, sourceLayer) {
937
950
  for (var index = 0; index < list.length; index++) {
938
951
  var entry = list[index];
939
952
  var entryFlags = entry[7] & 31;
940
- if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
953
+ if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) {
954
+ if (sourceLayer === sourceLayerStyle && entry[7] >> 5 === sourceLayerStyle && entry[0] === source[0] && !condition && !entry[2]) list.splice(index--, 1);
955
+ continue;
956
+ }
941
957
  if (entry[0] !== source[0]) continue;
942
958
  if (flags & recordDefault) {
943
959
  if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
@@ -1047,27 +1063,39 @@ var recordDefault = 8;
1047
1063
  var recordCSS = 16;
1048
1064
  function writeStyleRecord(state, property, value, cursor, original, flags) {
1049
1065
  var conditionOverride = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : -1;
1050
- var _state_flatPass;
1066
+ var _direct_flatPass;
1051
1067
  var _direct;
1052
1068
  var condition = conditionOverride !== -1 ? conditionOverride : cursor ? cursor[conditionValue] : 0;
1053
1069
  var identity = cursor ? cursor[conditionKey] : "";
1054
- var slots = (_direct = state).flatSlots || (_direct.flatSlots = /* @__PURE__ */ new Map());
1055
- var slot = property.startsWith("transition") ? "transition" : property;
1070
+ var direct = state;
1071
+ var slots = (_direct = direct).flatSlots || (_direct.flatSlots = /* @__PURE__ */ new Map());
1072
+ var sourceLayer = ((_direct_flatPass = direct.flatPass) === null || _direct_flatPass === void 0 ? void 0 : _direct_flatPass[passSourceLayer]) || 0;
1073
+ if (direct.flatInlineStyleProp) flags |= recordInline;
1074
+ var cssSlot = property.startsWith("transition") ? "transition" : property;
1075
+ var slot = flags & recordInline && cssSlot !== property ? property : cssSlot;
1056
1076
  var list = slots.get(slot);
1057
1077
  if (!list) slots.set(slot, list = []);
1058
- for (var index = 0; index < list.length; index++) {
1059
- var entry = list[index];
1060
- var entryFlags = entry[7];
1061
- if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
1062
- if (entry[0] !== property) continue;
1078
+ if (sourceLayer === sourceLayerStyle && !condition) {
1079
+ var other = slot === cssSlot ? list : slots.get(flags & recordInline ? cssSlot : property);
1080
+ if (other) for (var index = 0; index < other.length; index++) {
1081
+ var entry = other[index];
1082
+ var entryFlags = entry[7];
1083
+ if (entry[0] === property && !entry[2] && entryFlags >> 5 === sourceLayerStyle && (entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) other.splice(index--, 1);
1084
+ }
1085
+ }
1086
+ for (var index1 = 0; index1 < list.length; index1++) {
1087
+ var entry1 = list[index1];
1088
+ var entryFlags1 = entry1[7];
1089
+ if ((entryFlags1 & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
1090
+ if (entry1[0] !== property) continue;
1063
1091
  if (flags & recordDefault) {
1064
- if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
1065
- } else if (entryFlags & recordDefault && (!condition || entry[3] === identity)) {
1066
- list.splice(index--, 1);
1092
+ if (!(entryFlags1 & recordDefault) && (!entry1[2] || entry1[3] === identity)) return;
1093
+ } else if (entryFlags1 & recordDefault && (!condition || entry1[3] === identity)) {
1094
+ list.splice(index1--, 1);
1067
1095
  continue;
1068
1096
  }
1069
- if (entry[3] === identity) {
1070
- list.splice(index, 1);
1097
+ if (entry1[3] === identity) {
1098
+ list.splice(index1, 1);
1071
1099
  break;
1072
1100
  }
1073
1101
  }
@@ -1079,7 +1107,7 @@ function writeStyleRecord(state, property, value, cursor, original, flags) {
1079
1107
  cursor ? cursor[conditionSelector] : "",
1080
1108
  cursor ? cursor[conditionWrappers] : void 0,
1081
1109
  original,
1082
- flags | (((_state_flatPass = state.flatPass) === null || _state_flatPass === void 0 ? void 0 : _state_flatPass[passSourceLayer]) || 0) << 5
1110
+ flags | sourceLayer << 5
1083
1111
  ]);
1084
1112
  }
1085
1113
  function streamWriteInline(state, property, value, cursor, original) {
@@ -1254,7 +1282,7 @@ var cssWideColorKeywords = /* @__PURE__ */ new Set([
1254
1282
  "transparent"
1255
1283
  ]);
1256
1284
  function configuredValue(state, property, raw) {
1257
- var embedded = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
1285
+ var embedded = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, nativeColors = arguments.length > 4 ? arguments[4] : void 0;
1258
1286
  var grammar = getConfigRevisionState(state.conf);
1259
1287
  var name = raw;
1260
1288
  var opacity;
@@ -1274,7 +1302,7 @@ function configuredValue(state, property, raw) {
1274
1302
  var fontProperty = property.startsWith("font") || property === "lineHeight" || property === "letterSpacing";
1275
1303
  var resolveValues = state.styleProps.resolveValues;
1276
1304
  var byRaw;
1277
- if (!fontProperty) {
1305
+ if (!fontProperty && !nativeColors) {
1278
1306
  var _maps;
1279
1307
  var revision = grammar.revision;
1280
1308
  if (state.conf !== valueCacheConf || revision !== valueCacheRevision) {
@@ -1415,20 +1443,25 @@ function configuredValue(state, property, raw) {
1415
1443
  }
1416
1444
  var out = raw;
1417
1445
  if (isVariable(value)) {
1418
- out = resolveValues === "except-theme" && fromTheme ? `${THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : resolveVariableValue(property, value, resolveValues);
1446
+ out = resolveValues === "except-theme" && fromTheme ? `${THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : resolveVariableValue(nativeColors ? "color" : property, value, resolveValues);
1419
1447
  if (opacity !== void 0) {
1420
1448
  var _normalizeColor;
1421
1449
  out = (_normalizeColor = normalizeColor(out, opacity / 100)) !== null && _normalizeColor !== void 0 ? _normalizeColor : out;
1422
1450
  }
1423
1451
  }
1452
+ if (nativeColors && out && typeof out === "object") {
1453
+ var reference = `__tamagui_native_color_${nativeColors.size}`;
1454
+ nativeColors.set(reference, out);
1455
+ out = reference;
1456
+ }
1424
1457
  if (embedded && out === raw) {
1425
1458
  var usedSafeArea = state.flatUsesSafeArea;
1426
1459
  out = grammar.embeddedTokens(raw, function(word) {
1427
- return configuredValue(state, property, word);
1460
+ return configuredValue(state, property, word, false, nativeColors);
1428
1461
  });
1429
1462
  if (!usedSafeArea && state.flatUsesSafeArea) return out;
1430
1463
  }
1431
- if (!fontProperty && !fromTheme) if (valueCacheEntries > 8192) {
1464
+ if (!fontProperty && !fromTheme && !nativeColors) if (valueCacheEntries > 8192) {
1432
1465
  valueCaches = /* @__PURE__ */ new WeakMap();
1433
1466
  valueCacheEntries = 0;
1434
1467
  } else {
@@ -1591,8 +1624,8 @@ function emitTextDecoration(state, raw, cursor, originalValue, contextOnly) {
1591
1624
  function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
1592
1625
  emitProperty(state, property, resolveValue(state, property, raw), cursor, originalValue, contextOnly);
1593
1626
  }
1594
- function resolveValue(state, property, raw) {
1595
- var value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
1627
+ function resolveValue(state, property, raw, nativeColors) {
1628
+ var value = typeof raw === "string" ? configuredValue(state, property, raw, true, nativeColors) : raw;
1596
1629
  if (typeof value === "string" && value !== "" && true) value = resolveNumericValue(value);
1597
1630
  return value;
1598
1631
  }
@@ -1685,13 +1718,14 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
1685
1718
  }
1686
1719
  return;
1687
1720
  }
1688
- var value3 = resolveValue(state, property, raw);
1721
+ var nativeColors = typeof raw === "string" && (property === "backgroundImage" || property === "boxShadow" || property === "textShadow") ? /* @__PURE__ */ new Map() : void 0;
1722
+ var value3 = resolveValue(state, property, raw, nativeColors);
1689
1723
  if (canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
1690
1724
  state.flatBoxShadow = value3;
1691
1725
  state.flatBoxShadowSequence = frameSequence + 1;
1692
1726
  }
1693
1727
  if (typeof value3 === "string" && (property === "backgroundImage" || property === "boxShadow" || property === "textShadow")) {
1694
- var parsed = parseNativeStyle(property, value3);
1728
+ var parsed = parseNativeStyle(property, value3, nativeColors);
1695
1729
  if (parsed) {
1696
1730
  if (property === "textShadow") {
1697
1731
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
@@ -1891,18 +1925,20 @@ function contributeValue(state, property, value, originalValue) {
1891
1925
  function clearDirectStyle(state, property) {
1892
1926
  var _direct_flatAtomics;
1893
1927
  var direct = state;
1928
+ if (direct.flatDynamicColors) delete direct.flatDynamicColors[property];
1894
1929
  var propertyKind = getConfigRevisionState(state.conf).propertyKind(property);
1895
1930
  var atomicKey = property.startsWith("transition") ? "transition" : propertyKind > 0 && propertyKind < 5 ? "boxShadow" : propertyKind === 6 ? "textShadow" : propertyKind === 5 ? "transform" : property;
1896
1931
  var slot = atomicKey;
1897
1932
  (_direct_flatAtomics = direct.flatAtomics) === null || _direct_flatAtomics === void 0 || _direct_flatAtomics.delete(slot);
1898
1933
  if (direct.flatSlots) {
1899
- if (slot !== atomicKey) {
1934
+ if (slot !== atomicKey || atomicKey === "flex") {
1900
1935
  var entries = direct.flatSlots.get(slot);
1901
1936
  if (entries) {
1902
1937
  for (var index = entries.length; index--;) if (entries[index][0] === atomicKey) entries.splice(index, 1);
1938
+ if (!entries.length) direct.flatSlots.delete(slot);
1903
1939
  }
1904
1940
  }
1905
- direct.flatSlots.delete(atomicKey);
1941
+ if (atomicKey !== "flex") direct.flatSlots.delete(atomicKey);
1906
1942
  }
1907
1943
  if (atomicKey === "transform") state.transformAccumulator = void 0;
1908
1944
  if (state.style) delete state.style[atomicKey];