@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.
@@ -22739,8 +22739,12 @@ var POLICIES = {
22739
22739
  "dense-ui": DENSE_UI,
22740
22740
  "large-text": LARGE_TEXT
22741
22741
  };
22742
- var activePolicyName = "wcag-aa";
22742
+ var activePolicyName = null;
22743
22743
  function setActivePolicy(name) {
22744
+ if (name === null) {
22745
+ activePolicyName = null;
22746
+ return;
22747
+ }
22744
22748
  const match = ACCESSIBILITY_POLICIES.find((n) => n === name);
22745
22749
  if (match) {
22746
22750
  activePolicyName = match;
@@ -22750,6 +22754,7 @@ function getActivePolicyName() {
22750
22754
  return activePolicyName;
22751
22755
  }
22752
22756
  function getActivePolicy() {
22757
+ if (activePolicyName === null) return null;
22753
22758
  return POLICIES[activePolicyName];
22754
22759
  }
22755
22760
 
@@ -25038,7 +25043,8 @@ var cssPolicyContrast = defineCSSRule({
25038
25043
  options: {},
25039
25044
  check(graph, emit) {
25040
25045
  const policy = getActivePolicy();
25041
- const name = getActivePolicyName();
25046
+ if (policy === null) return;
25047
+ const name = getActivePolicyName() ?? "";
25042
25048
  const colorDecls = graph.declarationsByProperty.get("color");
25043
25049
  if (!colorDecls) return;
25044
25050
  const candidates = /* @__PURE__ */ new Set();
@@ -25115,7 +25121,8 @@ var cssPolicySpacing = defineCSSRule({
25115
25121
  options: {},
25116
25122
  check(graph, emit) {
25117
25123
  const policy = getActivePolicy();
25118
- const name = getActivePolicyName();
25124
+ if (policy === null) return;
25125
+ const name = getActivePolicyName() ?? "";
25119
25126
  const letterDecls = graph.declarationsByProperty.get("letter-spacing");
25120
25127
  if (letterDecls) {
25121
25128
  for (let i = 0; i < letterDecls.length; i++) {
@@ -25224,7 +25231,8 @@ var cssPolicyTouchTarget = defineCSSRule({
25224
25231
  options: {},
25225
25232
  check(graph, emit) {
25226
25233
  const policy = getActivePolicy();
25227
- const name = getActivePolicyName();
25234
+ if (policy === null) return;
25235
+ const name = getActivePolicyName() ?? "";
25228
25236
  const decls = graph.declarationsForProperties(
25229
25237
  "height",
25230
25238
  "min-height",
@@ -25383,7 +25391,8 @@ var cssPolicyTypography = defineCSSRule({
25383
25391
  options: {},
25384
25392
  check(graph, emit) {
25385
25393
  const policy = getActivePolicy();
25386
- const name = getActivePolicyName();
25394
+ if (policy === null) return;
25395
+ const name = getActivePolicyName() ?? "";
25387
25396
  const fontDecls = graph.declarationsByProperty.get("font-size");
25388
25397
  if (fontDecls) {
25389
25398
  for (let i = 0; i < fontDecls.length; i++) {
@@ -36859,7 +36868,7 @@ function resolveRuleLayerOrder(rule, css) {
36859
36868
  if (!name) return 0;
36860
36869
  return css.layerOrder.get(name) ?? 0;
36861
36870
  }
36862
- function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
36871
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
36863
36872
  const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
36864
36873
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
36865
36874
  const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
@@ -36870,11 +36879,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36870
36879
  let factByProperty = null;
36871
36880
  if (edges !== void 0 && edges.length > 0) {
36872
36881
  const byProperty = /* @__PURE__ */ new Map();
36882
+ let conditionalAttributeDispatch = null;
36873
36883
  for (let j = 0; j < edges.length; j++) {
36874
36884
  const currentEdge = edges[j];
36875
36885
  if (!currentEdge) continue;
36876
36886
  const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
36877
36887
  if (!declarations) continue;
36888
+ let conditionalAttributeName = null;
36889
+ if (currentEdge.conditionalMatch) {
36890
+ conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
36891
+ }
36878
36892
  for (let k = 0; k < declarations.length; k++) {
36879
36893
  const declaration = declarations[k];
36880
36894
  if (!declaration) continue;
@@ -36893,6 +36907,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36893
36907
  }
36894
36908
  if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
36895
36909
  bucket.conditional.add(expandedEntry.value);
36910
+ if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
36911
+ if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
36912
+ let dispatchMap = conditionalAttributeDispatch.get(property);
36913
+ if (!dispatchMap) {
36914
+ dispatchMap = /* @__PURE__ */ new Map();
36915
+ conditionalAttributeDispatch.set(property, dispatchMap);
36916
+ }
36917
+ dispatchMap.set(expandedEntry.value, conditionalAttributeName);
36918
+ }
36896
36919
  continue;
36897
36920
  }
36898
36921
  bucket.unconditional.add(expandedEntry.value);
@@ -36917,6 +36940,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36917
36940
  }
36918
36941
  }
36919
36942
  }
36943
+ if (hasDelta && conditionalAttributeDispatch !== null) {
36944
+ const dispatchMap = conditionalAttributeDispatch.get(property);
36945
+ if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
36946
+ let singleAttribute = null;
36947
+ let allSameAttribute = true;
36948
+ for (const attrName of dispatchMap.values()) {
36949
+ if (singleAttribute === null) {
36950
+ singleAttribute = attrName;
36951
+ } else if (singleAttribute !== attrName) {
36952
+ allSameAttribute = false;
36953
+ break;
36954
+ }
36955
+ }
36956
+ if (allSameAttribute && singleAttribute !== null) {
36957
+ hasDelta = false;
36958
+ }
36959
+ }
36960
+ }
36920
36961
  const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
36921
36962
  facts.set(property, {
36922
36963
  hasConditional,
@@ -37002,6 +37043,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
37002
37043
  }
37003
37044
  return out;
37004
37045
  }
37046
+ function identifyConditionalAttribute(selectorId, node, selectorsById) {
37047
+ const selector = selectorsById.get(selectorId);
37048
+ if (!selector) return null;
37049
+ const constraints = selector.anchor.attributes;
37050
+ let dynamicAttributeName = null;
37051
+ for (let i = 0; i < constraints.length; i++) {
37052
+ const constraint = constraints[i];
37053
+ if (!constraint) continue;
37054
+ if (constraint.operator !== "equals") continue;
37055
+ if (constraint.value === null) continue;
37056
+ const elementValue = node.attributes.get(constraint.name);
37057
+ if (elementValue !== null) continue;
37058
+ if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
37059
+ return null;
37060
+ }
37061
+ dynamicAttributeName = constraint.name;
37062
+ }
37063
+ return dynamicAttributeName;
37064
+ }
37005
37065
  function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
37006
37066
  if (property !== "overflow" && property !== "overflow-y") {
37007
37067
  return {
@@ -37564,7 +37624,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37564
37624
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
37565
37625
  elements,
37566
37626
  appliesByNode,
37567
- monitoredDeclarationsBySelectorId
37627
+ monitoredDeclarationsBySelectorId,
37628
+ selectorsById
37568
37629
  );
37569
37630
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
37570
37631
  conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
@@ -39516,7 +39577,8 @@ var jsxStylePolicy = defineCrossRule({
39516
39577
  check(context, emit) {
39517
39578
  const { solids } = context;
39518
39579
  const policy = getActivePolicy();
39519
- const name = getActivePolicyName();
39580
+ if (policy === null) return;
39581
+ const name = getActivePolicyName() ?? "";
39520
39582
  forEachStylePropertyAcross(solids, (solid, p) => {
39521
39583
  if (!ts133.isPropertyAssignment(p)) return;
39522
39584
  const key = objectKeyName(p.name);
@@ -41222,4 +41284,4 @@ export {
41222
41284
  rules3,
41223
41285
  runCrossFileRules
41224
41286
  };
41225
- //# sourceMappingURL=chunk-HIADOXXV.js.map
41287
+ //# sourceMappingURL=chunk-BK7TC7DN.js.map