@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.
@@ -379,10 +379,28 @@ function contributeProp(pass, keyOg, valOg, originalOg = valOg, disabled = false
379
379
  }
380
380
  const styleOriginals = shouldTrackStyleTokenProvenance ? styleOriginalValues.get(style) : void 0;
381
381
  for (const key in style) {
382
- if (style[key] == null) continue;
383
- if (key === "containerName") pass[passContainerName] = style[key];
384
- else if (key === "containerType") pass[passContainerType] = style[key];
385
- contributeValue(styleState, key, style[key], styleOriginals?.[key]);
382
+ const value = style[key];
383
+ if (value == null) continue;
384
+ let inline = !styleState.styleProps.stylePieceEntries;
385
+ if (key === "containerName") {
386
+ pass[passContainerName] = value;
387
+ inline = false;
388
+ } else if (key === "containerType") {
389
+ pass[passContainerType] = value;
390
+ inline = false;
391
+ }
392
+ if (inline) {
393
+ if (typeof value === "string") {
394
+ const [segments] = getConfigRevisionState(conf).parseFlatValue(value);
395
+ for (let index2 = 4; index2 < segments.length; index2 += 5) if (!(segments[index2] & 1)) {
396
+ inline = false;
397
+ break;
398
+ }
399
+ } else if (value && typeof value === "object" && !Array.isArray(value) && !isVariable(value) && classifyConditionalObject(value, styleState) !== 0) inline = false;
400
+ }
401
+ styleState.flatInlineStyleProp = inline;
402
+ contributeValue(styleState, key, value, styleOriginals?.[key]);
403
+ styleState.flatInlineStyleProp = false;
386
404
  }
387
405
  }
388
406
  pass[passSourceLayer] = layerBeforeStyle;
@@ -965,7 +983,10 @@ function writeCapturedStyleRecord(slots, slot, source, sourceLayer) {
965
983
  for (let index = 0; index < list.length; index++) {
966
984
  const entry = list[index];
967
985
  const entryFlags = entry[7] & 31;
968
- if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) continue;
986
+ if ((entryFlags & (recordInline | recordCSS)) !== (flags & (recordInline | recordCSS))) {
987
+ if (sourceLayer === sourceLayerStyle && entry[7] >> 5 === sourceLayerStyle && entry[0] === source[0] && !condition && !entry[2]) list.splice(index--, 1);
988
+ continue;
989
+ }
969
990
  if (entry[0] !== source[0]) continue;
970
991
  if (flags & recordDefault) {
971
992
  if (!(entryFlags & recordDefault) && (!entry[2] || entry[3] === identity)) return;
@@ -1088,9 +1109,20 @@ function writeStyleRecord(state, property, value, cursor, original, flags, condi
1088
1109
  const identity = cursor ? cursor[conditionKey] : "";
1089
1110
  const direct = state;
1090
1111
  const slots = direct.flatSlots ||= /* @__PURE__ */ new Map();
1091
- const slot = canGenerateCSS && (state.flatShouldDoClasses || flags & recordCSS) ? styleSlot(property) : property.startsWith("transition") ? "transition" : property;
1112
+ const sourceLayer = direct.flatPass?.[passSourceLayer] || 0;
1113
+ if (direct.flatInlineStyleProp) flags |= recordInline;
1114
+ const cssSlot = canGenerateCSS && (state.flatShouldDoClasses || flags & recordCSS) ? styleSlot(property) : property.startsWith("transition") ? "transition" : property;
1115
+ const slot = flags & recordInline && cssSlot !== property ? property : cssSlot;
1092
1116
  let list = slots.get(slot);
1093
1117
  if (!list) slots.set(slot, list = []);
1118
+ if (sourceLayer === sourceLayerStyle && !condition) {
1119
+ const other = slot === cssSlot ? list : slots.get(flags & recordInline ? cssSlot : property);
1120
+ if (other) for (let index = 0; index < other.length; index++) {
1121
+ const entry = other[index];
1122
+ const entryFlags = entry[7];
1123
+ if (entry[0] === property && !entry[2] && entryFlags >> 5 === sourceLayerStyle && (entryFlags & 17) !== (flags & 17)) other.splice(index--, 1);
1124
+ }
1125
+ }
1094
1126
  for (let index = 0; index < list.length; index++) {
1095
1127
  const entry = list[index];
1096
1128
  const entryFlags = entry[7];
@@ -1115,7 +1147,7 @@ function writeStyleRecord(state, property, value, cursor, original, flags, condi
1115
1147
  cursor ? cursor[conditionSelector] : "",
1116
1148
  cursor ? cursor[conditionWrappers] : void 0,
1117
1149
  original,
1118
- flags | (state.flatPass?.[passSourceLayer] || 0) << 5
1150
+ flags | sourceLayer << 5
1119
1151
  ]);
1120
1152
  }
1121
1153
  function streamWriteInline(state, property, value, cursor, original, normalize = property === "lineHeight", conditionOverride = -1, force = false) {
@@ -1226,7 +1258,7 @@ const cssWideColorKeywords = /* @__PURE__ */ new Set([
1226
1258
  "currentcolor",
1227
1259
  "transparent"
1228
1260
  ]);
1229
- function configuredValue(state, property, raw, embedded = false) {
1261
+ function configuredValue(state, property, raw, embedded = false, nativeColors) {
1230
1262
  const grammar = getConfigRevisionState(state.conf);
1231
1263
  let name = raw;
1232
1264
  let opacity;
@@ -1246,7 +1278,7 @@ function configuredValue(state, property, raw, embedded = false) {
1246
1278
  const fontProperty = property.startsWith("font") || property === "lineHeight" || property === "letterSpacing";
1247
1279
  const resolveValues = state.styleProps.resolveValues;
1248
1280
  let byRaw;
1249
- if (!fontProperty) {
1281
+ if (!fontProperty && !nativeColors) {
1250
1282
  const revision = grammar.revision;
1251
1283
  if (state.conf !== valueCacheConf || revision !== valueCacheRevision) {
1252
1284
  valueCacheConf = state.conf;
@@ -1361,15 +1393,20 @@ function configuredValue(state, property, raw, embedded = false) {
1361
1393
  }
1362
1394
  let out = raw;
1363
1395
  if (isVariable(value)) {
1364
- out = resolveValues === "except-theme" && fromTheme ? `${THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : resolveVariableValue(property, value, resolveValues);
1396
+ out = resolveValues === "except-theme" && fromTheme ? `${THEME_REF_PREFIX}${lookupName}${opacity !== void 0 ? `/${opacity}` : ""}` : resolveVariableValue(nativeColors ? "color" : property, value, resolveValues);
1365
1397
  if (opacity !== void 0) out = `color-mix(in srgb, ${out} ${opacity}%, transparent)`;
1366
1398
  }
1399
+ if (nativeColors && out && typeof out === "object") {
1400
+ const reference = `__tamagui_native_color_${nativeColors.size}`;
1401
+ nativeColors.set(reference, out);
1402
+ out = reference;
1403
+ }
1367
1404
  if (embedded && out === raw) {
1368
1405
  const usedSafeArea = state.flatUsesSafeArea;
1369
- out = grammar.embeddedTokens(raw, (word) => configuredValue(state, property, word));
1406
+ out = grammar.embeddedTokens(raw, (word) => configuredValue(state, property, word, false, nativeColors));
1370
1407
  if (!usedSafeArea && state.flatUsesSafeArea) return out;
1371
1408
  }
1372
- if (!fontProperty && !fromTheme) if (valueCacheEntries > 8192) {
1409
+ if (!fontProperty && !fromTheme && !nativeColors) if (valueCacheEntries > 8192) {
1373
1410
  valueCaches = /* @__PURE__ */ new WeakMap();
1374
1411
  valueCacheEntries = 0;
1375
1412
  } else {
@@ -1437,8 +1474,8 @@ function resolveNumericValue(value) {
1437
1474
  function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
1438
1475
  emitProperty(state, property, resolveValue(state, property, raw), cursor, originalValue, contextOnly);
1439
1476
  }
1440
- function resolveValue(state, property, raw) {
1441
- let value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
1477
+ function resolveValue(state, property, raw, nativeColors) {
1478
+ let value = typeof raw === "string" ? configuredValue(state, property, raw, true, nativeColors) : raw;
1442
1479
  if (!state.flatShouldDoClasses && typeof value === "string" && value !== "" && property !== "lineHeight") value = resolveNumericValue(value);
1443
1480
  return value;
1444
1481
  }
@@ -1547,7 +1584,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
1547
1584
  else emitProperty(state, property, raw, cursor, originalValue, contextOnly);
1548
1585
  return;
1549
1586
  }
1550
- let value = resolveValue(state, property, raw);
1587
+ let value = resolveValue(state, property, raw, void 0);
1551
1588
  if (canGenerateCSS && state.flatShouldDoClasses && property === "boxShadow" && !condition) {
1552
1589
  state.flatBoxShadow = value;
1553
1590
  state.flatBoxShadowSequence = frameSequence + 1;
@@ -1678,19 +1715,21 @@ function contributeValue(state, property, value, originalValue, contextOnly = fa
1678
1715
  }
1679
1716
  function clearDirectStyle(state, property) {
1680
1717
  const direct = state;
1718
+ if (direct.flatDynamicColors) delete direct.flatDynamicColors[property];
1681
1719
  property = webStyleProperty(property);
1682
1720
  const propertyKind = getConfigRevisionState(state.conf).propertyKind(property);
1683
1721
  const atomicKey = property.startsWith("transition") ? "transition" : propertyKind > 0 && propertyKind < 5 ? "boxShadow" : propertyKind === 6 ? "textShadow" : propertyKind === 5 ? "transform" : property;
1684
1722
  const slot = styleSlot(atomicKey);
1685
1723
  direct.flatAtomics?.delete(slot);
1686
1724
  if (direct.flatSlots) {
1687
- if (slot !== atomicKey) {
1725
+ if (slot !== atomicKey || atomicKey === "flex") {
1688
1726
  const entries = direct.flatSlots.get(slot);
1689
1727
  if (entries) {
1690
1728
  for (let index = entries.length; index--;) if (entries[index][0] === atomicKey) entries.splice(index, 1);
1729
+ if (!entries.length) direct.flatSlots.delete(slot);
1691
1730
  }
1692
1731
  }
1693
- direct.flatSlots.delete(atomicKey);
1732
+ if (atomicKey !== "flex") direct.flatSlots.delete(atomicKey);
1694
1733
  }
1695
1734
  if (atomicKey === "transform") state.transformAccumulator = void 0;
1696
1735
  if (state.style) delete state.style[atomicKey];