@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
|
@@ -67,9 +67,29 @@ function canonicalPath(path) {
|
|
|
67
67
|
return canonical;
|
|
68
68
|
}
|
|
69
69
|
var LOG_LEVELS = ["trace", "debug", "info", "warning", "error", "critical", "off"];
|
|
70
|
+
var Level = {
|
|
71
|
+
Trace: 0,
|
|
72
|
+
Debug: 1,
|
|
73
|
+
Info: 2,
|
|
74
|
+
Warning: 3,
|
|
75
|
+
Error: 4,
|
|
76
|
+
Critical: 5,
|
|
77
|
+
Off: 6
|
|
78
|
+
};
|
|
79
|
+
var LOG_LEVEL_ORDER = {
|
|
80
|
+
trace: Level.Trace,
|
|
81
|
+
debug: Level.Debug,
|
|
82
|
+
info: Level.Info,
|
|
83
|
+
warning: Level.Warning,
|
|
84
|
+
error: Level.Error,
|
|
85
|
+
critical: Level.Critical,
|
|
86
|
+
off: Level.Off
|
|
87
|
+
};
|
|
70
88
|
var noopLogger = {
|
|
71
|
-
enabled: false,
|
|
72
89
|
level: "off",
|
|
90
|
+
isLevelEnabled() {
|
|
91
|
+
return false;
|
|
92
|
+
},
|
|
73
93
|
trace() {
|
|
74
94
|
},
|
|
75
95
|
debug() {
|
|
@@ -4893,6 +4913,9 @@ function typeIncludesString(graph, node) {
|
|
|
4893
4913
|
function typeIsArray(graph, node) {
|
|
4894
4914
|
return graph.typeResolver.isArrayType(node);
|
|
4895
4915
|
}
|
|
4916
|
+
function typeIsStrictArray(graph, node) {
|
|
4917
|
+
return graph.typeResolver.isStrictArrayType(node);
|
|
4918
|
+
}
|
|
4896
4919
|
function getArrayElementKind(graph, node) {
|
|
4897
4920
|
return graph.typeResolver.getArrayElementKind(node);
|
|
4898
4921
|
}
|
|
@@ -15167,6 +15190,7 @@ var preferSetLookupInLoop = defineSolidRule({
|
|
|
15167
15190
|
options: options77,
|
|
15168
15191
|
check(graph, emit) {
|
|
15169
15192
|
const reported = /* @__PURE__ */ new Set();
|
|
15193
|
+
const graphHasTypes = hasTypeInfo(graph);
|
|
15170
15194
|
for (const method of LINEAR_SEARCH_METHODS) {
|
|
15171
15195
|
const calls = getCallsByMethodName(graph, method);
|
|
15172
15196
|
for (let i = 0, len = calls.length; i < len; i++) {
|
|
@@ -15184,6 +15208,7 @@ var preferSetLookupInLoop = defineSolidRule({
|
|
|
15184
15208
|
const loop = getEnclosingLoop(call.node);
|
|
15185
15209
|
if (!loop) continue;
|
|
15186
15210
|
if (!isDeclaredOutsideLoop2(loop, variable)) continue;
|
|
15211
|
+
if (graphHasTypes && !typeIsStrictArray(graph, callee.expression)) continue;
|
|
15187
15212
|
if (isStringLikeReceiver(graph, callee.expression, variable)) continue;
|
|
15188
15213
|
const key = `${loop.pos}:var:${variable.id}`;
|
|
15189
15214
|
if (reported.has(key)) continue;
|
|
@@ -18271,6 +18296,35 @@ var TypeResolver = class {
|
|
|
18271
18296
|
return false;
|
|
18272
18297
|
}
|
|
18273
18298
|
}
|
|
18299
|
+
/**
|
|
18300
|
+
* Strict array check: only matches Array<T>, T[], ReadonlyArray<T>, and tuples.
|
|
18301
|
+
* Does NOT match typed arrays (Uint8Array, Buffer, etc.) or other types with
|
|
18302
|
+
* a numeric index signature.
|
|
18303
|
+
*/
|
|
18304
|
+
isStrictArrayType(node) {
|
|
18305
|
+
try {
|
|
18306
|
+
const tsType = this.checker.getTypeAtLocation(node);
|
|
18307
|
+
return this.checkIsStrictArrayType(tsType);
|
|
18308
|
+
} catch {
|
|
18309
|
+
return false;
|
|
18310
|
+
}
|
|
18311
|
+
}
|
|
18312
|
+
checkIsStrictArrayType(tsType) {
|
|
18313
|
+
if (tsType.flags & 524288) {
|
|
18314
|
+
const objFlags = getObjectFlags(tsType);
|
|
18315
|
+
if (objFlags & 8) return true;
|
|
18316
|
+
if (objFlags & 4) {
|
|
18317
|
+
const name = tsType.getSymbol()?.getName();
|
|
18318
|
+
if (name === "Array" || name === "ReadonlyArray") return true;
|
|
18319
|
+
}
|
|
18320
|
+
}
|
|
18321
|
+
if (tsType.isUnion()) {
|
|
18322
|
+
for (const t of tsType.types) {
|
|
18323
|
+
if (this.checkIsStrictArrayType(t)) return true;
|
|
18324
|
+
}
|
|
18325
|
+
}
|
|
18326
|
+
return false;
|
|
18327
|
+
}
|
|
18274
18328
|
checkIsArrayType(tsType) {
|
|
18275
18329
|
if (tsType.flags & 524288) {
|
|
18276
18330
|
const objFlags = getObjectFlags(tsType);
|
|
@@ -18322,7 +18376,7 @@ var TypeResolver = class {
|
|
|
18322
18376
|
if (exprTsType.flags & ts101.TypeFlags.Any) return false;
|
|
18323
18377
|
if (targetTsType.flags & ts101.TypeFlags.Any) return false;
|
|
18324
18378
|
const result = this.checker.isTypeAssignableTo(exprTsType, targetTsType);
|
|
18325
|
-
if (this.logger.
|
|
18379
|
+
if (this.logger.isLevelEnabled(Level.Debug)) {
|
|
18326
18380
|
const exprStr = this.checker.typeToString(exprTsType);
|
|
18327
18381
|
const targetStr = this.checker.typeToString(targetTsType);
|
|
18328
18382
|
this.logger.debug(`isUnnecessaryCast: expr="${exprStr.slice(0, 120)}" target="${targetStr.slice(0, 120)}" assignable=${result} exprFlags=${exprTsType.flags} targetFlags=${targetTsType.flags}`);
|
|
@@ -22739,8 +22793,12 @@ var POLICIES = {
|
|
|
22739
22793
|
"dense-ui": DENSE_UI,
|
|
22740
22794
|
"large-text": LARGE_TEXT
|
|
22741
22795
|
};
|
|
22742
|
-
var activePolicyName =
|
|
22796
|
+
var activePolicyName = null;
|
|
22743
22797
|
function setActivePolicy(name) {
|
|
22798
|
+
if (name === null) {
|
|
22799
|
+
activePolicyName = null;
|
|
22800
|
+
return;
|
|
22801
|
+
}
|
|
22744
22802
|
const match = ACCESSIBILITY_POLICIES.find((n) => n === name);
|
|
22745
22803
|
if (match) {
|
|
22746
22804
|
activePolicyName = match;
|
|
@@ -22750,6 +22808,7 @@ function getActivePolicyName() {
|
|
|
22750
22808
|
return activePolicyName;
|
|
22751
22809
|
}
|
|
22752
22810
|
function getActivePolicy() {
|
|
22811
|
+
if (activePolicyName === null) return null;
|
|
22753
22812
|
return POLICIES[activePolicyName];
|
|
22754
22813
|
}
|
|
22755
22814
|
|
|
@@ -25038,7 +25097,8 @@ var cssPolicyContrast = defineCSSRule({
|
|
|
25038
25097
|
options: {},
|
|
25039
25098
|
check(graph, emit) {
|
|
25040
25099
|
const policy = getActivePolicy();
|
|
25041
|
-
|
|
25100
|
+
if (policy === null) return;
|
|
25101
|
+
const name = getActivePolicyName() ?? "";
|
|
25042
25102
|
const colorDecls = graph.declarationsByProperty.get("color");
|
|
25043
25103
|
if (!colorDecls) return;
|
|
25044
25104
|
const candidates = /* @__PURE__ */ new Set();
|
|
@@ -25115,7 +25175,8 @@ var cssPolicySpacing = defineCSSRule({
|
|
|
25115
25175
|
options: {},
|
|
25116
25176
|
check(graph, emit) {
|
|
25117
25177
|
const policy = getActivePolicy();
|
|
25118
|
-
|
|
25178
|
+
if (policy === null) return;
|
|
25179
|
+
const name = getActivePolicyName() ?? "";
|
|
25119
25180
|
const letterDecls = graph.declarationsByProperty.get("letter-spacing");
|
|
25120
25181
|
if (letterDecls) {
|
|
25121
25182
|
for (let i = 0; i < letterDecls.length; i++) {
|
|
@@ -25224,7 +25285,8 @@ var cssPolicyTouchTarget = defineCSSRule({
|
|
|
25224
25285
|
options: {},
|
|
25225
25286
|
check(graph, emit) {
|
|
25226
25287
|
const policy = getActivePolicy();
|
|
25227
|
-
|
|
25288
|
+
if (policy === null) return;
|
|
25289
|
+
const name = getActivePolicyName() ?? "";
|
|
25228
25290
|
const decls = graph.declarationsForProperties(
|
|
25229
25291
|
"height",
|
|
25230
25292
|
"min-height",
|
|
@@ -25383,7 +25445,8 @@ var cssPolicyTypography = defineCSSRule({
|
|
|
25383
25445
|
options: {},
|
|
25384
25446
|
check(graph, emit) {
|
|
25385
25447
|
const policy = getActivePolicy();
|
|
25386
|
-
|
|
25448
|
+
if (policy === null) return;
|
|
25449
|
+
const name = getActivePolicyName() ?? "";
|
|
25387
25450
|
const fontDecls = graph.declarationsByProperty.get("font-size");
|
|
25388
25451
|
if (fontDecls) {
|
|
25389
25452
|
for (let i = 0; i < fontDecls.length; i++) {
|
|
@@ -31192,7 +31255,7 @@ function publishLayoutPerfStatsForTest(stats) {
|
|
|
31192
31255
|
}
|
|
31193
31256
|
function maybeLogLayoutPerf(stats, log) {
|
|
31194
31257
|
if (process.env["SOLID_LINT_LAYOUT_PROFILE"] !== "1") return;
|
|
31195
|
-
if (!log || !log.
|
|
31258
|
+
if (!log || !log.isLevelEnabled(Level.Debug)) return;
|
|
31196
31259
|
const view = snapshotLayoutPerfStats(stats);
|
|
31197
31260
|
log.debug(
|
|
31198
31261
|
`[layout] elements=${view.elementsScanned} candidates=${view.selectorCandidatesChecked} compiledSelectors=${view.compiledSelectorCount} unsupportedSelectors=${view.selectorsRejectedUnsupported} conditionalSelectors=${view.selectorsGuardedConditional} ancestryChecks=${view.ancestryChecks} edges=${view.matchEdgesCreated} collected=${view.casesCollected} cases=${view.casesScored} rejectLowEvidence=${view.casesRejectedLowEvidence} rejectThreshold=${view.casesRejectedThreshold} rejectUndecidable=${view.casesRejectedUndecidable} rejectIdentifiability=${view.casesRejectedIdentifiability} undecidableInterval=${view.undecidableInterval} conditionalSignalRatio=${Math.round(view.conditionalSignalRatio * 1e3) / 1e3} conditionalSignals=${view.conditionalSignals} totalSignals=${view.totalSignals} cohortUnimodalFalse=${view.cohortUnimodalFalse} factorCoverageMean=${Math.round(view.factorCoverageMean * 1e3) / 1e3} posteriorWidthP95=${Math.round(view.posteriorWidthP95 * 1e3) / 1e3} uncertaintyEscalations=${view.uncertaintyEscalations} snapshots=${view.signalSnapshotsBuilt} snapshotHits=${view.signalSnapshotCacheHits} measurementIndexHits=${view.measurementIndexHits} contexts=${view.contextsClassified} diagnostics=${view.diagnosticsEmitted} selectorIndexMs=${Math.round(view.selectorIndexMs * 100) / 100} selectorMatchMs=${Math.round(view.selectorMatchMs * 100) / 100} cascadeBuildMs=${Math.round(view.cascadeBuildMs * 100) / 100} caseBuildMs=${Math.round(view.caseBuildMs * 100) / 100} scoringMs=${Math.round(view.scoringMs * 100) / 100} elapsedMs=${Math.round(view.elapsedMs * 100) / 100}`
|
|
@@ -31240,17 +31303,17 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31240
31303
|
if (cached !== void 0) return cached;
|
|
31241
31304
|
const binding = resolveTagBinding(normalizedFile, tag);
|
|
31242
31305
|
if (binding === null) {
|
|
31243
|
-
if (logger.
|
|
31306
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): binding=null`);
|
|
31244
31307
|
hostByTagCache.set(cacheKey, null);
|
|
31245
31308
|
return null;
|
|
31246
31309
|
}
|
|
31247
31310
|
if (binding.kind === "component") {
|
|
31248
|
-
if (logger.
|
|
31311
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): component, tagName=${binding.host.descriptor.tagName}, attrs=[${[...binding.host.descriptor.staticAttributes.keys()]}]`);
|
|
31249
31312
|
hostByTagCache.set(cacheKey, binding.host);
|
|
31250
31313
|
return binding.host;
|
|
31251
31314
|
}
|
|
31252
31315
|
const host = binding.base ? binding.base.host : null;
|
|
31253
|
-
if (logger.
|
|
31316
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveHost(${tag}): namespace, base=${host?.descriptor.tagName ?? "null"}`);
|
|
31254
31317
|
hostByTagCache.set(cacheKey, host);
|
|
31255
31318
|
return host;
|
|
31256
31319
|
},
|
|
@@ -31263,26 +31326,26 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31263
31326
|
}
|
|
31264
31327
|
};
|
|
31265
31328
|
function resolveComponentHostEntry(entry) {
|
|
31266
|
-
if (entry.resolution === "resolved")
|
|
31267
|
-
|
|
31329
|
+
if (entry.resolution === "resolved") {
|
|
31330
|
+
return { descriptor: entry.descriptor, hostElementRef: entry.hostElementRef };
|
|
31331
|
+
}
|
|
31332
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveComponentHostEntry: deferred innerTag=${entry.innerTag}, file=${entry.filePath}, attrs=[${[...entry.staticAttributes.keys()]}]`);
|
|
31268
31333
|
const innerBinding = resolveLocalIdentifierBinding(entry.filePath, entry.innerTag);
|
|
31269
|
-
if (logger.
|
|
31334
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerBinding=${innerBinding === null ? "null" : innerBinding.kind}`);
|
|
31270
31335
|
const innerHost = extractHostFromBinding(innerBinding);
|
|
31271
|
-
if (logger.
|
|
31272
|
-
let tagName = innerHost !== null ? innerHost.tagName : null;
|
|
31336
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] innerHost=${innerHost === null ? "null" : `tagName=${innerHost.descriptor.tagName}, attrs=[${[...innerHost.descriptor.staticAttributes.keys()]}]`}`);
|
|
31337
|
+
let tagName = innerHost !== null ? innerHost.descriptor.tagName : null;
|
|
31273
31338
|
if (tagName === null) {
|
|
31274
31339
|
tagName = resolveTagNameFromPolymorphicProp(entry.staticAttributes);
|
|
31275
|
-
if (logger.
|
|
31340
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] polymorphic fallback: tagName=${tagName}`);
|
|
31276
31341
|
}
|
|
31277
|
-
const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.staticAttributes) : entry.staticAttributes;
|
|
31278
|
-
const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.staticClassTokens) : entry.staticClassTokens;
|
|
31279
|
-
const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.forwardsChildren;
|
|
31280
|
-
if (logger.
|
|
31342
|
+
const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
|
|
31343
|
+
const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
|
|
31344
|
+
const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
|
|
31345
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
|
|
31281
31346
|
return {
|
|
31282
|
-
tagName,
|
|
31283
|
-
|
|
31284
|
-
staticClassTokens,
|
|
31285
|
-
forwardsChildren
|
|
31347
|
+
descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
|
|
31348
|
+
hostElementRef: innerHost?.hostElementRef ?? null
|
|
31286
31349
|
};
|
|
31287
31350
|
}
|
|
31288
31351
|
function extractHostFromBinding(binding) {
|
|
@@ -31323,10 +31386,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31323
31386
|
if (hostEntry) {
|
|
31324
31387
|
const resolved = resolveComponentHostEntry(hostEntry);
|
|
31325
31388
|
if (resolved !== null) {
|
|
31326
|
-
const binding = {
|
|
31327
|
-
kind: "component",
|
|
31328
|
-
host: resolved
|
|
31329
|
-
};
|
|
31389
|
+
const binding = { kind: "component", host: resolved };
|
|
31330
31390
|
localBindingCache.set(key, binding);
|
|
31331
31391
|
resolvingLocal.delete(key);
|
|
31332
31392
|
return binding;
|
|
@@ -31387,7 +31447,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31387
31447
|
const baseExpression = toExpressionArgument(firstArg);
|
|
31388
31448
|
if (baseExpression === null) return null;
|
|
31389
31449
|
const baseBinding = resolveBindingFromExpression(filePath, baseExpression);
|
|
31390
|
-
if (logger.
|
|
31450
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign base: ${baseBinding === null ? "null" : baseBinding.kind}${baseBinding?.kind === "component" ? `, tagName=${baseBinding.host.descriptor.tagName}` : ""}`);
|
|
31391
31451
|
let baseComponent = null;
|
|
31392
31452
|
const members = /* @__PURE__ */ new Map();
|
|
31393
31453
|
if (baseBinding && baseBinding.kind === "component") {
|
|
@@ -31413,7 +31473,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31413
31473
|
if (!ts123.isObjectLiteralExpression(argument)) continue;
|
|
31414
31474
|
appendObjectExpressionMembers(filePath, argument, members);
|
|
31415
31475
|
}
|
|
31416
|
-
if (logger.
|
|
31476
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] Object.assign result: base=${baseComponent === null ? "null" : `tagName=${baseComponent.host.descriptor.tagName}`}, members=[${[...members.keys()]}]`);
|
|
31417
31477
|
if (baseComponent === null && members.size === 0) return null;
|
|
31418
31478
|
return {
|
|
31419
31479
|
kind: "namespace",
|
|
@@ -31455,7 +31515,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31455
31515
|
}
|
|
31456
31516
|
function resolveBindingFromImport(filePath, importBinding) {
|
|
31457
31517
|
const resolvedModule = moduleResolver.resolveSolid(filePath, importBinding.source) ?? resolveAndIndexExternalModule(filePath, importBinding.source);
|
|
31458
|
-
if (logger.
|
|
31518
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolveBindingFromImport: source=${importBinding.source}, kind=${importBinding.kind}, resolvedModule=${resolvedModule}`);
|
|
31459
31519
|
if (resolvedModule === null) return null;
|
|
31460
31520
|
const normalized = resolve4(resolvedModule);
|
|
31461
31521
|
if (importBinding.kind === "namespace") {
|
|
@@ -31464,7 +31524,7 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
|
|
|
31464
31524
|
const exportName = importBinding.kind === "default" ? "default" : importBinding.importedName;
|
|
31465
31525
|
if (exportName === null) return null;
|
|
31466
31526
|
const result = resolveExportBinding(normalized, exportName);
|
|
31467
|
-
if (logger.
|
|
31527
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] export ${exportName}: ${result === null ? "null" : result.kind}`);
|
|
31468
31528
|
return result;
|
|
31469
31529
|
}
|
|
31470
31530
|
function resolveAndIndexExternalModule(importerFile, importSource) {
|
|
@@ -31658,6 +31718,7 @@ function collectComponentHosts(graph) {
|
|
|
31658
31718
|
}
|
|
31659
31719
|
function resolveComponentHostEntryForFunction(graph, fn) {
|
|
31660
31720
|
let entry = null;
|
|
31721
|
+
let hostElementRefAgreed = true;
|
|
31661
31722
|
const bodyEntry = resolveHostEntryFromFunctionBody(graph, fn);
|
|
31662
31723
|
if (bodyEntry !== null) {
|
|
31663
31724
|
entry = bodyEntry;
|
|
@@ -31673,9 +31734,17 @@ function resolveComponentHostEntryForFunction(graph, fn) {
|
|
|
31673
31734
|
entry = returnEntry;
|
|
31674
31735
|
continue;
|
|
31675
31736
|
}
|
|
31676
|
-
if (areComponentHostEntriesEqual(entry, returnEntry))
|
|
31737
|
+
if (areComponentHostEntriesEqual(entry, returnEntry)) {
|
|
31738
|
+
if (hostElementRefAgreed && entry.resolution === "resolved" && returnEntry.resolution === "resolved" && entry.hostElementRef !== returnEntry.hostElementRef) {
|
|
31739
|
+
hostElementRefAgreed = false;
|
|
31740
|
+
}
|
|
31741
|
+
continue;
|
|
31742
|
+
}
|
|
31677
31743
|
return null;
|
|
31678
31744
|
}
|
|
31745
|
+
if (!hostElementRefAgreed && entry !== null && entry.resolution === "resolved") {
|
|
31746
|
+
return { resolution: "resolved", descriptor: entry.descriptor, hostElementRef: null };
|
|
31747
|
+
}
|
|
31679
31748
|
return entry;
|
|
31680
31749
|
}
|
|
31681
31750
|
function resolveHostEntryFromFunctionBody(graph, fn) {
|
|
@@ -31703,7 +31772,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
|
|
|
31703
31772
|
staticAttributes: collectStaticAttributes(element),
|
|
31704
31773
|
staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
|
|
31705
31774
|
forwardsChildren: detectChildrenForwarding(element)
|
|
31706
|
-
}
|
|
31775
|
+
},
|
|
31776
|
+
hostElementRef: { solid: graph, element }
|
|
31707
31777
|
};
|
|
31708
31778
|
}
|
|
31709
31779
|
if (isContextProviderTag(element.tag)) {
|
|
@@ -32872,7 +32942,7 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
|
|
|
32872
32942
|
ancestor = ancestor.parentElementNode;
|
|
32873
32943
|
}
|
|
32874
32944
|
if (fileRootElements !== null) {
|
|
32875
|
-
if (logger.
|
|
32945
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
32876
32946
|
const compoundDesc = describeCompound(targetCompound);
|
|
32877
32947
|
logger.trace(`[selector-match] fallback: node=${node.key} tag=${node.tagName} checking ${fileRootElements.length} roots for compound=${compoundDesc}`);
|
|
32878
32948
|
}
|
|
@@ -32883,11 +32953,11 @@ function matchesChain(matcher, node, index, perf, fileRootElements, logger) {
|
|
|
32883
32953
|
if (root.solidFile !== node.solidFile) continue;
|
|
32884
32954
|
perf.ancestryChecks++;
|
|
32885
32955
|
const compoundResult = matchesCompound(root, targetCompound);
|
|
32886
|
-
if (logger.
|
|
32956
|
+
if (logger.isLevelEnabled(Level.Trace) && compoundResult === "no-match") {
|
|
32887
32957
|
logger.trace(`[selector-match] fallback MISS: root=${root.key} tag=${root.tagName} attrs=[${[...root.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}]`);
|
|
32888
32958
|
}
|
|
32889
32959
|
if (compoundResult !== "no-match") {
|
|
32890
|
-
if (logger.
|
|
32960
|
+
if (logger.isLevelEnabled(Level.Debug)) {
|
|
32891
32961
|
const compoundDesc = describeCompound(targetCompound);
|
|
32892
32962
|
logger.debug(`[selector-match] fallback HIT: node=${node.key} tag=${node.tagName} matched root=${root.key} tag=${root.tagName} compound=${compoundDesc} isFinal=${isFinal}`);
|
|
32893
32963
|
}
|
|
@@ -34010,6 +34080,9 @@ function readBaselineOffsetFacts(graph, node) {
|
|
|
34010
34080
|
function readElementRef(graph, node) {
|
|
34011
34081
|
return readElementRefById(graph, node.solidFile, node.elementId);
|
|
34012
34082
|
}
|
|
34083
|
+
function readHostElementRef(graph, node) {
|
|
34084
|
+
return graph.hostElementRefsByNode.get(node) ?? null;
|
|
34085
|
+
}
|
|
34013
34086
|
function readElementRefById(graph, solidFile, elementId) {
|
|
34014
34087
|
const refs = graph.elementRefsBySolidFileAndId.get(solidFile);
|
|
34015
34088
|
if (!refs) return null;
|
|
@@ -36708,7 +36781,7 @@ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, app
|
|
|
36708
36781
|
};
|
|
36709
36782
|
applies.push(edge);
|
|
36710
36783
|
ctx.perf.matchEdgesCreated++;
|
|
36711
|
-
if (ctx.logger.
|
|
36784
|
+
if (ctx.logger.isLevelEnabled(Level.Trace)) {
|
|
36712
36785
|
ctx.logger.trace(
|
|
36713
36786
|
`[cascade] edge node=${node.key} selector=${selector.id} match=${matchResult} conditional=${edge.conditionalMatch} selector-raw=${selector.raw.slice(0, 80)}`
|
|
36714
36787
|
);
|
|
@@ -37151,7 +37224,7 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
37151
37224
|
if (!child) continue;
|
|
37152
37225
|
if (child.kind === "expression") {
|
|
37153
37226
|
if (isStructuralExpression(child.node)) {
|
|
37154
|
-
if (logger.
|
|
37227
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
|
|
37155
37228
|
memo.set(element.id, 2 /* Unknown */);
|
|
37156
37229
|
return 2 /* Unknown */;
|
|
37157
37230
|
}
|
|
@@ -37173,11 +37246,11 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
37173
37246
|
if (!child.isDomElement) {
|
|
37174
37247
|
const childMeta = compositionMetaByElementId.get(child.id);
|
|
37175
37248
|
if (childMeta !== void 0 && isControlTag(childMeta.tagName)) {
|
|
37176
|
-
if (logger.
|
|
37249
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag}#${child.id} resolves to control tag=${childMeta.tagName}, skipping`);
|
|
37177
37250
|
continue;
|
|
37178
37251
|
}
|
|
37179
37252
|
if (childState !== 1 /* No */) {
|
|
37180
|
-
if (logger.
|
|
37253
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag ?? child.id}#${child.id} has state=${childState} \u2192 childHasUnknown`);
|
|
37181
37254
|
childHasUnknown = true;
|
|
37182
37255
|
}
|
|
37183
37256
|
continue;
|
|
@@ -37190,12 +37263,12 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
37190
37263
|
if (childState === 3 /* DynamicText */) childHasDynamicText = true;
|
|
37191
37264
|
}
|
|
37192
37265
|
if (childHasUnknown) {
|
|
37193
|
-
if (logger.
|
|
37266
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
|
|
37194
37267
|
memo.set(element.id, 2 /* Unknown */);
|
|
37195
37268
|
return 2 /* Unknown */;
|
|
37196
37269
|
}
|
|
37197
37270
|
if (hasTextOnlyExpression || childHasDynamicText) {
|
|
37198
|
-
if (logger.
|
|
37271
|
+
if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
|
|
37199
37272
|
memo.set(element.id, 3 /* DynamicText */);
|
|
37200
37273
|
return 3 /* DynamicText */;
|
|
37201
37274
|
}
|
|
@@ -37217,15 +37290,16 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
|
|
|
37217
37290
|
const meta = compositionMetaByElementId.get(element.id);
|
|
37218
37291
|
if (!meta || !meta.participates) continue;
|
|
37219
37292
|
const localClassTokens = selectorRequirements.needsClassTokens ? getStaticClassTokensForElementEntity(solid, element) : EMPTY_STRING_LIST3;
|
|
37220
|
-
const classTokens = mergeClassTokens(localClassTokens, meta.
|
|
37293
|
+
const classTokens = mergeClassTokens(localClassTokens, meta.resolvedHost?.descriptor.staticClassTokens);
|
|
37221
37294
|
const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
|
|
37222
37295
|
const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
|
|
37223
37296
|
const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
|
|
37224
|
-
const attributes = mergeAttributes(localAttributes, meta.
|
|
37297
|
+
const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
|
|
37225
37298
|
const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
|
|
37226
37299
|
const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
|
|
37227
37300
|
const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
|
|
37228
37301
|
const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId);
|
|
37302
|
+
const hostElementRef = meta.resolvedHost?.hostElementRef ?? null;
|
|
37229
37303
|
out.push({
|
|
37230
37304
|
element,
|
|
37231
37305
|
key: toLayoutElementKey(solid.file, element.id),
|
|
@@ -37238,7 +37312,8 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
|
|
|
37238
37312
|
selectorDispatchKeys,
|
|
37239
37313
|
inlineStyleValues,
|
|
37240
37314
|
textualContent,
|
|
37241
|
-
parentElementId
|
|
37315
|
+
parentElementId,
|
|
37316
|
+
hostElementRef
|
|
37242
37317
|
});
|
|
37243
37318
|
}
|
|
37244
37319
|
return out;
|
|
@@ -37248,7 +37323,7 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
|
|
|
37248
37323
|
for (let i = 0; i < solid.jsxElements.length; i++) {
|
|
37249
37324
|
const element = solid.jsxElements[i];
|
|
37250
37325
|
if (!element) continue;
|
|
37251
|
-
const
|
|
37326
|
+
const resolvedHost = resolveHostForElement(
|
|
37252
37327
|
componentHostResolver,
|
|
37253
37328
|
solid.file,
|
|
37254
37329
|
element
|
|
@@ -37257,30 +37332,30 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
|
|
|
37257
37332
|
componentHostResolver,
|
|
37258
37333
|
solid.file,
|
|
37259
37334
|
element,
|
|
37260
|
-
|
|
37335
|
+
resolvedHost
|
|
37261
37336
|
);
|
|
37262
37337
|
const participates = element.tag !== null && !isTransparentPrimitive;
|
|
37263
|
-
const tag = resolveEffectiveTag(element,
|
|
37338
|
+
const tag = resolveEffectiveTag(element, resolvedHost?.descriptor ?? null);
|
|
37264
37339
|
const tagName = tag ? tag.toLowerCase() : null;
|
|
37265
37340
|
out.set(element.id, {
|
|
37266
37341
|
element,
|
|
37267
37342
|
participates,
|
|
37268
37343
|
tag,
|
|
37269
37344
|
tagName,
|
|
37270
|
-
|
|
37345
|
+
resolvedHost
|
|
37271
37346
|
});
|
|
37272
37347
|
}
|
|
37273
37348
|
return out;
|
|
37274
37349
|
}
|
|
37275
|
-
function
|
|
37350
|
+
function resolveHostForElement(componentHostResolver, solidFile, element) {
|
|
37276
37351
|
if (element.tag === null) return null;
|
|
37277
37352
|
if (element.isDomElement) return null;
|
|
37278
37353
|
return componentHostResolver.resolveHost(solidFile, element.tag);
|
|
37279
37354
|
}
|
|
37280
|
-
function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element,
|
|
37355
|
+
function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
|
|
37281
37356
|
if (element.tag === null) return false;
|
|
37282
37357
|
if (element.isDomElement) return false;
|
|
37283
|
-
if (
|
|
37358
|
+
if (resolvedHost !== null) return false;
|
|
37284
37359
|
return componentHostResolver.isTransparentPrimitive(solidFile, element.tag);
|
|
37285
37360
|
}
|
|
37286
37361
|
function resolveEffectiveTag(element, hostDescriptor) {
|
|
@@ -37398,6 +37473,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37398
37473
|
const childrenByParentNodeMutable = /* @__PURE__ */ new Map();
|
|
37399
37474
|
const elementBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
|
|
37400
37475
|
const elementRefsBySolidFileAndIdMutable = /* @__PURE__ */ new Map();
|
|
37476
|
+
const hostElementRefsByNodeMutable = /* @__PURE__ */ new Map();
|
|
37401
37477
|
const appliesByElementNodeMutable = /* @__PURE__ */ new Map();
|
|
37402
37478
|
const selectorsById = /* @__PURE__ */ new Map();
|
|
37403
37479
|
const monitoredDeclarationsBySelectorId = /* @__PURE__ */ new Map();
|
|
@@ -37434,7 +37510,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37434
37510
|
const moduleResolver = createLayoutModuleResolver(solids, css);
|
|
37435
37511
|
const componentHostResolver = createLayoutComponentHostResolver(solids, moduleResolver, logger);
|
|
37436
37512
|
const cssScopeBySolidFile = collectCSSScopeBySolidFile(solids, css, moduleResolver);
|
|
37437
|
-
if (logger.
|
|
37513
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
37438
37514
|
for (const [solidFile, scopePaths] of cssScopeBySolidFile) {
|
|
37439
37515
|
if (scopePaths.length > 0) {
|
|
37440
37516
|
let names = "";
|
|
@@ -37529,6 +37605,9 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37529
37605
|
isControl: isControlTag(record.tagName),
|
|
37530
37606
|
isReplaced: isReplacedTag(record.tagName)
|
|
37531
37607
|
};
|
|
37608
|
+
if (record.hostElementRef !== null) {
|
|
37609
|
+
hostElementRefsByNodeMutable.set(node, record.hostElementRef);
|
|
37610
|
+
}
|
|
37532
37611
|
elements.push(node);
|
|
37533
37612
|
elementById.set(record.element.id, node);
|
|
37534
37613
|
nodeByElementId.set(record.element.id, node);
|
|
@@ -37550,7 +37629,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37550
37629
|
}
|
|
37551
37630
|
}
|
|
37552
37631
|
}
|
|
37553
|
-
if (logger.
|
|
37632
|
+
if (logger.isLevelEnabled(Level.Debug)) {
|
|
37554
37633
|
for (const [file, roots] of rootElementsByFile) {
|
|
37555
37634
|
const descs = roots.map((r) => `${r.key}(tag=${r.tagName}, attrs=[${[...r.attributes.entries()].map(([k, v]) => `${k}=${v}`).join(",")}])`);
|
|
37556
37635
|
logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
|
|
@@ -37593,7 +37672,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37593
37672
|
appliesByNode.set(node, edges);
|
|
37594
37673
|
}
|
|
37595
37674
|
perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
|
|
37596
|
-
if (logger.
|
|
37675
|
+
if (logger.isLevelEnabled(Level.Trace)) {
|
|
37597
37676
|
for (let i = 0; i < elements.length; i++) {
|
|
37598
37677
|
const node = elements[i];
|
|
37599
37678
|
if (!node) continue;
|
|
@@ -37649,6 +37728,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
37649
37728
|
childrenByParentNode: childrenByParentNodeMutable,
|
|
37650
37729
|
elementBySolidFileAndId: elementBySolidFileAndIdMutable,
|
|
37651
37730
|
elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
|
|
37731
|
+
hostElementRefsByNode: hostElementRefsByNodeMutable,
|
|
37652
37732
|
appliesByNode,
|
|
37653
37733
|
selectorCandidatesByNode,
|
|
37654
37734
|
selectorsById,
|
|
@@ -38049,7 +38129,7 @@ function computeFlowParticipationFact(snapshot) {
|
|
|
38049
38129
|
}
|
|
38050
38130
|
function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf, logger) {
|
|
38051
38131
|
const out = /* @__PURE__ */ new Map();
|
|
38052
|
-
const trace = logger.
|
|
38132
|
+
const trace = logger.isLevelEnabled(Level.Trace);
|
|
38053
38133
|
for (const [parent, children] of childrenByParentNode) {
|
|
38054
38134
|
if (children.length < 2) continue;
|
|
38055
38135
|
const snapshot = snapshotByElementNode.get(parent);
|
|
@@ -38919,7 +38999,7 @@ function runLayoutDetector(context, detector) {
|
|
|
38919
38999
|
result.evidence.posteriorLower,
|
|
38920
39000
|
result.evidence.posteriorUpper
|
|
38921
39001
|
);
|
|
38922
|
-
if (log.
|
|
39002
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
38923
39003
|
log.debug(
|
|
38924
39004
|
`[${detector.id}] accept case=${i} severity=${result.evidence.severity.toFixed(2)} confidence=${result.evidence.confidence.toFixed(2)} posterior=[${result.evidence.posteriorLower.toFixed(3)},${result.evidence.posteriorUpper.toFixed(3)}] evidenceMass=${result.evidence.evidenceMass.toFixed(3)} context=${result.evidence.contextKind} offset=${result.evidence.estimatedOffsetPx?.toFixed(2) ?? "null"} topFactors=[${result.evidence.topFactors.join(",")}] causes=[${result.evidence.causes.join("; ")}]`
|
|
38925
39005
|
);
|
|
@@ -38928,7 +39008,7 @@ function runLayoutDetector(context, detector) {
|
|
|
38928
39008
|
continue;
|
|
38929
39009
|
}
|
|
38930
39010
|
recordPolicyMetrics(context, result.evidenceMass, result.posteriorLower, result.posteriorUpper);
|
|
38931
|
-
if (log.
|
|
39011
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
38932
39012
|
log.debug(
|
|
38933
39013
|
`[${detector.id}] reject case=${i} reason=${result.reason} detail=${result.detail ?? "none"} posterior=[${result.posteriorLower.toFixed(3)},${result.posteriorUpper.toFixed(3)}] evidenceMass=${result.evidenceMass.toFixed(3)}`
|
|
38934
39014
|
);
|
|
@@ -39549,13 +39629,39 @@ var INLINE_TOUCH_TARGET_KEYS = /* @__PURE__ */ new Set([
|
|
|
39549
39629
|
"height",
|
|
39550
39630
|
"min-height",
|
|
39551
39631
|
"width",
|
|
39552
|
-
"min-width"
|
|
39553
|
-
"padding-left",
|
|
39554
|
-
"padding-right",
|
|
39555
|
-
"padding-inline",
|
|
39556
|
-
"padding-inline-start",
|
|
39557
|
-
"padding-inline-end"
|
|
39632
|
+
"min-width"
|
|
39558
39633
|
]);
|
|
39634
|
+
var INTERACTIVE_HTML_TAGS = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "label", "summary"]);
|
|
39635
|
+
var INTERACTIVE_ARIA_ROLES = /* @__PURE__ */ new Set([
|
|
39636
|
+
"button",
|
|
39637
|
+
"link",
|
|
39638
|
+
"checkbox",
|
|
39639
|
+
"radio",
|
|
39640
|
+
"combobox",
|
|
39641
|
+
"listbox",
|
|
39642
|
+
"menuitem",
|
|
39643
|
+
"menuitemcheckbox",
|
|
39644
|
+
"menuitemradio",
|
|
39645
|
+
"option",
|
|
39646
|
+
"switch",
|
|
39647
|
+
"tab"
|
|
39648
|
+
]);
|
|
39649
|
+
function isInteractiveElement(solid, element, hostElementRef) {
|
|
39650
|
+
if (element.tagName !== null && INTERACTIVE_HTML_TAGS.has(element.tagName)) return true;
|
|
39651
|
+
const roleAttr = getJSXAttributeEntity(solid, element, "role");
|
|
39652
|
+
if (roleAttr !== null && roleAttr.valueNode !== null) {
|
|
39653
|
+
const role = getStaticStringFromJSXValue(roleAttr.valueNode);
|
|
39654
|
+
if (role !== null && INTERACTIVE_ARIA_ROLES.has(role)) return true;
|
|
39655
|
+
}
|
|
39656
|
+
if (hostElementRef !== null && hostElementRef.element.tagName !== null) {
|
|
39657
|
+
if (INTERACTIVE_HTML_TAGS.has(hostElementRef.element.tagName)) return true;
|
|
39658
|
+
}
|
|
39659
|
+
return false;
|
|
39660
|
+
}
|
|
39661
|
+
function readNodeHostElementRef(layout, solid, element) {
|
|
39662
|
+
const node = layout.elementBySolidFileAndId.get(solid.file)?.get(element.id) ?? null;
|
|
39663
|
+
return node !== null ? readHostElementRef(layout, node) : null;
|
|
39664
|
+
}
|
|
39559
39665
|
var jsxStylePolicy = defineCrossRule({
|
|
39560
39666
|
id: "jsx-style-policy",
|
|
39561
39667
|
severity: "warn",
|
|
@@ -39566,10 +39672,11 @@ var jsxStylePolicy = defineCrossRule({
|
|
|
39566
39672
|
category: "css-jsx"
|
|
39567
39673
|
},
|
|
39568
39674
|
check(context, emit) {
|
|
39569
|
-
const { solids } = context;
|
|
39675
|
+
const { solids, layout } = context;
|
|
39570
39676
|
const policy = getActivePolicy();
|
|
39571
|
-
|
|
39572
|
-
|
|
39677
|
+
if (policy === null) return;
|
|
39678
|
+
const name = getActivePolicyName() ?? "";
|
|
39679
|
+
forEachStylePropertyAcross(solids, (solid, p, element) => {
|
|
39573
39680
|
if (!ts133.isPropertyAssignment(p)) return;
|
|
39574
39681
|
const key = objectKeyName(p.name);
|
|
39575
39682
|
if (!key) return;
|
|
@@ -39617,6 +39724,8 @@ var jsxStylePolicy = defineCrossRule({
|
|
|
39617
39724
|
return;
|
|
39618
39725
|
}
|
|
39619
39726
|
if (INLINE_TOUCH_TARGET_KEYS.has(normalizedKey)) {
|
|
39727
|
+
const hostRef = readNodeHostElementRef(layout, solid, element);
|
|
39728
|
+
if (!isInteractiveElement(solid, element, hostRef)) return;
|
|
39620
39729
|
const strVal = getStaticStringValue(p.initializer);
|
|
39621
39730
|
if (!strVal) return;
|
|
39622
39731
|
const px = parsePxValue(strVal);
|
|
@@ -39695,7 +39804,7 @@ var siblingAlignmentDetector = {
|
|
|
39695
39804
|
id: "sibling-alignment-outlier",
|
|
39696
39805
|
collect: collectAlignmentCases,
|
|
39697
39806
|
evaluate(input, context) {
|
|
39698
|
-
if (context.logger.
|
|
39807
|
+
if (context.logger.isLevelEnabled(Level.Trace)) {
|
|
39699
39808
|
const ctx = input.context;
|
|
39700
39809
|
context.logger.trace(
|
|
39701
39810
|
`[sibling-alignment] evaluate subject=${input.subject.elementKey} tag=${input.subject.tag} parent=${ctx.parentElementKey} parentTag=${ctx.parentTag} context.kind=${ctx.kind} certainty=${ctx.certainty} display=${ctx.parentDisplay} alignItems=${ctx.parentAlignItems} crossAxisIsBlockAxis=${ctx.crossAxisIsBlockAxis} crossAxisCertainty=${ctx.crossAxisIsBlockAxisCertainty} baseline=${ctx.baselineRelevance}`
|
|
@@ -39744,7 +39853,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39744
39853
|
const log = context.logger;
|
|
39745
39854
|
const detections = runLayoutDetector(context, siblingAlignmentDetector);
|
|
39746
39855
|
const uniqueDetections = dedupeDetectionsBySubject(detections);
|
|
39747
|
-
if (log.
|
|
39856
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39748
39857
|
log.debug(
|
|
39749
39858
|
`[sibling-alignment] raw=${detections.length} deduped=${uniqueDetections.length}`
|
|
39750
39859
|
);
|
|
@@ -39758,7 +39867,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39758
39867
|
const subjectId = detection.caseData.subject.elementId;
|
|
39759
39868
|
const logPrefix = `[sibling-alignment] <${subjectTag}> in <${parentTag}> (${subjectFile}#${subjectId})`;
|
|
39760
39869
|
if (detection.evidence.confidence < MIN_CONFIDENCE_THRESHOLD) {
|
|
39761
|
-
if (log.
|
|
39870
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39762
39871
|
log.debug(
|
|
39763
39872
|
`${logPrefix} SKIP: confidence=${detection.evidence.confidence.toFixed(2)} < threshold=${MIN_CONFIDENCE_THRESHOLD}`
|
|
39764
39873
|
);
|
|
@@ -39767,7 +39876,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39767
39876
|
}
|
|
39768
39877
|
const estimatedOffset = detection.evidence.estimatedOffsetPx;
|
|
39769
39878
|
if (estimatedOffset !== null && Math.abs(estimatedOffset) < MIN_OFFSET_PX_THRESHOLD && !hasNonOffsetPrimaryEvidence(detection.evidence.topFactors)) {
|
|
39770
|
-
if (log.
|
|
39879
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39771
39880
|
log.debug(
|
|
39772
39881
|
`${logPrefix} SKIP: offset=${estimatedOffset.toFixed(2)}px < ${MIN_OFFSET_PX_THRESHOLD}px (no non-offset primary evidence, topFactors=[${detection.evidence.topFactors.join(",")}])`
|
|
39773
39882
|
);
|
|
@@ -39779,7 +39888,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39779
39888
|
detection.caseData.cohort.parentElementKey,
|
|
39780
39889
|
detection.caseData.subject.solidFile
|
|
39781
39890
|
)) {
|
|
39782
|
-
if (log.
|
|
39891
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39783
39892
|
log.debug(`${logPrefix} SKIP: out-of-flow ancestor`);
|
|
39784
39893
|
}
|
|
39785
39894
|
continue;
|
|
@@ -39790,7 +39899,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39790
39899
|
detection.caseData.subject.elementId
|
|
39791
39900
|
);
|
|
39792
39901
|
if (!subjectRef) {
|
|
39793
|
-
if (log.
|
|
39902
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39794
39903
|
log.debug(`${logPrefix} SKIP: no node ref`);
|
|
39795
39904
|
}
|
|
39796
39905
|
continue;
|
|
@@ -39806,7 +39915,7 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
|
|
|
39806
39915
|
const primaryFix = detection.evidence.primaryFix;
|
|
39807
39916
|
const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
|
|
39808
39917
|
const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
|
|
39809
|
-
if (log.
|
|
39918
|
+
if (log.isLevelEnabled(Level.Debug)) {
|
|
39810
39919
|
log.debug(
|
|
39811
39920
|
`${logPrefix} EMIT: severity=${severity} confidence=${confidence} offset=${offset?.toFixed(2) ?? "null"} posterior=[${detection.evidence.posteriorLower.toFixed(3)},${detection.evidence.posteriorUpper.toFixed(3)}] evidenceMass=${detection.evidence.evidenceMass.toFixed(3)} topFactors=[${detection.evidence.topFactors.join(",")}] causes=[${causes}]`
|
|
39812
39921
|
);
|
|
@@ -40215,7 +40324,8 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
|
|
|
40215
40324
|
const ref = readNodeRef(context.layout, node);
|
|
40216
40325
|
if (!ref) continue;
|
|
40217
40326
|
const reservedSpace = readReservedSpaceFact(context.layout, node);
|
|
40218
|
-
|
|
40327
|
+
const hostRef = readHostElementRef(context.layout, node);
|
|
40328
|
+
if (hasReservedSize(ref.solid, node.attributes, ref.element, reservedSpace, hostRef)) continue;
|
|
40219
40329
|
emit(
|
|
40220
40330
|
createDiagnostic(
|
|
40221
40331
|
ref.solid.file,
|
|
@@ -40230,15 +40340,17 @@ var cssLayoutUnsizedReplacedElement = defineCrossRule({
|
|
|
40230
40340
|
}
|
|
40231
40341
|
}
|
|
40232
40342
|
});
|
|
40233
|
-
function hasReservedSize(solid, attributes, element, reservedSpaceFact) {
|
|
40343
|
+
function hasReservedSize(solid, attributes, element, reservedSpaceFact, hostElementRef) {
|
|
40234
40344
|
if (reservedSpaceFact.hasReservedSpace) return true;
|
|
40235
40345
|
const attrWidth = parsePositiveLength(attributes.get("width"));
|
|
40236
40346
|
const attrHeight = parsePositiveLength(attributes.get("height"));
|
|
40237
40347
|
const jsxAttrWidth = readPositiveJsxAttribute(solid, element, "width");
|
|
40238
40348
|
const jsxAttrHeight = readPositiveJsxAttribute(solid, element, "height");
|
|
40239
|
-
|
|
40240
|
-
const
|
|
40241
|
-
|
|
40349
|
+
const hostJsxWidth = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "width") : false;
|
|
40350
|
+
const hostJsxHeight = hostElementRef !== null ? readPositiveJsxAttribute(hostElementRef.solid, hostElementRef.element, "height") : false;
|
|
40351
|
+
if (attrWidth && attrHeight || jsxAttrWidth && jsxAttrHeight || hostJsxWidth && hostJsxHeight) return true;
|
|
40352
|
+
const hasAnyWidth = attrWidth || jsxAttrWidth || hostJsxWidth || reservedSpaceFact.hasUsableInlineDimension;
|
|
40353
|
+
const hasAnyHeight = attrHeight || jsxAttrHeight || hostJsxHeight || reservedSpaceFact.hasUsableBlockDimension || reservedSpaceFact.hasContainIntrinsicSize;
|
|
40242
40354
|
if (reservedSpaceFact.hasUsableAspectRatio && (hasAnyWidth || hasAnyHeight)) return true;
|
|
40243
40355
|
if (reservedSpaceFact.hasContainIntrinsicSize && (hasAnyWidth || hasAnyHeight)) return true;
|
|
40244
40356
|
return false;
|
|
@@ -41254,6 +41366,7 @@ export {
|
|
|
41254
41366
|
classifyFile,
|
|
41255
41367
|
extensionsToGlobs,
|
|
41256
41368
|
canonicalPath,
|
|
41369
|
+
Level,
|
|
41257
41370
|
noopLogger,
|
|
41258
41371
|
SolidGraph,
|
|
41259
41372
|
runPhases,
|
|
@@ -41274,4 +41387,4 @@ export {
|
|
|
41274
41387
|
rules3,
|
|
41275
41388
|
runCrossFileRules
|
|
41276
41389
|
};
|
|
41277
|
-
//# sourceMappingURL=chunk-
|
|
41390
|
+
//# sourceMappingURL=chunk-WY5MMHK2.js.map
|