@drskillissue/ganko 0.2.5 → 0.2.61

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-HIADOXXV.js";
17
+ } from "./chunk-BK7TC7DN.js";
18
18
  import "./chunk-EGRHWZRV.js";
19
19
 
20
20
  // src/eslint-adapter.ts
package/dist/index.cjs CHANGED
@@ -29284,8 +29284,12 @@ var POLICIES = {
29284
29284
  "dense-ui": DENSE_UI,
29285
29285
  "large-text": LARGE_TEXT
29286
29286
  };
29287
- var activePolicyName = "wcag-aa";
29287
+ var activePolicyName = null;
29288
29288
  function setActivePolicy(name) {
29289
+ if (name === null) {
29290
+ activePolicyName = null;
29291
+ return;
29292
+ }
29289
29293
  const match = ACCESSIBILITY_POLICIES.find((n) => n === name);
29290
29294
  if (match) {
29291
29295
  activePolicyName = match;
@@ -29295,6 +29299,7 @@ function getActivePolicyName() {
29295
29299
  return activePolicyName;
29296
29300
  }
29297
29301
  function getActivePolicy() {
29302
+ if (activePolicyName === null) return null;
29298
29303
  return POLICIES[activePolicyName];
29299
29304
  }
29300
29305
 
@@ -29613,7 +29618,8 @@ var cssPolicyContrast = defineCSSRule({
29613
29618
  options: {},
29614
29619
  check(graph, emit) {
29615
29620
  const policy = getActivePolicy();
29616
- const name = getActivePolicyName();
29621
+ if (policy === null) return;
29622
+ const name = getActivePolicyName() ?? "";
29617
29623
  const colorDecls = graph.declarationsByProperty.get("color");
29618
29624
  if (!colorDecls) return;
29619
29625
  const candidates = /* @__PURE__ */ new Set();
@@ -29690,7 +29696,8 @@ var cssPolicySpacing = defineCSSRule({
29690
29696
  options: {},
29691
29697
  check(graph, emit) {
29692
29698
  const policy = getActivePolicy();
29693
- const name = getActivePolicyName();
29699
+ if (policy === null) return;
29700
+ const name = getActivePolicyName() ?? "";
29694
29701
  const letterDecls = graph.declarationsByProperty.get("letter-spacing");
29695
29702
  if (letterDecls) {
29696
29703
  for (let i = 0; i < letterDecls.length; i++) {
@@ -29799,7 +29806,8 @@ var cssPolicyTouchTarget = defineCSSRule({
29799
29806
  options: {},
29800
29807
  check(graph, emit) {
29801
29808
  const policy = getActivePolicy();
29802
- const name = getActivePolicyName();
29809
+ if (policy === null) return;
29810
+ const name = getActivePolicyName() ?? "";
29803
29811
  const decls = graph.declarationsForProperties(
29804
29812
  "height",
29805
29813
  "min-height",
@@ -29958,7 +29966,8 @@ var cssPolicyTypography = defineCSSRule({
29958
29966
  options: {},
29959
29967
  check(graph, emit) {
29960
29968
  const policy = getActivePolicy();
29961
- const name = getActivePolicyName();
29969
+ if (policy === null) return;
29970
+ const name = getActivePolicyName() ?? "";
29962
29971
  const fontDecls = graph.declarationsByProperty.get("font-size");
29963
29972
  if (fontDecls) {
29964
29973
  for (let i = 0; i < fontDecls.length; i++) {
@@ -37385,7 +37394,7 @@ function resolveRuleLayerOrder(rule, css) {
37385
37394
  if (!name) return 0;
37386
37395
  return css.layerOrder.get(name) ?? 0;
37387
37396
  }
37388
- function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
37397
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
37389
37398
  const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
37390
37399
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
37391
37400
  const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
@@ -37396,11 +37405,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
37396
37405
  let factByProperty = null;
37397
37406
  if (edges !== void 0 && edges.length > 0) {
37398
37407
  const byProperty = /* @__PURE__ */ new Map();
37408
+ let conditionalAttributeDispatch = null;
37399
37409
  for (let j = 0; j < edges.length; j++) {
37400
37410
  const currentEdge = edges[j];
37401
37411
  if (!currentEdge) continue;
37402
37412
  const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
37403
37413
  if (!declarations) continue;
37414
+ let conditionalAttributeName = null;
37415
+ if (currentEdge.conditionalMatch) {
37416
+ conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
37417
+ }
37404
37418
  for (let k = 0; k < declarations.length; k++) {
37405
37419
  const declaration = declarations[k];
37406
37420
  if (!declaration) continue;
@@ -37419,6 +37433,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
37419
37433
  }
37420
37434
  if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
37421
37435
  bucket.conditional.add(expandedEntry.value);
37436
+ if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
37437
+ if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
37438
+ let dispatchMap = conditionalAttributeDispatch.get(property);
37439
+ if (!dispatchMap) {
37440
+ dispatchMap = /* @__PURE__ */ new Map();
37441
+ conditionalAttributeDispatch.set(property, dispatchMap);
37442
+ }
37443
+ dispatchMap.set(expandedEntry.value, conditionalAttributeName);
37444
+ }
37422
37445
  continue;
37423
37446
  }
37424
37447
  bucket.unconditional.add(expandedEntry.value);
@@ -37443,6 +37466,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
37443
37466
  }
37444
37467
  }
37445
37468
  }
37469
+ if (hasDelta && conditionalAttributeDispatch !== null) {
37470
+ const dispatchMap = conditionalAttributeDispatch.get(property);
37471
+ if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
37472
+ let singleAttribute = null;
37473
+ let allSameAttribute = true;
37474
+ for (const attrName of dispatchMap.values()) {
37475
+ if (singleAttribute === null) {
37476
+ singleAttribute = attrName;
37477
+ } else if (singleAttribute !== attrName) {
37478
+ allSameAttribute = false;
37479
+ break;
37480
+ }
37481
+ }
37482
+ if (allSameAttribute && singleAttribute !== null) {
37483
+ hasDelta = false;
37484
+ }
37485
+ }
37486
+ }
37446
37487
  const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
37447
37488
  facts.set(property, {
37448
37489
  hasConditional,
@@ -37528,6 +37569,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
37528
37569
  }
37529
37570
  return out;
37530
37571
  }
37572
+ function identifyConditionalAttribute(selectorId, node, selectorsById) {
37573
+ const selector = selectorsById.get(selectorId);
37574
+ if (!selector) return null;
37575
+ const constraints = selector.anchor.attributes;
37576
+ let dynamicAttributeName = null;
37577
+ for (let i = 0; i < constraints.length; i++) {
37578
+ const constraint = constraints[i];
37579
+ if (!constraint) continue;
37580
+ if (constraint.operator !== "equals") continue;
37581
+ if (constraint.value === null) continue;
37582
+ const elementValue = node.attributes.get(constraint.name);
37583
+ if (elementValue !== null) continue;
37584
+ if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
37585
+ return null;
37586
+ }
37587
+ dynamicAttributeName = constraint.name;
37588
+ }
37589
+ return dynamicAttributeName;
37590
+ }
37531
37591
  function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
37532
37592
  if (property !== "overflow" && property !== "overflow-y") {
37533
37593
  return {
@@ -38090,7 +38150,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
38090
38150
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
38091
38151
  elements,
38092
38152
  appliesByNode,
38093
- monitoredDeclarationsBySelectorId
38153
+ monitoredDeclarationsBySelectorId,
38154
+ selectorsById
38094
38155
  );
38095
38156
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
38096
38157
  conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
@@ -39903,7 +39964,8 @@ var jsxStylePolicy = defineCrossRule({
39903
39964
  check(context, emit) {
39904
39965
  const { solids } = context;
39905
39966
  const policy = getActivePolicy();
39906
- const name = getActivePolicyName();
39967
+ if (policy === null) return;
39968
+ const name = getActivePolicyName() ?? "";
39907
39969
  forEachStylePropertyAcross(solids, (solid, p) => {
39908
39970
  if (!import_typescript135.default.isPropertyAssignment(p)) return;
39909
39971
  const key = objectKeyName(p.name);