@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.
@@ -14,7 +14,7 @@ import {
14
14
  rules3,
15
15
  runCrossFileRules,
16
16
  runPhases
17
- } from "./chunk-QDFZ6A6X.js";
17
+ } from "./chunk-CHVGY25Z.js";
18
18
  import "./chunk-EGRHWZRV.js";
19
19
 
20
20
  // src/eslint-adapter.ts
package/dist/index.cjs CHANGED
@@ -36787,7 +36787,7 @@ var DYNAMIC_ATTRIBUTE_GUARD = {
36787
36787
  key: "dynamic-attribute:*"
36788
36788
  };
36789
36789
  var SCROLLABLE_VALUES = /* @__PURE__ */ new Set(["auto", "scroll"]);
36790
- function collectMonitoredDeclarations(selector, layerOrder, guard) {
36790
+ function collectMonitoredDeclarations(selector, layerOrder, guard, variablesByName) {
36791
36791
  const out = [];
36792
36792
  const declarations = selector.rule.declarations;
36793
36793
  for (let i = 0; i < declarations.length; i++) {
@@ -36803,12 +36803,14 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36803
36803
  specificityScore: selector.specificityScore,
36804
36804
  isImportant: declaration.cascadePosition.isImportant || declaration.node.important
36805
36805
  };
36806
+ const rawValue = declaration.value;
36807
+ const resolvedValue = variablesByName !== null && rawValue.includes("var(") ? substituteVarReferences(rawValue, variablesByName, 0) : rawValue;
36806
36808
  const directSignal = MONITORED_SIGNAL_NAME_MAP.get(property);
36807
36809
  if (directSignal !== void 0) {
36808
- out.push({ property: directSignal, value: declaration.value, guardProvenance: guard, position });
36810
+ out.push({ property: directSignal, value: resolvedValue, guardProvenance: guard, position });
36809
36811
  continue;
36810
36812
  }
36811
- const value2 = declaration.value.trim().toLowerCase();
36813
+ const value2 = resolvedValue.trim().toLowerCase();
36812
36814
  const expanded = expandShorthand(property, value2);
36813
36815
  if (expanded === void 0) continue;
36814
36816
  if (expanded === null) {
@@ -36819,7 +36821,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36819
36821
  if (!longhand) continue;
36820
36822
  const signal = MONITORED_SIGNAL_NAME_MAP.get(longhand);
36821
36823
  if (signal === void 0) continue;
36822
- out.push({ property: signal, value: declaration.value, guardProvenance: guard, position });
36824
+ out.push({ property: signal, value: resolvedValue, guardProvenance: guard, position });
36823
36825
  }
36824
36826
  continue;
36825
36827
  }
@@ -36914,19 +36916,6 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
36914
36916
  }
36915
36917
  }
36916
36918
  var MAX_VAR_SUBSTITUTION_DEPTH = 10;
36917
- function resolveVarReferencesInCascade(cascade, variablesByName) {
36918
- for (const [property, declaration] of cascade) {
36919
- if (!declaration.value.includes("var(")) continue;
36920
- const resolved = substituteVarReferences(declaration.value, variablesByName, 0);
36921
- if (resolved !== declaration.value) {
36922
- cascade.set(property, {
36923
- value: resolved,
36924
- source: declaration.source,
36925
- guardProvenance: declaration.guardProvenance
36926
- });
36927
- }
36928
- }
36929
- }
36930
36919
  function substituteVarReferences(value2, variablesByName, depth) {
36931
36920
  if (depth >= MAX_VAR_SUBSTITUTION_DEPTH) return value2;
36932
36921
  const refs = extractVarReferences(value2);
@@ -36960,7 +36949,7 @@ function selectBestVariableValue(candidates) {
36960
36949
  const first = candidates[0];
36961
36950
  return first ? first.value : null;
36962
36951
  }
36963
- function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind, variablesByName) {
36952
+ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind) {
36964
36953
  const out = /* @__PURE__ */ new Map();
36965
36954
  const positions = /* @__PURE__ */ new Map();
36966
36955
  for (let i = 0; i < edges.length; i++) {
@@ -37018,9 +37007,6 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
37018
37007
  if (tailwind !== null) {
37019
37008
  augmentCascadeWithTailwind(out, node, tailwind);
37020
37009
  }
37021
- if (variablesByName !== null) {
37022
- resolveVarReferencesInCascade(out, variablesByName);
37023
- }
37024
37010
  return out;
37025
37011
  }
37026
37012
  function compareLayoutEdge(a, b) {
@@ -37689,7 +37675,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37689
37675
  const monitoredDeclarations = collectMonitoredDeclarations(
37690
37676
  selector,
37691
37677
  resolveRuleLayerOrder(selector.rule, css),
37692
- guard
37678
+ guard,
37679
+ css.variablesByName
37693
37680
  );
37694
37681
  selectorsById.set(selector.id, selector);
37695
37682
  monitoredDeclarationsBySelectorId.set(selector.id, monitoredDeclarations);
@@ -37867,7 +37854,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37867
37854
  const mutableEdges = appliesByElementNodeMutable.get(node);
37868
37855
  if (mutableEdges) mutableEdges.sort(compareLayoutEdge);
37869
37856
  const edges = mutableEdges ?? EMPTY_EDGE_LIST;
37870
- const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind, css.variablesByName);
37857
+ const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind);
37871
37858
  if (trace && cascade.size > 0) {
37872
37859
  const displayDecl = cascade.get("display");
37873
37860
  const flexDirDecl = cascade.get("flex-direction");
@@ -41551,7 +41538,13 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
41551
41538
  }
41552
41539
  });
41553
41540
  function checkDimension(snapshot, signal, min, layout, node, emit, messageId, template, tag, policyName) {
41554
- const px = readKnownPx(snapshot, signal);
41541
+ let px = readKnownPx(snapshot, signal);
41542
+ if (px === null) {
41543
+ const signalValue = readKnownSignalWithGuard(snapshot, signal);
41544
+ if (signalValue !== null && signalValue.guard.kind === 1 /* Conditional */) {
41545
+ px = resolveUnconditionalFallbackPx(layout, node, signal);
41546
+ }
41547
+ }
41555
41548
  if (px === null) return;
41556
41549
  if (px >= min) return;
41557
41550
  emitLayoutDiagnostic(
@@ -41571,6 +41564,20 @@ function checkDimension(snapshot, signal, min, layout, node, emit, messageId, te
41571
41564
  }
41572
41565
  );
41573
41566
  }
41567
+ function resolveUnconditionalFallbackPx(layout, node, signal) {
41568
+ const delta = readConditionalSignalDeltaFact(layout, node, signal);
41569
+ if (!delta.hasConditional) return null;
41570
+ const values = delta.unconditionalValues;
41571
+ let bestPx = null;
41572
+ for (let i = 0; i < values.length; i++) {
41573
+ const raw = values[i];
41574
+ if (!raw) continue;
41575
+ const px = parsePxValue(raw);
41576
+ if (px === null) continue;
41577
+ if (bestPx === null || px > bestPx) bestPx = px;
41578
+ }
41579
+ return bestPx;
41580
+ }
41574
41581
 
41575
41582
  // src/cross-file/rules/index.ts
41576
41583
  var rules3 = [