@drskillissue/ganko 0.2.61 → 0.2.71

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.
package/dist/index.cjs CHANGED
@@ -151,9 +151,29 @@ function canonicalPath(path) {
151
151
  return canonical;
152
152
  }
153
153
  var LOG_LEVELS = ["trace", "debug", "info", "warning", "error", "critical", "off"];
154
+ var Level = {
155
+ Trace: 0,
156
+ Debug: 1,
157
+ Info: 2,
158
+ Warning: 3,
159
+ Error: 4,
160
+ Critical: 5,
161
+ Off: 6
162
+ };
163
+ var LOG_LEVEL_ORDER = {
164
+ trace: Level.Trace,
165
+ debug: Level.Debug,
166
+ info: Level.Info,
167
+ warning: Level.Warning,
168
+ error: Level.Error,
169
+ critical: Level.Critical,
170
+ off: Level.Off
171
+ };
154
172
  var noopLogger = {
155
- enabled: false,
156
173
  level: "off",
174
+ isLevelEnabled() {
175
+ return false;
176
+ },
157
177
  trace() {
158
178
  },
159
179
  debug() {
@@ -2790,7 +2810,7 @@ var GraphCache = class {
2790
2810
  const key = canonicalPath(path);
2791
2811
  const cached = this.solids.get(key);
2792
2812
  const hit = cached !== void 0 && cached.version === version;
2793
- if (this.log.enabled) this.log.debug(`hasSolidGraph: ${key} v=${version} cached=${cached?.version ?? "none"} hit=${hit} (${this.solids.size} total)`);
2813
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`hasSolidGraph: ${key} v=${version} cached=${cached?.version ?? "none"} hit=${hit} (${this.solids.size} total)`);
2794
2814
  return hit;
2795
2815
  }
2796
2816
  /**
@@ -2807,7 +2827,7 @@ var GraphCache = class {
2807
2827
  const key = canonicalPath(path);
2808
2828
  this.solids.set(key, { version, graph });
2809
2829
  this.solidGeneration++;
2810
- if (this.log.enabled) this.log.debug(`setSolidGraph: ${key} v=${version} (${this.solids.size} total) solidGen=${this.solidGeneration}`);
2830
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`setSolidGraph: ${key} v=${version} (${this.solids.size} total) solidGen=${this.solidGeneration}`);
2811
2831
  }
2812
2832
  /**
2813
2833
  * Get a cached SolidGraph without building on miss.
@@ -2823,10 +2843,10 @@ var GraphCache = class {
2823
2843
  const key = canonicalPath(path);
2824
2844
  const cached = this.solids.get(key);
2825
2845
  if (cached !== void 0 && cached.version === version) {
2826
- if (this.log.enabled) this.log.debug(`getCachedSolidGraph HIT: ${key} v=${version}`);
2846
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getCachedSolidGraph HIT: ${key} v=${version}`);
2827
2847
  return cached.graph;
2828
2848
  }
2829
- if (this.log.enabled) this.log.debug(`getCachedSolidGraph MISS: ${key} v=${version}`);
2849
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getCachedSolidGraph MISS: ${key} v=${version}`);
2830
2850
  return null;
2831
2851
  }
2832
2852
  /**
@@ -2843,15 +2863,15 @@ var GraphCache = class {
2843
2863
  const key = canonicalPath(path);
2844
2864
  const cached = this.solids.get(key);
2845
2865
  if (cached !== void 0 && cached.version === version) {
2846
- if (this.log.enabled) this.log.debug(`getSolidGraph HIT: ${key} v=${version}`);
2866
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getSolidGraph HIT: ${key} v=${version}`);
2847
2867
  return cached.graph;
2848
2868
  }
2849
- if (this.log.enabled) this.log.debug(`getSolidGraph MISS: ${key} v=${version} (was ${cached?.version ?? "uncached"})`);
2869
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getSolidGraph MISS: ${key} v=${version} (was ${cached?.version ?? "uncached"})`);
2850
2870
  const t0 = performance.now();
2851
2871
  const graph = build();
2852
2872
  this.solids.set(key, { version, graph });
2853
2873
  this.solidGeneration++;
2854
- if (this.log.enabled) this.log.debug(`getSolidGraph BUILT: ${key} v=${version} in ${performance.now() - t0}ms (${this.solids.size} total) solidGen=${this.solidGeneration}`);
2874
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getSolidGraph BUILT: ${key} v=${version} in ${performance.now() - t0}ms (${this.solids.size} total) solidGen=${this.solidGeneration}`);
2855
2875
  return graph;
2856
2876
  }
2857
2877
  /**
@@ -2865,14 +2885,14 @@ var GraphCache = class {
2865
2885
  */
2866
2886
  getCSSGraph(build) {
2867
2887
  if (this.css !== null && this.css.generation === this.cssGeneration) {
2868
- if (this.log.enabled) this.log.debug(`getCSSGraph HIT: gen=${this.cssGeneration}`);
2888
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getCSSGraph HIT: gen=${this.cssGeneration}`);
2869
2889
  return this.css.graph;
2870
2890
  }
2871
- if (this.log.enabled) this.log.debug(`getCSSGraph MISS: currentGen=${this.cssGeneration} cachedGen=${this.css?.generation ?? "none"}`);
2891
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getCSSGraph MISS: currentGen=${this.cssGeneration} cachedGen=${this.css?.generation ?? "none"}`);
2872
2892
  const t0 = performance.now();
2873
2893
  const graph = build();
2874
2894
  this.css = { generation: this.cssGeneration, graph };
2875
- if (this.log.enabled) this.log.debug(`getCSSGraph BUILT: gen=${this.cssGeneration} in ${performance.now() - t0}ms`);
2895
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getCSSGraph BUILT: gen=${this.cssGeneration} in ${performance.now() - t0}ms`);
2876
2896
  return graph;
2877
2897
  }
2878
2898
  /**
@@ -2887,10 +2907,10 @@ var GraphCache = class {
2887
2907
  const solidGen = this.solidGeneration;
2888
2908
  const cssGen = this.cssGeneration;
2889
2909
  if (this.layout !== null && this.layout.solidGeneration === solidGen && this.layout.cssGeneration === cssGen) {
2890
- if (this.log.enabled) this.log.debug(`getLayoutGraph HIT: solidGen=${solidGen} cssGen=${cssGen}`);
2910
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getLayoutGraph HIT: solidGen=${solidGen} cssGen=${cssGen}`);
2891
2911
  return this.layout.graph;
2892
2912
  }
2893
- if (this.log.enabled) this.log.debug(
2913
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(
2894
2914
  `getLayoutGraph MISS: solidGen=${solidGen} cssGen=${cssGen} cached=${this.layout !== null}`
2895
2915
  );
2896
2916
  const t0 = performance.now();
@@ -2900,7 +2920,7 @@ var GraphCache = class {
2900
2920
  cssGeneration: cssGen,
2901
2921
  graph
2902
2922
  };
2903
- if (this.log.enabled) this.log.debug(`getLayoutGraph BUILT: in ${performance.now() - t0}ms`);
2923
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getLayoutGraph BUILT: in ${performance.now() - t0}ms`);
2904
2924
  return graph;
2905
2925
  }
2906
2926
  /**
@@ -2915,7 +2935,7 @@ var GraphCache = class {
2915
2935
  invalidate(path) {
2916
2936
  const key = canonicalPath(path);
2917
2937
  const kind = classifyFile(key);
2918
- if (this.log.enabled) this.log.debug(`invalidate: ${key} kind=${kind} solids=${this.solids.size} hasCrossFileResults=${this.crossFileResults !== null} hasLayout=${this.layout !== null}`);
2938
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`invalidate: ${key} kind=${kind} solids=${this.solids.size} hasCrossFileResults=${this.crossFileResults !== null} hasLayout=${this.layout !== null}`);
2919
2939
  if (kind === "solid") {
2920
2940
  const had = this.solids.has(key);
2921
2941
  this.solids.delete(key);
@@ -2923,7 +2943,7 @@ var GraphCache = class {
2923
2943
  this.crossFileResults = null;
2924
2944
  this.solidGeneration++;
2925
2945
  this.layout = null;
2926
- if (this.log.enabled) this.log.debug(`invalidate SOLID: ${key} wasInCache=${had} solids=${this.solids.size} solidGen=${this.solidGeneration}`);
2946
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`invalidate SOLID: ${key} wasInCache=${had} solids=${this.solids.size} solidGen=${this.solidGeneration}`);
2927
2947
  }
2928
2948
  if (kind === "css") {
2929
2949
  this.crossFileDiagnostics.delete(key);
@@ -2931,7 +2951,7 @@ var GraphCache = class {
2931
2951
  this.cssGeneration++;
2932
2952
  this.css = null;
2933
2953
  this.layout = null;
2934
- if (this.log.enabled) this.log.debug(`invalidate CSS: ${key} newCssGen=${this.cssGeneration}`);
2954
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`invalidate CSS: ${key} newCssGen=${this.cssGeneration}`);
2935
2955
  }
2936
2956
  }
2937
2957
  /**
@@ -2940,7 +2960,7 @@ var GraphCache = class {
2940
2960
  * Called on workspace-level events like config changes.
2941
2961
  */
2942
2962
  invalidateAll() {
2943
- if (this.log.enabled) this.log.debug(`invalidateAll: solids=${this.solids.size} solidGen=${this.solidGeneration} cssGen=${this.cssGeneration}`);
2963
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`invalidateAll: solids=${this.solids.size} solidGen=${this.solidGeneration} cssGen=${this.cssGeneration}`);
2944
2964
  this.solids.clear();
2945
2965
  this.crossFileDiagnostics.clear();
2946
2966
  this.crossFileResults = null;
@@ -2956,7 +2976,7 @@ var GraphCache = class {
2956
2976
  * Used by cross-file analysis which needs all SolidGraphs.
2957
2977
  */
2958
2978
  getAllSolidGraphs() {
2959
- if (this.log.enabled) this.log.debug(`getAllSolidGraphs: ${this.solids.size} graphs`);
2979
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getAllSolidGraphs: ${this.solids.size} graphs`);
2960
2980
  const out = new Array(this.solids.size);
2961
2981
  let i = 0;
2962
2982
  for (const entry of this.solids.values()) {
@@ -3012,10 +3032,10 @@ var GraphCache = class {
3012
3032
  const solidMatch = this.crossFileResults.solidGeneration === this.solidGeneration;
3013
3033
  const cssMatch = this.crossFileResults.cssGeneration === this.cssGeneration;
3014
3034
  if (solidMatch && cssMatch) {
3015
- if (this.log.enabled) this.log.debug(`getCachedCrossFileResults HIT: ${this.crossFileResults?.byFile.size} files`);
3035
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(`getCachedCrossFileResults HIT: ${this.crossFileResults?.byFile.size} files`);
3016
3036
  return this.crossFileResults.byFile;
3017
3037
  }
3018
- if (this.log.enabled) this.log.debug(
3038
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(
3019
3039
  `getCachedCrossFileResults MISS: solidMatch=${solidMatch} cssMatch=${cssMatch} cachedSolidGen=${this.crossFileResults?.solidGeneration} currentSolidGen=${this.solidGeneration} cachedCssGen=${this.crossFileResults?.cssGeneration} currentCssGen=${this.cssGeneration}`
3020
3040
  );
3021
3041
  return null;
@@ -3046,7 +3066,7 @@ var GraphCache = class {
3046
3066
  cssGeneration: this.cssGeneration,
3047
3067
  byFile
3048
3068
  };
3049
- if (this.log.enabled) this.log.debug(
3069
+ if (this.log.isLevelEnabled(Level.Debug)) this.log.debug(
3050
3070
  `setCachedCrossFileResults: ${allDiagnostics.length} diags across ${byFile.size} files solidGen=${this.solidGeneration} cssGen=${this.cssGeneration}`
3051
3071
  );
3052
3072
  this.crossFileDiagnostics.clear();
@@ -3358,6 +3378,35 @@ var TypeResolver = class {
3358
3378
  return false;
3359
3379
  }
3360
3380
  }
3381
+ /**
3382
+ * Strict array check: only matches Array<T>, T[], ReadonlyArray<T>, and tuples.
3383
+ * Does NOT match typed arrays (Uint8Array, Buffer, etc.) or other types with
3384
+ * a numeric index signature.
3385
+ */
3386
+ isStrictArrayType(node) {
3387
+ try {
3388
+ const tsType = this.checker.getTypeAtLocation(node);
3389
+ return this.checkIsStrictArrayType(tsType);
3390
+ } catch {
3391
+ return false;
3392
+ }
3393
+ }
3394
+ checkIsStrictArrayType(tsType) {
3395
+ if (tsType.flags & 524288) {
3396
+ const objFlags = getObjectFlags(tsType);
3397
+ if (objFlags & 8) return true;
3398
+ if (objFlags & 4) {
3399
+ const name = tsType.getSymbol()?.getName();
3400
+ if (name === "Array" || name === "ReadonlyArray") return true;
3401
+ }
3402
+ }
3403
+ if (tsType.isUnion()) {
3404
+ for (const t of tsType.types) {
3405
+ if (this.checkIsStrictArrayType(t)) return true;
3406
+ }
3407
+ }
3408
+ return false;
3409
+ }
3361
3410
  checkIsArrayType(tsType) {
3362
3411
  if (tsType.flags & 524288) {
3363
3412
  const objFlags = getObjectFlags(tsType);
@@ -3409,7 +3458,7 @@ var TypeResolver = class {
3409
3458
  if (exprTsType.flags & import_typescript2.default.TypeFlags.Any) return false;
3410
3459
  if (targetTsType.flags & import_typescript2.default.TypeFlags.Any) return false;
3411
3460
  const result = this.checker.isTypeAssignableTo(exprTsType, targetTsType);
3412
- if (this.logger.enabled) {
3461
+ if (this.logger.isLevelEnabled(Level.Debug)) {
3413
3462
  const exprStr = this.checker.typeToString(exprTsType);
3414
3463
  const targetStr = this.checker.typeToString(targetTsType);
3415
3464
  this.logger.debug(`isUnnecessaryCast: expr="${exprStr.slice(0, 120)}" target="${targetStr.slice(0, 120)}" assignable=${result} exprFlags=${exprTsType.flags} targetFlags=${targetTsType.flags}`);
@@ -3926,6 +3975,7 @@ function getStaticStringFromJSXValue(node) {
3926
3975
  const expression = node.expression;
3927
3976
  if (!expression) return null;
3928
3977
  if (import_typescript4.default.isStringLiteral(expression)) return expression.text;
3978
+ if (import_typescript4.default.isNumericLiteral(expression)) return expression.text;
3929
3979
  if (import_typescript4.default.isNoSubstitutionTemplateLiteral(expression)) return expression.text;
3930
3980
  if (import_typescript4.default.isTemplateExpression(expression) && expression.templateSpans.length === 0) {
3931
3981
  return expression.head.text;
@@ -10373,6 +10423,9 @@ function typeIncludesString(graph, node) {
10373
10423
  function typeIsArray(graph, node) {
10374
10424
  return graph.typeResolver.isArrayType(node);
10375
10425
  }
10426
+ function typeIsStrictArray(graph, node) {
10427
+ return graph.typeResolver.isStrictArrayType(node);
10428
+ }
10376
10429
  function getArrayElementKind(graph, node) {
10377
10430
  return graph.typeResolver.getArrayElementKind(node);
10378
10431
  }
@@ -20168,6 +20221,7 @@ var preferSetLookupInLoop = defineSolidRule({
20168
20221
  options: options77,
20169
20222
  check(graph, emit) {
20170
20223
  const reported = /* @__PURE__ */ new Set();
20224
+ const graphHasTypes = hasTypeInfo(graph);
20171
20225
  for (const method of LINEAR_SEARCH_METHODS) {
20172
20226
  const calls = getCallsByMethodName(graph, method);
20173
20227
  for (let i = 0, len = calls.length; i < len; i++) {
@@ -20185,6 +20239,7 @@ var preferSetLookupInLoop = defineSolidRule({
20185
20239
  const loop = getEnclosingLoop(call.node);
20186
20240
  if (!loop) continue;
20187
20241
  if (!isDeclaredOutsideLoop2(loop, variable)) continue;
20242
+ if (graphHasTypes && !typeIsStrictArray(graph, callee.expression)) continue;
20188
20243
  if (isStringLikeReceiver(graph, callee.expression, variable)) continue;
20189
20244
  const key = `${loop.pos}:var:${variable.id}`;
20190
20245
  if (reported.has(key)) continue;
@@ -31740,6 +31795,9 @@ function readBaselineOffsetFacts(graph, node) {
31740
31795
  function readElementRef(graph, node) {
31741
31796
  return readElementRefById(graph, node.solidFile, node.elementId);
31742
31797
  }
31798
+ function readHostElementRef(graph, node) {
31799
+ return graph.hostElementRefsByNode.get(node) ?? null;
31800
+ }
31743
31801
  function readElementRefById(graph, solidFile, elementId) {
31744
31802
  const refs = graph.elementRefsBySolidFileAndId.get(solidFile);
31745
31803
  if (!refs) return null;
@@ -32805,7 +32863,7 @@ function publishLayoutPerfStatsForTest(stats) {
32805
32863
  }
32806
32864
  function maybeLogLayoutPerf(stats, log) {
32807
32865
  if (process.env["SOLID_LINT_LAYOUT_PROFILE"] !== "1") return;
32808
- if (!log || !log.enabled) return;
32866
+ if (!log || !log.isLevelEnabled(Level.Debug)) return;
32809
32867
  const view = snapshotLayoutPerfStats(stats);
32810
32868
  log.debug(
32811
32869
  `[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}`
@@ -32853,17 +32911,17 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
32853
32911
  if (cached !== void 0) return cached;
32854
32912
  const binding = resolveTagBinding(normalizedFile, tag);
32855
32913
  if (binding === null) {
32856
- if (logger.enabled) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
32914
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
32857
32915
  hostByTagCache.set(cacheKey, null);
32858
32916
  return null;
32859
32917
  }
32860
32918
  if (binding.kind === "component") {
32861
- if (logger.enabled) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.tagName}, attrs=[${[...binding.host.staticAttributes.keys()]}]`);
32919
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.descriptor.tagName}, attrs=[${[...binding.host.descriptor.staticAttributes.keys()]}]`);
32862
32920
  hostByTagCache.set(cacheKey, binding.host);
32863
32921
  return binding.host;
32864
32922
  }
32865
32923
  const host = binding.base ? binding.base.host : null;
32866
- if (logger.enabled) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.tagName ?? "null"}`);
32924
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.descriptor.tagName ?? "null"}`);
32867
32925
  hostByTagCache.set(cacheKey, host);
32868
32926
  return host;
32869
32927
  },
@@ -32876,26 +32934,26 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
32876
32934
  }
32877
32935
  };
32878
32936
  function resolveComponentHostEntry(entry) {
32879
- if (entry.resolution === "resolved") return entry.descriptor;
32880
- if (logger.enabled) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
32937
+ if (entry.resolution === "resolved") {
32938
+ return { descriptor: entry.descriptor, hostElementRef: entry.hostElementRef };
32939
+ }
32940
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
32881
32941
  const innerBinding = resolveLocalIdentifierBinding(entry.filePath, entry.innerTag);
32882
- if (logger.enabled) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
32942
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
32883
32943
  const innerHost = extractHostFromBinding(innerBinding);
32884
- if (logger.enabled) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.tagName}, attrs=[${[...innerHost.staticAttributes.keys()]}]`}`);
32885
- let tagName = innerHost !== null ? innerHost.tagName : null;
32944
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.descriptor.tagName}, attrs=[${[...innerHost.descriptor.staticAttributes.keys()]}]`}`);
32945
+ let tagName = innerHost !== null ? innerHost.descriptor.tagName : null;
32886
32946
  if (tagName === null) {
32887
32947
  tagName = resolveTagNameFromPolymorphicProp(entry.staticAttributes);
32888
- if (logger.enabled) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
32948
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
32889
32949
  }
32890
- const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.staticAttributes) : entry.staticAttributes;
32891
- const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.staticClassTokens) : entry.staticClassTokens;
32892
- const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.forwardsChildren;
32893
- if (logger.enabled) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
32950
+ const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
32951
+ const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
32952
+ const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
32953
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
32894
32954
  return {
32895
- tagName,
32896
- staticAttributes,
32897
- staticClassTokens,
32898
- forwardsChildren
32955
+ descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
32956
+ hostElementRef: innerHost?.hostElementRef ?? null
32899
32957
  };
32900
32958
  }
32901
32959
  function extractHostFromBinding(binding) {
@@ -32936,10 +32994,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
32936
32994
  if (hostEntry) {
32937
32995
  const resolved = resolveComponentHostEntry(hostEntry);
32938
32996
  if (resolved !== null) {
32939
- const binding = {
32940
- kind: "component",
32941
- host: resolved
32942
- };
32997
+ const binding = { kind: "component", host: resolved };
32943
32998
  localBindingCache.set(key, binding);
32944
32999
  resolvingLocal.delete(key);
32945
33000
  return binding;
@@ -33000,7 +33055,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
33000
33055
  const baseExpression = toExpressionArgument(firstArg);
33001
33056
  if (baseExpression === null) return null;
33002
33057
  const baseBinding = resolveBindingFromExpression(filePath, baseExpression);
33003
- if (logger.enabled) logger.trace(`[component-host] Object.assign base: ${baseBinding === null ? "null" : baseBinding.kind}${baseBinding?.kind === "component" ? `, tagName=${baseBinding.host.tagName}` : ""}`);
33058
+ 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}` : ""}`);
33004
33059
  let baseComponent = null;
33005
33060
  const members = /* @__PURE__ */ new Map();
33006
33061
  if (baseBinding && baseBinding.kind === "component") {
@@ -33026,7 +33081,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
33026
33081
  if (!import_typescript126.default.isObjectLiteralExpression(argument)) continue;
33027
33082
  appendObjectExpressionMembers(filePath, argument, members);
33028
33083
  }
33029
- if (logger.enabled) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.tagName}`}, members=[${[...members.keys()]}]`);
33084
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.descriptor.tagName}`}, members=[${[...members.keys()]}]`);
33030
33085
  if (baseComponent === null && members.size === 0) return null;
33031
33086
  return {
33032
33087
  kind: "namespace",
@@ -33068,7 +33123,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
33068
33123
  }
33069
33124
  function resolveBindingFromImport(filePath, importBinding) {
33070
33125
  const resolvedModule = moduleResolver.resolveSolid(filePath, importBinding.source) ?? resolveAndIndexExternalModule(filePath, importBinding.source);
33071
- if (logger.enabled) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
33126
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
33072
33127
  if (resolvedModule === null) return null;
33073
33128
  const normalized = (0, import_node_path4.resolve)(resolvedModule);
33074
33129
  if (importBinding.kind === "namespace") {
@@ -33077,7 +33132,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
33077
33132
  const exportName = importBinding.kind === "default" ? "default" : importBinding.importedName;
33078
33133
  if (exportName === null) return null;
33079
33134
  const result = resolveExportBinding(normalized, exportName);
33080
- if (logger.enabled) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
33135
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
33081
33136
  return result;
33082
33137
  }
33083
33138
  function resolveAndIndexExternalModule(importerFile, importSource) {
@@ -33271,6 +33326,7 @@ function collectComponentHosts(graph) {
33271
33326
  }
33272
33327
  function resolveComponentHostEntryForFunction(graph, fn) {
33273
33328
  let entry = null;
33329
+ let hostElementRefAgreed = true;
33274
33330
  const bodyEntry = resolveHostEntryFromFunctionBody(graph, fn);
33275
33331
  if (bodyEntry !== null) {
33276
33332
  entry = bodyEntry;
@@ -33286,9 +33342,17 @@ function resolveComponentHostEntryForFunction(graph, fn) {
33286
33342
  entry = returnEntry;
33287
33343
  continue;
33288
33344
  }
33289
- if (areComponentHostEntriesEqual(entry, returnEntry)) continue;
33345
+ if (areComponentHostEntriesEqual(entry, returnEntry)) {
33346
+ if (hostElementRefAgreed && entry.resolution === "resolved" && returnEntry.resolution === "resolved" && entry.hostElementRef !== returnEntry.hostElementRef) {
33347
+ hostElementRefAgreed = false;
33348
+ }
33349
+ continue;
33350
+ }
33290
33351
  return null;
33291
33352
  }
33353
+ if (!hostElementRefAgreed && entry !== null && entry.resolution === "resolved") {
33354
+ return { resolution: "resolved", descriptor: entry.descriptor, hostElementRef: null };
33355
+ }
33292
33356
  return entry;
33293
33357
  }
33294
33358
  function resolveHostEntryFromFunctionBody(graph, fn) {
@@ -33316,7 +33380,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
33316
33380
  staticAttributes: collectStaticAttributes(element),
33317
33381
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
33318
33382
  forwardsChildren: detectChildrenForwarding(element)
33319
- }
33383
+ },
33384
+ hostElementRef: { solid: graph, element }
33320
33385
  };
33321
33386
  }
33322
33387
  if (isContextProviderTag(element.tag)) {
@@ -34026,7 +34091,7 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
34026
34091
  ancestor = ancestor.parentElementNode;
34027
34092
  }
34028
34093
  if (fileRootElements !== null) {
34029
- if (logger.enabled) {
34094
+ if (logger.isLevelEnabled(Level.Trace)) {
34030
34095
  const compoundDesc = describeCompound(targetCompound);
34031
34096
  logger.trace(`[selector-match] fallback: node=${node.key} tag=${node.tagName} checking ${fileRootElements.length} roots for compound=${compoundDesc}`);
34032
34097
  }
@@ -34037,11 +34102,11 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
34037
34102
  if (root.solidFile !== node.solidFile) continue;
34038
34103
  perf.ancestryChecks++;
34039
34104
  const compoundResult = matchesCompound(root, targetCompound);
34040
- if (logger.enabled && compoundResult === "no-match") {
34105
+ if (logger.isLevelEnabled(Level.Trace) && compoundResult === "no-match") {
34041
34106
  logger.trace(`[selector-match] fallback MISS: root=${root.key} tag=${root.tagName} attrs=[${[...root.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}]`);
34042
34107
  }
34043
34108
  if (compoundResult !== "no-match") {
34044
- if (logger.enabled) {
34109
+ if (logger.isLevelEnabled(Level.Debug)) {
34045
34110
  const compoundDesc = describeCompound(targetCompound);
34046
34111
  logger.debug(`[selector-match] fallback HIT: node=${node.key} tag=${node.tagName} matched root=${root.key} tag=${root.tagName} compound=${compoundDesc} isFinal=${isFinal}`);
34047
34112
  }
@@ -37243,7 +37308,7 @@ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, app
37243
37308
  };
37244
37309
  applies.push(edge);
37245
37310
  ctx.perf.matchEdgesCreated++;
37246
- if (ctx.logger.enabled) {
37311
+ if (ctx.logger.isLevelEnabled(Level.Trace)) {
37247
37312
  ctx.logger.trace(
37248
37313
  `[cascade] edge node=${node.key} selector=${selector.id} match=${matchResult} conditional=${edge.conditionalMatch} selector-raw=${selector.raw.slice(0, 80)}`
37249
37314
  );
@@ -37686,7 +37751,7 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
37686
37751
  if (!child) continue;
37687
37752
  if (child.kind === "expression") {
37688
37753
  if (isStructuralExpression(child.node)) {
37689
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
37754
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
37690
37755
  memo.set(element.id, 2 /* Unknown */);
37691
37756
  return 2 /* Unknown */;
37692
37757
  }
@@ -37708,11 +37773,11 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
37708
37773
  if (!child.isDomElement) {
37709
37774
  const childMeta = compositionMetaByElementId.get(child.id);
37710
37775
  if (childMeta !== void 0 && isControlTag(childMeta.tagName)) {
37711
- 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`);
37776
+ 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`);
37712
37777
  continue;
37713
37778
  }
37714
37779
  if (childState !== 1 /* No */) {
37715
- 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`);
37780
+ 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`);
37716
37781
  childHasUnknown = true;
37717
37782
  }
37718
37783
  continue;
@@ -37725,12 +37790,12 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
37725
37790
  if (childState === 3 /* DynamicText */) childHasDynamicText = true;
37726
37791
  }
37727
37792
  if (childHasUnknown) {
37728
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
37793
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
37729
37794
  memo.set(element.id, 2 /* Unknown */);
37730
37795
  return 2 /* Unknown */;
37731
37796
  }
37732
37797
  if (hasTextOnlyExpression || childHasDynamicText) {
37733
- if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
37798
+ if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
37734
37799
  memo.set(element.id, 3 /* DynamicText */);
37735
37800
  return 3 /* DynamicText */;
37736
37801
  }
@@ -37752,15 +37817,16 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
37752
37817
  const meta = compositionMetaByElementId.get(element.id);
37753
37818
  if (!meta || !meta.participates) continue;
37754
37819
  const localClassTokens = selectorRequirements.needsClassTokens ? getStaticClassTokensForElementEntity(solid, element) : EMPTY_STRING_LIST3;
37755
- const classTokens = mergeClassTokens(localClassTokens, meta.hostDescriptor?.staticClassTokens);
37820
+ const classTokens = mergeClassTokens(localClassTokens, meta.resolvedHost?.descriptor.staticClassTokens);
37756
37821
  const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
37757
37822
  const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
37758
37823
  const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
37759
- const attributes = mergeAttributes(localAttributes, meta.hostDescriptor?.staticAttributes);
37824
+ const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
37760
37825
  const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
37761
37826
  const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
37762
37827
  const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
37763
37828
  const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId);
37829
+ const hostElementRef = meta.resolvedHost?.hostElementRef ?? null;
37764
37830
  out.push({
37765
37831
  element,
37766
37832
  key: toLayoutElementKey(solid.file, element.id),
@@ -37773,7 +37839,8 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
37773
37839
  selectorDispatchKeys,
37774
37840
  inlineStyleValues,
37775
37841
  textualContent,
37776
- parentElementId
37842
+ parentElementId,
37843
+ hostElementRef
37777
37844
  });
37778
37845
  }
37779
37846
  return out;
@@ -37783,7 +37850,7 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
37783
37850
  for (let i = 0; i < solid.jsxElements.length; i++) {
37784
37851
  const element = solid.jsxElements[i];
37785
37852
  if (!element) continue;
37786
- const hostDescriptor = resolveHostDescriptorForElement(
37853
+ const resolvedHost = resolveHostForElement(
37787
37854
  componentHostResolver,
37788
37855
  solid.file,
37789
37856
  element
@@ -37792,30 +37859,30 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
37792
37859
  componentHostResolver,
37793
37860
  solid.file,
37794
37861
  element,
37795
- hostDescriptor
37862
+ resolvedHost
37796
37863
  );
37797
37864
  const participates = element.tag !== null && !isTransparentPrimitive;
37798
- const tag = resolveEffectiveTag(element, hostDescriptor);
37865
+ const tag = resolveEffectiveTag(element, resolvedHost?.descriptor ?? null);
37799
37866
  const tagName = tag ? tag.toLowerCase() : null;
37800
37867
  out.set(element.id, {
37801
37868
  element,
37802
37869
  participates,
37803
37870
  tag,
37804
37871
  tagName,
37805
- hostDescriptor
37872
+ resolvedHost
37806
37873
  });
37807
37874
  }
37808
37875
  return out;
37809
37876
  }
37810
- function resolveHostDescriptorForElement(componentHostResolver, solidFile, element) {
37877
+ function resolveHostForElement(componentHostResolver, solidFile, element) {
37811
37878
  if (element.tag === null) return null;
37812
37879
  if (element.isDomElement) return null;
37813
37880
  return componentHostResolver.resolveHost(solidFile, element.tag);
37814
37881
  }
37815
- function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, hostDescriptor) {
37882
+ function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
37816
37883
  if (element.tag === null) return false;
37817
37884
  if (element.isDomElement) return false;
37818
- if (hostDescriptor !== null) return false;
37885
+ if (resolvedHost !== null) return false;
37819
37886
  return componentHostResolver.isTransparentPrimitive(solidFile, element.tag);
37820
37887
  }
37821
37888
  function resolveEffectiveTag(element, hostDescriptor) {
@@ -37933,6 +38000,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37933
38000
  const childrenByParentNodeMutable = /* @__PURE__ */ new Map();
37934
38001
  const elementBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
37935
38002
  const elementRefsBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
38003
+ const hostElementRefsByNodeMutable = /* @__PURE__ */ new Map();
37936
38004
  const appliesByElementNodeMutable = /* @__PURE__ */ new Map();
37937
38005
  const selectorsById = /* @__PURE__ */ new Map();
37938
38006
  const monitoredDeclarationsBySelectorId = /* @__PURE__ */ new Map();
@@ -37969,7 +38037,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37969
38037
  const moduleResolver = createLayoutModuleResolver(solids, css);
37970
38038
  const componentHostResolver = createLayoutComponentHostResolver(solids, moduleResolver, logger);
37971
38039
  const cssScopeBySolidFile = collectCSSScopeBySolidFile(solids, css, moduleResolver);
37972
- if (logger.enabled) {
38040
+ if (logger.isLevelEnabled(Level.Trace)) {
37973
38041
  for (const [solidFile, scopePaths] of cssScopeBySolidFile) {
37974
38042
  if (scopePaths.length > 0) {
37975
38043
  let names = "";
@@ -38064,6 +38132,9 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
38064
38132
  isControl: isControlTag(record.tagName),
38065
38133
  isReplaced: isReplacedTag(record.tagName)
38066
38134
  };
38135
+ if (record.hostElementRef !== null) {
38136
+ hostElementRefsByNodeMutable.set(node, record.hostElementRef);
38137
+ }
38067
38138
  elements.push(node);
38068
38139
  elementById.set(record.element.id, node);
38069
38140
  nodeByElementId.set(record.element.id, node);
@@ -38085,7 +38156,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
38085
38156
  }
38086
38157
  }
38087
38158
  }
38088
- if (logger.enabled) {
38159
+ if (logger.isLevelEnabled(Level.Debug)) {
38089
38160
  for (const [file, roots] of rootElementsByFile) {
38090
38161
  const descs = roots.map((r) => `${r.key}(tag=${r.tagName}, attrs=[${[...r.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}])`);
38091
38162
  logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
@@ -38128,7 +38199,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
38128
38199
  appliesByNode.set(node, edges);
38129
38200
  }
38130
38201
  perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
38131
- if (logger.enabled) {
38202
+ if (logger.isLevelEnabled(Level.Trace)) {
38132
38203
  for (let i = 0; i < elements.length; i++) {
38133
38204
  const node = elements[i];
38134
38205
  if (!node) continue;
@@ -38184,6 +38255,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
38184
38255
  childrenByParentNode: childrenByParentNodeMutable,
38185
38256
  elementBySolidFileAndId: elementBySolidFileAndIdMutable,
38186
38257
  elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
38258
+ hostElementRefsByNode: hostElementRefsByNodeMutable,
38187
38259
  appliesByNode,
38188
38260
  selectorCandidatesByNode,
38189
38261
  selectorsById,
@@ -38584,7 +38656,7 @@ function computeFlowParticipationFact(snapshot) {
38584
38656
  }
38585
38657
  function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf, logger) {
38586
38658
  const out = /* @__PURE__ */ new Map();
38587
- const trace = logger.enabled;
38659
+ const trace = logger.isLevelEnabled(Level.Trace);
38588
38660
  for (const [parent, children] of childrenByParentNode) {
38589
38661
  if (children.length < 2) continue;
38590
38662
  const snapshot = snapshotByElementNode.get(parent);
@@ -39403,7 +39475,7 @@ function runLayoutDetector(context, detector) {
39403
39475
  result.evidence.posteriorLower,
39404
39476
  result.evidence.posteriorUpper
39405
39477
  );
39406
- if (log.enabled) {
39478
+ if (log.isLevelEnabled(Level.Debug)) {
39407
39479
  log.debug(
39408
39480
  `[${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("; ")}]`
39409
39481
  );
@@ -39412,7 +39484,7 @@ function runLayoutDetector(context, detector) {
39412
39484
  continue;
39413
39485
  }
39414
39486
  recordPolicyMetrics(context, result.evidenceMass, result.posteriorLower, result.posteriorUpper);
39415
- if (log.enabled) {
39487
+ if (log.isLevelEnabled(Level.Debug)) {
39416
39488
  log.debug(
39417
39489
  `[${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)}`
39418
39490
  );
@@ -39945,13 +40017,39 @@ var INLINE_TOUCH_TARGET_KEYS = /* @__PURE__ */ new Set([
39945
40017
  "height",
39946
40018
  "min-height",
39947
40019
  "width",
39948
- "min-width",
39949
- "padding-left",
39950
- "padding-right",
39951
- "padding-inline",
39952
- "padding-inline-start",
39953
- "padding-inline-end"
40020
+ "min-width"
39954
40021
  ]);
40022
+ var INTERACTIVE_HTML_TAGS = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "label", "summary"]);
40023
+ var INTERACTIVE_ARIA_ROLES = /* @__PURE__ */ new Set([
40024
+ "button",
40025
+ "link",
40026
+ "checkbox",
40027
+ "radio",
40028
+ "combobox",
40029
+ "listbox",
40030
+ "menuitem",
40031
+ "menuitemcheckbox",
40032
+ "menuitemradio",
40033
+ "option",
40034
+ "switch",
40035
+ "tab"
40036
+ ]);
40037
+ function isInteractiveElement(solid, element, hostElementRef) {
40038
+ if (element.tagName !== null && INTERACTIVE_HTML_TAGS.has(element.tagName)) return true;
40039
+ const roleAttr = getJSXAttributeEntity(solid, element, "role");
40040
+ if (roleAttr !== null && roleAttr.valueNode !== null) {
40041
+ const role = getStaticStringFromJSXValue(roleAttr.valueNode);
40042
+ if (role !== null && INTERACTIVE_ARIA_ROLES.has(role)) return true;
40043
+ }
40044
+ if (hostElementRef !== null && hostElementRef.element.tagName !== null) {
40045
+ if (INTERACTIVE_HTML_TAGS.has(hostElementRef.element.tagName)) return true;
40046
+ }
40047
+ return false;
40048
+ }
40049
+ function readNodeHostElementRef(layout, solid, element) {
40050
+ const node = layout.elementBySolidFileAndId.get(solid.file)?.get(element.id) ?? null;
40051
+ return node !== null ? readHostElementRef(layout, node) : null;
40052
+ }
39955
40053
  var jsxStylePolicy = defineCrossRule({
39956
40054
  id: "jsx-style-policy",
39957
40055
  severity: "warn",
@@ -39962,11 +40060,11 @@ var jsxStylePolicy = defineCrossRule({
39962
40060
  category: "css-jsx"
39963
40061
  },
39964
40062
  check(context, emit) {
39965
- const { solids } = context;
40063
+ const { solids, layout } = context;
39966
40064
  const policy = getActivePolicy();
39967
40065
  if (policy === null) return;
39968
40066
  const name = getActivePolicyName() ?? "";
39969
- forEachStylePropertyAcross(solids, (solid, p) => {
40067
+ forEachStylePropertyAcross(solids, (solid, p, element) => {
39970
40068
  if (!import_typescript135.default.isPropertyAssignment(p)) return;
39971
40069
  const key = objectKeyName(p.name);
39972
40070
  if (!key) return;
@@ -40014,6 +40112,8 @@ var jsxStylePolicy = defineCrossRule({
40014
40112
  return;
40015
40113
  }
40016
40114
  if (INLINE_TOUCH_TARGET_KEYS.has(normalizedKey)) {
40115
+ const hostRef = readNodeHostElementRef(layout, solid, element);
40116
+ if (!isInteractiveElement(solid, element, hostRef)) return;
40017
40117
  const strVal = getStaticStringValue(p.initializer);
40018
40118
  if (!strVal) return;
40019
40119
  const px = parsePxValue(strVal);
@@ -40092,7 +40192,7 @@ var siblingAlignmentDetector = {
40092
40192
  id: "sibling-alignment-outlier",
40093
40193
  collect: collectAlignmentCases,
40094
40194
  evaluate(input, context) {
40095
- if (context.logger.enabled) {
40195
+ if (context.logger.isLevelEnabled(Level.Trace)) {
40096
40196
  const ctx = input.context;
40097
40197
  context.logger.trace(
40098
40198
  `[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}`
@@ -40141,7 +40241,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
40141
40241
  const log = context.logger;
40142
40242
  const detections = runLayoutDetector(context, siblingAlignmentDetector);
40143
40243
  const uniqueDetections = dedupeDetectionsBySubject(detections);
40144
- if (log.enabled) {
40244
+ if (log.isLevelEnabled(Level.Debug)) {
40145
40245
  log.debug(
40146
40246
  `[sibling-alignment] raw=${detections.length} deduped=${uniqueDetections.length}`
40147
40247
  );
@@ -40155,7 +40255,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
40155
40255
  const subjectId = detection.caseData.subject.elementId;
40156
40256
  const logPrefix = `[sibling-alignment] <${subjectTag}> in <${parentTag}> (${subjectFile}#${subjectId})`;
40157
40257
  if (detection.evidence.confidence < MIN_CONFIDENCE_THRESHOLD) {
40158
- if (log.enabled) {
40258
+ if (log.isLevelEnabled(Level.Debug)) {
40159
40259
  log.debug(
40160
40260
  `${logPrefix} SKIP: confidence=${detection.evidence.confidence.toFixed(2)} < threshold=${MIN_CONFIDENCE_THRESHOLD}`
40161
40261
  );
@@ -40164,7 +40264,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
40164
40264
  }
40165
40265
  const estimatedOffset = detection.evidence.estimatedOffsetPx;
40166
40266
  if (estimatedOffset !== null && Math.abs(estimatedOffset) < MIN_OFFSET_PX_THRESHOLD && !hasNonOffsetPrimaryEvidence(detection.evidence.topFactors)) {
40167
- if (log.enabled) {
40267
+ if (log.isLevelEnabled(Level.Debug)) {
40168
40268
  log.debug(
40169
40269
  `${logPrefix} SKIP: offset=${estimatedOffset.toFixed(2)}px < ${MIN_OFFSET_PX_THRESHOLD}px (no non-offset primary evidence, topFactors=[${detection.evidence.topFactors.join(",")}])`
40170
40270
  );
@@ -40176,7 +40276,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
40176
40276
  detection.caseData.cohort.parentElementKey,
40177
40277
  detection.caseData.subject.solidFile
40178
40278
  )) {
40179
- if (log.enabled) {
40279
+ if (log.isLevelEnabled(Level.Debug)) {
40180
40280
  log.debug(`${logPrefix} SKIP: out-of-flow ancestor`);
40181
40281
  }
40182
40282
  continue;
@@ -40187,7 +40287,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
40187
40287
  detection.caseData.subject.elementId
40188
40288
  );
40189
40289
  if (!subjectRef) {
40190
- if (log.enabled) {
40290
+ if (log.isLevelEnabled(Level.Debug)) {
40191
40291
  log.debug(`${logPrefix} SKIP: no node ref`);
40192
40292
  }
40193
40293
  continue;
@@ -40203,7 +40303,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
40203
40303
  const primaryFix = detection.evidence.primaryFix;
40204
40304
  const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
40205
40305
  const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
40206
- if (log.enabled) {
40306
+ if (log.isLevelEnabled(Level.Debug)) {
40207
40307
  log.debug(
40208
40308
  `${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}]`
40209
40309
  );
@@ -40612,7 +40712,8 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
40612
40712
  const ref = readNodeRef(context.layout, node);
40613
40713
  if (!ref) continue;
40614
40714
  const reservedSpace = readReservedSpaceFact(context.layout, node);
40615
- if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace)) continue;
40715
+ const hostRef = readHostElementRef(context.layout, node);
40716
+ if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace, hostRef)) continue;
40616
40717
  emit(
40617
40718
  createDiagnostic(
40618
40719
  ref.solid.file,
@@ -40627,15 +40728,17 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
40627
40728
  }
40628
40729
  }
40629
40730
  });
40630
- function hasReservedSize(solid, attributes, element, reservedSpaceFact) {
40731
+ function hasReservedSize(solid, attributes, element, reservedSpaceFact, hostElementRef) {
40631
40732
  if (reservedSpaceFact.hasReservedSpace) return true;
40632
40733
  const attrWidth = parsePositiveLength(attributes.get("width"));
40633
40734
  const attrHeight = parsePositiveLength(attributes.get("height"));
40634
40735
  const jsxAttrWidth = readPositiveJsxAttribute(solid, element, "width");
40635
40736
  const jsxAttrHeight = readPositiveJsxAttribute(solid, element, "height");
40636
- if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight) return true;
40637
- const hasAnyWidth = attrWidth || jsxAttrWidth || reservedSpaceFact.hasUsableInlineDimension;
40638
- const hasAnyHeight = attrHeight || jsxAttrHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
40737
+ const hostJsxWidth = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "width") : false;
40738
+ const hostJsxHeight = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "height") : false;
40739
+ if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight || hostJsxWidth && hostJsxHeight) return true;
40740
+ const hasAnyWidth = attrWidth || jsxAttrWidth || hostJsxWidth || reservedSpaceFact.hasUsableInlineDimension;
40741
+ const hasAnyHeight = attrHeight || jsxAttrHeight || hostJsxHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
40639
40742
  if (reservedSpaceFact.hasUsableAspectRatio && (hasAnyWidth || hasAnyHeight)) return true;
40640
40743
  if (reservedSpaceFact.hasContainIntrinsicSize && (hasAnyWidth || hasAnyHeight)) return true;
40641
40744
  return false;