@drskillissue/ganko 0.2.6 → 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.
- package/dist/{chunk-FTIRRRQY.js → chunk-WY5MMHK2.js} +195 -82
- package/dist/chunk-WY5MMHK2.js.map +1 -0
- package/dist/eslint-plugin.cjs +189 -81
- package/dist/eslint-plugin.cjs.map +1 -1
- package/dist/eslint-plugin.js +1 -1
- package/dist/index.cjs +214 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +23 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/dist/chunk-FTIRRRQY.js.map +0 -1
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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}`);
|
|
@@ -10373,6 +10422,9 @@ function typeIncludesString(graph, node) {
|
|
|
10373
10422
|
function typeIsArray(graph, node) {
|
|
10374
10423
|
return graph.typeResolver.isArrayType(node);
|
|
10375
10424
|
}
|
|
10425
|
+
function typeIsStrictArray(graph, node) {
|
|
10426
|
+
return graph.typeResolver.isStrictArrayType(node);
|
|
10427
|
+
}
|
|
10376
10428
|
function getArrayElementKind(graph, node) {
|
|
10377
10429
|
return graph.typeResolver.getArrayElementKind(node);
|
|
10378
10430
|
}
|
|
@@ -20168,6 +20220,7 @@ var preferSetLookupInLoop = defineSolidRule({
|
|
|
20168
20220
|
options: options77,
|
|
20169
20221
|
check(graph, emit) {
|
|
20170
20222
|
const reported = /* @__PURE__ */ new Set();
|
|
20223
|
+
const graphHasTypes = hasTypeInfo(graph);
|
|
20171
20224
|
for (const method of LINEAR_SEARCH_METHODS) {
|
|
20172
20225
|
const calls = getCallsByMethodName(graph, method);
|
|
20173
20226
|
for (let i = 0, len = calls.length; i < len; i++) {
|
|
@@ -20185,6 +20238,7 @@ var preferSetLookupInLoop = defineSolidRule({
|
|
|
20185
20238
|
const loop = getEnclosingLoop(call.node);
|
|
20186
20239
|
if (!loop) continue;
|
|
20187
20240
|
if (!isDeclaredOutsideLoop2(loop, variable)) continue;
|
|
20241
|
+
if (graphHasTypes && !typeIsStrictArray(graph, callee.expression)) continue;
|
|
20188
20242
|
if (isStringLikeReceiver(graph, callee.expression, variable)) continue;
|
|
20189
20243
|
const key = `${loop.pos}:var:${variable.id}`;
|
|
20190
20244
|
if (reported.has(key)) continue;
|
|
@@ -29284,8 +29338,12 @@ var POLICIES = {
|
|
|
29284
29338
|
"dense-ui": DENSE_UI,
|
|
29285
29339
|
"large-text": LARGE_TEXT
|
|
29286
29340
|
};
|
|
29287
|
-
var activePolicyName =
|
|
29341
|
+
var activePolicyName = null;
|
|
29288
29342
|
function setActivePolicy(name) {
|
|
29343
|
+
if (name === null) {
|
|
29344
|
+
activePolicyName = null;
|
|
29345
|
+
return;
|
|
29346
|
+
}
|
|
29289
29347
|
const match = ACCESSIBILITY_POLICIES.find((n) => n === name);
|
|
29290
29348
|
if (match) {
|
|
29291
29349
|
activePolicyName = match;
|
|
@@ -29295,6 +29353,7 @@ function getActivePolicyName() {
|
|
|
29295
29353
|
return activePolicyName;
|
|
29296
29354
|
}
|
|
29297
29355
|
function getActivePolicy() {
|
|
29356
|
+
if (activePolicyName === null) return null;
|
|
29298
29357
|
return POLICIES[activePolicyName];
|
|
29299
29358
|
}
|
|
29300
29359
|
|
|
@@ -29613,7 +29672,8 @@ var cssPolicyContrast = defineCSSRule({
|
|
|
29613
29672
|
options: {},
|
|
29614
29673
|
check(graph, emit) {
|
|
29615
29674
|
const policy = getActivePolicy();
|
|
29616
|
-
|
|
29675
|
+
if (policy === null) return;
|
|
29676
|
+
const name = getActivePolicyName() ?? "";
|
|
29617
29677
|
const colorDecls = graph.declarationsByProperty.get("color");
|
|
29618
29678
|
if (!colorDecls) return;
|
|
29619
29679
|
const candidates = /* @__PURE__ */ new Set();
|
|
@@ -29690,7 +29750,8 @@ var cssPolicySpacing = defineCSSRule({
|
|
|
29690
29750
|
options: {},
|
|
29691
29751
|
check(graph, emit) {
|
|
29692
29752
|
const policy = getActivePolicy();
|
|
29693
|
-
|
|
29753
|
+
if (policy === null) return;
|
|
29754
|
+
const name = getActivePolicyName() ?? "";
|
|
29694
29755
|
const letterDecls = graph.declarationsByProperty.get("letter-spacing");
|
|
29695
29756
|
if (letterDecls) {
|
|
29696
29757
|
for (let i = 0; i < letterDecls.length; i++) {
|
|
@@ -29799,7 +29860,8 @@ var cssPolicyTouchTarget = defineCSSRule({
|
|
|
29799
29860
|
options: {},
|
|
29800
29861
|
check(graph, emit) {
|
|
29801
29862
|
const policy = getActivePolicy();
|
|
29802
|
-
|
|
29863
|
+
if (policy === null) return;
|
|
29864
|
+
const name = getActivePolicyName() ?? "";
|
|
29803
29865
|
const decls = graph.declarationsForProperties(
|
|
29804
29866
|
"height",
|
|
29805
29867
|
"min-height",
|
|
@@ -29958,7 +30020,8 @@ var cssPolicyTypography = defineCSSRule({
|
|
|
29958
30020
|
options: {},
|
|
29959
30021
|
check(graph, emit) {
|
|
29960
30022
|
const policy = getActivePolicy();
|
|
29961
|
-
|
|
30023
|
+
if (policy === null) return;
|
|
30024
|
+
const name = getActivePolicyName() ?? "";
|
|
29962
30025
|
const fontDecls = graph.declarationsByProperty.get("font-size");
|
|
29963
30026
|
if (fontDecls) {
|
|
29964
30027
|
for (let i = 0; i < fontDecls.length; i++) {
|
|
@@ -31731,6 +31794,9 @@ function readBaselineOffsetFacts(graph, node) {
|
|
|
31731
31794
|
function readElementRef(graph, node) {
|
|
31732
31795
|
return readElementRefById(graph, node.solidFile, node.elementId);
|
|
31733
31796
|
}
|
|
31797
|
+
function readHostElementRef(graph, node) {
|
|
31798
|
+
return graph.hostElementRefsByNode.get(node) ?? null;
|
|
31799
|
+
}
|
|
31734
31800
|
function readElementRefById(graph, solidFile, elementId) {
|
|
31735
31801
|
const refs = graph.elementRefsBySolidFileAndId.get(solidFile);
|
|
31736
31802
|
if (!refs) return null;
|
|
@@ -32796,7 +32862,7 @@ function publishLayoutPerfStatsForTest(stats) {
|
|
|
32796
32862
|
}
|
|
32797
32863
|
function maybeLogLayoutPerf(stats, log) {
|
|
32798
32864
|
if (process.env["SOLID_LINT_LAYOUT_PROFILE"] !== "1") return;
|
|
32799
|
-
if (!log || !log.
|
|
32865
|
+
if (!log || !log.isLevelEnabled(Level.Debug)) return;
|
|
32800
32866
|
const view = snapshotLayoutPerfStats(stats);
|
|
32801
32867
|
log.debug(
|
|
32802
32868
|
`[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}`
|
|
@@ -32844,17 +32910,17 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32844
32910
|
if (cached !== void 0) return cached;
|
|
32845
32911
|
const binding = resolveTagBinding(normalizedFile, tag);
|
|
32846
32912
|
if (binding === null) {
|
|
32847
|
-
if (logger.
|
|
32913
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
|
|
32848
32914
|
hostByTagCache.set(cacheKey, null);
|
|
32849
32915
|
return null;
|
|
32850
32916
|
}
|
|
32851
32917
|
if (binding.kind === "component") {
|
|
32852
|
-
if (logger.
|
|
32918
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.descriptor.tagName}, attrs=[${[...binding.host.descriptor.staticAttributes.keys()]}]`);
|
|
32853
32919
|
hostByTagCache.set(cacheKey, binding.host);
|
|
32854
32920
|
return binding.host;
|
|
32855
32921
|
}
|
|
32856
32922
|
const host = binding.base ? binding.base.host : null;
|
|
32857
|
-
if (logger.
|
|
32923
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.descriptor.tagName ?? "null"}`);
|
|
32858
32924
|
hostByTagCache.set(cacheKey, host);
|
|
32859
32925
|
return host;
|
|
32860
32926
|
},
|
|
@@ -32867,26 +32933,26 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32867
32933
|
}
|
|
32868
32934
|
};
|
|
32869
32935
|
function resolveComponentHostEntry(entry) {
|
|
32870
|
-
if (entry.resolution === "resolved")
|
|
32871
|
-
|
|
32936
|
+
if (entry.resolution === "resolved") {
|
|
32937
|
+
return { descriptor: entry.descriptor, hostElementRef: entry.hostElementRef };
|
|
32938
|
+
}
|
|
32939
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
|
|
32872
32940
|
const innerBinding = resolveLocalIdentifierBinding(entry.filePath, entry.innerTag);
|
|
32873
|
-
if (logger.
|
|
32941
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
|
|
32874
32942
|
const innerHost = extractHostFromBinding(innerBinding);
|
|
32875
|
-
if (logger.
|
|
32876
|
-
let tagName = innerHost !== null ? innerHost.tagName : null;
|
|
32943
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.descriptor.tagName}, attrs=[${[...innerHost.descriptor.staticAttributes.keys()]}]`}`);
|
|
32944
|
+
let tagName = innerHost !== null ? innerHost.descriptor.tagName : null;
|
|
32877
32945
|
if (tagName === null) {
|
|
32878
32946
|
tagName = resolveTagNameFromPolymorphicProp(entry.staticAttributes);
|
|
32879
|
-
if (logger.
|
|
32947
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
|
|
32880
32948
|
}
|
|
32881
|
-
const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.staticAttributes) : entry.staticAttributes;
|
|
32882
|
-
const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.staticClassTokens) : entry.staticClassTokens;
|
|
32883
|
-
const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.forwardsChildren;
|
|
32884
|
-
if (logger.
|
|
32949
|
+
const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
|
|
32950
|
+
const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
|
|
32951
|
+
const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
|
|
32952
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
|
|
32885
32953
|
return {
|
|
32886
|
-
tagName,
|
|
32887
|
-
|
|
32888
|
-
staticClassTokens,
|
|
32889
|
-
forwardsChildren
|
|
32954
|
+
descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
|
|
32955
|
+
hostElementRef: innerHost?.hostElementRef ?? null
|
|
32890
32956
|
};
|
|
32891
32957
|
}
|
|
32892
32958
|
function extractHostFromBinding(binding) {
|
|
@@ -32927,10 +32993,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32927
32993
|
if (hostEntry) {
|
|
32928
32994
|
const resolved = resolveComponentHostEntry(hostEntry);
|
|
32929
32995
|
if (resolved !== null) {
|
|
32930
|
-
const binding = {
|
|
32931
|
-
kind: "component",
|
|
32932
|
-
host: resolved
|
|
32933
|
-
};
|
|
32996
|
+
const binding = { kind: "component", host: resolved };
|
|
32934
32997
|
localBindingCache.set(key, binding);
|
|
32935
32998
|
resolvingLocal.delete(key);
|
|
32936
32999
|
return binding;
|
|
@@ -32991,7 +33054,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32991
33054
|
const baseExpression = toExpressionArgument(firstArg);
|
|
32992
33055
|
if (baseExpression === null) return null;
|
|
32993
33056
|
const baseBinding = resolveBindingFromExpression(filePath, baseExpression);
|
|
32994
|
-
if (logger.
|
|
33057
|
+
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}` : ""}`);
|
|
32995
33058
|
let baseComponent = null;
|
|
32996
33059
|
const members = /* @__PURE__ */ new Map();
|
|
32997
33060
|
if (baseBinding && baseBinding.kind === "component") {
|
|
@@ -33017,7 +33080,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
33017
33080
|
if (!import_typescript126.default.isObjectLiteralExpression(argument)) continue;
|
|
33018
33081
|
appendObjectExpressionMembers(filePath, argument, members);
|
|
33019
33082
|
}
|
|
33020
|
-
if (logger.
|
|
33083
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.descriptor.tagName}`}, members=[${[...members.keys()]}]`);
|
|
33021
33084
|
if (baseComponent === null && members.size === 0) return null;
|
|
33022
33085
|
return {
|
|
33023
33086
|
kind: "namespace",
|
|
@@ -33059,7 +33122,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
33059
33122
|
}
|
|
33060
33123
|
function resolveBindingFromImport(filePath, importBinding) {
|
|
33061
33124
|
const resolvedModule = moduleResolver.resolveSolid(filePath, importBinding.source) ?? resolveAndIndexExternalModule(filePath, importBinding.source);
|
|
33062
|
-
if (logger.
|
|
33125
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
|
|
33063
33126
|
if (resolvedModule === null) return null;
|
|
33064
33127
|
const normalized = (0, import_node_path4.resolve)(resolvedModule);
|
|
33065
33128
|
if (importBinding.kind === "namespace") {
|
|
@@ -33068,7 +33131,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
33068
33131
|
const exportName = importBinding.kind === "default" ? "default" : importBinding.importedName;
|
|
33069
33132
|
if (exportName === null) return null;
|
|
33070
33133
|
const result = resolveExportBinding(normalized, exportName);
|
|
33071
|
-
if (logger.
|
|
33134
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
|
|
33072
33135
|
return result;
|
|
33073
33136
|
}
|
|
33074
33137
|
function resolveAndIndexExternalModule(importerFile, importSource) {
|
|
@@ -33262,6 +33325,7 @@ function collectComponentHosts(graph) {
|
|
|
33262
33325
|
}
|
|
33263
33326
|
function resolveComponentHostEntryForFunction(graph, fn) {
|
|
33264
33327
|
let entry = null;
|
|
33328
|
+
let hostElementRefAgreed = true;
|
|
33265
33329
|
const bodyEntry = resolveHostEntryFromFunctionBody(graph, fn);
|
|
33266
33330
|
if (bodyEntry !== null) {
|
|
33267
33331
|
entry = bodyEntry;
|
|
@@ -33277,9 +33341,17 @@ function resolveComponentHostEntryForFunction(graph, fn) {
|
|
|
33277
33341
|
entry = returnEntry;
|
|
33278
33342
|
continue;
|
|
33279
33343
|
}
|
|
33280
|
-
if (areComponentHostEntriesEqual(entry, returnEntry))
|
|
33344
|
+
if (areComponentHostEntriesEqual(entry, returnEntry)) {
|
|
33345
|
+
if (hostElementRefAgreed && entry.resolution === "resolved" && returnEntry.resolution === "resolved" && entry.hostElementRef !== returnEntry.hostElementRef) {
|
|
33346
|
+
hostElementRefAgreed = false;
|
|
33347
|
+
}
|
|
33348
|
+
continue;
|
|
33349
|
+
}
|
|
33281
33350
|
return null;
|
|
33282
33351
|
}
|
|
33352
|
+
if (!hostElementRefAgreed && entry !== null && entry.resolution === "resolved") {
|
|
33353
|
+
return { resolution: "resolved", descriptor: entry.descriptor, hostElementRef: null };
|
|
33354
|
+
}
|
|
33283
33355
|
return entry;
|
|
33284
33356
|
}
|
|
33285
33357
|
function resolveHostEntryFromFunctionBody(graph, fn) {
|
|
@@ -33307,7 +33379,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
|
|
|
33307
33379
|
staticAttributes: collectStaticAttributes(element),
|
|
33308
33380
|
staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
|
|
33309
33381
|
forwardsChildren: detectChildrenForwarding(element)
|
|
33310
|
-
}
|
|
33382
|
+
},
|
|
33383
|
+
hostElementRef: { solid: graph, element }
|
|
33311
33384
|
};
|
|
33312
33385
|
}
|
|
33313
33386
|
if (isContextProviderTag(element.tag)) {
|
|
@@ -34017,7 +34090,7 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
|
|
|
34017
34090
|
ancestor = ancestor.parentElementNode;
|
|
34018
34091
|
}
|
|
34019
34092
|
if (fileRootElements !== null) {
|
|
34020
|
-
if (logger.
|
|
34093
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
34021
34094
|
const compoundDesc = describeCompound(targetCompound);
|
|
34022
34095
|
logger.trace(`[selector-match] fallback: node=${node.key} tag=${node.tagName} checking ${fileRootElements.length} roots for compound=${compoundDesc}`);
|
|
34023
34096
|
}
|
|
@@ -34028,11 +34101,11 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
|
|
|
34028
34101
|
if (root.solidFile !== node.solidFile) continue;
|
|
34029
34102
|
perf.ancestryChecks++;
|
|
34030
34103
|
const compoundResult = matchesCompound(root, targetCompound);
|
|
34031
|
-
if (logger.
|
|
34104
|
+
if (logger.isLevelEnabled(Level.Trace) && compoundResult === "no-match") {
|
|
34032
34105
|
logger.trace(`[selector-match] fallback MISS: root=${root.key} tag=${root.tagName} attrs=[${[...root.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}]`);
|
|
34033
34106
|
}
|
|
34034
34107
|
if (compoundResult !== "no-match") {
|
|
34035
|
-
if (logger.
|
|
34108
|
+
if (logger.isLevelEnabled(Level.Debug)) {
|
|
34036
34109
|
const compoundDesc = describeCompound(targetCompound);
|
|
34037
34110
|
logger.debug(`[selector-match] fallback HIT: node=${node.key} tag=${node.tagName} matched root=${root.key} tag=${root.tagName} compound=${compoundDesc} isFinal=${isFinal}`);
|
|
34038
34111
|
}
|
|
@@ -37234,7 +37307,7 @@ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, app
|
|
|
37234
37307
|
};
|
|
37235
37308
|
applies.push(edge);
|
|
37236
37309
|
ctx.perf.matchEdgesCreated++;
|
|
37237
|
-
if (ctx.logger.
|
|
37310
|
+
if (ctx.logger.isLevelEnabled(Level.Trace)) {
|
|
37238
37311
|
ctx.logger.trace(
|
|
37239
37312
|
`[cascade] edge node=${node.key} selector=${selector.id} match=${matchResult} conditional=${edge.conditionalMatch} selector-raw=${selector.raw.slice(0, 80)}`
|
|
37240
37313
|
);
|
|
@@ -37677,7 +37750,7 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
37677
37750
|
if (!child) continue;
|
|
37678
37751
|
if (child.kind === "expression") {
|
|
37679
37752
|
if (isStructuralExpression(child.node)) {
|
|
37680
|
-
if (logger.
|
|
37753
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
|
|
37681
37754
|
memo.set(element.id, 2 /* Unknown */);
|
|
37682
37755
|
return 2 /* Unknown */;
|
|
37683
37756
|
}
|
|
@@ -37699,11 +37772,11 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
37699
37772
|
if (!child.isDomElement) {
|
|
37700
37773
|
const childMeta = compositionMetaByElementId.get(child.id);
|
|
37701
37774
|
if (childMeta !== void 0 && isControlTag(childMeta.tagName)) {
|
|
37702
|
-
if (logger.
|
|
37775
|
+
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`);
|
|
37703
37776
|
continue;
|
|
37704
37777
|
}
|
|
37705
37778
|
if (childState !== 1 /* No */) {
|
|
37706
|
-
if (logger.
|
|
37779
|
+
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`);
|
|
37707
37780
|
childHasUnknown = true;
|
|
37708
37781
|
}
|
|
37709
37782
|
continue;
|
|
@@ -37716,12 +37789,12 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
37716
37789
|
if (childState === 3 /* DynamicText */) childHasDynamicText = true;
|
|
37717
37790
|
}
|
|
37718
37791
|
if (childHasUnknown) {
|
|
37719
|
-
if (logger.
|
|
37792
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
|
|
37720
37793
|
memo.set(element.id, 2 /* Unknown */);
|
|
37721
37794
|
return 2 /* Unknown */;
|
|
37722
37795
|
}
|
|
37723
37796
|
if (hasTextOnlyExpression || childHasDynamicText) {
|
|
37724
|
-
if (logger.
|
|
37797
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
|
|
37725
37798
|
memo.set(element.id, 3 /* DynamicText */);
|
|
37726
37799
|
return 3 /* DynamicText */;
|
|
37727
37800
|
}
|
|
@@ -37743,15 +37816,16 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
|
|
|
37743
37816
|
const meta = compositionMetaByElementId.get(element.id);
|
|
37744
37817
|
if (!meta || !meta.participates) continue;
|
|
37745
37818
|
const localClassTokens = selectorRequirements.needsClassTokens ? getStaticClassTokensForElementEntity(solid, element) : EMPTY_STRING_LIST3;
|
|
37746
|
-
const classTokens = mergeClassTokens(localClassTokens, meta.
|
|
37819
|
+
const classTokens = mergeClassTokens(localClassTokens, meta.resolvedHost?.descriptor.staticClassTokens);
|
|
37747
37820
|
const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
|
|
37748
37821
|
const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
|
|
37749
37822
|
const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
|
|
37750
|
-
const attributes = mergeAttributes(localAttributes, meta.
|
|
37823
|
+
const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
|
|
37751
37824
|
const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
|
|
37752
37825
|
const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
|
|
37753
37826
|
const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
|
|
37754
37827
|
const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId);
|
|
37828
|
+
const hostElementRef = meta.resolvedHost?.hostElementRef ?? null;
|
|
37755
37829
|
out.push({
|
|
37756
37830
|
element,
|
|
37757
37831
|
key: toLayoutElementKey(solid.file, element.id),
|
|
@@ -37764,7 +37838,8 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
|
|
|
37764
37838
|
selectorDispatchKeys,
|
|
37765
37839
|
inlineStyleValues,
|
|
37766
37840
|
textualContent,
|
|
37767
|
-
parentElementId
|
|
37841
|
+
parentElementId,
|
|
37842
|
+
hostElementRef
|
|
37768
37843
|
});
|
|
37769
37844
|
}
|
|
37770
37845
|
return out;
|
|
@@ -37774,7 +37849,7 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
|
|
|
37774
37849
|
for (let i = 0; i < solid.jsxElements.length; i++) {
|
|
37775
37850
|
const element = solid.jsxElements[i];
|
|
37776
37851
|
if (!element) continue;
|
|
37777
|
-
const
|
|
37852
|
+
const resolvedHost = resolveHostForElement(
|
|
37778
37853
|
componentHostResolver,
|
|
37779
37854
|
solid.file,
|
|
37780
37855
|
element
|
|
@@ -37783,30 +37858,30 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
|
|
|
37783
37858
|
componentHostResolver,
|
|
37784
37859
|
solid.file,
|
|
37785
37860
|
element,
|
|
37786
|
-
|
|
37861
|
+
resolvedHost
|
|
37787
37862
|
);
|
|
37788
37863
|
const participates = element.tag !== null && !isTransparentPrimitive;
|
|
37789
|
-
const tag = resolveEffectiveTag(element,
|
|
37864
|
+
const tag = resolveEffectiveTag(element, resolvedHost?.descriptor ?? null);
|
|
37790
37865
|
const tagName = tag ? tag.toLowerCase() : null;
|
|
37791
37866
|
out.set(element.id, {
|
|
37792
37867
|
element,
|
|
37793
37868
|
participates,
|
|
37794
37869
|
tag,
|
|
37795
37870
|
tagName,
|
|
37796
|
-
|
|
37871
|
+
resolvedHost
|
|
37797
37872
|
});
|
|
37798
37873
|
}
|
|
37799
37874
|
return out;
|
|
37800
37875
|
}
|
|
37801
|
-
function
|
|
37876
|
+
function resolveHostForElement(componentHostResolver, solidFile, element) {
|
|
37802
37877
|
if (element.tag === null) return null;
|
|
37803
37878
|
if (element.isDomElement) return null;
|
|
37804
37879
|
return componentHostResolver.resolveHost(solidFile, element.tag);
|
|
37805
37880
|
}
|
|
37806
|
-
function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element,
|
|
37881
|
+
function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
|
|
37807
37882
|
if (element.tag === null) return false;
|
|
37808
37883
|
if (element.isDomElement) return false;
|
|
37809
|
-
if (
|
|
37884
|
+
if (resolvedHost !== null) return false;
|
|
37810
37885
|
return componentHostResolver.isTransparentPrimitive(solidFile, element.tag);
|
|
37811
37886
|
}
|
|
37812
37887
|
function resolveEffectiveTag(element, hostDescriptor) {
|
|
@@ -37924,6 +37999,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37924
37999
|
const childrenByParentNodeMutable = /* @__PURE__ */ new Map();
|
|
37925
38000
|
const elementBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
|
|
37926
38001
|
const elementRefsBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
|
|
38002
|
+
const hostElementRefsByNodeMutable = /* @__PURE__ */ new Map();
|
|
37927
38003
|
const appliesByElementNodeMutable = /* @__PURE__ */ new Map();
|
|
37928
38004
|
const selectorsById = /* @__PURE__ */ new Map();
|
|
37929
38005
|
const monitoredDeclarationsBySelectorId = /* @__PURE__ */ new Map();
|
|
@@ -37960,7 +38036,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37960
38036
|
const moduleResolver = createLayoutModuleResolver(solids, css);
|
|
37961
38037
|
const componentHostResolver = createLayoutComponentHostResolver(solids, moduleResolver, logger);
|
|
37962
38038
|
const cssScopeBySolidFile = collectCSSScopeBySolidFile(solids, css, moduleResolver);
|
|
37963
|
-
if (logger.
|
|
38039
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
37964
38040
|
for (const [solidFile, scopePaths] of cssScopeBySolidFile) {
|
|
37965
38041
|
if (scopePaths.length > 0) {
|
|
37966
38042
|
let names = "";
|
|
@@ -38055,6 +38131,9 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
38055
38131
|
isControl: isControlTag(record.tagName),
|
|
38056
38132
|
isReplaced: isReplacedTag(record.tagName)
|
|
38057
38133
|
};
|
|
38134
|
+
if (record.hostElementRef !== null) {
|
|
38135
|
+
hostElementRefsByNodeMutable.set(node, record.hostElementRef);
|
|
38136
|
+
}
|
|
38058
38137
|
elements.push(node);
|
|
38059
38138
|
elementById.set(record.element.id, node);
|
|
38060
38139
|
nodeByElementId.set(record.element.id, node);
|
|
@@ -38076,7 +38155,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
38076
38155
|
}
|
|
38077
38156
|
}
|
|
38078
38157
|
}
|
|
38079
|
-
if (logger.
|
|
38158
|
+
if (logger.isLevelEnabled(Level.Debug)) {
|
|
38080
38159
|
for (const [file, roots] of rootElementsByFile) {
|
|
38081
38160
|
const descs = roots.map((r) => `${r.key}(tag=${r.tagName}, attrs=[${[...r.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}])`);
|
|
38082
38161
|
logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
|
|
@@ -38119,7 +38198,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
38119
38198
|
appliesByNode.set(node, edges);
|
|
38120
38199
|
}
|
|
38121
38200
|
perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
|
|
38122
|
-
if (logger.
|
|
38201
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
38123
38202
|
for (let i = 0; i < elements.length; i++) {
|
|
38124
38203
|
const node = elements[i];
|
|
38125
38204
|
if (!node) continue;
|
|
@@ -38175,6 +38254,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
38175
38254
|
childrenByParentNode: childrenByParentNodeMutable,
|
|
38176
38255
|
elementBySolidFileAndId: elementBySolidFileAndIdMutable,
|
|
38177
38256
|
elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
|
|
38257
|
+
hostElementRefsByNode: hostElementRefsByNodeMutable,
|
|
38178
38258
|
appliesByNode,
|
|
38179
38259
|
selectorCandidatesByNode,
|
|
38180
38260
|
selectorsById,
|
|
@@ -38575,7 +38655,7 @@ function computeFlowParticipationFact(snapshot) {
|
|
|
38575
38655
|
}
|
|
38576
38656
|
function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf, logger) {
|
|
38577
38657
|
const out = /* @__PURE__ */ new Map();
|
|
38578
|
-
const trace = logger.
|
|
38658
|
+
const trace = logger.isLevelEnabled(Level.Trace);
|
|
38579
38659
|
for (const [parent, children] of childrenByParentNode) {
|
|
38580
38660
|
if (children.length < 2) continue;
|
|
38581
38661
|
const snapshot = snapshotByElementNode.get(parent);
|
|
@@ -39394,7 +39474,7 @@ function runLayoutDetector(context, detector) {
|
|
|
39394
39474
|
result.evidence.posteriorLower,
|
|
39395
39475
|
result.evidence.posteriorUpper
|
|
39396
39476
|
);
|
|
39397
|
-
if (log.
|
|
39477
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39398
39478
|
log.debug(
|
|
39399
39479
|
`[${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("; ")}]`
|
|
39400
39480
|
);
|
|
@@ -39403,7 +39483,7 @@ function runLayoutDetector(context, detector) {
|
|
|
39403
39483
|
continue;
|
|
39404
39484
|
}
|
|
39405
39485
|
recordPolicyMetrics(context, result.evidenceMass, result.posteriorLower, result.posteriorUpper);
|
|
39406
|
-
if (log.
|
|
39486
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39407
39487
|
log.debug(
|
|
39408
39488
|
`[${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)}`
|
|
39409
39489
|
);
|
|
@@ -39936,13 +40016,39 @@ var INLINE_TOUCH_TARGET_KEYS = /* @__PURE__ */ new Set([
|
|
|
39936
40016
|
"height",
|
|
39937
40017
|
"min-height",
|
|
39938
40018
|
"width",
|
|
39939
|
-
"min-width"
|
|
39940
|
-
"padding-left",
|
|
39941
|
-
"padding-right",
|
|
39942
|
-
"padding-inline",
|
|
39943
|
-
"padding-inline-start",
|
|
39944
|
-
"padding-inline-end"
|
|
40019
|
+
"min-width"
|
|
39945
40020
|
]);
|
|
40021
|
+
var INTERACTIVE_HTML_TAGS = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "label", "summary"]);
|
|
40022
|
+
var INTERACTIVE_ARIA_ROLES = /* @__PURE__ */ new Set([
|
|
40023
|
+
"button",
|
|
40024
|
+
"link",
|
|
40025
|
+
"checkbox",
|
|
40026
|
+
"radio",
|
|
40027
|
+
"combobox",
|
|
40028
|
+
"listbox",
|
|
40029
|
+
"menuitem",
|
|
40030
|
+
"menuitemcheckbox",
|
|
40031
|
+
"menuitemradio",
|
|
40032
|
+
"option",
|
|
40033
|
+
"switch",
|
|
40034
|
+
"tab"
|
|
40035
|
+
]);
|
|
40036
|
+
function isInteractiveElement(solid, element, hostElementRef) {
|
|
40037
|
+
if (element.tagName !== null && INTERACTIVE_HTML_TAGS.has(element.tagName)) return true;
|
|
40038
|
+
const roleAttr = getJSXAttributeEntity(solid, element, "role");
|
|
40039
|
+
if (roleAttr !== null && roleAttr.valueNode !== null) {
|
|
40040
|
+
const role = getStaticStringFromJSXValue(roleAttr.valueNode);
|
|
40041
|
+
if (role !== null && INTERACTIVE_ARIA_ROLES.has(role)) return true;
|
|
40042
|
+
}
|
|
40043
|
+
if (hostElementRef !== null && hostElementRef.element.tagName !== null) {
|
|
40044
|
+
if (INTERACTIVE_HTML_TAGS.has(hostElementRef.element.tagName)) return true;
|
|
40045
|
+
}
|
|
40046
|
+
return false;
|
|
40047
|
+
}
|
|
40048
|
+
function readNodeHostElementRef(layout, solid, element) {
|
|
40049
|
+
const node = layout.elementBySolidFileAndId.get(solid.file)?.get(element.id) ?? null;
|
|
40050
|
+
return node !== null ? readHostElementRef(layout, node) : null;
|
|
40051
|
+
}
|
|
39946
40052
|
var jsxStylePolicy = defineCrossRule({
|
|
39947
40053
|
id: "jsx-style-policy",
|
|
39948
40054
|
severity: "warn",
|
|
@@ -39953,10 +40059,11 @@ var jsxStylePolicy = defineCrossRule({
|
|
|
39953
40059
|
category: "css-jsx"
|
|
39954
40060
|
},
|
|
39955
40061
|
check(context, emit) {
|
|
39956
|
-
const { solids } = context;
|
|
40062
|
+
const { solids, layout } = context;
|
|
39957
40063
|
const policy = getActivePolicy();
|
|
39958
|
-
|
|
39959
|
-
|
|
40064
|
+
if (policy === null) return;
|
|
40065
|
+
const name = getActivePolicyName() ?? "";
|
|
40066
|
+
forEachStylePropertyAcross(solids, (solid, p, element) => {
|
|
39960
40067
|
if (!import_typescript135.default.isPropertyAssignment(p)) return;
|
|
39961
40068
|
const key = objectKeyName(p.name);
|
|
39962
40069
|
if (!key) return;
|
|
@@ -40004,6 +40111,8 @@ var jsxStylePolicy = defineCrossRule({
|
|
|
40004
40111
|
return;
|
|
40005
40112
|
}
|
|
40006
40113
|
if (INLINE_TOUCH_TARGET_KEYS.has(normalizedKey)) {
|
|
40114
|
+
const hostRef = readNodeHostElementRef(layout, solid, element);
|
|
40115
|
+
if (!isInteractiveElement(solid, element, hostRef)) return;
|
|
40007
40116
|
const strVal = getStaticStringValue(p.initializer);
|
|
40008
40117
|
if (!strVal) return;
|
|
40009
40118
|
const px = parsePxValue(strVal);
|
|
@@ -40082,7 +40191,7 @@ var siblingAlignmentDetector = {
|
|
|
40082
40191
|
id: "sibling-alignment-outlier",
|
|
40083
40192
|
collect: collectAlignmentCases,
|
|
40084
40193
|
evaluate(input, context) {
|
|
40085
|
-
if (context.logger.
|
|
40194
|
+
if (context.logger.isLevelEnabled(Level.Trace)) {
|
|
40086
40195
|
const ctx = input.context;
|
|
40087
40196
|
context.logger.trace(
|
|
40088
40197
|
`[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}`
|
|
@@ -40131,7 +40240,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
40131
40240
|
const log = context.logger;
|
|
40132
40241
|
const detections = runLayoutDetector(context, siblingAlignmentDetector);
|
|
40133
40242
|
const uniqueDetections = dedupeDetectionsBySubject(detections);
|
|
40134
|
-
if (log.
|
|
40243
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
40135
40244
|
log.debug(
|
|
40136
40245
|
`[sibling-alignment] raw=${detections.length} deduped=${uniqueDetections.length}`
|
|
40137
40246
|
);
|
|
@@ -40145,7 +40254,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
40145
40254
|
const subjectId = detection.caseData.subject.elementId;
|
|
40146
40255
|
const logPrefix = `[sibling-alignment] <${subjectTag}> in <${parentTag}> (${subjectFile}#${subjectId})`;
|
|
40147
40256
|
if (detection.evidence.confidence < MIN_CONFIDENCE_THRESHOLD) {
|
|
40148
|
-
if (log.
|
|
40257
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
40149
40258
|
log.debug(
|
|
40150
40259
|
`${logPrefix} SKIP: confidence=${detection.evidence.confidence.toFixed(2)} < threshold=${MIN_CONFIDENCE_THRESHOLD}`
|
|
40151
40260
|
);
|
|
@@ -40154,7 +40263,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
40154
40263
|
}
|
|
40155
40264
|
const estimatedOffset = detection.evidence.estimatedOffsetPx;
|
|
40156
40265
|
if (estimatedOffset !== null && Math.abs(estimatedOffset) < MIN_OFFSET_PX_THRESHOLD && !hasNonOffsetPrimaryEvidence(detection.evidence.topFactors)) {
|
|
40157
|
-
if (log.
|
|
40266
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
40158
40267
|
log.debug(
|
|
40159
40268
|
`${logPrefix} SKIP: offset=${estimatedOffset.toFixed(2)}px < ${MIN_OFFSET_PX_THRESHOLD}px (no non-offset primary evidence, topFactors=[${detection.evidence.topFactors.join(",")}])`
|
|
40160
40269
|
);
|
|
@@ -40166,7 +40275,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
40166
40275
|
detection.caseData.cohort.parentElementKey,
|
|
40167
40276
|
detection.caseData.subject.solidFile
|
|
40168
40277
|
)) {
|
|
40169
|
-
if (log.
|
|
40278
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
40170
40279
|
log.debug(`${logPrefix} SKIP: out-of-flow ancestor`);
|
|
40171
40280
|
}
|
|
40172
40281
|
continue;
|
|
@@ -40177,7 +40286,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
40177
40286
|
detection.caseData.subject.elementId
|
|
40178
40287
|
);
|
|
40179
40288
|
if (!subjectRef) {
|
|
40180
|
-
if (log.
|
|
40289
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
40181
40290
|
log.debug(`${logPrefix} SKIP: no node ref`);
|
|
40182
40291
|
}
|
|
40183
40292
|
continue;
|
|
@@ -40193,7 +40302,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
40193
40302
|
const primaryFix = detection.evidence.primaryFix;
|
|
40194
40303
|
const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
|
|
40195
40304
|
const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
|
|
40196
|
-
if (log.
|
|
40305
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
40197
40306
|
log.debug(
|
|
40198
40307
|
`${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}]`
|
|
40199
40308
|
);
|
|
@@ -40602,7 +40711,8 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
|
|
|
40602
40711
|
const ref = readNodeRef(context.layout, node);
|
|
40603
40712
|
if (!ref) continue;
|
|
40604
40713
|
const reservedSpace = readReservedSpaceFact(context.layout, node);
|
|
40605
|
-
|
|
40714
|
+
const hostRef = readHostElementRef(context.layout, node);
|
|
40715
|
+
if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace, hostRef)) continue;
|
|
40606
40716
|
emit(
|
|
40607
40717
|
createDiagnostic(
|
|
40608
40718
|
ref.solid.file,
|
|
@@ -40617,15 +40727,17 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
|
|
|
40617
40727
|
}
|
|
40618
40728
|
}
|
|
40619
40729
|
});
|
|
40620
|
-
function hasReservedSize(solid, attributes, element, reservedSpaceFact) {
|
|
40730
|
+
function hasReservedSize(solid, attributes, element, reservedSpaceFact, hostElementRef) {
|
|
40621
40731
|
if (reservedSpaceFact.hasReservedSpace) return true;
|
|
40622
40732
|
const attrWidth = parsePositiveLength(attributes.get("width"));
|
|
40623
40733
|
const attrHeight = parsePositiveLength(attributes.get("height"));
|
|
40624
40734
|
const jsxAttrWidth = readPositiveJsxAttribute(solid, element, "width");
|
|
40625
40735
|
const jsxAttrHeight = readPositiveJsxAttribute(solid, element, "height");
|
|
40626
|
-
|
|
40627
|
-
const
|
|
40628
|
-
|
|
40736
|
+
const hostJsxWidth = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "width") : false;
|
|
40737
|
+
const hostJsxHeight = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "height") : false;
|
|
40738
|
+
if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight || hostJsxWidth && hostJsxHeight) return true;
|
|
40739
|
+
const hasAnyWidth = attrWidth || jsxAttrWidth || hostJsxWidth || reservedSpaceFact.hasUsableInlineDimension;
|
|
40740
|
+
const hasAnyHeight = attrHeight || jsxAttrHeight || hostJsxHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
|
|
40629
40741
|
if (reservedSpaceFact.hasUsableAspectRatio && (hasAnyWidth || hasAnyHeight)) return true;
|
|
40630
40742
|
if (reservedSpaceFact.hasContainIntrinsicSize && (hasAnyWidth || hasAnyHeight)) return true;
|
|
40631
40743
|
return false;
|