@drskillissue/ganko 0.2.81 → 0.2.82

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.
@@ -36063,7 +36063,7 @@ var DYNAMIC_ATTRIBUTE_GUARD = {
36063
36063
  key: "dynamic-attribute:*"
36064
36064
  };
36065
36065
  var SCROLLABLE_VALUES = /* @__PURE__ */ new Set(["auto", "scroll"]);
36066
- function collectMonitoredDeclarations(selector, layerOrder, guard) {
36066
+ function collectMonitoredDeclarations(selector, layerOrder, guard, variablesByName) {
36067
36067
  const out = [];
36068
36068
  const declarations = selector.rule.declarations;
36069
36069
  for (let i = 0; i < declarations.length; i++) {
@@ -36079,12 +36079,14 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36079
36079
  specificityScore: selector.specificityScore,
36080
36080
  isImportant: declaration.cascadePosition.isImportant || declaration.node.important
36081
36081
  };
36082
+ const rawValue = declaration.value;
36083
+ const resolvedValue = variablesByName !== null && rawValue.includes("var(") ? substituteVarReferences(rawValue, variablesByName, 0) : rawValue;
36082
36084
  const directSignal = MONITORED_SIGNAL_NAME_MAP.get(property);
36083
36085
  if (directSignal !== void 0) {
36084
- out.push({ property: directSignal, value: declaration.value, guardProvenance: guard, position });
36086
+ out.push({ property: directSignal, value: resolvedValue, guardProvenance: guard, position });
36085
36087
  continue;
36086
36088
  }
36087
- const value2 = declaration.value.trim().toLowerCase();
36089
+ const value2 = resolvedValue.trim().toLowerCase();
36088
36090
  const expanded = expandShorthand(property, value2);
36089
36091
  if (expanded === void 0) continue;
36090
36092
  if (expanded === null) {
@@ -36095,7 +36097,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36095
36097
  if (!longhand) continue;
36096
36098
  const signal = MONITORED_SIGNAL_NAME_MAP.get(longhand);
36097
36099
  if (signal === void 0) continue;
36098
- out.push({ property: signal, value: declaration.value, guardProvenance: guard, position });
36100
+ out.push({ property: signal, value: resolvedValue, guardProvenance: guard, position });
36099
36101
  }
36100
36102
  continue;
36101
36103
  }
@@ -36190,19 +36192,6 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
36190
36192
  }
36191
36193
  }
36192
36194
  var MAX_VAR_SUBSTITUTION_DEPTH = 10;
36193
- function resolveVarReferencesInCascade(cascade, variablesByName) {
36194
- for (const [property, declaration] of cascade) {
36195
- if (!declaration.value.includes("var(")) continue;
36196
- const resolved = substituteVarReferences(declaration.value, variablesByName, 0);
36197
- if (resolved !== declaration.value) {
36198
- cascade.set(property, {
36199
- value: resolved,
36200
- source: declaration.source,
36201
- guardProvenance: declaration.guardProvenance
36202
- });
36203
- }
36204
- }
36205
- }
36206
36195
  function substituteVarReferences(value2, variablesByName, depth) {
36207
36196
  if (depth >= MAX_VAR_SUBSTITUTION_DEPTH) return value2;
36208
36197
  const refs = extractVarReferences(value2);
@@ -36236,7 +36225,7 @@ function selectBestVariableValue(candidates) {
36236
36225
  const first = candidates[0];
36237
36226
  return first ? first.value : null;
36238
36227
  }
36239
- function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind, variablesByName) {
36228
+ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind) {
36240
36229
  const out = /* @__PURE__ */ new Map();
36241
36230
  const positions = /* @__PURE__ */ new Map();
36242
36231
  for (let i = 0; i < edges.length; i++) {
@@ -36294,9 +36283,6 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
36294
36283
  if (tailwind !== null) {
36295
36284
  augmentCascadeWithTailwind(out, node, tailwind);
36296
36285
  }
36297
- if (variablesByName !== null) {
36298
- resolveVarReferencesInCascade(out, variablesByName);
36299
- }
36300
36286
  return out;
36301
36287
  }
36302
36288
  function compareLayoutEdge(a, b) {
@@ -36965,7 +36951,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36965
36951
  const monitoredDeclarations = collectMonitoredDeclarations(
36966
36952
  selector,
36967
36953
  resolveRuleLayerOrder(selector.rule, css),
36968
- guard
36954
+ guard,
36955
+ css.variablesByName
36969
36956
  );
36970
36957
  selectorsById.set(selector.id, selector);
36971
36958
  monitoredDeclarationsBySelectorId.set(selector.id, monitoredDeclarations);
@@ -37143,7 +37130,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37143
37130
  const mutableEdges = appliesByElementNodeMutable.get(node);
37144
37131
  if (mutableEdges) mutableEdges.sort(compareLayoutEdge);
37145
37132
  const edges = mutableEdges ?? EMPTY_EDGE_LIST;
37146
- const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind, css.variablesByName);
37133
+ const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind);
37147
37134
  if (trace && cascade.size > 0) {
37148
37135
  const displayDecl = cascade.get("display");
37149
37136
  const flexDirDecl = cascade.get("flex-direction");
@@ -40922,7 +40909,13 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40922
40909
  }
40923
40910
  });
40924
40911
  function checkDimension(snapshot, signal, min, layout, node, emit, messageId, template, tag, policyName) {
40925
- const px = readKnownPx(snapshot, signal);
40912
+ let px = readKnownPx(snapshot, signal);
40913
+ if (px === null) {
40914
+ const signalValue = readKnownSignalWithGuard(snapshot, signal);
40915
+ if (signalValue !== null && signalValue.guard.kind === 1 /* Conditional */) {
40916
+ px = resolveUnconditionalFallbackPx(layout, node, signal);
40917
+ }
40918
+ }
40926
40919
  if (px === null) return;
40927
40920
  if (px >= min) return;
40928
40921
  emitLayoutDiagnostic(
@@ -40942,6 +40935,20 @@ function checkDimension(snapshot, signal, min, layout, node, emit, messageId, te
40942
40935
  }
40943
40936
  );
40944
40937
  }
40938
+ function resolveUnconditionalFallbackPx(layout, node, signal) {
40939
+ const delta = readConditionalSignalDeltaFact(layout, node, signal);
40940
+ if (!delta.hasConditional) return null;
40941
+ const values = delta.unconditionalValues;
40942
+ let bestPx = null;
40943
+ for (let i = 0; i < values.length; i++) {
40944
+ const raw = values[i];
40945
+ if (!raw) continue;
40946
+ const px = parsePxValue(raw);
40947
+ if (px === null) continue;
40948
+ if (bestPx === null || px > bestPx) bestPx = px;
40949
+ }
40950
+ return bestPx;
40951
+ }
40945
40952
 
40946
40953
  // src/cross-file/rules/index.ts
40947
40954
  var rules3 = [