@drskillissue/ganko 0.2.5 → 0.2.7

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.
@@ -67,9 +67,29 @@ function canonicalPath(path) {
67
67
  return canonical;
68
68
  }
69
69
  var LOG_LEVELS = ["trace", "debug", "info", "warning", "error", "critical", "off"];
70
+ var Level = {
71
+ Trace: 0,
72
+ Debug: 1,
73
+ Info: 2,
74
+ Warning: 3,
75
+ Error: 4,
76
+ Critical: 5,
77
+ Off: 6
78
+ };
79
+ var LOG_LEVEL_ORDER = {
80
+ trace: Level.Trace,
81
+ debug: Level.Debug,
82
+ info: Level.Info,
83
+ warning: Level.Warning,
84
+ error: Level.Error,
85
+ critical: Level.Critical,
86
+ off: Level.Off
87
+ };
70
88
  var noopLogger = {
71
- enabled: false,
72
89
  level: "off",
90
+ isLevelEnabled() {
91
+ return false;
92
+ },
73
93
  trace() {
74
94
  },
75
95
  debug() {
@@ -4893,6 +4913,9 @@ function typeIncludesString(graph, node) {
4893
4913
  function typeIsArray(graph, node) {
4894
4914
  return graph.typeResolver.isArrayType(node);
4895
4915
  }
4916
+ function typeIsStrictArray(graph, node) {
4917
+ return graph.typeResolver.isStrictArrayType(node);
4918
+ }
4896
4919
  function getArrayElementKind(graph, node) {
4897
4920
  return graph.typeResolver.getArrayElementKind(node);
4898
4921
  }
@@ -15167,6 +15190,7 @@ var preferSetLookupInLoop = defineSolidRule({
15167
15190
  options: options77,
15168
15191
  check(graph, emit) {
15169
15192
  const reported = /* @__PURE__ */ new Set();
15193
+ const graphHasTypes = hasTypeInfo(graph);
15170
15194
  for (const method of LINEAR_SEARCH_METHODS) {
15171
15195
  const calls = getCallsByMethodName(graph, method);
15172
15196
  for (let i = 0, len = calls.length; i < len; i++) {
@@ -15184,6 +15208,7 @@ var preferSetLookupInLoop = defineSolidRule({
15184
15208
  const loop = getEnclosingLoop(call.node);
15185
15209
  if (!loop) continue;
15186
15210
  if (!isDeclaredOutsideLoop2(loop, variable)) continue;
15211
+ if (graphHasTypes && !typeIsStrictArray(graph, callee.expression)) continue;
15187
15212
  if (isStringLikeReceiver(graph, callee.expression, variable)) continue;
15188
15213
  const key = `${loop.pos}:var:${variable.id}`;
15189
15214
  if (reported.has(key)) continue;
@@ -18271,6 +18296,35 @@ var TypeResolver = class {
18271
18296
  return false;
18272
18297
  }
18273
18298
  }
18299
+ /**
18300
+ * Strict array check: only matches Array<T>, T[], ReadonlyArray<T>, and tuples.
18301
+ * Does NOT match typed arrays (Uint8Array, Buffer, etc.) or other types with
18302
+ * a numeric index signature.
18303
+ */
18304
+ isStrictArrayType(node) {
18305
+ try {
18306
+ const tsType = this.checker.getTypeAtLocation(node);
18307
+ return this.checkIsStrictArrayType(tsType);
18308
+ } catch {
18309
+ return false;
18310
+ }
18311
+ }
18312
+ checkIsStrictArrayType(tsType) {
18313
+ if (tsType.flags & 524288) {
18314
+ const objFlags = getObjectFlags(tsType);
18315
+ if (objFlags & 8) return true;
18316
+ if (objFlags & 4) {
18317
+ const name = tsType.getSymbol()?.getName();
18318
+ if (name === "Array" || name === "ReadonlyArray") return true;
18319
+ }
18320
+ }
18321
+ if (tsType.isUnion()) {
18322
+ for (const t of tsType.types) {
18323
+ if (this.checkIsStrictArrayType(t)) return true;
18324
+ }
18325
+ }
18326
+ return false;
18327
+ }
18274
18328
  checkIsArrayType(tsType) {
18275
18329
  if (tsType.flags & 524288) {
18276
18330
  const objFlags = getObjectFlags(tsType);
@@ -18322,7 +18376,7 @@ var TypeResolver = class {
18322
18376
  if (exprTsType.flags & ts101.TypeFlags.Any) return false;
18323
18377
  if (targetTsType.flags & ts101.TypeFlags.Any) return false;
18324
18378
  const result = this.checker.isTypeAssignableTo(exprTsType, targetTsType);
18325
- if (this.logger.enabled) {
18379
+ if (this.logger.isLevelEnabled(Level.Debug)) {
18326
18380
  const exprStr = this.checker.typeToString(exprTsType);
18327
18381
  const targetStr = this.checker.typeToString(targetTsType);
18328
18382
  this.logger.debug(`isUnnecessaryCast: expr="${exprStr.slice(0, 120)}" target="${targetStr.slice(0, 120)}" assignable=${result} exprFlags=${exprTsType.flags} targetFlags=${targetTsType.flags}`);
@@ -22739,8 +22793,12 @@ var POLICIES = {
22739
22793
  "dense-ui": DENSE_UI,
22740
22794
  "large-text": LARGE_TEXT
22741
22795
  };
22742
- var activePolicyName = "wcag-aa";
22796
+ var activePolicyName = null;
22743
22797
  function setActivePolicy(name) {
22798
+ if (name === null) {
22799
+ activePolicyName = null;
22800
+ return;
22801
+ }
22744
22802
  const match = ACCESSIBILITY_POLICIES.find((n) => n === name);
22745
22803
  if (match) {
22746
22804
  activePolicyName = match;
@@ -22750,6 +22808,7 @@ function getActivePolicyName() {
22750
22808
  return activePolicyName;
22751
22809
  }
22752
22810
  function getActivePolicy() {
22811
+ if (activePolicyName === null) return null;
22753
22812
  return POLICIES[activePolicyName];
22754
22813
  }
22755
22814
 
@@ -25038,7 +25097,8 @@ var cssPolicyContrast = defineCSSRule({
25038
25097
  options: {},
25039
25098
  check(graph, emit) {
25040
25099
  const policy = getActivePolicy();
25041
- const name = getActivePolicyName();
25100
+ if (policy === null) return;
25101
+ const name = getActivePolicyName() ?? "";
25042
25102
  const colorDecls = graph.declarationsByProperty.get("color");
25043
25103
  if (!colorDecls) return;
25044
25104
  const candidates = /* @__PURE__ */ new Set();
@@ -25115,7 +25175,8 @@ var cssPolicySpacing = defineCSSRule({
25115
25175
  options: {},
25116
25176
  check(graph, emit) {
25117
25177
  const policy = getActivePolicy();
25118
- const name = getActivePolicyName();
25178
+ if (policy === null) return;
25179
+ const name = getActivePolicyName() ?? "";
25119
25180
  const letterDecls = graph.declarationsByProperty.get("letter-spacing");
25120
25181
  if (letterDecls) {
25121
25182
  for (let i = 0; i < letterDecls.length; i++) {
@@ -25224,7 +25285,8 @@ var cssPolicyTouchTarget = defineCSSRule({
25224
25285
  options: {},
25225
25286
  check(graph, emit) {
25226
25287
  const policy = getActivePolicy();
25227
- const name = getActivePolicyName();
25288
+ if (policy === null) return;
25289
+ const name = getActivePolicyName() ?? "";
25228
25290
  const decls = graph.declarationsForProperties(
25229
25291
  "height",
25230
25292
  "min-height",
@@ -25383,7 +25445,8 @@ var cssPolicyTypography = defineCSSRule({
25383
25445
  options: {},
25384
25446
  check(graph, emit) {
25385
25447
  const policy = getActivePolicy();
25386
- const name = getActivePolicyName();
25448
+ if (policy === null) return;
25449
+ const name = getActivePolicyName() ?? "";
25387
25450
  const fontDecls = graph.declarationsByProperty.get("font-size");
25388
25451
  if (fontDecls) {
25389
25452
  for (let i = 0; i < fontDecls.length; i++) {
@@ -31192,7 +31255,7 @@ function publishLayoutPerfStatsForTest(stats) {
31192
31255
  }
31193
31256
  function maybeLogLayoutPerf(stats, log) {
31194
31257
  if (process.env["SOLID_LINT_LAYOUT_PROFILE"] !== "1") return;
31195
- if (!log || !log.enabled) return;
31258
+ if (!log || !log.isLevelEnabled(Level.Debug)) return;
31196
31259
  const view = snapshotLayoutPerfStats(stats);
31197
31260
  log.debug(
31198
31261
  `[layout] elements=${view.elementsScanned} candidates=${view.selectorCandidatesChecked} compiledSelectors=${view.compiledSelectorCount} unsupportedSelectors=${view.selectorsRejectedUnsupported} conditionalSelectors=${view.selectorsGuardedConditional} ancestryChecks=${view.ancestryChecks} edges=${view.matchEdgesCreated} collected=${view.casesCollected} cases=${view.casesScored} rejectLowEvidence=${view.casesRejectedLowEvidence} rejectThreshold=${view.casesRejectedThreshold} rejectUndecidable=${view.casesRejectedUndecidable} rejectIdentifiability=${view.casesRejectedIdentifiability} undecidableInterval=${view.undecidableInterval} conditionalSignalRatio=${Math.round(view.conditionalSignalRatio * 1e3) / 1e3} conditionalSignals=${view.conditionalSignals} totalSignals=${view.totalSignals} cohortUnimodalFalse=${view.cohortUnimodalFalse} factorCoverageMean=${Math.round(view.factorCoverageMean * 1e3) / 1e3} posteriorWidthP95=${Math.round(view.posteriorWidthP95 * 1e3) / 1e3} uncertaintyEscalations=${view.uncertaintyEscalations} snapshots=${view.signalSnapshotsBuilt} snapshotHits=${view.signalSnapshotCacheHits} measurementIndexHits=${view.measurementIndexHits} contexts=${view.contextsClassified} diagnostics=${view.diagnosticsEmitted} selectorIndexMs=${Math.round(view.selectorIndexMs * 100) / 100} selectorMatchMs=${Math.round(view.selectorMatchMs * 100) / 100} cascadeBuildMs=${Math.round(view.cascadeBuildMs * 100) / 100} caseBuildMs=${Math.round(view.caseBuildMs * 100) / 100} scoringMs=${Math.round(view.scoringMs * 100) / 100} elapsedMs=${Math.round(view.elapsedMs * 100) / 100}`
@@ -31240,17 +31303,17 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31240
31303
  if (cached !== void 0) return cached;
31241
31304
  const binding = resolveTagBinding(normalizedFile, tag);
31242
31305
  if (binding === null) {
31243
- if (logger.enabled) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
31306
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
31244
31307
  hostByTagCache.set(cacheKey, null);
31245
31308
  return null;
31246
31309
  }
31247
31310
  if (binding.kind === "component") {
31248
- if (logger.enabled) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.tagName}, attrs=[${[...binding.host.staticAttributes.keys()]}]`);
31311
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.descriptor.tagName}, attrs=[${[...binding.host.descriptor.staticAttributes.keys()]}]`);
31249
31312
  hostByTagCache.set(cacheKey, binding.host);
31250
31313
  return binding.host;
31251
31314
  }
31252
31315
  const host = binding.base ? binding.base.host : null;
31253
- if (logger.enabled) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.tagName ?? "null"}`);
31316
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.descriptor.tagName ?? "null"}`);
31254
31317
  hostByTagCache.set(cacheKey, host);
31255
31318
  return host;
31256
31319
  },
@@ -31263,26 +31326,26 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31263
31326
  }
31264
31327
  };
31265
31328
  function resolveComponentHostEntry(entry) {
31266
- if (entry.resolution === "resolved") return entry.descriptor;
31267
- if (logger.enabled) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
31329
+ if (entry.resolution === "resolved") {
31330
+ return { descriptor: entry.descriptor, hostElementRef: entry.hostElementRef };
31331
+ }
31332
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
31268
31333
  const innerBinding = resolveLocalIdentifierBinding(entry.filePath, entry.innerTag);
31269
- if (logger.enabled) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
31334
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
31270
31335
  const innerHost = extractHostFromBinding(innerBinding);
31271
- if (logger.enabled) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.tagName}, attrs=[${[...innerHost.staticAttributes.keys()]}]`}`);
31272
- let tagName = innerHost !== null ? innerHost.tagName : null;
31336
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.descriptor.tagName}, attrs=[${[...innerHost.descriptor.staticAttributes.keys()]}]`}`);
31337
+ let tagName = innerHost !== null ? innerHost.descriptor.tagName : null;
31273
31338
  if (tagName === null) {
31274
31339
  tagName = resolveTagNameFromPolymorphicProp(entry.staticAttributes);
31275
- if (logger.enabled) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
31340
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
31276
31341
  }
31277
- const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.staticAttributes) : entry.staticAttributes;
31278
- const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.staticClassTokens) : entry.staticClassTokens;
31279
- const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.forwardsChildren;
31280
- if (logger.enabled) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
31342
+ const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
31343
+ const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
31344
+ const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
31345
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
31281
31346
  return {
31282
- tagName,
31283
- staticAttributes,
31284
- staticClassTokens,
31285
- forwardsChildren
31347
+ descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
31348
+ hostElementRef: innerHost?.hostElementRef ?? null
31286
31349
  };
31287
31350
  }
31288
31351
  function extractHostFromBinding(binding) {
@@ -31323,10 +31386,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31323
31386
  if (hostEntry) {
31324
31387
  const resolved = resolveComponentHostEntry(hostEntry);
31325
31388
  if (resolved !== null) {
31326
- const binding = {
31327
- kind: "component",
31328
- host: resolved
31329
- };
31389
+ const binding = { kind: "component", host: resolved };
31330
31390
  localBindingCache.set(key, binding);
31331
31391
  resolvingLocal.delete(key);
31332
31392
  return binding;
@@ -31387,7 +31447,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31387
31447
  const baseExpression = toExpressionArgument(firstArg);
31388
31448
  if (baseExpression === null) return null;
31389
31449
  const baseBinding = resolveBindingFromExpression(filePath, baseExpression);
31390
- if (logger.enabled) logger.trace(`[component-host] Object.assign base: ${baseBinding === null ? "null" : baseBinding.kind}${baseBinding?.kind === "component" ? `, tagName=${baseBinding.host.tagName}` : ""}`);
31450
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign base: ${baseBinding === null ? "null" : baseBinding.kind}${baseBinding?.kind === "component" ? `, tagName=${baseBinding.host.descriptor.tagName}` : ""}`);
31391
31451
  let baseComponent = null;
31392
31452
  const members = /* @__PURE__ */ new Map();
31393
31453
  if (baseBinding && baseBinding.kind === "component") {
@@ -31413,7 +31473,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31413
31473
  if (!ts123.isObjectLiteralExpression(argument)) continue;
31414
31474
  appendObjectExpressionMembers(filePath, argument, members);
31415
31475
  }
31416
- if (logger.enabled) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.tagName}`}, members=[${[...members.keys()]}]`);
31476
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.descriptor.tagName}`}, members=[${[...members.keys()]}]`);
31417
31477
  if (baseComponent === null && members.size === 0) return null;
31418
31478
  return {
31419
31479
  kind: "namespace",
@@ -31455,7 +31515,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31455
31515
  }
31456
31516
  function resolveBindingFromImport(filePath, importBinding) {
31457
31517
  const resolvedModule = moduleResolver.resolveSolid(filePath, importBinding.source) ?? resolveAndIndexExternalModule(filePath, importBinding.source);
31458
- if (logger.enabled) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
31518
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
31459
31519
  if (resolvedModule === null) return null;
31460
31520
  const normalized = resolve4(resolvedModule);
31461
31521
  if (importBinding.kind === "namespace") {
@@ -31464,7 +31524,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31464
31524
  const exportName = importBinding.kind === "default" ? "default" : importBinding.importedName;
31465
31525
  if (exportName === null) return null;
31466
31526
  const result = resolveExportBinding(normalized, exportName);
31467
- if (logger.enabled) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
31527
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
31468
31528
  return result;
31469
31529
  }
31470
31530
  function resolveAndIndexExternalModule(importerFile, importSource) {
@@ -31658,6 +31718,7 @@ function collectComponentHosts(graph) {
31658
31718
  }
31659
31719
  function resolveComponentHostEntryForFunction(graph, fn) {
31660
31720
  let entry = null;
31721
+ let hostElementRefAgreed = true;
31661
31722
  const bodyEntry = resolveHostEntryFromFunctionBody(graph, fn);
31662
31723
  if (bodyEntry !== null) {
31663
31724
  entry = bodyEntry;
@@ -31673,9 +31734,17 @@ function resolveComponentHostEntryForFunction(graph, fn) {
31673
31734
  entry = returnEntry;
31674
31735
  continue;
31675
31736
  }
31676
- if (areComponentHostEntriesEqual(entry, returnEntry)) continue;
31737
+ if (areComponentHostEntriesEqual(entry, returnEntry)) {
31738
+ if (hostElementRefAgreed && entry.resolution === "resolved" && returnEntry.resolution === "resolved" && entry.hostElementRef !== returnEntry.hostElementRef) {
31739
+ hostElementRefAgreed = false;
31740
+ }
31741
+ continue;
31742
+ }
31677
31743
  return null;
31678
31744
  }
31745
+ if (!hostElementRefAgreed && entry !== null && entry.resolution === "resolved") {
31746
+ return { resolution: "resolved", descriptor: entry.descriptor, hostElementRef: null };
31747
+ }
31679
31748
  return entry;
31680
31749
  }
31681
31750
  function resolveHostEntryFromFunctionBody(graph, fn) {
@@ -31703,7 +31772,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
31703
31772
  staticAttributes: collectStaticAttributes(element),
31704
31773
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
31705
31774
  forwardsChildren: detectChildrenForwarding(element)
31706
- }
31775
+ },
31776
+ hostElementRef: { solid: graph, element }
31707
31777
  };
31708
31778
  }
31709
31779
  if (isContextProviderTag(element.tag)) {
@@ -32872,7 +32942,7 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
32872
32942
  ancestor = ancestor.parentElementNode;
32873
32943
  }
32874
32944
  if (fileRootElements !== null) {
32875
- if (logger.enabled) {
32945
+ if (logger.isLevelEnabled(Level.Trace)) {
32876
32946
  const compoundDesc = describeCompound(targetCompound);
32877
32947
  logger.trace(`[selector-match] fallback: node=${node.key} tag=${node.tagName} checking ${fileRootElements.length} roots for compound=${compoundDesc}`);
32878
32948
  }
@@ -32883,11 +32953,11 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
32883
32953
  if (root.solidFile !== node.solidFile) continue;
32884
32954
  perf.ancestryChecks++;
32885
32955
  const compoundResult = matchesCompound(root, targetCompound);
32886
- if (logger.enabled && compoundResult === "no-match") {
32956
+ if (logger.isLevelEnabled(Level.Trace) && compoundResult === "no-match") {
32887
32957
  logger.trace(`[selector-match] fallback MISS: root=${root.key} tag=${root.tagName} attrs=[${[...root.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}]`);
32888
32958
  }
32889
32959
  if (compoundResult !== "no-match") {
32890
- if (logger.enabled) {
32960
+ if (logger.isLevelEnabled(Level.Debug)) {
32891
32961
  const compoundDesc = describeCompound(targetCompound);
32892
32962
  logger.debug(`[selector-match] fallback HIT: node=${node.key} tag=${node.tagName} matched root=${root.key} tag=${root.tagName} compound=${compoundDesc} isFinal=${isFinal}`);
32893
32963
  }
@@ -34010,6 +34080,9 @@ function readBaselineOffsetFacts(graph, node) {
34010
34080
  function readElementRef(graph, node) {
34011
34081
  return readElementRefById(graph, node.solidFile, node.elementId);
34012
34082
  }
34083
+ function readHostElementRef(graph, node) {
34084
+ return graph.hostElementRefsByNode.get(node) ?? null;
34085
+ }
34013
34086
  function readElementRefById(graph, solidFile, elementId) {
34014
34087
  const refs = graph.elementRefsBySolidFileAndId.get(solidFile);
34015
34088
  if (!refs) return null;
@@ -36708,7 +36781,7 @@ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, app
36708
36781
  };
36709
36782
  applies.push(edge);
36710
36783
  ctx.perf.matchEdgesCreated++;
36711
- if (ctx.logger.enabled) {
36784
+ if (ctx.logger.isLevelEnabled(Level.Trace)) {
36712
36785
  ctx.logger.trace(
36713
36786
  `[cascade] edge node=${node.key} selector=${selector.id} match=${matchResult} conditional=${edge.conditionalMatch} selector-raw=${selector.raw.slice(0, 80)}`
36714
36787
  );
@@ -36859,7 +36932,7 @@ function resolveRuleLayerOrder(rule, css) {
36859
36932
  if (!name) return 0;
36860
36933
  return css.layerOrder.get(name) ?? 0;
36861
36934
  }
36862
- function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
36935
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
36863
36936
  const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
36864
36937
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
36865
36938
  const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
@@ -36870,11 +36943,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36870
36943
  let factByProperty = null;
36871
36944
  if (edges !== void 0 && edges.length > 0) {
36872
36945
  const byProperty = /* @__PURE__ */ new Map();
36946
+ let conditionalAttributeDispatch = null;
36873
36947
  for (let j = 0; j < edges.length; j++) {
36874
36948
  const currentEdge = edges[j];
36875
36949
  if (!currentEdge) continue;
36876
36950
  const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
36877
36951
  if (!declarations) continue;
36952
+ let conditionalAttributeName = null;
36953
+ if (currentEdge.conditionalMatch) {
36954
+ conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
36955
+ }
36878
36956
  for (let k = 0; k < declarations.length; k++) {
36879
36957
  const declaration = declarations[k];
36880
36958
  if (!declaration) continue;
@@ -36893,6 +36971,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36893
36971
  }
36894
36972
  if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
36895
36973
  bucket.conditional.add(expandedEntry.value);
36974
+ if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
36975
+ if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
36976
+ let dispatchMap = conditionalAttributeDispatch.get(property);
36977
+ if (!dispatchMap) {
36978
+ dispatchMap = /* @__PURE__ */ new Map();
36979
+ conditionalAttributeDispatch.set(property, dispatchMap);
36980
+ }
36981
+ dispatchMap.set(expandedEntry.value, conditionalAttributeName);
36982
+ }
36896
36983
  continue;
36897
36984
  }
36898
36985
  bucket.unconditional.add(expandedEntry.value);
@@ -36917,6 +37004,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
36917
37004
  }
36918
37005
  }
36919
37006
  }
37007
+ if (hasDelta && conditionalAttributeDispatch !== null) {
37008
+ const dispatchMap = conditionalAttributeDispatch.get(property);
37009
+ if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
37010
+ let singleAttribute = null;
37011
+ let allSameAttribute = true;
37012
+ for (const attrName of dispatchMap.values()) {
37013
+ if (singleAttribute === null) {
37014
+ singleAttribute = attrName;
37015
+ } else if (singleAttribute !== attrName) {
37016
+ allSameAttribute = false;
37017
+ break;
37018
+ }
37019
+ }
37020
+ if (allSameAttribute && singleAttribute !== null) {
37021
+ hasDelta = false;
37022
+ }
37023
+ }
37024
+ }
36920
37025
  const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
36921
37026
  facts.set(property, {
36922
37027
  hasConditional,
@@ -37002,6 +37107,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
37002
37107
  }
37003
37108
  return out;
37004
37109
  }
37110
+ function identifyConditionalAttribute(selectorId, node, selectorsById) {
37111
+ const selector = selectorsById.get(selectorId);
37112
+ if (!selector) return null;
37113
+ const constraints = selector.anchor.attributes;
37114
+ let dynamicAttributeName = null;
37115
+ for (let i = 0; i < constraints.length; i++) {
37116
+ const constraint = constraints[i];
37117
+ if (!constraint) continue;
37118
+ if (constraint.operator !== "equals") continue;
37119
+ if (constraint.value === null) continue;
37120
+ const elementValue = node.attributes.get(constraint.name);
37121
+ if (elementValue !== null) continue;
37122
+ if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
37123
+ return null;
37124
+ }
37125
+ dynamicAttributeName = constraint.name;
37126
+ }
37127
+ return dynamicAttributeName;
37128
+ }
37005
37129
  function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
37006
37130
  if (property !== "overflow" && property !== "overflow-y") {
37007
37131
  return {
@@ -37100,7 +37224,7 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
37100
37224
  if (!child) continue;
37101
37225
  if (child.kind === "expression") {
37102
37226
  if (isStructuralExpression(child.node)) {
37103
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
37227
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
37104
37228
  memo.set(element.id, 2 /* Unknown */);
37105
37229
  return 2 /* Unknown */;
37106
37230
  }
@@ -37122,11 +37246,11 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
37122
37246
  if (!child.isDomElement) {
37123
37247
  const childMeta = compositionMetaByElementId.get(child.id);
37124
37248
  if (childMeta !== void 0 && isControlTag(childMeta.tagName)) {
37125
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag}#${child.id} resolves to control tag=${childMeta.tagName}, skipping`);
37249
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag}#${child.id} resolves to control tag=${childMeta.tagName}, skipping`);
37126
37250
  continue;
37127
37251
  }
37128
37252
  if (childState !== 1 /* No */) {
37129
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag ?? child.id}#${child.id} has state=${childState} \u2192 childHasUnknown`);
37253
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag ?? child.id}#${child.id} has state=${childState} \u2192 childHasUnknown`);
37130
37254
  childHasUnknown = true;
37131
37255
  }
37132
37256
  continue;
@@ -37139,12 +37263,12 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
37139
37263
  if (childState === 3 /* DynamicText */) childHasDynamicText = true;
37140
37264
  }
37141
37265
  if (childHasUnknown) {
37142
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
37266
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
37143
37267
  memo.set(element.id, 2 /* Unknown */);
37144
37268
  return 2 /* Unknown */;
37145
37269
  }
37146
37270
  if (hasTextOnlyExpression || childHasDynamicText) {
37147
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
37271
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
37148
37272
  memo.set(element.id, 3 /* DynamicText */);
37149
37273
  return 3 /* DynamicText */;
37150
37274
  }
@@ -37166,15 +37290,16 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
37166
37290
  const meta = compositionMetaByElementId.get(element.id);
37167
37291
  if (!meta || !meta.participates) continue;
37168
37292
  const localClassTokens = selectorRequirements.needsClassTokens ? getStaticClassTokensForElementEntity(solid, element) : EMPTY_STRING_LIST3;
37169
- const classTokens = mergeClassTokens(localClassTokens, meta.hostDescriptor?.staticClassTokens);
37293
+ const classTokens = mergeClassTokens(localClassTokens, meta.resolvedHost?.descriptor.staticClassTokens);
37170
37294
  const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
37171
37295
  const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
37172
37296
  const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
37173
- const attributes = mergeAttributes(localAttributes, meta.hostDescriptor?.staticAttributes);
37297
+ const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
37174
37298
  const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
37175
37299
  const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
37176
37300
  const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
37177
37301
  const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId);
37302
+ const hostElementRef = meta.resolvedHost?.hostElementRef ?? null;
37178
37303
  out.push({
37179
37304
  element,
37180
37305
  key: toLayoutElementKey(solid.file, element.id),
@@ -37187,7 +37312,8 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
37187
37312
  selectorDispatchKeys,
37188
37313
  inlineStyleValues,
37189
37314
  textualContent,
37190
- parentElementId
37315
+ parentElementId,
37316
+ hostElementRef
37191
37317
  });
37192
37318
  }
37193
37319
  return out;
@@ -37197,7 +37323,7 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
37197
37323
  for (let i = 0; i < solid.jsxElements.length; i++) {
37198
37324
  const element = solid.jsxElements[i];
37199
37325
  if (!element) continue;
37200
- const hostDescriptor = resolveHostDescriptorForElement(
37326
+ const resolvedHost = resolveHostForElement(
37201
37327
  componentHostResolver,
37202
37328
  solid.file,
37203
37329
  element
@@ -37206,30 +37332,30 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
37206
37332
  componentHostResolver,
37207
37333
  solid.file,
37208
37334
  element,
37209
- hostDescriptor
37335
+ resolvedHost
37210
37336
  );
37211
37337
  const participates = element.tag !== null && !isTransparentPrimitive;
37212
- const tag = resolveEffectiveTag(element, hostDescriptor);
37338
+ const tag = resolveEffectiveTag(element, resolvedHost?.descriptor ?? null);
37213
37339
  const tagName = tag ? tag.toLowerCase() : null;
37214
37340
  out.set(element.id, {
37215
37341
  element,
37216
37342
  participates,
37217
37343
  tag,
37218
37344
  tagName,
37219
- hostDescriptor
37345
+ resolvedHost
37220
37346
  });
37221
37347
  }
37222
37348
  return out;
37223
37349
  }
37224
- function resolveHostDescriptorForElement(componentHostResolver, solidFile, element) {
37350
+ function resolveHostForElement(componentHostResolver, solidFile, element) {
37225
37351
  if (element.tag === null) return null;
37226
37352
  if (element.isDomElement) return null;
37227
37353
  return componentHostResolver.resolveHost(solidFile, element.tag);
37228
37354
  }
37229
- function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, hostDescriptor) {
37355
+ function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
37230
37356
  if (element.tag === null) return false;
37231
37357
  if (element.isDomElement) return false;
37232
- if (hostDescriptor !== null) return false;
37358
+ if (resolvedHost !== null) return false;
37233
37359
  return componentHostResolver.isTransparentPrimitive(solidFile, element.tag);
37234
37360
  }
37235
37361
  function resolveEffectiveTag(element, hostDescriptor) {
@@ -37347,6 +37473,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37347
37473
  const childrenByParentNodeMutable = /* @__PURE__ */ new Map();
37348
37474
  const elementBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
37349
37475
  const elementRefsBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
37476
+ const hostElementRefsByNodeMutable = /* @__PURE__ */ new Map();
37350
37477
  const appliesByElementNodeMutable = /* @__PURE__ */ new Map();
37351
37478
  const selectorsById = /* @__PURE__ */ new Map();
37352
37479
  const monitoredDeclarationsBySelectorId = /* @__PURE__ */ new Map();
@@ -37383,7 +37510,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37383
37510
  const moduleResolver = createLayoutModuleResolver(solids, css);
37384
37511
  const componentHostResolver = createLayoutComponentHostResolver(solids, moduleResolver, logger);
37385
37512
  const cssScopeBySolidFile = collectCSSScopeBySolidFile(solids, css, moduleResolver);
37386
- if (logger.enabled) {
37513
+ if (logger.isLevelEnabled(Level.Trace)) {
37387
37514
  for (const [solidFile, scopePaths] of cssScopeBySolidFile) {
37388
37515
  if (scopePaths.length > 0) {
37389
37516
  let names = "";
@@ -37478,6 +37605,9 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37478
37605
  isControl: isControlTag(record.tagName),
37479
37606
  isReplaced: isReplacedTag(record.tagName)
37480
37607
  };
37608
+ if (record.hostElementRef !== null) {
37609
+ hostElementRefsByNodeMutable.set(node, record.hostElementRef);
37610
+ }
37481
37611
  elements.push(node);
37482
37612
  elementById.set(record.element.id, node);
37483
37613
  nodeByElementId.set(record.element.id, node);
@@ -37499,7 +37629,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37499
37629
  }
37500
37630
  }
37501
37631
  }
37502
- if (logger.enabled) {
37632
+ if (logger.isLevelEnabled(Level.Debug)) {
37503
37633
  for (const [file, roots] of rootElementsByFile) {
37504
37634
  const descs = roots.map((r) => `${r.key}(tag=${r.tagName}, attrs=[${[...r.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}])`);
37505
37635
  logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
@@ -37542,7 +37672,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37542
37672
  appliesByNode.set(node, edges);
37543
37673
  }
37544
37674
  perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
37545
- if (logger.enabled) {
37675
+ if (logger.isLevelEnabled(Level.Trace)) {
37546
37676
  for (let i = 0; i < elements.length; i++) {
37547
37677
  const node = elements[i];
37548
37678
  if (!node) continue;
@@ -37564,7 +37694,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37564
37694
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
37565
37695
  elements,
37566
37696
  appliesByNode,
37567
- monitoredDeclarationsBySelectorId
37697
+ monitoredDeclarationsBySelectorId,
37698
+ selectorsById
37568
37699
  );
37569
37700
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
37570
37701
  conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
@@ -37597,6 +37728,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37597
37728
  childrenByParentNode: childrenByParentNodeMutable,
37598
37729
  elementBySolidFileAndId: elementBySolidFileAndIdMutable,
37599
37730
  elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
37731
+ hostElementRefsByNode: hostElementRefsByNodeMutable,
37600
37732
  appliesByNode,
37601
37733
  selectorCandidatesByNode,
37602
37734
  selectorsById,
@@ -37997,7 +38129,7 @@ function computeFlowParticipationFact(snapshot) {
37997
38129
  }
37998
38130
  function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf, logger) {
37999
38131
  const out = /* @__PURE__ */ new Map();
38000
- const trace = logger.enabled;
38132
+ const trace = logger.isLevelEnabled(Level.Trace);
38001
38133
  for (const [parent, children] of childrenByParentNode) {
38002
38134
  if (children.length < 2) continue;
38003
38135
  const snapshot = snapshotByElementNode.get(parent);
@@ -38867,7 +38999,7 @@ function runLayoutDetector(context, detector) {
38867
38999
  result.evidence.posteriorLower,
38868
39000
  result.evidence.posteriorUpper
38869
39001
  );
38870
- if (log.enabled) {
39002
+ if (log.isLevelEnabled(Level.Debug)) {
38871
39003
  log.debug(
38872
39004
  `[${detector.id}] accept case=${i} severity=${result.evidence.severity.toFixed(2)} confidence=${result.evidence.confidence.toFixed(2)} posterior=[${result.evidence.posteriorLower.toFixed(3)},${result.evidence.posteriorUpper.toFixed(3)}] evidenceMass=${result.evidence.evidenceMass.toFixed(3)} context=${result.evidence.contextKind} offset=${result.evidence.estimatedOffsetPx?.toFixed(2) ?? "null"} topFactors=[${result.evidence.topFactors.join(",")}] causes=[${result.evidence.causes.join("; ")}]`
38873
39005
  );
@@ -38876,7 +39008,7 @@ function runLayoutDetector(context, detector) {
38876
39008
  continue;
38877
39009
  }
38878
39010
  recordPolicyMetrics(context, result.evidenceMass, result.posteriorLower, result.posteriorUpper);
38879
- if (log.enabled) {
39011
+ if (log.isLevelEnabled(Level.Debug)) {
38880
39012
  log.debug(
38881
39013
  `[${detector.id}] reject case=${i} reason=${result.reason} detail=${result.detail ?? "none"} posterior=[${result.posteriorLower.toFixed(3)},${result.posteriorUpper.toFixed(3)}] evidenceMass=${result.evidenceMass.toFixed(3)}`
38882
39014
  );
@@ -39497,13 +39629,39 @@ var INLINE_TOUCH_TARGET_KEYS = /* @__PURE__ */ new Set([
39497
39629
  "height",
39498
39630
  "min-height",
39499
39631
  "width",
39500
- "min-width",
39501
- "padding-left",
39502
- "padding-right",
39503
- "padding-inline",
39504
- "padding-inline-start",
39505
- "padding-inline-end"
39632
+ "min-width"
39633
+ ]);
39634
+ var INTERACTIVE_HTML_TAGS = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "label", "summary"]);
39635
+ var INTERACTIVE_ARIA_ROLES = /* @__PURE__ */ new Set([
39636
+ "button",
39637
+ "link",
39638
+ "checkbox",
39639
+ "radio",
39640
+ "combobox",
39641
+ "listbox",
39642
+ "menuitem",
39643
+ "menuitemcheckbox",
39644
+ "menuitemradio",
39645
+ "option",
39646
+ "switch",
39647
+ "tab"
39506
39648
  ]);
39649
+ function isInteractiveElement(solid, element, hostElementRef) {
39650
+ if (element.tagName !== null && INTERACTIVE_HTML_TAGS.has(element.tagName)) return true;
39651
+ const roleAttr = getJSXAttributeEntity(solid, element, "role");
39652
+ if (roleAttr !== null && roleAttr.valueNode !== null) {
39653
+ const role = getStaticStringFromJSXValue(roleAttr.valueNode);
39654
+ if (role !== null && INTERACTIVE_ARIA_ROLES.has(role)) return true;
39655
+ }
39656
+ if (hostElementRef !== null && hostElementRef.element.tagName !== null) {
39657
+ if (INTERACTIVE_HTML_TAGS.has(hostElementRef.element.tagName)) return true;
39658
+ }
39659
+ return false;
39660
+ }
39661
+ function readNodeHostElementRef(layout, solid, element) {
39662
+ const node = layout.elementBySolidFileAndId.get(solid.file)?.get(element.id) ?? null;
39663
+ return node !== null ? readHostElementRef(layout, node) : null;
39664
+ }
39507
39665
  var jsxStylePolicy = defineCrossRule({
39508
39666
  id: "jsx-style-policy",
39509
39667
  severity: "warn",
@@ -39514,10 +39672,11 @@ var jsxStylePolicy = defineCrossRule({
39514
39672
  category: "css-jsx"
39515
39673
  },
39516
39674
  check(context, emit) {
39517
- const { solids } = context;
39675
+ const { solids, layout } = context;
39518
39676
  const policy = getActivePolicy();
39519
- const name = getActivePolicyName();
39520
- forEachStylePropertyAcross(solids, (solid, p) => {
39677
+ if (policy === null) return;
39678
+ const name = getActivePolicyName() ?? "";
39679
+ forEachStylePropertyAcross(solids, (solid, p, element) => {
39521
39680
  if (!ts133.isPropertyAssignment(p)) return;
39522
39681
  const key = objectKeyName(p.name);
39523
39682
  if (!key) return;
@@ -39565,6 +39724,8 @@ var jsxStylePolicy = defineCrossRule({
39565
39724
  return;
39566
39725
  }
39567
39726
  if (INLINE_TOUCH_TARGET_KEYS.has(normalizedKey)) {
39727
+ const hostRef = readNodeHostElementRef(layout, solid, element);
39728
+ if (!isInteractiveElement(solid, element, hostRef)) return;
39568
39729
  const strVal = getStaticStringValue(p.initializer);
39569
39730
  if (!strVal) return;
39570
39731
  const px = parsePxValue(strVal);
@@ -39643,7 +39804,7 @@ var siblingAlignmentDetector = {
39643
39804
  id: "sibling-alignment-outlier",
39644
39805
  collect: collectAlignmentCases,
39645
39806
  evaluate(input, context) {
39646
- if (context.logger.enabled) {
39807
+ if (context.logger.isLevelEnabled(Level.Trace)) {
39647
39808
  const ctx = input.context;
39648
39809
  context.logger.trace(
39649
39810
  `[sibling-alignment] evaluate subject=${input.subject.elementKey} tag=${input.subject.tag} parent=${ctx.parentElementKey} parentTag=${ctx.parentTag} context.kind=${ctx.kind} certainty=${ctx.certainty} display=${ctx.parentDisplay} alignItems=${ctx.parentAlignItems} crossAxisIsBlockAxis=${ctx.crossAxisIsBlockAxis} crossAxisCertainty=${ctx.crossAxisIsBlockAxisCertainty} baseline=${ctx.baselineRelevance}`
@@ -39692,7 +39853,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39692
39853
  const log = context.logger;
39693
39854
  const detections = runLayoutDetector(context, siblingAlignmentDetector);
39694
39855
  const uniqueDetections = dedupeDetectionsBySubject(detections);
39695
- if (log.enabled) {
39856
+ if (log.isLevelEnabled(Level.Debug)) {
39696
39857
  log.debug(
39697
39858
  `[sibling-alignment] raw=${detections.length} deduped=${uniqueDetections.length}`
39698
39859
  );
@@ -39706,7 +39867,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39706
39867
  const subjectId = detection.caseData.subject.elementId;
39707
39868
  const logPrefix = `[sibling-alignment] <${subjectTag}> in <${parentTag}> (${subjectFile}#${subjectId})`;
39708
39869
  if (detection.evidence.confidence < MIN_CONFIDENCE_THRESHOLD) {
39709
- if (log.enabled) {
39870
+ if (log.isLevelEnabled(Level.Debug)) {
39710
39871
  log.debug(
39711
39872
  `${logPrefix} SKIP: confidence=${detection.evidence.confidence.toFixed(2)} < threshold=${MIN_CONFIDENCE_THRESHOLD}`
39712
39873
  );
@@ -39715,7 +39876,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39715
39876
  }
39716
39877
  const estimatedOffset = detection.evidence.estimatedOffsetPx;
39717
39878
  if (estimatedOffset !== null && Math.abs(estimatedOffset) < MIN_OFFSET_PX_THRESHOLD && !hasNonOffsetPrimaryEvidence(detection.evidence.topFactors)) {
39718
- if (log.enabled) {
39879
+ if (log.isLevelEnabled(Level.Debug)) {
39719
39880
  log.debug(
39720
39881
  `${logPrefix} SKIP: offset=${estimatedOffset.toFixed(2)}px < ${MIN_OFFSET_PX_THRESHOLD}px (no non-offset primary evidence, topFactors=[${detection.evidence.topFactors.join(",")}])`
39721
39882
  );
@@ -39727,7 +39888,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39727
39888
  detection.caseData.cohort.parentElementKey,
39728
39889
  detection.caseData.subject.solidFile
39729
39890
  )) {
39730
- if (log.enabled) {
39891
+ if (log.isLevelEnabled(Level.Debug)) {
39731
39892
  log.debug(`${logPrefix} SKIP: out-of-flow ancestor`);
39732
39893
  }
39733
39894
  continue;
@@ -39738,7 +39899,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39738
39899
  detection.caseData.subject.elementId
39739
39900
  );
39740
39901
  if (!subjectRef) {
39741
- if (log.enabled) {
39902
+ if (log.isLevelEnabled(Level.Debug)) {
39742
39903
  log.debug(`${logPrefix} SKIP: no node ref`);
39743
39904
  }
39744
39905
  continue;
@@ -39754,7 +39915,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39754
39915
  const primaryFix = detection.evidence.primaryFix;
39755
39916
  const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
39756
39917
  const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
39757
- if (log.enabled) {
39918
+ if (log.isLevelEnabled(Level.Debug)) {
39758
39919
  log.debug(
39759
39920
  `${logPrefix} EMIT: severity=${severity} confidence=${confidence} offset=${offset?.toFixed(2) ?? "null"} posterior=[${detection.evidence.posteriorLower.toFixed(3)},${detection.evidence.posteriorUpper.toFixed(3)}] evidenceMass=${detection.evidence.evidenceMass.toFixed(3)} topFactors=[${detection.evidence.topFactors.join(",")}] causes=[${causes}]`
39760
39921
  );
@@ -40163,7 +40324,8 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
40163
40324
  const ref = readNodeRef(context.layout, node);
40164
40325
  if (!ref) continue;
40165
40326
  const reservedSpace = readReservedSpaceFact(context.layout, node);
40166
- if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace)) continue;
40327
+ const hostRef = readHostElementRef(context.layout, node);
40328
+ if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace, hostRef)) continue;
40167
40329
  emit(
40168
40330
  createDiagnostic(
40169
40331
  ref.solid.file,
@@ -40178,15 +40340,17 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
40178
40340
  }
40179
40341
  }
40180
40342
  });
40181
- function hasReservedSize(solid, attributes, element, reservedSpaceFact) {
40343
+ function hasReservedSize(solid, attributes, element, reservedSpaceFact, hostElementRef) {
40182
40344
  if (reservedSpaceFact.hasReservedSpace) return true;
40183
40345
  const attrWidth = parsePositiveLength(attributes.get("width"));
40184
40346
  const attrHeight = parsePositiveLength(attributes.get("height"));
40185
40347
  const jsxAttrWidth = readPositiveJsxAttribute(solid, element, "width");
40186
40348
  const jsxAttrHeight = readPositiveJsxAttribute(solid, element, "height");
40187
- if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight) return true;
40188
- const hasAnyWidth = attrWidth || jsxAttrWidth || reservedSpaceFact.hasUsableInlineDimension;
40189
- const hasAnyHeight = attrHeight || jsxAttrHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
40349
+ const hostJsxWidth = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "width") : false;
40350
+ const hostJsxHeight = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "height") : false;
40351
+ if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight || hostJsxWidth && hostJsxHeight) return true;
40352
+ const hasAnyWidth = attrWidth || jsxAttrWidth || hostJsxWidth || reservedSpaceFact.hasUsableInlineDimension;
40353
+ const hasAnyHeight = attrHeight || jsxAttrHeight || hostJsxHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
40190
40354
  if (reservedSpaceFact.hasUsableAspectRatio && (hasAnyWidth || hasAnyHeight)) return true;
40191
40355
  if (reservedSpaceFact.hasContainIntrinsicSize && (hasAnyWidth || hasAnyHeight)) return true;
40192
40356
  return false;
@@ -41202,6 +41366,7 @@ export {
41202
41366
  classifyFile,
41203
41367
  extensionsToGlobs,
41204
41368
  canonicalPath,
41369
+ Level,
41205
41370
  noopLogger,
41206
41371
  SolidGraph,
41207
41372
  runPhases,
@@ -41222,4 +41387,4 @@ export {
41222
41387
  rules3,
41223
41388
  runCrossFileRules
41224
41389
  };
41225
- //# sourceMappingURL=chunk-HIADOXXV.js.map
41390
+ //# sourceMappingURL=chunk-WY5MMHK2.js.map