@drskillissue/ganko 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HIADOXXV.js → chunk-WY5MMHK2.js} +249 -84
- package/dist/chunk-WY5MMHK2.js.map +1 -0
- package/dist/eslint-plugin.cjs +243 -83
- package/dist/eslint-plugin.cjs.map +1 -1
- package/dist/eslint-plugin.js +1 -1
- package/dist/index.cjs +268 -104
- 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-HIADOXXV.js.map +0 -1
package/dist/eslint-plugin.cjs
CHANGED
|
@@ -142,9 +142,29 @@ function canonicalPath(path) {
|
|
|
142
142
|
return canonical;
|
|
143
143
|
}
|
|
144
144
|
var LOG_LEVELS = ["trace", "debug", "info", "warning", "error", "critical", "off"];
|
|
145
|
+
var Level = {
|
|
146
|
+
Trace: 0,
|
|
147
|
+
Debug: 1,
|
|
148
|
+
Info: 2,
|
|
149
|
+
Warning: 3,
|
|
150
|
+
Error: 4,
|
|
151
|
+
Critical: 5,
|
|
152
|
+
Off: 6
|
|
153
|
+
};
|
|
154
|
+
var LOG_LEVEL_ORDER = {
|
|
155
|
+
trace: Level.Trace,
|
|
156
|
+
debug: Level.Debug,
|
|
157
|
+
info: Level.Info,
|
|
158
|
+
warning: Level.Warning,
|
|
159
|
+
error: Level.Error,
|
|
160
|
+
critical: Level.Critical,
|
|
161
|
+
off: Level.Off
|
|
162
|
+
};
|
|
145
163
|
var noopLogger = {
|
|
146
|
-
enabled: false,
|
|
147
164
|
level: "off",
|
|
165
|
+
isLevelEnabled() {
|
|
166
|
+
return false;
|
|
167
|
+
},
|
|
148
168
|
trace() {
|
|
149
169
|
},
|
|
150
170
|
debug() {
|
|
@@ -2913,6 +2933,35 @@ var TypeResolver = class {
|
|
|
2913
2933
|
return false;
|
|
2914
2934
|
}
|
|
2915
2935
|
}
|
|
2936
|
+
/**
|
|
2937
|
+
* Strict array check: only matches Array<T>, T[], ReadonlyArray<T>, and tuples.
|
|
2938
|
+
* Does NOT match typed arrays (Uint8Array, Buffer, etc.) or other types with
|
|
2939
|
+
* a numeric index signature.
|
|
2940
|
+
*/
|
|
2941
|
+
isStrictArrayType(node) {
|
|
2942
|
+
try {
|
|
2943
|
+
const tsType = this.checker.getTypeAtLocation(node);
|
|
2944
|
+
return this.checkIsStrictArrayType(tsType);
|
|
2945
|
+
} catch {
|
|
2946
|
+
return false;
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
checkIsStrictArrayType(tsType) {
|
|
2950
|
+
if (tsType.flags & 524288) {
|
|
2951
|
+
const objFlags = getObjectFlags(tsType);
|
|
2952
|
+
if (objFlags & 8) return true;
|
|
2953
|
+
if (objFlags & 4) {
|
|
2954
|
+
const name = tsType.getSymbol()?.getName();
|
|
2955
|
+
if (name === "Array" || name === "ReadonlyArray") return true;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
if (tsType.isUnion()) {
|
|
2959
|
+
for (const t of tsType.types) {
|
|
2960
|
+
if (this.checkIsStrictArrayType(t)) return true;
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
return false;
|
|
2964
|
+
}
|
|
2916
2965
|
checkIsArrayType(tsType) {
|
|
2917
2966
|
if (tsType.flags & 524288) {
|
|
2918
2967
|
const objFlags = getObjectFlags(tsType);
|
|
@@ -2964,7 +3013,7 @@ var TypeResolver = class {
|
|
|
2964
3013
|
if (exprTsType.flags & import_typescript2.default.TypeFlags.Any) return false;
|
|
2965
3014
|
if (targetTsType.flags & import_typescript2.default.TypeFlags.Any) return false;
|
|
2966
3015
|
const result = this.checker.isTypeAssignableTo(exprTsType, targetTsType);
|
|
2967
|
-
if (this.logger.
|
|
3016
|
+
if (this.logger.isLevelEnabled(Level.Debug)) {
|
|
2968
3017
|
const exprStr = this.checker.typeToString(exprTsType);
|
|
2969
3018
|
const targetStr = this.checker.typeToString(targetTsType);
|
|
2970
3019
|
this.logger.debug(`isUnnecessaryCast: expr="${exprStr.slice(0, 120)}" target="${targetStr.slice(0, 120)}" assignable=${result} exprFlags=${exprTsType.flags} targetFlags=${targetTsType.flags}`);
|
|
@@ -9928,6 +9977,9 @@ function typeIncludesString(graph, node) {
|
|
|
9928
9977
|
function typeIsArray(graph, node) {
|
|
9929
9978
|
return graph.typeResolver.isArrayType(node);
|
|
9930
9979
|
}
|
|
9980
|
+
function typeIsStrictArray(graph, node) {
|
|
9981
|
+
return graph.typeResolver.isStrictArrayType(node);
|
|
9982
|
+
}
|
|
9931
9983
|
function getArrayElementKind(graph, node) {
|
|
9932
9984
|
return graph.typeResolver.getArrayElementKind(node);
|
|
9933
9985
|
}
|
|
@@ -19723,6 +19775,7 @@ var preferSetLookupInLoop = defineSolidRule({
|
|
|
19723
19775
|
options: options77,
|
|
19724
19776
|
check(graph, emit) {
|
|
19725
19777
|
const reported = /* @__PURE__ */ new Set();
|
|
19778
|
+
const graphHasTypes = hasTypeInfo(graph);
|
|
19726
19779
|
for (const method of LINEAR_SEARCH_METHODS) {
|
|
19727
19780
|
const calls = getCallsByMethodName(graph, method);
|
|
19728
19781
|
for (let i = 0, len = calls.length; i < len; i++) {
|
|
@@ -19740,6 +19793,7 @@ var preferSetLookupInLoop = defineSolidRule({
|
|
|
19740
19793
|
const loop = getEnclosingLoop(call.node);
|
|
19741
19794
|
if (!loop) continue;
|
|
19742
19795
|
if (!isDeclaredOutsideLoop2(loop, variable)) continue;
|
|
19796
|
+
if (graphHasTypes && !typeIsStrictArray(graph, callee.expression)) continue;
|
|
19743
19797
|
if (isStringLikeReceiver(graph, callee.expression, variable)) continue;
|
|
19744
19798
|
const key = `${loop.pos}:var:${variable.id}`;
|
|
19745
19799
|
if (reported.has(key)) continue;
|
|
@@ -28997,11 +29051,12 @@ var POLICIES = {
|
|
|
28997
29051
|
"dense-ui": DENSE_UI,
|
|
28998
29052
|
"large-text": LARGE_TEXT
|
|
28999
29053
|
};
|
|
29000
|
-
var activePolicyName =
|
|
29054
|
+
var activePolicyName = null;
|
|
29001
29055
|
function getActivePolicyName() {
|
|
29002
29056
|
return activePolicyName;
|
|
29003
29057
|
}
|
|
29004
29058
|
function getActivePolicy() {
|
|
29059
|
+
if (activePolicyName === null) return null;
|
|
29005
29060
|
return POLICIES[activePolicyName];
|
|
29006
29061
|
}
|
|
29007
29062
|
|
|
@@ -29320,7 +29375,8 @@ var cssPolicyContrast = defineCSSRule({
|
|
|
29320
29375
|
options: {},
|
|
29321
29376
|
check(graph, emit) {
|
|
29322
29377
|
const policy = getActivePolicy();
|
|
29323
|
-
|
|
29378
|
+
if (policy === null) return;
|
|
29379
|
+
const name = getActivePolicyName() ?? "";
|
|
29324
29380
|
const colorDecls = graph.declarationsByProperty.get("color");
|
|
29325
29381
|
if (!colorDecls) return;
|
|
29326
29382
|
const candidates = /* @__PURE__ */ new Set();
|
|
@@ -29397,7 +29453,8 @@ var cssPolicySpacing = defineCSSRule({
|
|
|
29397
29453
|
options: {},
|
|
29398
29454
|
check(graph, emit) {
|
|
29399
29455
|
const policy = getActivePolicy();
|
|
29400
|
-
|
|
29456
|
+
if (policy === null) return;
|
|
29457
|
+
const name = getActivePolicyName() ?? "";
|
|
29401
29458
|
const letterDecls = graph.declarationsByProperty.get("letter-spacing");
|
|
29402
29459
|
if (letterDecls) {
|
|
29403
29460
|
for (let i = 0; i < letterDecls.length; i++) {
|
|
@@ -29506,7 +29563,8 @@ var cssPolicyTouchTarget = defineCSSRule({
|
|
|
29506
29563
|
options: {},
|
|
29507
29564
|
check(graph, emit) {
|
|
29508
29565
|
const policy = getActivePolicy();
|
|
29509
|
-
|
|
29566
|
+
if (policy === null) return;
|
|
29567
|
+
const name = getActivePolicyName() ?? "";
|
|
29510
29568
|
const decls = graph.declarationsForProperties(
|
|
29511
29569
|
"height",
|
|
29512
29570
|
"min-height",
|
|
@@ -29665,7 +29723,8 @@ var cssPolicyTypography = defineCSSRule({
|
|
|
29665
29723
|
options: {},
|
|
29666
29724
|
check(graph, emit) {
|
|
29667
29725
|
const policy = getActivePolicy();
|
|
29668
|
-
|
|
29726
|
+
if (policy === null) return;
|
|
29727
|
+
const name = getActivePolicyName() ?? "";
|
|
29669
29728
|
const fontDecls = graph.declarationsByProperty.get("font-size");
|
|
29670
29729
|
if (fontDecls) {
|
|
29671
29730
|
for (let i = 0; i < fontDecls.length; i++) {
|
|
@@ -31007,6 +31066,9 @@ function readBaselineOffsetFacts(graph, node) {
|
|
|
31007
31066
|
function readElementRef(graph, node) {
|
|
31008
31067
|
return readElementRefById(graph, node.solidFile, node.elementId);
|
|
31009
31068
|
}
|
|
31069
|
+
function readHostElementRef(graph, node) {
|
|
31070
|
+
return graph.hostElementRefsByNode.get(node) ?? null;
|
|
31071
|
+
}
|
|
31010
31072
|
function readElementRefById(graph, solidFile, elementId) {
|
|
31011
31073
|
const refs = graph.elementRefsBySolidFileAndId.get(solidFile);
|
|
31012
31074
|
if (!refs) return null;
|
|
@@ -32072,7 +32134,7 @@ function publishLayoutPerfStatsForTest(stats) {
|
|
|
32072
32134
|
}
|
|
32073
32135
|
function maybeLogLayoutPerf(stats, log) {
|
|
32074
32136
|
if (process.env["SOLID_LINT_LAYOUT_PROFILE"] !== "1") return;
|
|
32075
|
-
if (!log || !log.
|
|
32137
|
+
if (!log || !log.isLevelEnabled(Level.Debug)) return;
|
|
32076
32138
|
const view = snapshotLayoutPerfStats(stats);
|
|
32077
32139
|
log.debug(
|
|
32078
32140
|
`[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}`
|
|
@@ -32137,17 +32199,17 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32137
32199
|
if (cached !== void 0) return cached;
|
|
32138
32200
|
const binding = resolveTagBinding(normalizedFile, tag);
|
|
32139
32201
|
if (binding === null) {
|
|
32140
|
-
if (logger.
|
|
32202
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
|
|
32141
32203
|
hostByTagCache.set(cacheKey, null);
|
|
32142
32204
|
return null;
|
|
32143
32205
|
}
|
|
32144
32206
|
if (binding.kind === "component") {
|
|
32145
|
-
if (logger.
|
|
32207
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.descriptor.tagName}, attrs=[${[...binding.host.descriptor.staticAttributes.keys()]}]`);
|
|
32146
32208
|
hostByTagCache.set(cacheKey, binding.host);
|
|
32147
32209
|
return binding.host;
|
|
32148
32210
|
}
|
|
32149
32211
|
const host = binding.base ? binding.base.host : null;
|
|
32150
|
-
if (logger.
|
|
32212
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.descriptor.tagName ?? "null"}`);
|
|
32151
32213
|
hostByTagCache.set(cacheKey, host);
|
|
32152
32214
|
return host;
|
|
32153
32215
|
},
|
|
@@ -32160,26 +32222,26 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32160
32222
|
}
|
|
32161
32223
|
};
|
|
32162
32224
|
function resolveComponentHostEntry(entry) {
|
|
32163
|
-
if (entry.resolution === "resolved")
|
|
32164
|
-
|
|
32225
|
+
if (entry.resolution === "resolved") {
|
|
32226
|
+
return { descriptor: entry.descriptor, hostElementRef: entry.hostElementRef };
|
|
32227
|
+
}
|
|
32228
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
|
|
32165
32229
|
const innerBinding = resolveLocalIdentifierBinding(entry.filePath, entry.innerTag);
|
|
32166
|
-
if (logger.
|
|
32230
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
|
|
32167
32231
|
const innerHost = extractHostFromBinding(innerBinding);
|
|
32168
|
-
if (logger.
|
|
32169
|
-
let tagName = innerHost !== null ? innerHost.tagName : null;
|
|
32232
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.descriptor.tagName}, attrs=[${[...innerHost.descriptor.staticAttributes.keys()]}]`}`);
|
|
32233
|
+
let tagName = innerHost !== null ? innerHost.descriptor.tagName : null;
|
|
32170
32234
|
if (tagName === null) {
|
|
32171
32235
|
tagName = resolveTagNameFromPolymorphicProp(entry.staticAttributes);
|
|
32172
|
-
if (logger.
|
|
32236
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
|
|
32173
32237
|
}
|
|
32174
|
-
const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.staticAttributes) : entry.staticAttributes;
|
|
32175
|
-
const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.staticClassTokens) : entry.staticClassTokens;
|
|
32176
|
-
const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.forwardsChildren;
|
|
32177
|
-
if (logger.
|
|
32238
|
+
const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
|
|
32239
|
+
const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
|
|
32240
|
+
const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
|
|
32241
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
|
|
32178
32242
|
return {
|
|
32179
|
-
tagName,
|
|
32180
|
-
|
|
32181
|
-
staticClassTokens,
|
|
32182
|
-
forwardsChildren
|
|
32243
|
+
descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
|
|
32244
|
+
hostElementRef: innerHost?.hostElementRef ?? null
|
|
32183
32245
|
};
|
|
32184
32246
|
}
|
|
32185
32247
|
function extractHostFromBinding(binding) {
|
|
@@ -32220,10 +32282,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32220
32282
|
if (hostEntry) {
|
|
32221
32283
|
const resolved = resolveComponentHostEntry(hostEntry);
|
|
32222
32284
|
if (resolved !== null) {
|
|
32223
|
-
const binding = {
|
|
32224
|
-
kind: "component",
|
|
32225
|
-
host: resolved
|
|
32226
|
-
};
|
|
32285
|
+
const binding = { kind: "component", host: resolved };
|
|
32227
32286
|
localBindingCache.set(key, binding);
|
|
32228
32287
|
resolvingLocal.delete(key);
|
|
32229
32288
|
return binding;
|
|
@@ -32284,7 +32343,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32284
32343
|
const baseExpression = toExpressionArgument(firstArg);
|
|
32285
32344
|
if (baseExpression === null) return null;
|
|
32286
32345
|
const baseBinding = resolveBindingFromExpression(filePath, baseExpression);
|
|
32287
|
-
if (logger.
|
|
32346
|
+
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}` : ""}`);
|
|
32288
32347
|
let baseComponent = null;
|
|
32289
32348
|
const members = /* @__PURE__ */ new Map();
|
|
32290
32349
|
if (baseBinding && baseBinding.kind === "component") {
|
|
@@ -32310,7 +32369,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32310
32369
|
if (!import_typescript125.default.isObjectLiteralExpression(argument)) continue;
|
|
32311
32370
|
appendObjectExpressionMembers(filePath, argument, members);
|
|
32312
32371
|
}
|
|
32313
|
-
if (logger.
|
|
32372
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.descriptor.tagName}`}, members=[${[...members.keys()]}]`);
|
|
32314
32373
|
if (baseComponent === null && members.size === 0) return null;
|
|
32315
32374
|
return {
|
|
32316
32375
|
kind: "namespace",
|
|
@@ -32352,7 +32411,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32352
32411
|
}
|
|
32353
32412
|
function resolveBindingFromImport(filePath, importBinding) {
|
|
32354
32413
|
const resolvedModule = moduleResolver.resolveSolid(filePath, importBinding.source) ?? resolveAndIndexExternalModule(filePath, importBinding.source);
|
|
32355
|
-
if (logger.
|
|
32414
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
|
|
32356
32415
|
if (resolvedModule === null) return null;
|
|
32357
32416
|
const normalized = (0, import_node_path3.resolve)(resolvedModule);
|
|
32358
32417
|
if (importBinding.kind === "namespace") {
|
|
@@ -32361,7 +32420,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
32361
32420
|
const exportName = importBinding.kind === "default" ? "default" : importBinding.importedName;
|
|
32362
32421
|
if (exportName === null) return null;
|
|
32363
32422
|
const result = resolveExportBinding(normalized, exportName);
|
|
32364
|
-
if (logger.
|
|
32423
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
|
|
32365
32424
|
return result;
|
|
32366
32425
|
}
|
|
32367
32426
|
function resolveAndIndexExternalModule(importerFile, importSource) {
|
|
@@ -32555,6 +32614,7 @@ function collectComponentHosts(graph) {
|
|
|
32555
32614
|
}
|
|
32556
32615
|
function resolveComponentHostEntryForFunction(graph, fn) {
|
|
32557
32616
|
let entry = null;
|
|
32617
|
+
let hostElementRefAgreed = true;
|
|
32558
32618
|
const bodyEntry = resolveHostEntryFromFunctionBody(graph, fn);
|
|
32559
32619
|
if (bodyEntry !== null) {
|
|
32560
32620
|
entry = bodyEntry;
|
|
@@ -32570,9 +32630,17 @@ function resolveComponentHostEntryForFunction(graph, fn) {
|
|
|
32570
32630
|
entry = returnEntry;
|
|
32571
32631
|
continue;
|
|
32572
32632
|
}
|
|
32573
|
-
if (areComponentHostEntriesEqual(entry, returnEntry))
|
|
32633
|
+
if (areComponentHostEntriesEqual(entry, returnEntry)) {
|
|
32634
|
+
if (hostElementRefAgreed && entry.resolution === "resolved" && returnEntry.resolution === "resolved" && entry.hostElementRef !== returnEntry.hostElementRef) {
|
|
32635
|
+
hostElementRefAgreed = false;
|
|
32636
|
+
}
|
|
32637
|
+
continue;
|
|
32638
|
+
}
|
|
32574
32639
|
return null;
|
|
32575
32640
|
}
|
|
32641
|
+
if (!hostElementRefAgreed && entry !== null && entry.resolution === "resolved") {
|
|
32642
|
+
return { resolution: "resolved", descriptor: entry.descriptor, hostElementRef: null };
|
|
32643
|
+
}
|
|
32576
32644
|
return entry;
|
|
32577
32645
|
}
|
|
32578
32646
|
function resolveHostEntryFromFunctionBody(graph, fn) {
|
|
@@ -32600,7 +32668,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
|
|
|
32600
32668
|
staticAttributes: collectStaticAttributes(element),
|
|
32601
32669
|
staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
|
|
32602
32670
|
forwardsChildren: detectChildrenForwarding(element)
|
|
32603
|
-
}
|
|
32671
|
+
},
|
|
32672
|
+
hostElementRef: { solid: graph, element }
|
|
32604
32673
|
};
|
|
32605
32674
|
}
|
|
32606
32675
|
if (isContextProviderTag(element.tag)) {
|
|
@@ -33310,7 +33379,7 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
|
|
|
33310
33379
|
ancestor = ancestor.parentElementNode;
|
|
33311
33380
|
}
|
|
33312
33381
|
if (fileRootElements !== null) {
|
|
33313
|
-
if (logger.
|
|
33382
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
33314
33383
|
const compoundDesc = describeCompound(targetCompound);
|
|
33315
33384
|
logger.trace(`[selector-match] fallback: node=${node.key} tag=${node.tagName} checking ${fileRootElements.length} roots for compound=${compoundDesc}`);
|
|
33316
33385
|
}
|
|
@@ -33321,11 +33390,11 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
|
|
|
33321
33390
|
if (root.solidFile !== node.solidFile) continue;
|
|
33322
33391
|
perf.ancestryChecks++;
|
|
33323
33392
|
const compoundResult = matchesCompound(root, targetCompound);
|
|
33324
|
-
if (logger.
|
|
33393
|
+
if (logger.isLevelEnabled(Level.Trace) && compoundResult === "no-match") {
|
|
33325
33394
|
logger.trace(`[selector-match] fallback MISS: root=${root.key} tag=${root.tagName} attrs=[${[...root.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}]`);
|
|
33326
33395
|
}
|
|
33327
33396
|
if (compoundResult !== "no-match") {
|
|
33328
|
-
if (logger.
|
|
33397
|
+
if (logger.isLevelEnabled(Level.Debug)) {
|
|
33329
33398
|
const compoundDesc = describeCompound(targetCompound);
|
|
33330
33399
|
logger.debug(`[selector-match] fallback HIT: node=${node.key} tag=${node.tagName} matched root=${root.key} tag=${root.tagName} compound=${compoundDesc} isFinal=${isFinal}`);
|
|
33331
33400
|
}
|
|
@@ -36527,7 +36596,7 @@ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, app
|
|
|
36527
36596
|
};
|
|
36528
36597
|
applies.push(edge);
|
|
36529
36598
|
ctx.perf.matchEdgesCreated++;
|
|
36530
|
-
if (ctx.logger.
|
|
36599
|
+
if (ctx.logger.isLevelEnabled(Level.Trace)) {
|
|
36531
36600
|
ctx.logger.trace(
|
|
36532
36601
|
`[cascade] edge node=${node.key} selector=${selector.id} match=${matchResult} conditional=${edge.conditionalMatch} selector-raw=${selector.raw.slice(0, 80)}`
|
|
36533
36602
|
);
|
|
@@ -36678,7 +36747,7 @@ function resolveRuleLayerOrder(rule, css) {
|
|
|
36678
36747
|
if (!name) return 0;
|
|
36679
36748
|
return css.layerOrder.get(name) ?? 0;
|
|
36680
36749
|
}
|
|
36681
|
-
function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
|
|
36750
|
+
function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId, selectorsById) {
|
|
36682
36751
|
const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
|
|
36683
36752
|
const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
|
|
36684
36753
|
const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
|
|
@@ -36689,11 +36758,16 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
|
|
|
36689
36758
|
let factByProperty = null;
|
|
36690
36759
|
if (edges !== void 0 && edges.length > 0) {
|
|
36691
36760
|
const byProperty = /* @__PURE__ */ new Map();
|
|
36761
|
+
let conditionalAttributeDispatch = null;
|
|
36692
36762
|
for (let j = 0; j < edges.length; j++) {
|
|
36693
36763
|
const currentEdge = edges[j];
|
|
36694
36764
|
if (!currentEdge) continue;
|
|
36695
36765
|
const declarations = monitoredDeclarationsBySelectorId.get(currentEdge.selectorId);
|
|
36696
36766
|
if (!declarations) continue;
|
|
36767
|
+
let conditionalAttributeName = null;
|
|
36768
|
+
if (currentEdge.conditionalMatch) {
|
|
36769
|
+
conditionalAttributeName = identifyConditionalAttribute(currentEdge.selectorId, node, selectorsById);
|
|
36770
|
+
}
|
|
36697
36771
|
for (let k = 0; k < declarations.length; k++) {
|
|
36698
36772
|
const declaration = declarations[k];
|
|
36699
36773
|
if (!declaration) continue;
|
|
@@ -36712,6 +36786,15 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
|
|
|
36712
36786
|
}
|
|
36713
36787
|
if (declaration.guardProvenance.kind === 1 /* Conditional */ || currentEdge.conditionalMatch) {
|
|
36714
36788
|
bucket.conditional.add(expandedEntry.value);
|
|
36789
|
+
if (conditionalAttributeName !== null && declaration.guardProvenance.kind !== 1 /* Conditional */) {
|
|
36790
|
+
if (conditionalAttributeDispatch === null) conditionalAttributeDispatch = /* @__PURE__ */ new Map();
|
|
36791
|
+
let dispatchMap = conditionalAttributeDispatch.get(property);
|
|
36792
|
+
if (!dispatchMap) {
|
|
36793
|
+
dispatchMap = /* @__PURE__ */ new Map();
|
|
36794
|
+
conditionalAttributeDispatch.set(property, dispatchMap);
|
|
36795
|
+
}
|
|
36796
|
+
dispatchMap.set(expandedEntry.value, conditionalAttributeName);
|
|
36797
|
+
}
|
|
36715
36798
|
continue;
|
|
36716
36799
|
}
|
|
36717
36800
|
bucket.unconditional.add(expandedEntry.value);
|
|
@@ -36736,6 +36819,24 @@ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclaratio
|
|
|
36736
36819
|
}
|
|
36737
36820
|
}
|
|
36738
36821
|
}
|
|
36822
|
+
if (hasDelta && conditionalAttributeDispatch !== null) {
|
|
36823
|
+
const dispatchMap = conditionalAttributeDispatch.get(property);
|
|
36824
|
+
if (dispatchMap !== void 0 && dispatchMap.size === conditionalValues.length) {
|
|
36825
|
+
let singleAttribute = null;
|
|
36826
|
+
let allSameAttribute = true;
|
|
36827
|
+
for (const attrName of dispatchMap.values()) {
|
|
36828
|
+
if (singleAttribute === null) {
|
|
36829
|
+
singleAttribute = attrName;
|
|
36830
|
+
} else if (singleAttribute !== attrName) {
|
|
36831
|
+
allSameAttribute = false;
|
|
36832
|
+
break;
|
|
36833
|
+
}
|
|
36834
|
+
}
|
|
36835
|
+
if (allSameAttribute && singleAttribute !== null) {
|
|
36836
|
+
hasDelta = false;
|
|
36837
|
+
}
|
|
36838
|
+
}
|
|
36839
|
+
}
|
|
36739
36840
|
const scrollProfile = buildScrollValueProfile(property, conditionalValues, unconditionalValues);
|
|
36740
36841
|
facts.set(property, {
|
|
36741
36842
|
hasConditional,
|
|
@@ -36821,6 +36922,25 @@ function buildConditionalDeltaSignalGroupElements(elementsWithConditionalDeltaBy
|
|
|
36821
36922
|
}
|
|
36822
36923
|
return out;
|
|
36823
36924
|
}
|
|
36925
|
+
function identifyConditionalAttribute(selectorId, node, selectorsById) {
|
|
36926
|
+
const selector = selectorsById.get(selectorId);
|
|
36927
|
+
if (!selector) return null;
|
|
36928
|
+
const constraints = selector.anchor.attributes;
|
|
36929
|
+
let dynamicAttributeName = null;
|
|
36930
|
+
for (let i = 0; i < constraints.length; i++) {
|
|
36931
|
+
const constraint = constraints[i];
|
|
36932
|
+
if (!constraint) continue;
|
|
36933
|
+
if (constraint.operator !== "equals") continue;
|
|
36934
|
+
if (constraint.value === null) continue;
|
|
36935
|
+
const elementValue = node.attributes.get(constraint.name);
|
|
36936
|
+
if (elementValue !== null) continue;
|
|
36937
|
+
if (dynamicAttributeName !== null && dynamicAttributeName !== constraint.name) {
|
|
36938
|
+
return null;
|
|
36939
|
+
}
|
|
36940
|
+
dynamicAttributeName = constraint.name;
|
|
36941
|
+
}
|
|
36942
|
+
return dynamicAttributeName;
|
|
36943
|
+
}
|
|
36824
36944
|
function buildScrollValueProfile(property, conditionalValues, unconditionalValues) {
|
|
36825
36945
|
if (property !== "overflow" && property !== "overflow-y") {
|
|
36826
36946
|
return {
|
|
@@ -36919,7 +37039,7 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
36919
37039
|
if (!child) continue;
|
|
36920
37040
|
if (child.kind === "expression") {
|
|
36921
37041
|
if (isStructuralExpression(child.node)) {
|
|
36922
|
-
if (logger.
|
|
37042
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
|
|
36923
37043
|
memo.set(element.id, 2 /* Unknown */);
|
|
36924
37044
|
return 2 /* Unknown */;
|
|
36925
37045
|
}
|
|
@@ -36941,11 +37061,11 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
36941
37061
|
if (!child.isDomElement) {
|
|
36942
37062
|
const childMeta = compositionMetaByElementId.get(child.id);
|
|
36943
37063
|
if (childMeta !== void 0 && isControlTag(childMeta.tagName)) {
|
|
36944
|
-
if (logger.
|
|
37064
|
+
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`);
|
|
36945
37065
|
continue;
|
|
36946
37066
|
}
|
|
36947
37067
|
if (childState !== 1 /* No */) {
|
|
36948
|
-
if (logger.
|
|
37068
|
+
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`);
|
|
36949
37069
|
childHasUnknown = true;
|
|
36950
37070
|
}
|
|
36951
37071
|
continue;
|
|
@@ -36958,12 +37078,12 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
36958
37078
|
if (childState === 3 /* DynamicText */) childHasDynamicText = true;
|
|
36959
37079
|
}
|
|
36960
37080
|
if (childHasUnknown) {
|
|
36961
|
-
if (logger.
|
|
37081
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
|
|
36962
37082
|
memo.set(element.id, 2 /* Unknown */);
|
|
36963
37083
|
return 2 /* Unknown */;
|
|
36964
37084
|
}
|
|
36965
37085
|
if (hasTextOnlyExpression || childHasDynamicText) {
|
|
36966
|
-
if (logger.
|
|
37086
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
|
|
36967
37087
|
memo.set(element.id, 3 /* DynamicText */);
|
|
36968
37088
|
return 3 /* DynamicText */;
|
|
36969
37089
|
}
|
|
@@ -36985,15 +37105,16 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
|
|
|
36985
37105
|
const meta = compositionMetaByElementId.get(element.id);
|
|
36986
37106
|
if (!meta || !meta.participates) continue;
|
|
36987
37107
|
const localClassTokens = selectorRequirements.needsClassTokens ? getStaticClassTokensForElementEntity(solid, element) : EMPTY_STRING_LIST3;
|
|
36988
|
-
const classTokens = mergeClassTokens(localClassTokens, meta.
|
|
37108
|
+
const classTokens = mergeClassTokens(localClassTokens, meta.resolvedHost?.descriptor.staticClassTokens);
|
|
36989
37109
|
const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
|
|
36990
37110
|
const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
|
|
36991
37111
|
const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
|
|
36992
|
-
const attributes = mergeAttributes(localAttributes, meta.
|
|
37112
|
+
const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
|
|
36993
37113
|
const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
|
|
36994
37114
|
const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
|
|
36995
37115
|
const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
|
|
36996
37116
|
const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId);
|
|
37117
|
+
const hostElementRef = meta.resolvedHost?.hostElementRef ?? null;
|
|
36997
37118
|
out.push({
|
|
36998
37119
|
element,
|
|
36999
37120
|
key: toLayoutElementKey(solid.file, element.id),
|
|
@@ -37006,7 +37127,8 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
|
|
|
37006
37127
|
selectorDispatchKeys,
|
|
37007
37128
|
inlineStyleValues,
|
|
37008
37129
|
textualContent,
|
|
37009
|
-
parentElementId
|
|
37130
|
+
parentElementId,
|
|
37131
|
+
hostElementRef
|
|
37010
37132
|
});
|
|
37011
37133
|
}
|
|
37012
37134
|
return out;
|
|
@@ -37016,7 +37138,7 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
|
|
|
37016
37138
|
for (let i = 0; i < solid.jsxElements.length; i++) {
|
|
37017
37139
|
const element = solid.jsxElements[i];
|
|
37018
37140
|
if (!element) continue;
|
|
37019
|
-
const
|
|
37141
|
+
const resolvedHost = resolveHostForElement(
|
|
37020
37142
|
componentHostResolver,
|
|
37021
37143
|
solid.file,
|
|
37022
37144
|
element
|
|
@@ -37025,30 +37147,30 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
|
|
|
37025
37147
|
componentHostResolver,
|
|
37026
37148
|
solid.file,
|
|
37027
37149
|
element,
|
|
37028
|
-
|
|
37150
|
+
resolvedHost
|
|
37029
37151
|
);
|
|
37030
37152
|
const participates = element.tag !== null && !isTransparentPrimitive;
|
|
37031
|
-
const tag = resolveEffectiveTag(element,
|
|
37153
|
+
const tag = resolveEffectiveTag(element, resolvedHost?.descriptor ?? null);
|
|
37032
37154
|
const tagName = tag ? tag.toLowerCase() : null;
|
|
37033
37155
|
out.set(element.id, {
|
|
37034
37156
|
element,
|
|
37035
37157
|
participates,
|
|
37036
37158
|
tag,
|
|
37037
37159
|
tagName,
|
|
37038
|
-
|
|
37160
|
+
resolvedHost
|
|
37039
37161
|
});
|
|
37040
37162
|
}
|
|
37041
37163
|
return out;
|
|
37042
37164
|
}
|
|
37043
|
-
function
|
|
37165
|
+
function resolveHostForElement(componentHostResolver, solidFile, element) {
|
|
37044
37166
|
if (element.tag === null) return null;
|
|
37045
37167
|
if (element.isDomElement) return null;
|
|
37046
37168
|
return componentHostResolver.resolveHost(solidFile, element.tag);
|
|
37047
37169
|
}
|
|
37048
|
-
function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element,
|
|
37170
|
+
function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
|
|
37049
37171
|
if (element.tag === null) return false;
|
|
37050
37172
|
if (element.isDomElement) return false;
|
|
37051
|
-
if (
|
|
37173
|
+
if (resolvedHost !== null) return false;
|
|
37052
37174
|
return componentHostResolver.isTransparentPrimitive(solidFile, element.tag);
|
|
37053
37175
|
}
|
|
37054
37176
|
function resolveEffectiveTag(element, hostDescriptor) {
|
|
@@ -37166,6 +37288,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37166
37288
|
const childrenByParentNodeMutable = /* @__PURE__ */ new Map();
|
|
37167
37289
|
const elementBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
|
|
37168
37290
|
const elementRefsBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
|
|
37291
|
+
const hostElementRefsByNodeMutable = /* @__PURE__ */ new Map();
|
|
37169
37292
|
const appliesByElementNodeMutable = /* @__PURE__ */ new Map();
|
|
37170
37293
|
const selectorsById = /* @__PURE__ */ new Map();
|
|
37171
37294
|
const monitoredDeclarationsBySelectorId = /* @__PURE__ */ new Map();
|
|
@@ -37202,7 +37325,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37202
37325
|
const moduleResolver = createLayoutModuleResolver(solids, css);
|
|
37203
37326
|
const componentHostResolver = createLayoutComponentHostResolver(solids, moduleResolver, logger);
|
|
37204
37327
|
const cssScopeBySolidFile = collectCSSScopeBySolidFile(solids, css, moduleResolver);
|
|
37205
|
-
if (logger.
|
|
37328
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
37206
37329
|
for (const [solidFile, scopePaths] of cssScopeBySolidFile) {
|
|
37207
37330
|
if (scopePaths.length > 0) {
|
|
37208
37331
|
let names = "";
|
|
@@ -37297,6 +37420,9 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37297
37420
|
isControl: isControlTag(record.tagName),
|
|
37298
37421
|
isReplaced: isReplacedTag(record.tagName)
|
|
37299
37422
|
};
|
|
37423
|
+
if (record.hostElementRef !== null) {
|
|
37424
|
+
hostElementRefsByNodeMutable.set(node, record.hostElementRef);
|
|
37425
|
+
}
|
|
37300
37426
|
elements.push(node);
|
|
37301
37427
|
elementById.set(record.element.id, node);
|
|
37302
37428
|
nodeByElementId.set(record.element.id, node);
|
|
@@ -37318,7 +37444,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37318
37444
|
}
|
|
37319
37445
|
}
|
|
37320
37446
|
}
|
|
37321
|
-
if (logger.
|
|
37447
|
+
if (logger.isLevelEnabled(Level.Debug)) {
|
|
37322
37448
|
for (const [file, roots] of rootElementsByFile) {
|
|
37323
37449
|
const descs = roots.map((r) => `${r.key}(tag=${r.tagName}, attrs=[${[...r.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}])`);
|
|
37324
37450
|
logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
|
|
@@ -37361,7 +37487,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37361
37487
|
appliesByNode.set(node, edges);
|
|
37362
37488
|
}
|
|
37363
37489
|
perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
|
|
37364
|
-
if (logger.
|
|
37490
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
37365
37491
|
for (let i = 0; i < elements.length; i++) {
|
|
37366
37492
|
const node = elements[i];
|
|
37367
37493
|
if (!node) continue;
|
|
@@ -37383,7 +37509,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37383
37509
|
const conditionalDeltaIndex = buildConditionalDeltaIndex(
|
|
37384
37510
|
elements,
|
|
37385
37511
|
appliesByNode,
|
|
37386
|
-
monitoredDeclarationsBySelectorId
|
|
37512
|
+
monitoredDeclarationsBySelectorId,
|
|
37513
|
+
selectorsById
|
|
37387
37514
|
);
|
|
37388
37515
|
const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
|
|
37389
37516
|
conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
|
|
@@ -37416,6 +37543,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37416
37543
|
childrenByParentNode: childrenByParentNodeMutable,
|
|
37417
37544
|
elementBySolidFileAndId: elementBySolidFileAndIdMutable,
|
|
37418
37545
|
elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
|
|
37546
|
+
hostElementRefsByNode: hostElementRefsByNodeMutable,
|
|
37419
37547
|
appliesByNode,
|
|
37420
37548
|
selectorCandidatesByNode,
|
|
37421
37549
|
selectorsById,
|
|
@@ -37816,7 +37944,7 @@ function computeFlowParticipationFact(snapshot) {
|
|
|
37816
37944
|
}
|
|
37817
37945
|
function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf, logger) {
|
|
37818
37946
|
const out = /* @__PURE__ */ new Map();
|
|
37819
|
-
const trace = logger.
|
|
37947
|
+
const trace = logger.isLevelEnabled(Level.Trace);
|
|
37820
37948
|
for (const [parent, children] of childrenByParentNode) {
|
|
37821
37949
|
if (children.length < 2) continue;
|
|
37822
37950
|
const snapshot = snapshotByElementNode.get(parent);
|
|
@@ -38635,7 +38763,7 @@ function runLayoutDetector(context, detector) {
|
|
|
38635
38763
|
result.evidence.posteriorLower,
|
|
38636
38764
|
result.evidence.posteriorUpper
|
|
38637
38765
|
);
|
|
38638
|
-
if (log.
|
|
38766
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
38639
38767
|
log.debug(
|
|
38640
38768
|
`[${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("; ")}]`
|
|
38641
38769
|
);
|
|
@@ -38644,7 +38772,7 @@ function runLayoutDetector(context, detector) {
|
|
|
38644
38772
|
continue;
|
|
38645
38773
|
}
|
|
38646
38774
|
recordPolicyMetrics(context, result.evidenceMass, result.posteriorLower, result.posteriorUpper);
|
|
38647
|
-
if (log.
|
|
38775
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
38648
38776
|
log.debug(
|
|
38649
38777
|
`[${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)}`
|
|
38650
38778
|
);
|
|
@@ -39272,13 +39400,39 @@ var INLINE_TOUCH_TARGET_KEYS = /* @__PURE__ */ new Set([
|
|
|
39272
39400
|
"height",
|
|
39273
39401
|
"min-height",
|
|
39274
39402
|
"width",
|
|
39275
|
-
"min-width"
|
|
39276
|
-
|
|
39277
|
-
|
|
39278
|
-
|
|
39279
|
-
"
|
|
39280
|
-
"
|
|
39403
|
+
"min-width"
|
|
39404
|
+
]);
|
|
39405
|
+
var INTERACTIVE_HTML_TAGS = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "label", "summary"]);
|
|
39406
|
+
var INTERACTIVE_ARIA_ROLES = /* @__PURE__ */ new Set([
|
|
39407
|
+
"button",
|
|
39408
|
+
"link",
|
|
39409
|
+
"checkbox",
|
|
39410
|
+
"radio",
|
|
39411
|
+
"combobox",
|
|
39412
|
+
"listbox",
|
|
39413
|
+
"menuitem",
|
|
39414
|
+
"menuitemcheckbox",
|
|
39415
|
+
"menuitemradio",
|
|
39416
|
+
"option",
|
|
39417
|
+
"switch",
|
|
39418
|
+
"tab"
|
|
39281
39419
|
]);
|
|
39420
|
+
function isInteractiveElement(solid, element, hostElementRef) {
|
|
39421
|
+
if (element.tagName !== null && INTERACTIVE_HTML_TAGS.has(element.tagName)) return true;
|
|
39422
|
+
const roleAttr = getJSXAttributeEntity(solid, element, "role");
|
|
39423
|
+
if (roleAttr !== null && roleAttr.valueNode !== null) {
|
|
39424
|
+
const role = getStaticStringFromJSXValue(roleAttr.valueNode);
|
|
39425
|
+
if (role !== null && INTERACTIVE_ARIA_ROLES.has(role)) return true;
|
|
39426
|
+
}
|
|
39427
|
+
if (hostElementRef !== null && hostElementRef.element.tagName !== null) {
|
|
39428
|
+
if (INTERACTIVE_HTML_TAGS.has(hostElementRef.element.tagName)) return true;
|
|
39429
|
+
}
|
|
39430
|
+
return false;
|
|
39431
|
+
}
|
|
39432
|
+
function readNodeHostElementRef(layout, solid, element) {
|
|
39433
|
+
const node = layout.elementBySolidFileAndId.get(solid.file)?.get(element.id) ?? null;
|
|
39434
|
+
return node !== null ? readHostElementRef(layout, node) : null;
|
|
39435
|
+
}
|
|
39282
39436
|
var jsxStylePolicy = defineCrossRule({
|
|
39283
39437
|
id: "jsx-style-policy",
|
|
39284
39438
|
severity: "warn",
|
|
@@ -39289,10 +39443,11 @@ var jsxStylePolicy = defineCrossRule({
|
|
|
39289
39443
|
category: "css-jsx"
|
|
39290
39444
|
},
|
|
39291
39445
|
check(context, emit) {
|
|
39292
|
-
const { solids } = context;
|
|
39446
|
+
const { solids, layout } = context;
|
|
39293
39447
|
const policy = getActivePolicy();
|
|
39294
|
-
|
|
39295
|
-
|
|
39448
|
+
if (policy === null) return;
|
|
39449
|
+
const name = getActivePolicyName() ?? "";
|
|
39450
|
+
forEachStylePropertyAcross(solids, (solid, p, element) => {
|
|
39296
39451
|
if (!import_typescript135.default.isPropertyAssignment(p)) return;
|
|
39297
39452
|
const key = objectKeyName(p.name);
|
|
39298
39453
|
if (!key) return;
|
|
@@ -39340,6 +39495,8 @@ var jsxStylePolicy = defineCrossRule({
|
|
|
39340
39495
|
return;
|
|
39341
39496
|
}
|
|
39342
39497
|
if (INLINE_TOUCH_TARGET_KEYS.has(normalizedKey)) {
|
|
39498
|
+
const hostRef = readNodeHostElementRef(layout, solid, element);
|
|
39499
|
+
if (!isInteractiveElement(solid, element, hostRef)) return;
|
|
39343
39500
|
const strVal = getStaticStringValue(p.initializer);
|
|
39344
39501
|
if (!strVal) return;
|
|
39345
39502
|
const px = parsePxValue(strVal);
|
|
@@ -39418,7 +39575,7 @@ var siblingAlignmentDetector = {
|
|
|
39418
39575
|
id: "sibling-alignment-outlier",
|
|
39419
39576
|
collect: collectAlignmentCases,
|
|
39420
39577
|
evaluate(input, context) {
|
|
39421
|
-
if (context.logger.
|
|
39578
|
+
if (context.logger.isLevelEnabled(Level.Trace)) {
|
|
39422
39579
|
const ctx = input.context;
|
|
39423
39580
|
context.logger.trace(
|
|
39424
39581
|
`[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}`
|
|
@@ -39467,7 +39624,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39467
39624
|
const log = context.logger;
|
|
39468
39625
|
const detections = runLayoutDetector(context, siblingAlignmentDetector);
|
|
39469
39626
|
const uniqueDetections = dedupeDetectionsBySubject(detections);
|
|
39470
|
-
if (log.
|
|
39627
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39471
39628
|
log.debug(
|
|
39472
39629
|
`[sibling-alignment] raw=${detections.length} deduped=${uniqueDetections.length}`
|
|
39473
39630
|
);
|
|
@@ -39481,7 +39638,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39481
39638
|
const subjectId = detection.caseData.subject.elementId;
|
|
39482
39639
|
const logPrefix = `[sibling-alignment] <${subjectTag}> in <${parentTag}> (${subjectFile}#${subjectId})`;
|
|
39483
39640
|
if (detection.evidence.confidence < MIN_CONFIDENCE_THRESHOLD) {
|
|
39484
|
-
if (log.
|
|
39641
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39485
39642
|
log.debug(
|
|
39486
39643
|
`${logPrefix} SKIP: confidence=${detection.evidence.confidence.toFixed(2)} < threshold=${MIN_CONFIDENCE_THRESHOLD}`
|
|
39487
39644
|
);
|
|
@@ -39490,7 +39647,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39490
39647
|
}
|
|
39491
39648
|
const estimatedOffset = detection.evidence.estimatedOffsetPx;
|
|
39492
39649
|
if (estimatedOffset !== null && Math.abs(estimatedOffset) < MIN_OFFSET_PX_THRESHOLD && !hasNonOffsetPrimaryEvidence(detection.evidence.topFactors)) {
|
|
39493
|
-
if (log.
|
|
39650
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39494
39651
|
log.debug(
|
|
39495
39652
|
`${logPrefix} SKIP: offset=${estimatedOffset.toFixed(2)}px < ${MIN_OFFSET_PX_THRESHOLD}px (no non-offset primary evidence, topFactors=[${detection.evidence.topFactors.join(",")}])`
|
|
39496
39653
|
);
|
|
@@ -39502,7 +39659,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39502
39659
|
detection.caseData.cohort.parentElementKey,
|
|
39503
39660
|
detection.caseData.subject.solidFile
|
|
39504
39661
|
)) {
|
|
39505
|
-
if (log.
|
|
39662
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39506
39663
|
log.debug(`${logPrefix} SKIP: out-of-flow ancestor`);
|
|
39507
39664
|
}
|
|
39508
39665
|
continue;
|
|
@@ -39513,7 +39670,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39513
39670
|
detection.caseData.subject.elementId
|
|
39514
39671
|
);
|
|
39515
39672
|
if (!subjectRef) {
|
|
39516
|
-
if (log.
|
|
39673
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39517
39674
|
log.debug(`${logPrefix} SKIP: no node ref`);
|
|
39518
39675
|
}
|
|
39519
39676
|
continue;
|
|
@@ -39529,7 +39686,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39529
39686
|
const primaryFix = detection.evidence.primaryFix;
|
|
39530
39687
|
const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
|
|
39531
39688
|
const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
|
|
39532
|
-
if (log.
|
|
39689
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39533
39690
|
log.debug(
|
|
39534
39691
|
`${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}]`
|
|
39535
39692
|
);
|
|
@@ -39938,7 +40095,8 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
|
|
|
39938
40095
|
const ref = readNodeRef(context.layout, node);
|
|
39939
40096
|
if (!ref) continue;
|
|
39940
40097
|
const reservedSpace = readReservedSpaceFact(context.layout, node);
|
|
39941
|
-
|
|
40098
|
+
const hostRef = readHostElementRef(context.layout, node);
|
|
40099
|
+
if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace, hostRef)) continue;
|
|
39942
40100
|
emit(
|
|
39943
40101
|
createDiagnostic(
|
|
39944
40102
|
ref.solid.file,
|
|
@@ -39953,15 +40111,17 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
|
|
|
39953
40111
|
}
|
|
39954
40112
|
}
|
|
39955
40113
|
});
|
|
39956
|
-
function hasReservedSize(solid, attributes, element, reservedSpaceFact) {
|
|
40114
|
+
function hasReservedSize(solid, attributes, element, reservedSpaceFact, hostElementRef) {
|
|
39957
40115
|
if (reservedSpaceFact.hasReservedSpace) return true;
|
|
39958
40116
|
const attrWidth = parsePositiveLength(attributes.get("width"));
|
|
39959
40117
|
const attrHeight = parsePositiveLength(attributes.get("height"));
|
|
39960
40118
|
const jsxAttrWidth = readPositiveJsxAttribute(solid, element, "width");
|
|
39961
40119
|
const jsxAttrHeight = readPositiveJsxAttribute(solid, element, "height");
|
|
39962
|
-
|
|
39963
|
-
const
|
|
39964
|
-
|
|
40120
|
+
const hostJsxWidth = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "width") : false;
|
|
40121
|
+
const hostJsxHeight = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "height") : false;
|
|
40122
|
+
if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight || hostJsxWidth && hostJsxHeight) return true;
|
|
40123
|
+
const hasAnyWidth = attrWidth || jsxAttrWidth || hostJsxWidth || reservedSpaceFact.hasUsableInlineDimension;
|
|
40124
|
+
const hasAnyHeight = attrHeight || jsxAttrHeight || hostJsxHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
|
|
39965
40125
|
if (reservedSpaceFact.hasUsableAspectRatio && (hasAnyWidth || hasAnyHeight)) return true;
|
|
39966
40126
|
if (reservedSpaceFact.hasContainIntrinsicSize && (hasAnyWidth || hasAnyHeight)) return true;
|
|
39967
40127
|
return false;
|