@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.
@@ -36678,7 +36678,7 @@ function resolveRuleLayerOrder(rule, css) {
36678
36678
  if (!name) return 0;
36679
36679
  return css.layerOrder.get(name) ?? 0;
36680
36680
  }
36681
- function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
36681
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
36682
36682
  const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
36683
36683
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
36684
36684
  const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
@@ -36689,11 +36689,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36689
36689
  let factByProperty = null;
36690
36690
  if (edges !== void 0 && edges.length > 0) {
36691
36691
  const byProperty = /* @__PURE__ */ new Map();
36692
+ let conditionalAttributeDispatch = null;
36692
36693
  for (let j = 0; j < edges.length; j++) {
36693
36694
  const currentEdge = edges[j];
36694
36695
  if (!currentEdge) continue;
36695
36696
  const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
36696
36697
  if (!declarations) continue;
36698
+ let conditionalAttributeName = null;
36699
+ if (currentEdge.conditionalMatch) {
36700
+ conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
36701
+ }
36697
36702
  for (let k = 0; k < declarations.length; k++) {
36698
36703
  const declaration = declarations[k];
36699
36704
  if (!declaration) continue;
@@ -36712,6 +36717,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36712
36717
  }
36713
36718
  if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
36714
36719
  bucket.conditional.add(expandedEntry.value);
36720
+ if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
36721
+ if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
36722
+ let dispatchMap = conditionalAttributeDispatch.get(property);
36723
+ if (!dispatchMap) {
36724
+ dispatchMap = /* @__PURE__ */ new Map();
36725
+ conditionalAttributeDispatch.set(property, dispatchMap);
36726
+ }
36727
+ dispatchMap.set(expandedEntry.value, conditionalAttributeName);
36728
+ }
36715
36729
  continue;
36716
36730
  }
36717
36731
  bucket.unconditional.add(expandedEntry.value);
@@ -36736,6 +36750,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36736
36750
  }
36737
36751
  }
36738
36752
  }
36753
+ if (hasDelta && conditionalAttributeDispatch !== null) {
36754
+ const dispatchMap = conditionalAttributeDispatch.get(property);
36755
+ if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
36756
+ let singleAttribute = null;
36757
+ let allSameAttribute = true;
36758
+ for (const attrName of dispatchMap.values()) {
36759
+ if (singleAttribute === null) {
36760
+ singleAttribute = attrName;
36761
+ } else if (singleAttribute !== attrName) {
36762
+ allSameAttribute = false;
36763
+ break;
36764
+ }
36765
+ }
36766
+ if (allSameAttribute && singleAttribute !== null) {
36767
+ hasDelta = false;
36768
+ }
36769
+ }
36770
+ }
36739
36771
  const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
36740
36772
  facts.set(property, {
36741
36773
  hasConditional,
@@ -36821,6 +36853,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
36821
36853
  }
36822
36854
  return out;
36823
36855
  }
36856
+ function identifyConditionalAttribute(selectorId, node, selectorsById) {
36857
+ const selector = selectorsById.get(selectorId);
36858
+ if (!selector) return null;
36859
+ const constraints = selector.anchor.attributes;
36860
+ let dynamicAttributeName = null;
36861
+ for (let i = 0; i < constraints.length; i++) {
36862
+ const constraint = constraints[i];
36863
+ if (!constraint) continue;
36864
+ if (constraint.operator !== "equals") continue;
36865
+ if (constraint.value === null) continue;
36866
+ const elementValue = node.attributes.get(constraint.name);
36867
+ if (elementValue !== null) continue;
36868
+ if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
36869
+ return null;
36870
+ }
36871
+ dynamicAttributeName = constraint.name;
36872
+ }
36873
+ return dynamicAttributeName;
36874
+ }
36824
36875
  function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
36825
36876
  if (property !== "overflow" && property !== "overflow-y") {
36826
36877
  return {
@@ -37383,7 +37434,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37383
37434
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
37384
37435
  elements,
37385
37436
  appliesByNode,
37386
- monitoredDeclarationsBySelectorId
37437
+ monitoredDeclarationsBySelectorId,
37438
+ selectorsById
37387
37439
  );
37388
37440
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
37389
37441
  conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,