@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.
@@ -28997,11 +28997,12 @@ var POLICIES = {
28997
28997
  "dense-ui": DENSE_UI,
28998
28998
  "large-text": LARGE_TEXT
28999
28999
  };
29000
- var activePolicyName = "wcag-aa";
29000
+ var activePolicyName = null;
29001
29001
  function getActivePolicyName() {
29002
29002
  return activePolicyName;
29003
29003
  }
29004
29004
  function getActivePolicy() {
29005
+ if (activePolicyName === null) return null;
29005
29006
  return POLICIES[activePolicyName];
29006
29007
  }
29007
29008
 
@@ -29320,7 +29321,8 @@ var cssPolicyContrast = defineCSSRule({
29320
29321
  options: {},
29321
29322
  check(graph, emit) {
29322
29323
  const policy = getActivePolicy();
29323
- const name = getActivePolicyName();
29324
+ if (policy === null) return;
29325
+ const name = getActivePolicyName() ?? "";
29324
29326
  const colorDecls = graph.declarationsByProperty.get("color");
29325
29327
  if (!colorDecls) return;
29326
29328
  const candidates = /* @__PURE__ */ new Set();
@@ -29397,7 +29399,8 @@ var cssPolicySpacing = defineCSSRule({
29397
29399
  options: {},
29398
29400
  check(graph, emit) {
29399
29401
  const policy = getActivePolicy();
29400
- const name = getActivePolicyName();
29402
+ if (policy === null) return;
29403
+ const name = getActivePolicyName() ?? "";
29401
29404
  const letterDecls = graph.declarationsByProperty.get("letter-spacing");
29402
29405
  if (letterDecls) {
29403
29406
  for (let i = 0; i < letterDecls.length; i++) {
@@ -29506,7 +29509,8 @@ var cssPolicyTouchTarget = defineCSSRule({
29506
29509
  options: {},
29507
29510
  check(graph, emit) {
29508
29511
  const policy = getActivePolicy();
29509
- const name = getActivePolicyName();
29512
+ if (policy === null) return;
29513
+ const name = getActivePolicyName() ?? "";
29510
29514
  const decls = graph.declarationsForProperties(
29511
29515
  "height",
29512
29516
  "min-height",
@@ -29665,7 +29669,8 @@ var cssPolicyTypography = defineCSSRule({
29665
29669
  options: {},
29666
29670
  check(graph, emit) {
29667
29671
  const policy = getActivePolicy();
29668
- const name = getActivePolicyName();
29672
+ if (policy === null) return;
29673
+ const name = getActivePolicyName() ?? "";
29669
29674
  const fontDecls = graph.declarationsByProperty.get("font-size");
29670
29675
  if (fontDecls) {
29671
29676
  for (let i = 0; i < fontDecls.length; i++) {
@@ -36678,7 +36683,7 @@ function resolveRuleLayerOrder(rule, css) {
36678
36683
  if (!name) return 0;
36679
36684
  return css.layerOrder.get(name) ?? 0;
36680
36685
  }
36681
- function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
36686
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
36682
36687
  const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
36683
36688
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
36684
36689
  const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
@@ -36689,11 +36694,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36689
36694
  let factByProperty = null;
36690
36695
  if (edges !== void 0 && edges.length > 0) {
36691
36696
  const byProperty = /* @__PURE__ */ new Map();
36697
+ let conditionalAttributeDispatch = null;
36692
36698
  for (let j = 0; j < edges.length; j++) {
36693
36699
  const currentEdge = edges[j];
36694
36700
  if (!currentEdge) continue;
36695
36701
  const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
36696
36702
  if (!declarations) continue;
36703
+ let conditionalAttributeName = null;
36704
+ if (currentEdge.conditionalMatch) {
36705
+ conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
36706
+ }
36697
36707
  for (let k = 0; k < declarations.length; k++) {
36698
36708
  const declaration = declarations[k];
36699
36709
  if (!declaration) continue;
@@ -36712,6 +36722,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36712
36722
  }
36713
36723
  if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
36714
36724
  bucket.conditional.add(expandedEntry.value);
36725
+ if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
36726
+ if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
36727
+ let dispatchMap = conditionalAttributeDispatch.get(property);
36728
+ if (!dispatchMap) {
36729
+ dispatchMap = /* @__PURE__ */ new Map();
36730
+ conditionalAttributeDispatch.set(property, dispatchMap);
36731
+ }
36732
+ dispatchMap.set(expandedEntry.value, conditionalAttributeName);
36733
+ }
36715
36734
  continue;
36716
36735
  }
36717
36736
  bucket.unconditional.add(expandedEntry.value);
@@ -36736,6 +36755,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36736
36755
  }
36737
36756
  }
36738
36757
  }
36758
+ if (hasDelta && conditionalAttributeDispatch !== null) {
36759
+ const dispatchMap = conditionalAttributeDispatch.get(property);
36760
+ if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
36761
+ let singleAttribute = null;
36762
+ let allSameAttribute = true;
36763
+ for (const attrName of dispatchMap.values()) {
36764
+ if (singleAttribute === null) {
36765
+ singleAttribute = attrName;
36766
+ } else if (singleAttribute !== attrName) {
36767
+ allSameAttribute = false;
36768
+ break;
36769
+ }
36770
+ }
36771
+ if (allSameAttribute && singleAttribute !== null) {
36772
+ hasDelta = false;
36773
+ }
36774
+ }
36775
+ }
36739
36776
  const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
36740
36777
  facts.set(property, {
36741
36778
  hasConditional,
@@ -36821,6 +36858,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
36821
36858
  }
36822
36859
  return out;
36823
36860
  }
36861
+ function identifyConditionalAttribute(selectorId, node, selectorsById) {
36862
+ const selector = selectorsById.get(selectorId);
36863
+ if (!selector) return null;
36864
+ const constraints = selector.anchor.attributes;
36865
+ let dynamicAttributeName = null;
36866
+ for (let i = 0; i < constraints.length; i++) {
36867
+ const constraint = constraints[i];
36868
+ if (!constraint) continue;
36869
+ if (constraint.operator !== "equals") continue;
36870
+ if (constraint.value === null) continue;
36871
+ const elementValue = node.attributes.get(constraint.name);
36872
+ if (elementValue !== null) continue;
36873
+ if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
36874
+ return null;
36875
+ }
36876
+ dynamicAttributeName = constraint.name;
36877
+ }
36878
+ return dynamicAttributeName;
36879
+ }
36824
36880
  function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
36825
36881
  if (property !== "overflow" && property !== "overflow-y") {
36826
36882
  return {
@@ -37383,7 +37439,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37383
37439
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
37384
37440
  elements,
37385
37441
  appliesByNode,
37386
- monitoredDeclarationsBySelectorId
37442
+ monitoredDeclarationsBySelectorId,
37443
+ selectorsById
37387
37444
  );
37388
37445
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
37389
37446
  conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
@@ -39291,7 +39348,8 @@ var jsxStylePolicy = defineCrossRule({
39291
39348
  check(context, emit) {
39292
39349
  const { solids } = context;
39293
39350
  const policy = getActivePolicy();
39294
- const name = getActivePolicyName();
39351
+ if (policy === null) return;
39352
+ const name = getActivePolicyName() ?? "";
39295
39353
  forEachStylePropertyAcross(solids, (solid, p) => {
39296
39354
  if (!import_typescript135.default.isPropertyAssignment(p)) return;
39297
39355
  const key = objectKeyName(p.name);