@drskillissue/ganko 0.2.5 → 0.2.6

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.
@@ -36859,7 +36859,7 @@ function resolveRuleLayerOrder(rule, css) {
36859
36859
  if (!name) return 0;
36860
36860
  return css.layerOrder.get(name) ?? 0;
36861
36861
  }
36862
- function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
36862
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
36863
36863
  const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
36864
36864
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
36865
36865
  const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
@@ -36870,11 +36870,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36870
36870
  let factByProperty = null;
36871
36871
  if (edges !== void 0 && edges.length > 0) {
36872
36872
  const byProperty = /* @__PURE__ */ new Map();
36873
+ let conditionalAttributeDispatch = null;
36873
36874
  for (let j = 0; j < edges.length; j++) {
36874
36875
  const currentEdge = edges[j];
36875
36876
  if (!currentEdge) continue;
36876
36877
  const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
36877
36878
  if (!declarations) continue;
36879
+ let conditionalAttributeName = null;
36880
+ if (currentEdge.conditionalMatch) {
36881
+ conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
36882
+ }
36878
36883
  for (let k = 0; k < declarations.length; k++) {
36879
36884
  const declaration = declarations[k];
36880
36885
  if (!declaration) continue;
@@ -36893,6 +36898,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36893
36898
  }
36894
36899
  if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
36895
36900
  bucket.conditional.add(expandedEntry.value);
36901
+ if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
36902
+ if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
36903
+ let dispatchMap = conditionalAttributeDispatch.get(property);
36904
+ if (!dispatchMap) {
36905
+ dispatchMap = /* @__PURE__ */ new Map();
36906
+ conditionalAttributeDispatch.set(property, dispatchMap);
36907
+ }
36908
+ dispatchMap.set(expandedEntry.value, conditionalAttributeName);
36909
+ }
36896
36910
  continue;
36897
36911
  }
36898
36912
  bucket.unconditional.add(expandedEntry.value);
@@ -36917,6 +36931,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36917
36931
  }
36918
36932
  }
36919
36933
  }
36934
+ if (hasDelta && conditionalAttributeDispatch !== null) {
36935
+ const dispatchMap = conditionalAttributeDispatch.get(property);
36936
+ if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
36937
+ let singleAttribute = null;
36938
+ let allSameAttribute = true;
36939
+ for (const attrName of dispatchMap.values()) {
36940
+ if (singleAttribute === null) {
36941
+ singleAttribute = attrName;
36942
+ } else if (singleAttribute !== attrName) {
36943
+ allSameAttribute = false;
36944
+ break;
36945
+ }
36946
+ }
36947
+ if (allSameAttribute && singleAttribute !== null) {
36948
+ hasDelta = false;
36949
+ }
36950
+ }
36951
+ }
36920
36952
  const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
36921
36953
  facts.set(property, {
36922
36954
  hasConditional,
@@ -37002,6 +37034,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
37002
37034
  }
37003
37035
  return out;
37004
37036
  }
37037
+ function identifyConditionalAttribute(selectorId, node, selectorsById) {
37038
+ const selector = selectorsById.get(selectorId);
37039
+ if (!selector) return null;
37040
+ const constraints = selector.anchor.attributes;
37041
+ let dynamicAttributeName = null;
37042
+ for (let i = 0; i < constraints.length; i++) {
37043
+ const constraint = constraints[i];
37044
+ if (!constraint) continue;
37045
+ if (constraint.operator !== "equals") continue;
37046
+ if (constraint.value === null) continue;
37047
+ const elementValue = node.attributes.get(constraint.name);
37048
+ if (elementValue !== null) continue;
37049
+ if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
37050
+ return null;
37051
+ }
37052
+ dynamicAttributeName = constraint.name;
37053
+ }
37054
+ return dynamicAttributeName;
37055
+ }
37005
37056
  function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
37006
37057
  if (property !== "overflow" && property !== "overflow-y") {
37007
37058
  return {
@@ -37564,7 +37615,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37564
37615
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
37565
37616
  elements,
37566
37617
  appliesByNode,
37567
- monitoredDeclarationsBySelectorId
37618
+ monitoredDeclarationsBySelectorId,
37619
+ selectorsById
37568
37620
  );
37569
37621
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
37570
37622
  conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
@@ -41222,4 +41274,4 @@ export {
41222
41274
  rules3,
41223
41275
  runCrossFileRules
41224
41276
  };
41225
- //# sourceMappingURL=chunk-HIADOXXV.js.map
41277
+ //# sourceMappingURL=chunk-FTIRRRQY.js.map