@drskillissue/ganko 0.1.22 → 0.1.24
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/README.md +1 -1
- package/dist/{chunk-5IOPY65Q.js → chunk-64TMAKYI.js} +975 -754
- package/dist/chunk-64TMAKYI.js.map +1 -0
- package/dist/{chunk-IF3V4IQF.js → chunk-KVZ56NZ5.js} +7 -6
- package/dist/chunk-KVZ56NZ5.js.map +1 -0
- package/dist/eslint-plugin.cjs +901 -680
- package/dist/eslint-plugin.cjs.map +1 -1
- package/dist/eslint-plugin.js +1 -1
- package/dist/index.cjs +907 -685
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -55
- package/dist/index.d.ts +112 -55
- package/dist/index.js +2 -2
- package/dist/rules-manifest.cjs +6 -5
- package/dist/rules-manifest.cjs.map +1 -1
- package/dist/rules-manifest.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5IOPY65Q.js.map +0 -1
- package/dist/chunk-IF3V4IQF.js.map +0 -1
|
@@ -2696,7 +2696,7 @@ function resolveMessage(template, data) {
|
|
|
2696
2696
|
}
|
|
2697
2697
|
return result;
|
|
2698
2698
|
}
|
|
2699
|
-
function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix) {
|
|
2699
|
+
function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix, suggest) {
|
|
2700
2700
|
const result = {
|
|
2701
2701
|
file,
|
|
2702
2702
|
rule,
|
|
@@ -2706,13 +2706,14 @@ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity,
|
|
|
2706
2706
|
loc: firstLine(loc)
|
|
2707
2707
|
};
|
|
2708
2708
|
if (fix !== void 0) result.fix = fix;
|
|
2709
|
+
if (suggest !== void 0 && suggest.length > 0) result.suggest = suggest;
|
|
2709
2710
|
return result;
|
|
2710
2711
|
}
|
|
2711
|
-
function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix) {
|
|
2712
|
-
return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix);
|
|
2712
|
+
function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix, suggest) {
|
|
2713
|
+
return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix, suggest);
|
|
2713
2714
|
}
|
|
2714
|
-
function createDiagnostic(file, node, rule, messageId, message, severity, fix) {
|
|
2715
|
-
return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix);
|
|
2715
|
+
function createDiagnostic(file, node, rule, messageId, message, severity, fix, suggest) {
|
|
2716
|
+
return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix, suggest);
|
|
2716
2717
|
}
|
|
2717
2718
|
|
|
2718
2719
|
// src/solid/rule.ts
|
|
@@ -7565,8 +7566,9 @@ var CONDITIONAL_MOUNT_TAGS = /* @__PURE__ */ new Set([
|
|
|
7565
7566
|
"TabPanel"
|
|
7566
7567
|
]);
|
|
7567
7568
|
var messages16 = {
|
|
7568
|
-
loadingMismatch: "createResource '{{name}}' has no initialValue but uses
|
|
7569
|
-
conditionalSuspense: "createResource '{{name}}'
|
|
7569
|
+
loadingMismatch: "createResource '{{name}}' has no initialValue but uses {{name}}.loading for manual loading UI. Suspense intercepts before your loading UI renders \u2014 the component is unmounted before the <Show>/<Switch> evaluates. Replace createResource with onMount + createSignal to decouple from Suspense entirely.",
|
|
7570
|
+
conditionalSuspense: "createResource '{{name}}' is inside a conditional mount point ({{mountTag}}) with a distant Suspense boundary. The SuspenseContext increment fires when the fetcher's Promise is pending and unmounts the entire page subtree \u2014 initialValue does NOT prevent this. Replace createResource with onMount + createSignal to avoid Suspense interaction.",
|
|
7571
|
+
missingErrorBoundary: "createResource '{{name}}' has no <ErrorBoundary> between its component and the nearest <Suspense>. When the fetcher throws (network error, 401/403/503, timeout), the error propagates to Suspense which has no error handling \u2014 the boundary breaks permanently. Wrap the component in <ErrorBoundary> or replace createResource with onMount + createSignal and catch errors in the fetcher."
|
|
7570
7572
|
};
|
|
7571
7573
|
var options16 = {};
|
|
7572
7574
|
function hasInitialValue(call) {
|
|
@@ -7609,35 +7611,95 @@ function hasLoadingRead(resourceVariable) {
|
|
|
7609
7611
|
}
|
|
7610
7612
|
return false;
|
|
7611
7613
|
}
|
|
7612
|
-
function
|
|
7614
|
+
function resolveFetcherFunction(graph, call) {
|
|
7615
|
+
const args = call.node.arguments;
|
|
7616
|
+
if (args.length === 0) return null;
|
|
7617
|
+
let fetcherNode;
|
|
7618
|
+
if (args.length === 1) {
|
|
7619
|
+
fetcherNode = args[0];
|
|
7620
|
+
} else if (args.length === 2) {
|
|
7621
|
+
const lastArg = args[1];
|
|
7622
|
+
fetcherNode = lastArg && lastArg.type === "ObjectExpression" ? args[0] : args[1];
|
|
7623
|
+
} else {
|
|
7624
|
+
fetcherNode = args[1];
|
|
7625
|
+
}
|
|
7626
|
+
if (!fetcherNode) return null;
|
|
7627
|
+
if (fetcherNode.type === "ArrowFunctionExpression" || fetcherNode.type === "FunctionExpression") {
|
|
7628
|
+
return graph.functionsByNode.get(fetcherNode) ?? null;
|
|
7629
|
+
}
|
|
7630
|
+
if (fetcherNode.type === "Identifier") {
|
|
7631
|
+
const fns = graph.functionsByName.get(fetcherNode.name);
|
|
7632
|
+
if (fns && fns.length > 0) {
|
|
7633
|
+
const fn = fns[0];
|
|
7634
|
+
if (fn) return fn;
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
return null;
|
|
7638
|
+
}
|
|
7639
|
+
function fetcherCanThrow(graph, fn, visited) {
|
|
7640
|
+
if (visited.has(fn.id)) return false;
|
|
7641
|
+
visited.add(fn.id);
|
|
7642
|
+
if (fn.async && fn.awaitRanges.length > 0) return true;
|
|
7643
|
+
if (fn.hasThrowStatement) return true;
|
|
7644
|
+
const callSites = fn.callSites;
|
|
7645
|
+
for (let i = 0, len = callSites.length; i < len; i++) {
|
|
7646
|
+
const callSite = callSites[i];
|
|
7647
|
+
if (!callSite) continue;
|
|
7648
|
+
if (!callSite.resolvedTarget) return true;
|
|
7649
|
+
if (fetcherCanThrow(graph, callSite.resolvedTarget, visited)) return true;
|
|
7650
|
+
}
|
|
7651
|
+
return false;
|
|
7652
|
+
}
|
|
7653
|
+
function analyzeComponentBoundaries(graph, componentName) {
|
|
7654
|
+
const result = {
|
|
7655
|
+
conditionalMountTag: null,
|
|
7656
|
+
suspenseDistance: 0,
|
|
7657
|
+
lacksErrorBoundary: false,
|
|
7658
|
+
usagesLackingErrorBoundary: []
|
|
7659
|
+
};
|
|
7613
7660
|
const usages = graph.jsxByTag.get(componentName) ?? [];
|
|
7661
|
+
if (usages.length === 0) return result;
|
|
7614
7662
|
for (let i = 0, len = usages.length; i < len; i++) {
|
|
7615
7663
|
const usage = usages[i];
|
|
7616
7664
|
if (!usage) continue;
|
|
7617
7665
|
let current = usage.parent;
|
|
7618
7666
|
let conditionalTag = null;
|
|
7619
7667
|
let componentLevels = 0;
|
|
7668
|
+
let foundErrorBoundary = false;
|
|
7669
|
+
let foundSuspense = false;
|
|
7620
7670
|
while (current) {
|
|
7621
7671
|
const tag = current.tag;
|
|
7622
7672
|
if (tag && !current.isDomElement) {
|
|
7623
7673
|
componentLevels++;
|
|
7624
|
-
if (tag === "
|
|
7674
|
+
if (tag === "ErrorBoundary") {
|
|
7675
|
+
foundErrorBoundary = true;
|
|
7676
|
+
} else if (tag === "Suspense") {
|
|
7677
|
+
foundSuspense = true;
|
|
7678
|
+
if (!foundErrorBoundary) {
|
|
7679
|
+
result.lacksErrorBoundary = true;
|
|
7680
|
+
result.usagesLackingErrorBoundary.push(usage);
|
|
7681
|
+
}
|
|
7625
7682
|
if (conditionalTag !== null && componentLevels > 1) {
|
|
7626
|
-
|
|
7683
|
+
result.conditionalMountTag = conditionalTag;
|
|
7684
|
+
result.suspenseDistance = componentLevels;
|
|
7627
7685
|
}
|
|
7628
|
-
|
|
7629
|
-
}
|
|
7630
|
-
if (conditionalTag === null && CONDITIONAL_MOUNT_TAGS.has(tag)) {
|
|
7686
|
+
break;
|
|
7687
|
+
} else if (conditionalTag === null && CONDITIONAL_MOUNT_TAGS.has(tag)) {
|
|
7631
7688
|
conditionalTag = tag;
|
|
7632
7689
|
}
|
|
7633
7690
|
}
|
|
7634
7691
|
current = current.parent;
|
|
7635
7692
|
}
|
|
7636
|
-
if (
|
|
7637
|
-
|
|
7693
|
+
if (!foundSuspense && !foundErrorBoundary) {
|
|
7694
|
+
result.lacksErrorBoundary = true;
|
|
7695
|
+
result.usagesLackingErrorBoundary.push(usage);
|
|
7696
|
+
if (conditionalTag !== null) {
|
|
7697
|
+
result.conditionalMountTag = conditionalTag;
|
|
7698
|
+
result.suspenseDistance = componentLevels;
|
|
7699
|
+
}
|
|
7638
7700
|
}
|
|
7639
7701
|
}
|
|
7640
|
-
return
|
|
7702
|
+
return result;
|
|
7641
7703
|
}
|
|
7642
7704
|
function getContainingComponentName(graph, call) {
|
|
7643
7705
|
const selfComponent = graph.componentScopes.get(call.scope);
|
|
@@ -7654,43 +7716,65 @@ function findResourceVariable(graph, name) {
|
|
|
7654
7716
|
}
|
|
7655
7717
|
return null;
|
|
7656
7718
|
}
|
|
7719
|
+
function buildErrorBoundaryFix(usages, graph) {
|
|
7720
|
+
if (usages.length === 0) return null;
|
|
7721
|
+
const usage = usages[0];
|
|
7722
|
+
if (!usage) return null;
|
|
7723
|
+
const jsxNode = usage.node;
|
|
7724
|
+
const startPos = jsxNode.range[0];
|
|
7725
|
+
const endPos = jsxNode.range[1];
|
|
7726
|
+
const ops = [
|
|
7727
|
+
{ range: [startPos, startPos], text: "<ErrorBoundary fallback={<div>Error</div>}>" },
|
|
7728
|
+
{ range: [endPos, endPos], text: "</ErrorBoundary>" }
|
|
7729
|
+
];
|
|
7730
|
+
const importFix = buildSolidImportFix(graph, "ErrorBoundary");
|
|
7731
|
+
if (importFix) ops.unshift(importFix);
|
|
7732
|
+
return ops;
|
|
7733
|
+
}
|
|
7657
7734
|
var resourceImplicitSuspense = defineSolidRule({
|
|
7658
7735
|
id: "resource-implicit-suspense",
|
|
7659
7736
|
severity: "warn",
|
|
7660
7737
|
messages: messages16,
|
|
7661
7738
|
meta: {
|
|
7662
|
-
description: "Detect createResource
|
|
7663
|
-
fixable:
|
|
7739
|
+
description: "Detect createResource that implicitly triggers or permanently breaks Suspense boundaries.",
|
|
7740
|
+
fixable: true,
|
|
7664
7741
|
category: "reactivity"
|
|
7665
7742
|
},
|
|
7666
7743
|
options: options16,
|
|
7667
7744
|
check(graph, emit) {
|
|
7668
7745
|
const resourceCalls = getCallsByPrimitive(graph, "createResource");
|
|
7669
7746
|
if (resourceCalls.length === 0) return;
|
|
7747
|
+
const throwVisited = /* @__PURE__ */ new Set();
|
|
7748
|
+
const boundaryCache = /* @__PURE__ */ new Map();
|
|
7670
7749
|
for (let i = 0, len = resourceCalls.length; i < len; i++) {
|
|
7671
7750
|
const call = resourceCalls[i];
|
|
7672
7751
|
if (!call) continue;
|
|
7673
|
-
if (hasInitialValue(call)) continue;
|
|
7674
7752
|
const resourceName = getResourceVariableName(call);
|
|
7675
7753
|
if (!resourceName) continue;
|
|
7676
|
-
const
|
|
7677
|
-
if (resourceVariable && hasLoadingRead(resourceVariable)) {
|
|
7678
|
-
emit(
|
|
7679
|
-
createDiagnostic(
|
|
7680
|
-
graph.file,
|
|
7681
|
-
call.node,
|
|
7682
|
-
"resource-implicit-suspense",
|
|
7683
|
-
"loadingMismatch",
|
|
7684
|
-
resolveMessage(messages16.loadingMismatch, { name: resourceName }),
|
|
7685
|
-
"warn"
|
|
7686
|
-
)
|
|
7687
|
-
);
|
|
7688
|
-
continue;
|
|
7689
|
-
}
|
|
7754
|
+
const hasInitial = hasInitialValue(call);
|
|
7690
7755
|
const componentName = getContainingComponentName(graph, call);
|
|
7756
|
+
if (!hasInitial) {
|
|
7757
|
+
const resourceVariable = findResourceVariable(graph, resourceName);
|
|
7758
|
+
if (resourceVariable && hasLoadingRead(resourceVariable)) {
|
|
7759
|
+
emit(
|
|
7760
|
+
createDiagnostic(
|
|
7761
|
+
graph.file,
|
|
7762
|
+
call.node,
|
|
7763
|
+
"resource-implicit-suspense",
|
|
7764
|
+
"loadingMismatch",
|
|
7765
|
+
resolveMessage(messages16.loadingMismatch, { name: resourceName }),
|
|
7766
|
+
"warn"
|
|
7767
|
+
)
|
|
7768
|
+
);
|
|
7769
|
+
}
|
|
7770
|
+
}
|
|
7691
7771
|
if (!componentName) continue;
|
|
7692
|
-
|
|
7693
|
-
if (
|
|
7772
|
+
let analysis = boundaryCache.get(componentName);
|
|
7773
|
+
if (!analysis) {
|
|
7774
|
+
analysis = analyzeComponentBoundaries(graph, componentName);
|
|
7775
|
+
boundaryCache.set(componentName, analysis);
|
|
7776
|
+
}
|
|
7777
|
+
if (analysis.conditionalMountTag) {
|
|
7694
7778
|
emit(
|
|
7695
7779
|
createDiagnostic(
|
|
7696
7780
|
graph.file,
|
|
@@ -7699,12 +7783,32 @@ var resourceImplicitSuspense = defineSolidRule({
|
|
|
7699
7783
|
"conditionalSuspense",
|
|
7700
7784
|
resolveMessage(messages16.conditionalSuspense, {
|
|
7701
7785
|
name: resourceName,
|
|
7702
|
-
mountTag:
|
|
7786
|
+
mountTag: analysis.conditionalMountTag
|
|
7703
7787
|
}),
|
|
7704
7788
|
"error"
|
|
7705
7789
|
)
|
|
7706
7790
|
);
|
|
7707
7791
|
}
|
|
7792
|
+
if (analysis.lacksErrorBoundary) {
|
|
7793
|
+
const fetcherFn = resolveFetcherFunction(graph, call);
|
|
7794
|
+
if (fetcherFn && fetcherCanThrow(graph, fetcherFn, throwVisited)) {
|
|
7795
|
+
const errorBoundaryFix = buildErrorBoundaryFix(
|
|
7796
|
+
analysis.usagesLackingErrorBoundary,
|
|
7797
|
+
graph
|
|
7798
|
+
);
|
|
7799
|
+
emit(
|
|
7800
|
+
createDiagnostic(
|
|
7801
|
+
graph.file,
|
|
7802
|
+
call.node,
|
|
7803
|
+
"resource-implicit-suspense",
|
|
7804
|
+
"missingErrorBoundary",
|
|
7805
|
+
resolveMessage(messages16.missingErrorBoundary, { name: resourceName }),
|
|
7806
|
+
"error",
|
|
7807
|
+
errorBoundaryFix ?? void 0
|
|
7808
|
+
)
|
|
7809
|
+
);
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7708
7812
|
}
|
|
7709
7813
|
}
|
|
7710
7814
|
});
|
|
@@ -30201,7 +30305,168 @@ function collectTransitiveCSSScope(entryPath, resolver, cssFilesByNormalizedPath
|
|
|
30201
30305
|
return out;
|
|
30202
30306
|
}
|
|
30203
30307
|
|
|
30308
|
+
// src/cross-file/layout/signal-model.ts
|
|
30309
|
+
var layoutSignalNames = [
|
|
30310
|
+
"line-height",
|
|
30311
|
+
"font-size",
|
|
30312
|
+
"width",
|
|
30313
|
+
"inline-size",
|
|
30314
|
+
"height",
|
|
30315
|
+
"block-size",
|
|
30316
|
+
"min-width",
|
|
30317
|
+
"min-block-size",
|
|
30318
|
+
"min-height",
|
|
30319
|
+
"aspect-ratio",
|
|
30320
|
+
"vertical-align",
|
|
30321
|
+
"display",
|
|
30322
|
+
"white-space",
|
|
30323
|
+
"object-fit",
|
|
30324
|
+
"overflow",
|
|
30325
|
+
"overflow-y",
|
|
30326
|
+
"overflow-anchor",
|
|
30327
|
+
"scrollbar-gutter",
|
|
30328
|
+
"scrollbar-width",
|
|
30329
|
+
"contain-intrinsic-size",
|
|
30330
|
+
"content-visibility",
|
|
30331
|
+
"align-items",
|
|
30332
|
+
"align-self",
|
|
30333
|
+
"justify-items",
|
|
30334
|
+
"place-items",
|
|
30335
|
+
"place-self",
|
|
30336
|
+
"flex-direction",
|
|
30337
|
+
"grid-auto-flow",
|
|
30338
|
+
"appearance",
|
|
30339
|
+
"box-sizing",
|
|
30340
|
+
"padding-top",
|
|
30341
|
+
"padding-left",
|
|
30342
|
+
"padding-right",
|
|
30343
|
+
"padding-bottom",
|
|
30344
|
+
"border-top-width",
|
|
30345
|
+
"border-left-width",
|
|
30346
|
+
"border-right-width",
|
|
30347
|
+
"border-bottom-width",
|
|
30348
|
+
"position",
|
|
30349
|
+
"top",
|
|
30350
|
+
"bottom",
|
|
30351
|
+
"margin-top",
|
|
30352
|
+
"margin-bottom",
|
|
30353
|
+
"transform",
|
|
30354
|
+
"translate",
|
|
30355
|
+
"inset-block-start",
|
|
30356
|
+
"inset-block-end",
|
|
30357
|
+
"writing-mode",
|
|
30358
|
+
"direction"
|
|
30359
|
+
];
|
|
30360
|
+
|
|
30361
|
+
// src/cross-file/layout/util.ts
|
|
30362
|
+
var CONTROL_ELEMENT_TAGS = /* @__PURE__ */ new Set([
|
|
30363
|
+
"input",
|
|
30364
|
+
"select",
|
|
30365
|
+
"textarea",
|
|
30366
|
+
"button"
|
|
30367
|
+
]);
|
|
30368
|
+
var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
|
|
30369
|
+
"img",
|
|
30370
|
+
"svg",
|
|
30371
|
+
"video",
|
|
30372
|
+
"canvas",
|
|
30373
|
+
"iframe",
|
|
30374
|
+
"object",
|
|
30375
|
+
"embed"
|
|
30376
|
+
]);
|
|
30377
|
+
var WHITESPACE_RE3 = /\s+/;
|
|
30378
|
+
function clamp(value2, min, max) {
|
|
30379
|
+
if (value2 < min) return min;
|
|
30380
|
+
if (value2 > max) return max;
|
|
30381
|
+
return value2;
|
|
30382
|
+
}
|
|
30383
|
+
function mergeEvidenceKind(left, right) {
|
|
30384
|
+
return left > right ? left : right;
|
|
30385
|
+
}
|
|
30386
|
+
function selectKth(values, targetIndex) {
|
|
30387
|
+
let left = 0;
|
|
30388
|
+
let right = values.length - 1;
|
|
30389
|
+
while (left <= right) {
|
|
30390
|
+
if (left === right) {
|
|
30391
|
+
const result = values[left];
|
|
30392
|
+
if (result === void 0) return 0;
|
|
30393
|
+
return result;
|
|
30394
|
+
}
|
|
30395
|
+
const pivotIndex = choosePivotIndex(values, left, right);
|
|
30396
|
+
const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
|
|
30397
|
+
if (partitionIndex === targetIndex) {
|
|
30398
|
+
const result = values[partitionIndex];
|
|
30399
|
+
if (result === void 0) return 0;
|
|
30400
|
+
return result;
|
|
30401
|
+
}
|
|
30402
|
+
if (partitionIndex < targetIndex) {
|
|
30403
|
+
left = partitionIndex + 1;
|
|
30404
|
+
continue;
|
|
30405
|
+
}
|
|
30406
|
+
right = partitionIndex - 1;
|
|
30407
|
+
}
|
|
30408
|
+
const fallback = values[targetIndex];
|
|
30409
|
+
if (fallback === void 0) return 0;
|
|
30410
|
+
return fallback;
|
|
30411
|
+
}
|
|
30412
|
+
function choosePivotIndex(values, left, right) {
|
|
30413
|
+
const middle = Math.floor((left + right) / 2);
|
|
30414
|
+
const leftValue = values[left] ?? 0;
|
|
30415
|
+
const middleValue = values[middle] ?? 0;
|
|
30416
|
+
const rightValue = values[right] ?? 0;
|
|
30417
|
+
if (leftValue < middleValue) {
|
|
30418
|
+
if (middleValue < rightValue) return middle;
|
|
30419
|
+
if (leftValue < rightValue) return right;
|
|
30420
|
+
return left;
|
|
30421
|
+
}
|
|
30422
|
+
if (leftValue < rightValue) return left;
|
|
30423
|
+
if (middleValue < rightValue) return right;
|
|
30424
|
+
return middle;
|
|
30425
|
+
}
|
|
30426
|
+
function partitionAroundPivot(values, left, right, pivotIndex) {
|
|
30427
|
+
const pivotValue = values[pivotIndex] ?? 0;
|
|
30428
|
+
swap(values, pivotIndex, right);
|
|
30429
|
+
let storeIndex = left;
|
|
30430
|
+
for (let i = left; i < right; i++) {
|
|
30431
|
+
const current = values[i];
|
|
30432
|
+
if (current === void 0 || current > pivotValue) continue;
|
|
30433
|
+
swap(values, storeIndex, i);
|
|
30434
|
+
storeIndex++;
|
|
30435
|
+
}
|
|
30436
|
+
swap(values, storeIndex, right);
|
|
30437
|
+
return storeIndex;
|
|
30438
|
+
}
|
|
30439
|
+
function swap(values, left, right) {
|
|
30440
|
+
if (left === right) return;
|
|
30441
|
+
const leftValue = values[left] ?? 0;
|
|
30442
|
+
const rightValue = values[right] ?? 0;
|
|
30443
|
+
values[left] = rightValue;
|
|
30444
|
+
values[right] = leftValue;
|
|
30445
|
+
}
|
|
30446
|
+
function toComparableExactValue(value2) {
|
|
30447
|
+
if (value2.value !== null) {
|
|
30448
|
+
if (value2.kind !== 0 /* Exact */) return null;
|
|
30449
|
+
return value2.value;
|
|
30450
|
+
}
|
|
30451
|
+
if (value2.kind === 0 /* Exact */) return 0;
|
|
30452
|
+
return null;
|
|
30453
|
+
}
|
|
30454
|
+
|
|
30204
30455
|
// src/cross-file/layout/perf.ts
|
|
30456
|
+
function createReservoir(capacity) {
|
|
30457
|
+
return { buffer: [], count: 0, capacity };
|
|
30458
|
+
}
|
|
30459
|
+
function reservoirPush(r, value2) {
|
|
30460
|
+
r.count++;
|
|
30461
|
+
if (r.buffer.length < r.capacity) {
|
|
30462
|
+
r.buffer.push(value2);
|
|
30463
|
+
return;
|
|
30464
|
+
}
|
|
30465
|
+
const j = Math.floor(Math.random() * r.count);
|
|
30466
|
+
if (j < r.capacity) {
|
|
30467
|
+
r.buffer[j] = value2;
|
|
30468
|
+
}
|
|
30469
|
+
}
|
|
30205
30470
|
var EMPTY_STATS = {
|
|
30206
30471
|
elementsScanned: 0,
|
|
30207
30472
|
selectorCandidatesChecked: 0,
|
|
@@ -30258,7 +30523,7 @@ function createLayoutPerfStats() {
|
|
|
30258
30523
|
cohortUnimodalFalse: 0,
|
|
30259
30524
|
factorCoverageSum: 0,
|
|
30260
30525
|
factorCoverageCount: 0,
|
|
30261
|
-
posteriorWidths:
|
|
30526
|
+
posteriorWidths: createReservoir(200),
|
|
30262
30527
|
uncertaintyEscalations: 0,
|
|
30263
30528
|
signalSnapshotsBuilt: 0,
|
|
30264
30529
|
signalSnapshotCacheHits: 0,
|
|
@@ -30323,14 +30588,12 @@ function maybeLogLayoutPerf(stats, log) {
|
|
|
30323
30588
|
`[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}`
|
|
30324
30589
|
);
|
|
30325
30590
|
}
|
|
30326
|
-
function computeP95(
|
|
30327
|
-
if (
|
|
30328
|
-
const
|
|
30329
|
-
|
|
30330
|
-
const
|
|
30331
|
-
|
|
30332
|
-
if (index >= sorted.length) return sorted[sorted.length - 1] ?? 0;
|
|
30333
|
-
return sorted[index] ?? 0;
|
|
30591
|
+
function computeP95(sampler) {
|
|
30592
|
+
if (sampler.buffer.length === 0) return 0;
|
|
30593
|
+
const scratch = [...sampler.buffer];
|
|
30594
|
+
const index = Math.ceil(scratch.length * 0.95) - 1;
|
|
30595
|
+
const clamped = index <= 0 ? 0 : index >= scratch.length ? scratch.length - 1 : index;
|
|
30596
|
+
return selectKth(scratch, clamped);
|
|
30334
30597
|
}
|
|
30335
30598
|
|
|
30336
30599
|
// src/cross-file/layout/component-host.ts
|
|
@@ -31439,98 +31702,47 @@ function expandShorthand(property, value2) {
|
|
|
31439
31702
|
{ name: blockTarget[1], value: parsed.end }
|
|
31440
31703
|
];
|
|
31441
31704
|
}
|
|
31705
|
+
if (property === "flex-flow") {
|
|
31706
|
+
return expandFlexFlow(value2);
|
|
31707
|
+
}
|
|
31442
31708
|
return void 0;
|
|
31443
31709
|
}
|
|
31710
|
+
var FLEX_DIRECTION_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse", "column", "column-reverse"]);
|
|
31711
|
+
function expandFlexFlow(value2) {
|
|
31712
|
+
const tokens = splitWhitespaceTokens(value2.trim().toLowerCase());
|
|
31713
|
+
if (tokens.length === 0) return null;
|
|
31714
|
+
if (tokens.length > 2) return null;
|
|
31715
|
+
let direction = null;
|
|
31716
|
+
let wrap = null;
|
|
31717
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
31718
|
+
const token = tokens[i];
|
|
31719
|
+
if (!token) continue;
|
|
31720
|
+
if (FLEX_DIRECTION_VALUES.has(token)) {
|
|
31721
|
+
if (direction !== null) return null;
|
|
31722
|
+
direction = token;
|
|
31723
|
+
} else {
|
|
31724
|
+
if (wrap !== null) return null;
|
|
31725
|
+
wrap = token;
|
|
31726
|
+
}
|
|
31727
|
+
}
|
|
31728
|
+
const out = [];
|
|
31729
|
+
if (direction !== null) {
|
|
31730
|
+
out.push({ name: "flex-direction", value: direction });
|
|
31731
|
+
}
|
|
31732
|
+
if (wrap !== null) {
|
|
31733
|
+
out.push({ name: "flex-wrap", value: wrap });
|
|
31734
|
+
}
|
|
31735
|
+
return out.length > 0 ? out : null;
|
|
31736
|
+
}
|
|
31444
31737
|
function getShorthandLonghandNames(property) {
|
|
31445
31738
|
const quad = QUAD_EXPANSIONS.get(property);
|
|
31446
31739
|
if (quad !== void 0) return [...quad];
|
|
31447
31740
|
const block = BLOCK_EXPANSIONS.get(property);
|
|
31448
31741
|
if (block !== void 0) return [...block];
|
|
31742
|
+
if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
|
|
31449
31743
|
return null;
|
|
31450
31744
|
}
|
|
31451
31745
|
|
|
31452
|
-
// src/cross-file/layout/util.ts
|
|
31453
|
-
var CONTROL_ELEMENT_TAGS = /* @__PURE__ */ new Set([
|
|
31454
|
-
"input",
|
|
31455
|
-
"select",
|
|
31456
|
-
"textarea",
|
|
31457
|
-
"button"
|
|
31458
|
-
]);
|
|
31459
|
-
function clamp(value2, min, max) {
|
|
31460
|
-
if (value2 < min) return min;
|
|
31461
|
-
if (value2 > max) return max;
|
|
31462
|
-
return value2;
|
|
31463
|
-
}
|
|
31464
|
-
function kindRank(kind) {
|
|
31465
|
-
if (kind === "exact") return 0;
|
|
31466
|
-
if (kind === "interval") return 1;
|
|
31467
|
-
if (kind === "conditional") return 2;
|
|
31468
|
-
return 3;
|
|
31469
|
-
}
|
|
31470
|
-
function mergeEvidenceKind(left, right) {
|
|
31471
|
-
if (kindRank(left) >= kindRank(right)) return left;
|
|
31472
|
-
return right;
|
|
31473
|
-
}
|
|
31474
|
-
function toComparableExactValue(value2) {
|
|
31475
|
-
if (value2.value !== null) {
|
|
31476
|
-
if (value2.kind !== "exact") return null;
|
|
31477
|
-
return value2.value;
|
|
31478
|
-
}
|
|
31479
|
-
if (value2.kind === "exact") return 0;
|
|
31480
|
-
return null;
|
|
31481
|
-
}
|
|
31482
|
-
|
|
31483
|
-
// src/cross-file/layout/signal-model.ts
|
|
31484
|
-
var layoutSignalNames = [
|
|
31485
|
-
"line-height",
|
|
31486
|
-
"font-size",
|
|
31487
|
-
"width",
|
|
31488
|
-
"inline-size",
|
|
31489
|
-
"height",
|
|
31490
|
-
"block-size",
|
|
31491
|
-
"min-width",
|
|
31492
|
-
"min-block-size",
|
|
31493
|
-
"min-height",
|
|
31494
|
-
"aspect-ratio",
|
|
31495
|
-
"vertical-align",
|
|
31496
|
-
"display",
|
|
31497
|
-
"white-space",
|
|
31498
|
-
"object-fit",
|
|
31499
|
-
"overflow",
|
|
31500
|
-
"overflow-y",
|
|
31501
|
-
"overflow-anchor",
|
|
31502
|
-
"scrollbar-gutter",
|
|
31503
|
-
"scrollbar-width",
|
|
31504
|
-
"contain-intrinsic-size",
|
|
31505
|
-
"content-visibility",
|
|
31506
|
-
"align-items",
|
|
31507
|
-
"align-self",
|
|
31508
|
-
"justify-items",
|
|
31509
|
-
"place-items",
|
|
31510
|
-
"place-self",
|
|
31511
|
-
"appearance",
|
|
31512
|
-
"box-sizing",
|
|
31513
|
-
"padding-top",
|
|
31514
|
-
"padding-left",
|
|
31515
|
-
"padding-right",
|
|
31516
|
-
"padding-bottom",
|
|
31517
|
-
"border-top-width",
|
|
31518
|
-
"border-left-width",
|
|
31519
|
-
"border-right-width",
|
|
31520
|
-
"border-bottom-width",
|
|
31521
|
-
"position",
|
|
31522
|
-
"top",
|
|
31523
|
-
"bottom",
|
|
31524
|
-
"margin-top",
|
|
31525
|
-
"margin-bottom",
|
|
31526
|
-
"transform",
|
|
31527
|
-
"translate",
|
|
31528
|
-
"inset-block-start",
|
|
31529
|
-
"inset-block-end",
|
|
31530
|
-
"writing-mode",
|
|
31531
|
-
"direction"
|
|
31532
|
-
];
|
|
31533
|
-
|
|
31534
31746
|
// src/cross-file/layout/signal-normalization.ts
|
|
31535
31747
|
var MONITORED_SIGNAL_SET = new Set(layoutSignalNames);
|
|
31536
31748
|
var MONITORED_SIGNAL_NAME_MAP = new Map(
|
|
@@ -31541,7 +31753,8 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
|
|
|
31541
31753
|
"border-width",
|
|
31542
31754
|
"margin-block",
|
|
31543
31755
|
"padding-block",
|
|
31544
|
-
"inset-block"
|
|
31756
|
+
"inset-block",
|
|
31757
|
+
"flex-flow"
|
|
31545
31758
|
]);
|
|
31546
31759
|
var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
|
|
31547
31760
|
"font-size",
|
|
@@ -31583,13 +31796,22 @@ var KEYWORD_SIGNAL_SET = /* @__PURE__ */ new Set([
|
|
|
31583
31796
|
"justify-items",
|
|
31584
31797
|
"place-items",
|
|
31585
31798
|
"place-self",
|
|
31799
|
+
"flex-direction",
|
|
31800
|
+
"grid-auto-flow",
|
|
31586
31801
|
"appearance",
|
|
31587
31802
|
"box-sizing",
|
|
31588
31803
|
"position",
|
|
31589
31804
|
"writing-mode",
|
|
31590
31805
|
"direction"
|
|
31591
31806
|
]);
|
|
31592
|
-
var
|
|
31807
|
+
var REPLACED_ELEMENT_TAGS = /* @__PURE__ */ new Set([
|
|
31808
|
+
...CONTROL_ELEMENT_TAGS,
|
|
31809
|
+
"img",
|
|
31810
|
+
"video",
|
|
31811
|
+
"canvas",
|
|
31812
|
+
"svg",
|
|
31813
|
+
"iframe"
|
|
31814
|
+
]);
|
|
31593
31815
|
function isMonitoredSignal(property) {
|
|
31594
31816
|
if (MONITORED_SIGNAL_SET.has(property)) return true;
|
|
31595
31817
|
return MONITORED_SHORTHAND_SET.has(property);
|
|
@@ -31600,7 +31822,7 @@ function isControlTag(tag) {
|
|
|
31600
31822
|
}
|
|
31601
31823
|
function isReplacedTag(tag) {
|
|
31602
31824
|
if (tag === null) return false;
|
|
31603
|
-
return
|
|
31825
|
+
return REPLACED_ELEMENT_TAGS.has(tag.toLowerCase());
|
|
31604
31826
|
}
|
|
31605
31827
|
function normalizeSignalMapWithCounts(values) {
|
|
31606
31828
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -31611,12 +31833,11 @@ function normalizeSignalMapWithCounts(values) {
|
|
|
31611
31833
|
"font-size",
|
|
31612
31834
|
fontSizeEntry.value,
|
|
31613
31835
|
fontSizeEntry.source,
|
|
31614
|
-
fontSizeEntry.guard,
|
|
31615
31836
|
fontSizeEntry.guardProvenance,
|
|
31616
31837
|
null
|
|
31617
31838
|
);
|
|
31618
31839
|
out.set("font-size", parsedFontSize);
|
|
31619
|
-
if (parsedFontSize.kind === "known" && parsedFontSize.guard ===
|
|
31840
|
+
if (parsedFontSize.kind === "known" && parsedFontSize.guard.kind === 0 /* Unconditional */) {
|
|
31620
31841
|
fontSizePx = parsedFontSize.px;
|
|
31621
31842
|
}
|
|
31622
31843
|
}
|
|
@@ -31632,7 +31853,6 @@ function normalizeSignalMapWithCounts(values) {
|
|
|
31632
31853
|
name,
|
|
31633
31854
|
declaration.value,
|
|
31634
31855
|
declaration.source,
|
|
31635
|
-
declaration.guard,
|
|
31636
31856
|
declaration.guardProvenance,
|
|
31637
31857
|
fontSizePx
|
|
31638
31858
|
);
|
|
@@ -31642,7 +31862,7 @@ function normalizeSignalMapWithCounts(values) {
|
|
|
31642
31862
|
let unknownSignalCount = 0;
|
|
31643
31863
|
let conditionalSignalCount = 0;
|
|
31644
31864
|
for (const value2 of out.values()) {
|
|
31645
|
-
if (value2.guard ===
|
|
31865
|
+
if (value2.guard.kind === 1 /* Conditional */) {
|
|
31646
31866
|
conditionalSignalCount++;
|
|
31647
31867
|
continue;
|
|
31648
31868
|
}
|
|
@@ -31670,7 +31890,7 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
|
|
|
31670
31890
|
if (!longhand) continue;
|
|
31671
31891
|
const name = MONITORED_SIGNAL_NAME_MAP.get(longhand);
|
|
31672
31892
|
if (name === void 0) continue;
|
|
31673
|
-
out.set(name, createUnknown(name, declaration.
|
|
31893
|
+
out.set(name, createUnknown(name, declaration.source, declaration.guardProvenance, reason));
|
|
31674
31894
|
}
|
|
31675
31895
|
return;
|
|
31676
31896
|
}
|
|
@@ -31680,127 +31900,139 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
|
|
|
31680
31900
|
if (!entry) continue;
|
|
31681
31901
|
const name = MONITORED_SIGNAL_NAME_MAP.get(entry.name);
|
|
31682
31902
|
if (name === void 0) continue;
|
|
31683
|
-
out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.
|
|
31903
|
+
out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guardProvenance, fontSizePx));
|
|
31684
31904
|
}
|
|
31685
31905
|
}
|
|
31686
31906
|
function toMonitoredSignalName(property) {
|
|
31687
31907
|
return MONITORED_SIGNAL_NAME_MAP.get(property) ?? null;
|
|
31688
31908
|
}
|
|
31689
|
-
function normalizeSignal(name, raw, source, guard,
|
|
31909
|
+
function normalizeSignal(name, raw, source, guard, fontSizePx) {
|
|
31690
31910
|
switch (name) {
|
|
31691
31911
|
case "line-height":
|
|
31692
|
-
return parseLineHeight(name, raw, source, guard,
|
|
31912
|
+
return parseLineHeight(name, raw, source, guard, fontSizePx);
|
|
31693
31913
|
case "aspect-ratio":
|
|
31694
|
-
return parseAspectRatio(name, raw, source, guard
|
|
31914
|
+
return parseAspectRatio(name, raw, source, guard);
|
|
31695
31915
|
case "contain-intrinsic-size":
|
|
31696
|
-
return parseContainIntrinsicSize(name, raw, source, guard
|
|
31916
|
+
return parseContainIntrinsicSize(name, raw, source, guard);
|
|
31697
31917
|
case "transform":
|
|
31698
|
-
return parseTransform(name, raw, source, guard
|
|
31918
|
+
return parseTransform(name, raw, source, guard);
|
|
31699
31919
|
case "translate":
|
|
31700
|
-
return parseTranslateProperty(name, raw, source, guard
|
|
31920
|
+
return parseTranslateProperty(name, raw, source, guard);
|
|
31701
31921
|
default:
|
|
31702
31922
|
break;
|
|
31703
31923
|
}
|
|
31704
|
-
if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard
|
|
31705
|
-
if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard
|
|
31706
|
-
return createUnknown(name,
|
|
31924
|
+
if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard);
|
|
31925
|
+
if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard);
|
|
31926
|
+
return createUnknown(name, source, guard, "unsupported signal");
|
|
31707
31927
|
}
|
|
31708
|
-
function parseAspectRatio(name, raw, source, guard
|
|
31928
|
+
function parseAspectRatio(name, raw, source, guard) {
|
|
31709
31929
|
const trimmed = raw.trim().toLowerCase();
|
|
31710
31930
|
if (trimmed.length === 0) {
|
|
31711
|
-
return createUnknown(name,
|
|
31931
|
+
return createUnknown(name, source, guard, "aspect-ratio value is empty");
|
|
31712
31932
|
}
|
|
31713
31933
|
if (hasDynamicExpression(trimmed)) {
|
|
31714
|
-
return createUnknown(name,
|
|
31934
|
+
return createUnknown(name, source, guard, "aspect-ratio uses runtime-dependent function");
|
|
31715
31935
|
}
|
|
31716
31936
|
if (trimmed === "auto") {
|
|
31717
|
-
return createUnknown(name,
|
|
31937
|
+
return createUnknown(name, source, guard, "aspect-ratio auto does not reserve ratio");
|
|
31718
31938
|
}
|
|
31719
31939
|
const slash = trimmed.indexOf("/");
|
|
31720
31940
|
if (slash !== -1) {
|
|
31721
31941
|
const left = Number(trimmed.slice(0, slash).trim());
|
|
31722
31942
|
const right = Number(trimmed.slice(slash + 1).trim());
|
|
31723
31943
|
if (!Number.isFinite(left) || !Number.isFinite(right) || left <= 0 || right <= 0) {
|
|
31724
|
-
return createUnknown(name,
|
|
31944
|
+
return createUnknown(name, source, guard, "aspect-ratio ratio is invalid");
|
|
31725
31945
|
}
|
|
31726
|
-
return createKnown(name, raw, source, guard,
|
|
31946
|
+
return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
|
|
31727
31947
|
}
|
|
31728
31948
|
const ratio = Number(trimmed);
|
|
31729
31949
|
if (!Number.isFinite(ratio) || ratio <= 0) {
|
|
31730
|
-
return createUnknown(name,
|
|
31950
|
+
return createUnknown(name, source, guard, "aspect-ratio is not statically parseable");
|
|
31731
31951
|
}
|
|
31732
|
-
return createKnown(name, raw, source, guard,
|
|
31952
|
+
return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
|
|
31733
31953
|
}
|
|
31734
|
-
function parseContainIntrinsicSize(name, raw, source, guard
|
|
31954
|
+
function parseContainIntrinsicSize(name, raw, source, guard) {
|
|
31735
31955
|
const trimmed = raw.trim().toLowerCase();
|
|
31736
31956
|
if (trimmed.length === 0) {
|
|
31737
|
-
return createUnknown(name,
|
|
31957
|
+
return createUnknown(name, source, guard, "contain-intrinsic-size value is empty");
|
|
31738
31958
|
}
|
|
31739
31959
|
if (hasDynamicExpression(trimmed)) {
|
|
31740
|
-
return createUnknown(name,
|
|
31960
|
+
return createUnknown(name, source, guard, "contain-intrinsic-size uses runtime-dependent function");
|
|
31741
31961
|
}
|
|
31742
31962
|
if (trimmed === "none" || trimmed === "auto") {
|
|
31743
|
-
return createUnknown(name,
|
|
31963
|
+
return createUnknown(name, source, guard, "contain-intrinsic-size does not reserve space");
|
|
31744
31964
|
}
|
|
31745
31965
|
const parts = splitWhitespaceTokens(trimmed);
|
|
31746
31966
|
for (let i = 0; i < parts.length; i++) {
|
|
31747
31967
|
const part = parts[i];
|
|
31748
31968
|
if (!part) continue;
|
|
31749
31969
|
const px = parseSignedPxValue(part);
|
|
31750
|
-
if (px !== null) return createKnown(name, raw, source, guard,
|
|
31970
|
+
if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
|
|
31751
31971
|
}
|
|
31752
|
-
return createUnknown(name,
|
|
31972
|
+
return createUnknown(name, source, guard, "contain-intrinsic-size is not statically parseable in px");
|
|
31753
31973
|
}
|
|
31754
|
-
function parseLineHeight(name, raw, source, guard,
|
|
31974
|
+
function parseLineHeight(name, raw, source, guard, fontSizePx) {
|
|
31755
31975
|
const unitless = parseUnitlessValue(raw);
|
|
31756
31976
|
if (unitless !== null) {
|
|
31757
31977
|
const base = fontSizePx === null ? 16 : fontSizePx;
|
|
31758
|
-
return createKnown(name, raw, source, guard,
|
|
31978
|
+
return createKnown(name, raw, source, guard, unitless * base, 1 /* Unitless */, "estimated");
|
|
31759
31979
|
}
|
|
31760
31980
|
const px = parseSignedPxValue(raw);
|
|
31761
|
-
if (px !== null) return createKnown(name, raw, source, guard,
|
|
31762
|
-
return createUnknown(name,
|
|
31981
|
+
if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
|
|
31982
|
+
return createUnknown(name, source, guard, "line-height is not statically parseable");
|
|
31763
31983
|
}
|
|
31764
|
-
|
|
31984
|
+
var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
|
|
31985
|
+
"auto",
|
|
31986
|
+
"none",
|
|
31987
|
+
"fit-content",
|
|
31988
|
+
"min-content",
|
|
31989
|
+
"max-content",
|
|
31990
|
+
"stretch"
|
|
31991
|
+
]);
|
|
31992
|
+
function parseLength(name, raw, source, guard) {
|
|
31765
31993
|
const px = parseSignedPxValue(raw);
|
|
31766
|
-
if (px
|
|
31767
|
-
return
|
|
31994
|
+
if (px !== null) {
|
|
31995
|
+
return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
|
|
31996
|
+
}
|
|
31997
|
+
const normalized = raw.trim().toLowerCase();
|
|
31998
|
+
if (DIMENSION_KEYWORD_SET.has(normalized) || normalized.startsWith("fit-content(")) {
|
|
31999
|
+
return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
|
|
31768
32000
|
}
|
|
31769
|
-
return
|
|
32001
|
+
return createUnknown(name, source, guard, "length is not statically parseable in px");
|
|
31770
32002
|
}
|
|
31771
|
-
function parseKeyword(name, raw, source, guard
|
|
32003
|
+
function parseKeyword(name, raw, source, guard) {
|
|
31772
32004
|
const normalized = raw.trim().toLowerCase();
|
|
31773
32005
|
if (normalized.length === 0) {
|
|
31774
|
-
return createUnknown(name,
|
|
32006
|
+
return createUnknown(name, source, guard, "keyword value is empty");
|
|
31775
32007
|
}
|
|
31776
32008
|
if (hasDynamicExpression(normalized)) {
|
|
31777
|
-
return createUnknown(name,
|
|
32009
|
+
return createUnknown(name, source, guard, "keyword uses runtime-dependent function");
|
|
31778
32010
|
}
|
|
31779
|
-
return createKnown(name, raw, source, guard,
|
|
32011
|
+
return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
|
|
31780
32012
|
}
|
|
31781
|
-
function parseTransform(name, raw, source, guard
|
|
32013
|
+
function parseTransform(name, raw, source, guard) {
|
|
31782
32014
|
const normalized = raw.trim().toLowerCase();
|
|
31783
32015
|
if (normalized.length === 0) {
|
|
31784
|
-
return createUnknown(name,
|
|
32016
|
+
return createUnknown(name, source, guard, "transform value is empty");
|
|
31785
32017
|
}
|
|
31786
32018
|
if (hasDynamicExpression(normalized)) {
|
|
31787
|
-
return createUnknown(name,
|
|
32019
|
+
return createUnknown(name, source, guard, "transform uses runtime-dependent function");
|
|
31788
32020
|
}
|
|
31789
32021
|
const y = extractTransformYPx(normalized);
|
|
31790
|
-
if (y !== null) return createKnown(name, raw, source, guard,
|
|
31791
|
-
return createUnknown(name,
|
|
32022
|
+
if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
|
|
32023
|
+
return createUnknown(name, source, guard, "transform has non-translational or non-px functions");
|
|
31792
32024
|
}
|
|
31793
|
-
function parseTranslateProperty(name, raw, source, guard
|
|
32025
|
+
function parseTranslateProperty(name, raw, source, guard) {
|
|
31794
32026
|
const trimmed = raw.trim().toLowerCase();
|
|
31795
32027
|
if (trimmed.length === 0) {
|
|
31796
|
-
return createUnknown(name,
|
|
32028
|
+
return createUnknown(name, source, guard, "translate value is empty");
|
|
31797
32029
|
}
|
|
31798
32030
|
if (hasDynamicExpression(trimmed)) {
|
|
31799
|
-
return createUnknown(name,
|
|
32031
|
+
return createUnknown(name, source, guard, "translate uses runtime-dependent function");
|
|
31800
32032
|
}
|
|
31801
32033
|
const y = extractTranslatePropertyYPx(trimmed);
|
|
31802
|
-
if (y !== null) return createKnown(name, raw, source, guard,
|
|
31803
|
-
return createUnknown(name,
|
|
32034
|
+
if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
|
|
32035
|
+
return createUnknown(name, source, guard, "translate property vertical component is not px");
|
|
31804
32036
|
}
|
|
31805
32037
|
function hasDynamicExpression(raw) {
|
|
31806
32038
|
if (raw.includes("var(")) return true;
|
|
@@ -31812,28 +32044,24 @@ function hasDynamicExpression(raw) {
|
|
|
31812
32044
|
if (raw.includes("clamp(")) return true;
|
|
31813
32045
|
return false;
|
|
31814
32046
|
}
|
|
31815
|
-
function createKnown(name, raw, source, guard,
|
|
32047
|
+
function createKnown(name, raw, source, guard, px, unit, quality) {
|
|
31816
32048
|
return {
|
|
31817
32049
|
kind: "known",
|
|
31818
32050
|
name,
|
|
31819
|
-
raw,
|
|
31820
32051
|
normalized: raw.trim().toLowerCase(),
|
|
31821
32052
|
source,
|
|
31822
32053
|
guard,
|
|
31823
|
-
guardProvenance,
|
|
31824
32054
|
unit,
|
|
31825
32055
|
px,
|
|
31826
32056
|
quality
|
|
31827
32057
|
};
|
|
31828
32058
|
}
|
|
31829
|
-
function createUnknown(name,
|
|
32059
|
+
function createUnknown(name, source, guard, reason) {
|
|
31830
32060
|
return {
|
|
31831
32061
|
kind: "unknown",
|
|
31832
32062
|
name,
|
|
31833
|
-
raw,
|
|
31834
32063
|
source,
|
|
31835
32064
|
guard,
|
|
31836
|
-
guardProvenance,
|
|
31837
32065
|
reason
|
|
31838
32066
|
};
|
|
31839
32067
|
}
|
|
@@ -32794,16 +33022,16 @@ function includesAttributeWord(value2, word) {
|
|
|
32794
33022
|
|
|
32795
33023
|
// src/cross-file/layout/guard-model.ts
|
|
32796
33024
|
var UNCONDITIONAL_GUARD = {
|
|
32797
|
-
kind:
|
|
33025
|
+
kind: 0 /* Unconditional */,
|
|
32798
33026
|
conditions: [],
|
|
32799
33027
|
key: "always"
|
|
32800
33028
|
};
|
|
32801
|
-
var
|
|
33029
|
+
var WHITESPACE_RE_GLOBAL = /\s+/g;
|
|
32802
33030
|
function resolveRuleGuard(rule) {
|
|
32803
33031
|
const conditions = collectRuleConditions(rule);
|
|
32804
33032
|
if (conditions.length === 0) return UNCONDITIONAL_GUARD;
|
|
32805
33033
|
return {
|
|
32806
|
-
kind:
|
|
33034
|
+
kind: 1 /* Conditional */,
|
|
32807
33035
|
conditions,
|
|
32808
33036
|
key: conditions.map((condition) => condition.key).join("&")
|
|
32809
33037
|
};
|
|
@@ -32857,7 +33085,7 @@ function buildCondition(kind, query) {
|
|
|
32857
33085
|
}
|
|
32858
33086
|
function normalizeQuery(query) {
|
|
32859
33087
|
if (query === null) return null;
|
|
32860
|
-
const normalized = query.trim().toLowerCase().replace(
|
|
33088
|
+
const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE_GLOBAL, " ");
|
|
32861
33089
|
if (normalized.length === 0) return null;
|
|
32862
33090
|
return normalized;
|
|
32863
33091
|
}
|
|
@@ -32909,13 +33137,7 @@ function buildSnapshotForNode(node, cascadeByElementNode, snapshotByElementNode,
|
|
|
32909
33137
|
const unknownSignalCount = normalized.unknownSignalCount + inherited.unknownDelta;
|
|
32910
33138
|
const conditionalSignalCount = normalized.conditionalSignalCount + inherited.conditionalDelta;
|
|
32911
33139
|
const snapshot = {
|
|
32912
|
-
|
|
32913
|
-
elementId: node.elementId,
|
|
32914
|
-
elementKey: node.key,
|
|
32915
|
-
tag: node.tag,
|
|
32916
|
-
textualContent: node.textualContent,
|
|
32917
|
-
isControl: node.isControl,
|
|
32918
|
-
isReplaced: node.isReplaced,
|
|
33140
|
+
node,
|
|
32919
33141
|
signals: inherited.signals,
|
|
32920
33142
|
knownSignalCount,
|
|
32921
33143
|
unknownSignalCount,
|
|
@@ -32946,7 +33168,7 @@ function inheritSignalsFromParent(parentSnapshot, local) {
|
|
|
32946
33168
|
if (!inheritedValue) continue;
|
|
32947
33169
|
if (out === null) out = new Map(local);
|
|
32948
33170
|
out.set(signal, inheritedValue);
|
|
32949
|
-
if (inheritedValue.guard ===
|
|
33171
|
+
if (inheritedValue.guard.kind === 1 /* Conditional */) {
|
|
32950
33172
|
conditionalDelta++;
|
|
32951
33173
|
continue;
|
|
32952
33174
|
}
|
|
@@ -32972,6 +33194,11 @@ function inheritSignalsFromParent(parentSnapshot, local) {
|
|
|
32972
33194
|
};
|
|
32973
33195
|
}
|
|
32974
33196
|
|
|
33197
|
+
// src/cross-file/layout/context-model.ts
|
|
33198
|
+
function deriveAlignmentContext(base, overrides) {
|
|
33199
|
+
return { ...base, ...overrides };
|
|
33200
|
+
}
|
|
33201
|
+
|
|
32975
33202
|
// src/cross-file/layout/signal-access.ts
|
|
32976
33203
|
var EMPTY_STRING_LIST = Object.freeze([]);
|
|
32977
33204
|
var EMPTY_LAYOUT_NODE_LIST = Object.freeze([]);
|
|
@@ -32990,7 +33217,7 @@ var EMPTY_LAYOUT_RESERVED_SPACE_FACT = Object.freeze({
|
|
|
32990
33217
|
});
|
|
32991
33218
|
var EMPTY_LAYOUT_SCROLL_CONTAINER_FACT = Object.freeze({
|
|
32992
33219
|
isScrollContainer: false,
|
|
32993
|
-
axis:
|
|
33220
|
+
axis: 0 /* None */,
|
|
32994
33221
|
overflow: null,
|
|
32995
33222
|
overflowY: null,
|
|
32996
33223
|
hasConditionalScroll: false,
|
|
@@ -33023,53 +33250,28 @@ function readKnownSignalWithGuard(snapshot, name) {
|
|
|
33023
33250
|
return value2;
|
|
33024
33251
|
}
|
|
33025
33252
|
function toEvidenceKind(value2) {
|
|
33026
|
-
if (value2.guard ===
|
|
33027
|
-
if (value2.quality === "estimated") return
|
|
33028
|
-
return
|
|
33029
|
-
}
|
|
33030
|
-
function readNumericSignalEvidence(snapshot, name) {
|
|
33031
|
-
const value2 = snapshot.signals.get(name);
|
|
33032
|
-
if (!value2) {
|
|
33033
|
-
return {
|
|
33034
|
-
value: null,
|
|
33035
|
-
kind: "unknown"
|
|
33036
|
-
};
|
|
33037
|
-
}
|
|
33038
|
-
if (value2.kind !== "known") {
|
|
33039
|
-
if (value2.guard === "conditional") {
|
|
33040
|
-
return {
|
|
33041
|
-
value: null,
|
|
33042
|
-
kind: "conditional"
|
|
33043
|
-
};
|
|
33044
|
-
}
|
|
33045
|
-
return {
|
|
33046
|
-
value: null,
|
|
33047
|
-
kind: "unknown"
|
|
33048
|
-
};
|
|
33049
|
-
}
|
|
33050
|
-
return {
|
|
33051
|
-
value: value2.px,
|
|
33052
|
-
kind: toEvidenceKind(value2)
|
|
33053
|
-
};
|
|
33253
|
+
if (value2.guard.kind === 1 /* Conditional */) return 2 /* Conditional */;
|
|
33254
|
+
if (value2.quality === "estimated") return 1 /* Interval */;
|
|
33255
|
+
return 0 /* Exact */;
|
|
33054
33256
|
}
|
|
33055
33257
|
function readNormalizedSignalEvidence(snapshot, name) {
|
|
33056
33258
|
const value2 = snapshot.signals.get(name);
|
|
33057
33259
|
if (!value2) {
|
|
33058
33260
|
return {
|
|
33059
33261
|
value: null,
|
|
33060
|
-
kind:
|
|
33262
|
+
kind: 3 /* Unknown */
|
|
33061
33263
|
};
|
|
33062
33264
|
}
|
|
33063
33265
|
if (value2.kind !== "known") {
|
|
33064
|
-
if (value2.guard ===
|
|
33266
|
+
if (value2.guard.kind === 1 /* Conditional */) {
|
|
33065
33267
|
return {
|
|
33066
33268
|
value: null,
|
|
33067
|
-
kind:
|
|
33269
|
+
kind: 2 /* Conditional */
|
|
33068
33270
|
};
|
|
33069
33271
|
}
|
|
33070
33272
|
return {
|
|
33071
33273
|
value: null,
|
|
33072
|
-
kind:
|
|
33274
|
+
kind: 3 /* Unknown */
|
|
33073
33275
|
};
|
|
33074
33276
|
}
|
|
33075
33277
|
return {
|
|
@@ -33080,7 +33282,7 @@ function readNormalizedSignalEvidence(snapshot, name) {
|
|
|
33080
33282
|
function readKnownSignal(snapshot, name) {
|
|
33081
33283
|
const value2 = readKnownSignalWithGuard(snapshot, name);
|
|
33082
33284
|
if (!value2) return null;
|
|
33083
|
-
if (value2.guard !==
|
|
33285
|
+
if (value2.guard.kind !== 0 /* Unconditional */) return null;
|
|
33084
33286
|
return value2;
|
|
33085
33287
|
}
|
|
33086
33288
|
function readKnownPx(snapshot, name) {
|
|
@@ -33114,19 +33316,19 @@ function hasEffectivePosition(snapshot) {
|
|
|
33114
33316
|
return position !== "static";
|
|
33115
33317
|
}
|
|
33116
33318
|
function readReservedSpaceFact(graph, node) {
|
|
33117
|
-
return graph.
|
|
33319
|
+
return graph.reservedSpaceFactsByNode.get(node) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
|
|
33118
33320
|
}
|
|
33119
33321
|
function readScrollContainerFact(graph, node) {
|
|
33120
|
-
return graph.
|
|
33322
|
+
return graph.scrollContainerFactsByNode.get(node) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
|
|
33121
33323
|
}
|
|
33122
33324
|
function readFlowParticipationFact(graph, node) {
|
|
33123
|
-
return graph.
|
|
33325
|
+
return graph.flowParticipationFactsByNode.get(node) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
|
|
33124
33326
|
}
|
|
33125
33327
|
function readContainingBlockFact(graph, node) {
|
|
33126
|
-
return graph.
|
|
33328
|
+
return graph.containingBlockFactsByNode.get(node) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
|
|
33127
33329
|
}
|
|
33128
33330
|
function readConditionalSignalDeltaFact(graph, node, name) {
|
|
33129
|
-
const byProperty = graph.
|
|
33331
|
+
const byProperty = graph.conditionalSignalDeltaFactsByNode.get(node);
|
|
33130
33332
|
if (!byProperty) return EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
|
|
33131
33333
|
return byProperty.get(name) ?? EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
|
|
33132
33334
|
}
|
|
@@ -33154,7 +33356,7 @@ function readScrollContainerElements(graph) {
|
|
|
33154
33356
|
return graph.scrollContainerElements;
|
|
33155
33357
|
}
|
|
33156
33358
|
function readBaselineOffsetFacts(graph, node) {
|
|
33157
|
-
return graph.
|
|
33359
|
+
return graph.baselineOffsetFactsByNode.get(node) ?? EMPTY_BASELINE_FACTS;
|
|
33158
33360
|
}
|
|
33159
33361
|
function readElementRef(graph, node) {
|
|
33160
33362
|
return readElementRefById(graph, node.solidFile, node.elementId);
|
|
@@ -33176,7 +33378,6 @@ function readStatefulBaseValueIndex(graph) {
|
|
|
33176
33378
|
}
|
|
33177
33379
|
|
|
33178
33380
|
// src/cross-file/layout/context-classification.ts
|
|
33179
|
-
var WHITESPACE_RE4 = /\s+/;
|
|
33180
33381
|
var TABLE_SEMANTIC_TAGS = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th"]);
|
|
33181
33382
|
var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
|
|
33182
33383
|
"table",
|
|
@@ -33193,7 +33394,6 @@ var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
|
|
|
33193
33394
|
var FLEX_DISPLAY_VALUES = /* @__PURE__ */ new Set(["flex", "inline-flex"]);
|
|
33194
33395
|
var GRID_DISPLAY_VALUES = /* @__PURE__ */ new Set(["grid", "inline-grid"]);
|
|
33195
33396
|
var INLINE_DISPLAY_VALUES = /* @__PURE__ */ new Set(["inline", "inline-block", "inline-list-item"]);
|
|
33196
|
-
var DISPLAY_TOKEN_SPLIT_RE = /\s+/;
|
|
33197
33397
|
function createAlignmentContextForParent(parent, snapshot) {
|
|
33198
33398
|
const axis = resolveAxis(snapshot);
|
|
33199
33399
|
const inlineDirection = resolveInlineDirection(snapshot);
|
|
@@ -33216,6 +33416,7 @@ function createAlignmentContextForParent(parent, snapshot) {
|
|
|
33216
33416
|
const contextCertainty = combineCertainty(classified.certainty, axis.certainty);
|
|
33217
33417
|
const certainty = combineCertainty(contextCertainty, inlineDirection.certainty);
|
|
33218
33418
|
const baselineRelevance = computeBaselineRelevance(classified.kind, parentAlignItems, parentPlaceItems);
|
|
33419
|
+
const crossAxisInfo = resolveCrossAxisIsBlockAxis(classified.kind, snapshot, axis.value);
|
|
33219
33420
|
const out = {
|
|
33220
33421
|
kind: classified.kind,
|
|
33221
33422
|
certainty,
|
|
@@ -33231,6 +33432,8 @@ function createAlignmentContextForParent(parent, snapshot) {
|
|
|
33231
33432
|
parentAlignItems,
|
|
33232
33433
|
parentPlaceItems,
|
|
33233
33434
|
hasPositionedOffset: positionedOffset.hasPositionedOffset,
|
|
33435
|
+
crossAxisIsBlockAxis: crossAxisInfo.value,
|
|
33436
|
+
crossAxisIsBlockAxisCertainty: crossAxisInfo.certainty,
|
|
33234
33437
|
baselineRelevance,
|
|
33235
33438
|
evidence
|
|
33236
33439
|
};
|
|
@@ -33240,7 +33443,7 @@ function classifyKind(evidence) {
|
|
|
33240
33443
|
if (evidence.hasTableSemantics) {
|
|
33241
33444
|
return {
|
|
33242
33445
|
kind: "table-cell",
|
|
33243
|
-
certainty:
|
|
33446
|
+
certainty: 0 /* Resolved */
|
|
33244
33447
|
};
|
|
33245
33448
|
}
|
|
33246
33449
|
if (evidence.containerKind === "table") {
|
|
@@ -33327,7 +33530,7 @@ function resolveContainerKind(parentDisplay, certainty) {
|
|
|
33327
33530
|
certainty
|
|
33328
33531
|
};
|
|
33329
33532
|
}
|
|
33330
|
-
const tokens = display.split(
|
|
33533
|
+
const tokens = display.split(WHITESPACE_RE3);
|
|
33331
33534
|
if (tokens.length === 2) {
|
|
33332
33535
|
const outside = tokens[0];
|
|
33333
33536
|
const inside = tokens[1];
|
|
@@ -33377,7 +33580,7 @@ function resolveAxis(snapshot) {
|
|
|
33377
33580
|
if (!snapshot.signals.has("writing-mode")) {
|
|
33378
33581
|
return {
|
|
33379
33582
|
value: "horizontal-tb",
|
|
33380
|
-
certainty:
|
|
33583
|
+
certainty: 0 /* Resolved */
|
|
33381
33584
|
};
|
|
33382
33585
|
}
|
|
33383
33586
|
const writingMode = readNormalizedSignalEvidence(snapshot, "writing-mode");
|
|
@@ -33402,7 +33605,7 @@ function resolveInlineDirection(snapshot) {
|
|
|
33402
33605
|
if (!snapshot.signals.has("direction")) {
|
|
33403
33606
|
return {
|
|
33404
33607
|
value: "ltr",
|
|
33405
|
-
certainty:
|
|
33608
|
+
certainty: 0 /* Resolved */
|
|
33406
33609
|
};
|
|
33407
33610
|
}
|
|
33408
33611
|
const direction = readNormalizedSignalEvidence(snapshot, "direction");
|
|
@@ -33418,16 +33621,16 @@ function resolveInlineDirection(snapshot) {
|
|
|
33418
33621
|
};
|
|
33419
33622
|
}
|
|
33420
33623
|
function toContextCertainty(kind) {
|
|
33421
|
-
if (kind ===
|
|
33422
|
-
if (kind ===
|
|
33423
|
-
return
|
|
33624
|
+
if (kind === 0 /* Exact */) return 0 /* Resolved */;
|
|
33625
|
+
if (kind === 1 /* Interval */ || kind === 2 /* Conditional */) return 1 /* Conditional */;
|
|
33626
|
+
return 2 /* Unknown */;
|
|
33424
33627
|
}
|
|
33425
33628
|
function resolvePositionedOffset(snapshot) {
|
|
33426
33629
|
const position = readKnownSignalWithGuard(snapshot, "position");
|
|
33427
33630
|
if (!position) {
|
|
33428
33631
|
return {
|
|
33429
33632
|
hasPositionedOffset: false,
|
|
33430
|
-
certainty:
|
|
33633
|
+
certainty: 2 /* Unknown */
|
|
33431
33634
|
};
|
|
33432
33635
|
}
|
|
33433
33636
|
const certainty = resolveSignalCertainty(position);
|
|
@@ -33442,15 +33645,33 @@ function resolvePositionedOffset(snapshot) {
|
|
|
33442
33645
|
certainty
|
|
33443
33646
|
};
|
|
33444
33647
|
}
|
|
33648
|
+
var FLEX_ROW_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse"]);
|
|
33649
|
+
function resolveCrossAxisIsBlockAxis(kind, snapshot, _axis) {
|
|
33650
|
+
if (kind !== "flex-cross-axis" && kind !== "grid-cross-axis") {
|
|
33651
|
+
return { value: true, certainty: 0 /* Resolved */ };
|
|
33652
|
+
}
|
|
33653
|
+
if (kind === "flex-cross-axis") {
|
|
33654
|
+
const signal2 = readKnownSignalWithGuard(snapshot, "flex-direction");
|
|
33655
|
+
if (!signal2) {
|
|
33656
|
+
return { value: true, certainty: 0 /* Resolved */ };
|
|
33657
|
+
}
|
|
33658
|
+
const certainty2 = resolveSignalCertainty(signal2);
|
|
33659
|
+
return { value: FLEX_ROW_VALUES.has(signal2.normalized), certainty: certainty2 };
|
|
33660
|
+
}
|
|
33661
|
+
const signal = readKnownSignalWithGuard(snapshot, "grid-auto-flow");
|
|
33662
|
+
if (!signal) {
|
|
33663
|
+
return { value: true, certainty: 0 /* Resolved */ };
|
|
33664
|
+
}
|
|
33665
|
+
const certainty = resolveSignalCertainty(signal);
|
|
33666
|
+
return { value: !signal.normalized.startsWith("column"), certainty };
|
|
33667
|
+
}
|
|
33445
33668
|
function resolveSignalCertainty(value2) {
|
|
33446
|
-
if (!value2) return
|
|
33447
|
-
if (value2.guard ===
|
|
33448
|
-
return
|
|
33669
|
+
if (!value2) return 2 /* Unknown */;
|
|
33670
|
+
if (value2.guard.kind === 1 /* Conditional */) return 1 /* Conditional */;
|
|
33671
|
+
return 0 /* Resolved */;
|
|
33449
33672
|
}
|
|
33450
33673
|
function combineCertainty(left, right) {
|
|
33451
|
-
|
|
33452
|
-
if (left === "conditional" || right === "conditional") return "conditional";
|
|
33453
|
-
return "resolved";
|
|
33674
|
+
return left > right ? left : right;
|
|
33454
33675
|
}
|
|
33455
33676
|
var FLEX_GRID_GEOMETRIC_ALIGN_ITEMS = /* @__PURE__ */ new Set([
|
|
33456
33677
|
"center",
|
|
@@ -33474,7 +33695,7 @@ function computeBaselineRelevance(kind, parentAlignItems, parentPlaceItems) {
|
|
|
33474
33695
|
function resolveEffectiveAlignItems(alignItems, placeItems) {
|
|
33475
33696
|
if (alignItems !== null) return alignItems;
|
|
33476
33697
|
if (placeItems === null) return null;
|
|
33477
|
-
const firstToken2 = placeItems.split(
|
|
33698
|
+
const firstToken2 = placeItems.split(WHITESPACE_RE3)[0];
|
|
33478
33699
|
return firstToken2 ?? null;
|
|
33479
33700
|
}
|
|
33480
33701
|
var TABLE_CELL_GEOMETRIC_VERTICAL_ALIGN = /* @__PURE__ */ new Set([
|
|
@@ -33489,24 +33710,7 @@ function finalizeTableCellBaselineRelevance(contextByParentNode, cohortVerticalA
|
|
|
33489
33710
|
if (context.kind !== "table-cell") continue;
|
|
33490
33711
|
if (consensusValue === null) continue;
|
|
33491
33712
|
if (!TABLE_CELL_GEOMETRIC_VERTICAL_ALIGN.has(consensusValue)) continue;
|
|
33492
|
-
contextByParentNode.set(parent, {
|
|
33493
|
-
kind: context.kind,
|
|
33494
|
-
certainty: context.certainty,
|
|
33495
|
-
parentSolidFile: context.parentSolidFile,
|
|
33496
|
-
parentElementId: context.parentElementId,
|
|
33497
|
-
parentElementKey: context.parentElementKey,
|
|
33498
|
-
parentTag: context.parentTag,
|
|
33499
|
-
axis: context.axis,
|
|
33500
|
-
axisCertainty: context.axisCertainty,
|
|
33501
|
-
inlineDirection: context.inlineDirection,
|
|
33502
|
-
inlineDirectionCertainty: context.inlineDirectionCertainty,
|
|
33503
|
-
parentDisplay: context.parentDisplay,
|
|
33504
|
-
parentAlignItems: context.parentAlignItems,
|
|
33505
|
-
parentPlaceItems: context.parentPlaceItems,
|
|
33506
|
-
hasPositionedOffset: context.hasPositionedOffset,
|
|
33507
|
-
baselineRelevance: "irrelevant",
|
|
33508
|
-
evidence: context.evidence
|
|
33509
|
-
});
|
|
33713
|
+
contextByParentNode.set(parent, deriveAlignmentContext(context, { baselineRelevance: "irrelevant" }));
|
|
33510
33714
|
}
|
|
33511
33715
|
}
|
|
33512
33716
|
|
|
@@ -33570,7 +33774,7 @@ function summarizeSignalFacts(snapshots) {
|
|
|
33570
33774
|
}
|
|
33571
33775
|
function accumulateSnapshotFacts(snapshot, sink) {
|
|
33572
33776
|
for (const value2 of snapshot.signals.values()) {
|
|
33573
|
-
if (value2.guard ===
|
|
33777
|
+
if (value2.guard.kind === 1 /* Conditional */) {
|
|
33574
33778
|
sink.addConditional();
|
|
33575
33779
|
continue;
|
|
33576
33780
|
}
|
|
@@ -33764,15 +33968,6 @@ function assertUnitInterval(name, value2) {
|
|
|
33764
33968
|
}
|
|
33765
33969
|
|
|
33766
33970
|
// src/cross-file/layout/content-composition.ts
|
|
33767
|
-
var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
|
|
33768
|
-
"img",
|
|
33769
|
-
"svg",
|
|
33770
|
-
"video",
|
|
33771
|
-
"canvas",
|
|
33772
|
-
"iframe",
|
|
33773
|
-
"object",
|
|
33774
|
-
"embed"
|
|
33775
|
-
]);
|
|
33776
33971
|
var BLOCK_FORMATTING_CONTEXT_DISPLAYS = /* @__PURE__ */ new Set([
|
|
33777
33972
|
"block",
|
|
33778
33973
|
"flex",
|
|
@@ -33806,7 +34001,7 @@ var VERTICAL_ALIGN_MITIGATIONS = /* @__PURE__ */ new Set([
|
|
|
33806
34001
|
"text-top",
|
|
33807
34002
|
"text-bottom"
|
|
33808
34003
|
]);
|
|
33809
|
-
function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode,
|
|
34004
|
+
function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
|
|
33810
34005
|
const state = {
|
|
33811
34006
|
hasTextContent: false,
|
|
33812
34007
|
hasInlineReplaced: false,
|
|
@@ -33820,10 +34015,10 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
|
|
|
33820
34015
|
blockChildCount: 0,
|
|
33821
34016
|
inlineChildCount: 0
|
|
33822
34017
|
};
|
|
33823
|
-
if (elementNode.textualContent ===
|
|
34018
|
+
if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
|
|
33824
34019
|
state.hasTextContent = true;
|
|
33825
34020
|
}
|
|
33826
|
-
const elementHotSignals =
|
|
34021
|
+
const elementHotSignals = snapshotHotSignalsByNode.get(elementNode);
|
|
33827
34022
|
const elementDisplay = elementHotSignals?.display.value ?? null;
|
|
33828
34023
|
if (elementDisplay !== null && establishesFormattingContext(elementDisplay)) {
|
|
33829
34024
|
return {
|
|
@@ -33834,7 +34029,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
|
|
|
33834
34029
|
wrappingContextMitigates: false,
|
|
33835
34030
|
hasVerticalAlignMitigation: false,
|
|
33836
34031
|
mixedContentDepth: 0,
|
|
33837
|
-
classification:
|
|
34032
|
+
classification: 4 /* BlockSegmented */,
|
|
33838
34033
|
analyzableChildCount: 0,
|
|
33839
34034
|
totalChildCount: 0,
|
|
33840
34035
|
hasOnlyBlockChildren: false
|
|
@@ -33844,7 +34039,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
|
|
|
33844
34039
|
elementNode,
|
|
33845
34040
|
childrenByParentNode,
|
|
33846
34041
|
snapshotByElementNode,
|
|
33847
|
-
|
|
34042
|
+
snapshotHotSignalsByNode,
|
|
33848
34043
|
state,
|
|
33849
34044
|
0
|
|
33850
34045
|
);
|
|
@@ -33864,7 +34059,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
|
|
|
33864
34059
|
hasOnlyBlockChildren
|
|
33865
34060
|
};
|
|
33866
34061
|
}
|
|
33867
|
-
function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode,
|
|
34062
|
+
function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, state, depth) {
|
|
33868
34063
|
const children = childrenByParentNode.get(node);
|
|
33869
34064
|
if (!children) return;
|
|
33870
34065
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -33875,7 +34070,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
|
|
|
33875
34070
|
if (!snapshot) continue;
|
|
33876
34071
|
if (depth === 0) state.analyzableChildCount++;
|
|
33877
34072
|
const childTag = child.tagName?.toLowerCase() ?? null;
|
|
33878
|
-
const hotSignals =
|
|
34073
|
+
const hotSignals = snapshotHotSignalsByNode.get(child);
|
|
33879
34074
|
const childDisplay = hotSignals?.display.value ?? null;
|
|
33880
34075
|
if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
|
|
33881
34076
|
state.hasInlineReplaced = true;
|
|
@@ -33897,16 +34092,16 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
|
|
|
33897
34092
|
checkVerticalAlignMitigation(snapshot, state);
|
|
33898
34093
|
updateMixedContentDepth(state, depth);
|
|
33899
34094
|
if (depth === 0) state.inlineChildCount++;
|
|
33900
|
-
const parentHotSignals =
|
|
34095
|
+
const parentHotSignals = snapshotHotSignalsByNode.get(node);
|
|
33901
34096
|
const parentDisplay = parentHotSignals?.display.value ?? null;
|
|
33902
34097
|
if (parentDisplay !== null && isAlignmentContextWithNonBaselineAlignment(parentDisplay, parentHotSignals)) {
|
|
33903
34098
|
state.wrappingContextMitigates = true;
|
|
33904
|
-
} else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode,
|
|
34099
|
+
} else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode)) {
|
|
33905
34100
|
state.wrappingContextMitigates = true;
|
|
33906
34101
|
}
|
|
33907
34102
|
continue;
|
|
33908
34103
|
}
|
|
33909
|
-
if (child.textualContent ===
|
|
34104
|
+
if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
|
|
33910
34105
|
state.hasTextContent = true;
|
|
33911
34106
|
}
|
|
33912
34107
|
checkHeightContributions(snapshot, state);
|
|
@@ -33916,7 +34111,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
|
|
|
33916
34111
|
child,
|
|
33917
34112
|
childrenByParentNode,
|
|
33918
34113
|
snapshotByElementNode,
|
|
33919
|
-
|
|
34114
|
+
snapshotHotSignalsByNode,
|
|
33920
34115
|
state,
|
|
33921
34116
|
depth + 1
|
|
33922
34117
|
);
|
|
@@ -33951,19 +34146,19 @@ function isAlignmentContextWithNonBaselineAlignment(display, hotSignals) {
|
|
|
33951
34146
|
if (alignItems === null) return false;
|
|
33952
34147
|
return alignItems !== "baseline";
|
|
33953
34148
|
}
|
|
33954
|
-
function containsMixedContent(node, childrenByParentNode, snapshotByElementNode,
|
|
33955
|
-
const hasText = node.textualContent ===
|
|
34149
|
+
function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
|
|
34150
|
+
const hasText = node.textualContent === 0 /* Yes */ || node.textualContent === 3 /* DynamicText */;
|
|
33956
34151
|
const hasReplaced = false;
|
|
33957
|
-
return scanMixedContent(node, childrenByParentNode, snapshotByElementNode,
|
|
34152
|
+
return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, { hasText, hasReplaced });
|
|
33958
34153
|
}
|
|
33959
|
-
function scanMixedContent(node, childrenByParentNode, snapshotByElementNode,
|
|
34154
|
+
function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found) {
|
|
33960
34155
|
const children = childrenByParentNode.get(node);
|
|
33961
34156
|
if (!children) return false;
|
|
33962
34157
|
for (let i = 0; i < children.length; i++) {
|
|
33963
34158
|
const child = children[i];
|
|
33964
34159
|
if (!child) continue;
|
|
33965
34160
|
const childTag = child.tagName?.toLowerCase() ?? null;
|
|
33966
|
-
const hotSignals =
|
|
34161
|
+
const hotSignals = snapshotHotSignalsByNode.get(child);
|
|
33967
34162
|
const childDisplay = hotSignals?.display.value ?? null;
|
|
33968
34163
|
if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
|
|
33969
34164
|
found.hasReplaced = true;
|
|
@@ -33978,12 +34173,12 @@ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, sna
|
|
|
33978
34173
|
if (found.hasText) return true;
|
|
33979
34174
|
continue;
|
|
33980
34175
|
}
|
|
33981
|
-
if (child.textualContent ===
|
|
34176
|
+
if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
|
|
33982
34177
|
found.hasText = true;
|
|
33983
34178
|
if (found.hasReplaced) return true;
|
|
33984
34179
|
}
|
|
33985
34180
|
if (childDisplay === null || isInlineContinuationDisplay(childDisplay)) {
|
|
33986
|
-
if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode,
|
|
34181
|
+
if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found)) {
|
|
33987
34182
|
return true;
|
|
33988
34183
|
}
|
|
33989
34184
|
}
|
|
@@ -34006,30 +34201,30 @@ function updateMixedContentDepth(state, depth) {
|
|
|
34006
34201
|
}
|
|
34007
34202
|
function classifyFromState(state, elementNode, hasOnlyBlockChildren) {
|
|
34008
34203
|
if (hasOnlyBlockChildren) {
|
|
34009
|
-
return
|
|
34204
|
+
return 4 /* BlockSegmented */;
|
|
34010
34205
|
}
|
|
34011
34206
|
if (state.totalChildCount === 0 && !state.hasTextContent) {
|
|
34012
|
-
if (elementNode.textualContent ===
|
|
34013
|
-
if (elementNode.textualContent ===
|
|
34014
|
-
return
|
|
34207
|
+
if (elementNode.textualContent === 2 /* Unknown */) return 5 /* Unknown */;
|
|
34208
|
+
if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
|
|
34209
|
+
return 0 /* TextOnly */;
|
|
34015
34210
|
}
|
|
34016
|
-
return
|
|
34211
|
+
return 5 /* Unknown */;
|
|
34017
34212
|
}
|
|
34018
34213
|
if (state.analyzableChildCount === 0 && state.totalChildCount > 0) {
|
|
34019
|
-
return
|
|
34214
|
+
return 5 /* Unknown */;
|
|
34020
34215
|
}
|
|
34021
34216
|
if (state.hasTextContent && state.hasInlineReplaced) {
|
|
34022
|
-
if (state.wrappingContextMitigates) return
|
|
34023
|
-
if (state.hasVerticalAlignMitigation) return
|
|
34024
|
-
return
|
|
34217
|
+
if (state.wrappingContextMitigates) return 3 /* MixedMitigated */;
|
|
34218
|
+
if (state.hasVerticalAlignMitigation) return 3 /* MixedMitigated */;
|
|
34219
|
+
return 2 /* MixedUnmitigated */;
|
|
34025
34220
|
}
|
|
34026
34221
|
if (!state.hasTextContent && state.hasInlineReplaced) {
|
|
34027
|
-
return
|
|
34222
|
+
return 1 /* ReplacedOnly */;
|
|
34028
34223
|
}
|
|
34029
34224
|
if (state.hasTextContent && !state.hasInlineReplaced) {
|
|
34030
|
-
return
|
|
34225
|
+
return 0 /* TextOnly */;
|
|
34031
34226
|
}
|
|
34032
|
-
return
|
|
34227
|
+
return 5 /* Unknown */;
|
|
34033
34228
|
}
|
|
34034
34229
|
function isIntrinsicReplacedTag(tag) {
|
|
34035
34230
|
return INTRINSIC_REPLACED_TAGS.has(tag);
|
|
@@ -34049,10 +34244,14 @@ function isInlineReplacedDisplay(display) {
|
|
|
34049
34244
|
function isInlineContinuationDisplay(display) {
|
|
34050
34245
|
return INLINE_CONTINUATION_DISPLAYS.has(display);
|
|
34051
34246
|
}
|
|
34052
|
-
|
|
34053
|
-
|
|
34247
|
+
var NO_DIVERGENCE = Object.freeze({
|
|
34248
|
+
strength: 0,
|
|
34249
|
+
majorityClassification: 5 /* Unknown */
|
|
34250
|
+
});
|
|
34251
|
+
function resolveCompositionDivergence(subjectFingerprint, allFingerprints, parentContext) {
|
|
34252
|
+
if (allFingerprints.length < 2) return NO_DIVERGENCE;
|
|
34054
34253
|
if (parentContext !== null && !hasSharedBaselineAlignment(parentContext)) {
|
|
34055
|
-
return
|
|
34254
|
+
return NO_DIVERGENCE;
|
|
34056
34255
|
}
|
|
34057
34256
|
const countByClassification = /* @__PURE__ */ new Map();
|
|
34058
34257
|
for (let i = 0; i < allFingerprints.length; i++) {
|
|
@@ -34064,10 +34263,7 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
|
|
|
34064
34263
|
}
|
|
34065
34264
|
const subjectNormalized = normalizeClassificationForComparison(subjectFingerprint.classification);
|
|
34066
34265
|
const subjectCount = countByClassification.get(subjectNormalized) ?? 0;
|
|
34067
|
-
|
|
34068
|
-
return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
|
|
34069
|
-
}
|
|
34070
|
-
let majorityClassification = "unknown";
|
|
34266
|
+
let majorityClassification = 5 /* Unknown */;
|
|
34071
34267
|
let majorityCount = 0;
|
|
34072
34268
|
for (const [classification, count] of countByClassification) {
|
|
34073
34269
|
if (count > majorityCount) {
|
|
@@ -34075,35 +34271,38 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
|
|
|
34075
34271
|
majorityClassification = classification;
|
|
34076
34272
|
}
|
|
34077
34273
|
}
|
|
34274
|
+
if (subjectCount === allFingerprints.length) {
|
|
34275
|
+
return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
|
|
34276
|
+
}
|
|
34078
34277
|
if (subjectNormalized === majorityClassification) {
|
|
34079
|
-
return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
|
|
34278
|
+
return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
|
|
34080
34279
|
}
|
|
34081
|
-
if (subjectNormalized ===
|
|
34082
|
-
return 0;
|
|
34280
|
+
if (subjectNormalized === 5 /* Unknown */) {
|
|
34281
|
+
return { strength: 0, majorityClassification };
|
|
34083
34282
|
}
|
|
34084
34283
|
const cal = alignmentStrengthCalibration;
|
|
34085
|
-
if (majorityClassification ===
|
|
34086
|
-
return cal.compositionMixedUnmitigatedOutlierStrength;
|
|
34284
|
+
if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
|
|
34285
|
+
return { strength: cal.compositionMixedUnmitigatedOutlierStrength, majorityClassification };
|
|
34087
34286
|
}
|
|
34088
|
-
if (majorityClassification ===
|
|
34089
|
-
return cal.compositionMixedOutlierAmongReplacedStrength;
|
|
34287
|
+
if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
|
|
34288
|
+
return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
|
|
34090
34289
|
}
|
|
34091
|
-
if (majorityClassification ===
|
|
34092
|
-
return cal.compositionTextOutlierAmongMixedStrength;
|
|
34290
|
+
if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 0 /* TextOnly */) {
|
|
34291
|
+
return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
|
|
34093
34292
|
}
|
|
34094
|
-
if (majorityClassification ===
|
|
34095
|
-
return cal.compositionTextOutlierAmongMixedStrength;
|
|
34293
|
+
if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 1 /* ReplacedOnly */) {
|
|
34294
|
+
return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
|
|
34096
34295
|
}
|
|
34097
|
-
if (majorityClassification ===
|
|
34098
|
-
return cal.compositionMixedOutlierAmongReplacedStrength;
|
|
34296
|
+
if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 1 /* ReplacedOnly */) {
|
|
34297
|
+
return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
|
|
34099
34298
|
}
|
|
34100
|
-
if (majorityClassification ===
|
|
34101
|
-
return cal.compositionTextOutlierAmongMixedStrength;
|
|
34299
|
+
if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 0 /* TextOnly */) {
|
|
34300
|
+
return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
|
|
34102
34301
|
}
|
|
34103
|
-
if (majorityClassification ===
|
|
34104
|
-
return 0;
|
|
34302
|
+
if (majorityClassification === 5 /* Unknown */) {
|
|
34303
|
+
return { strength: 0, majorityClassification };
|
|
34105
34304
|
}
|
|
34106
|
-
return cal.compositionUnknownPenalty;
|
|
34305
|
+
return { strength: cal.compositionUnknownPenalty, majorityClassification };
|
|
34107
34306
|
}
|
|
34108
34307
|
function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints) {
|
|
34109
34308
|
if (subjectFingerprint.inlineReplacedKind === null) return 0;
|
|
@@ -34124,28 +34323,9 @@ function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints
|
|
|
34124
34323
|
function hasSharedBaselineAlignment(context) {
|
|
34125
34324
|
return context.baselineRelevance === "relevant";
|
|
34126
34325
|
}
|
|
34127
|
-
function resolveMajorityClassification(allFingerprints) {
|
|
34128
|
-
const countByClassification = /* @__PURE__ */ new Map();
|
|
34129
|
-
for (let i = 0; i < allFingerprints.length; i++) {
|
|
34130
|
-
const fp = allFingerprints[i];
|
|
34131
|
-
if (!fp) continue;
|
|
34132
|
-
const normalized = normalizeClassificationForComparison(fp.classification);
|
|
34133
|
-
const existing = countByClassification.get(normalized) ?? 0;
|
|
34134
|
-
countByClassification.set(normalized, existing + 1);
|
|
34135
|
-
}
|
|
34136
|
-
let majorityClassification = "unknown";
|
|
34137
|
-
let majorityCount = 0;
|
|
34138
|
-
for (const [classification, count] of countByClassification) {
|
|
34139
|
-
if (count > majorityCount) {
|
|
34140
|
-
majorityCount = count;
|
|
34141
|
-
majorityClassification = classification;
|
|
34142
|
-
}
|
|
34143
|
-
}
|
|
34144
|
-
return majorityClassification;
|
|
34145
|
-
}
|
|
34146
34326
|
function normalizeClassificationForComparison(classification) {
|
|
34147
|
-
if (classification ===
|
|
34148
|
-
if (classification ===
|
|
34327
|
+
if (classification === 3 /* MixedMitigated */) return 0 /* TextOnly */;
|
|
34328
|
+
if (classification === 4 /* BlockSegmented */) return 0 /* TextOnly */;
|
|
34149
34329
|
return classification;
|
|
34150
34330
|
}
|
|
34151
34331
|
function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
|
|
@@ -34153,12 +34333,12 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
|
|
|
34153
34333
|
let analyzableCount = 0;
|
|
34154
34334
|
for (let i = 0; i < allFingerprints.length; i++) {
|
|
34155
34335
|
const fp = allFingerprints[i];
|
|
34156
|
-
if (fp && fp.classification !==
|
|
34336
|
+
if (fp && fp.classification !== 5 /* Unknown */) {
|
|
34157
34337
|
analyzableCount++;
|
|
34158
34338
|
}
|
|
34159
34339
|
}
|
|
34160
34340
|
const analyzableShare = analyzableCount / allFingerprints.length;
|
|
34161
|
-
if (subjectFingerprint.classification ===
|
|
34341
|
+
if (subjectFingerprint.classification === 5 /* Unknown */) {
|
|
34162
34342
|
return analyzableShare * 0.3;
|
|
34163
34343
|
}
|
|
34164
34344
|
if (subjectFingerprint.totalChildCount > 0 && subjectFingerprint.analyzableChildCount === 0) {
|
|
@@ -34166,24 +34346,19 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
|
|
|
34166
34346
|
}
|
|
34167
34347
|
return analyzableShare;
|
|
34168
34348
|
}
|
|
34349
|
+
var COMPOSITION_LABELS = {
|
|
34350
|
+
[0 /* TextOnly */]: "text-only",
|
|
34351
|
+
[1 /* ReplacedOnly */]: "inline-replaced-only",
|
|
34352
|
+
[2 /* MixedUnmitigated */]: "mixed text + inline-replaced",
|
|
34353
|
+
[3 /* MixedMitigated */]: "mixed (alignment mitigated)",
|
|
34354
|
+
[4 /* BlockSegmented */]: "block-segmented",
|
|
34355
|
+
[5 /* Unknown */]: "unknown"
|
|
34356
|
+
};
|
|
34169
34357
|
function formatCompositionClassification(classification) {
|
|
34170
|
-
|
|
34171
|
-
case "text-only":
|
|
34172
|
-
return "text-only";
|
|
34173
|
-
case "replaced-only":
|
|
34174
|
-
return "inline-replaced-only";
|
|
34175
|
-
case "mixed-unmitigated":
|
|
34176
|
-
return "mixed text + inline-replaced";
|
|
34177
|
-
case "mixed-mitigated":
|
|
34178
|
-
return "mixed (alignment mitigated)";
|
|
34179
|
-
case "block-segmented":
|
|
34180
|
-
return "block-segmented";
|
|
34181
|
-
case "unknown":
|
|
34182
|
-
return "unknown";
|
|
34183
|
-
}
|
|
34358
|
+
return COMPOSITION_LABELS[classification];
|
|
34184
34359
|
}
|
|
34185
34360
|
function formatCompositionFixSuggestion(subjectFingerprint) {
|
|
34186
|
-
if (subjectFingerprint.classification ===
|
|
34361
|
+
if (subjectFingerprint.classification === 2 /* MixedUnmitigated */) {
|
|
34187
34362
|
if (subjectFingerprint.hasVerticalAlignMitigation) {
|
|
34188
34363
|
return "verify vertical-align resolves the baseline shift";
|
|
34189
34364
|
}
|
|
@@ -34218,12 +34393,12 @@ function estimateBlockOffsetWithDeclaredFromHotSignals(hot, axis) {
|
|
|
34218
34393
|
function estimateBlockOffsetWithDeclaredFromSources(axis, position, readNumeric) {
|
|
34219
34394
|
let declaredTotal = 0;
|
|
34220
34395
|
let declaredCount = 0;
|
|
34221
|
-
let declaredKind =
|
|
34222
|
-
let declaredMissingKind =
|
|
34396
|
+
let declaredKind = 0 /* Exact */;
|
|
34397
|
+
let declaredMissingKind = 0 /* Exact */;
|
|
34223
34398
|
let effectiveTotal = 0;
|
|
34224
34399
|
let effectiveCount = 0;
|
|
34225
|
-
let effectiveKind =
|
|
34226
|
-
let effectiveMissingKind =
|
|
34400
|
+
let effectiveKind = 0 /* Exact */;
|
|
34401
|
+
let effectiveMissingKind = 0 /* Exact */;
|
|
34227
34402
|
const positioned = position.value !== null && position.value !== "static";
|
|
34228
34403
|
const add = (name, sign, requiresPositioning) => {
|
|
34229
34404
|
const v = readNumeric(name);
|
|
@@ -34294,7 +34469,7 @@ function buildCohortIndex(input) {
|
|
|
34294
34469
|
axisCertainty: context.axisCertainty,
|
|
34295
34470
|
measurementNodeByRootKey: input.measurementNodeByRootKey,
|
|
34296
34471
|
snapshotByElementNode: input.snapshotByElementNode,
|
|
34297
|
-
|
|
34472
|
+
snapshotHotSignalsByNode: input.snapshotHotSignalsByNode
|
|
34298
34473
|
});
|
|
34299
34474
|
measurementIndexHits += cohortMetricsResult.measurementHits;
|
|
34300
34475
|
const metrics = cohortMetricsResult.metrics;
|
|
@@ -34328,7 +34503,7 @@ function buildCohortIndex(input) {
|
|
|
34328
34503
|
subjectMetrics.rootNode,
|
|
34329
34504
|
input.childrenByParentNode,
|
|
34330
34505
|
input.snapshotByElementNode,
|
|
34331
|
-
input.
|
|
34506
|
+
input.snapshotHotSignalsByNode
|
|
34332
34507
|
);
|
|
34333
34508
|
subjectsByElementKey.set(subjectMetrics.key, {
|
|
34334
34509
|
element: subjectMetrics.element,
|
|
@@ -34394,7 +34569,7 @@ function collectCohortMetrics(input) {
|
|
|
34394
34569
|
if (!snapshot) {
|
|
34395
34570
|
throw new Error(`missing snapshot for measurement node ${measurementNode.key}`);
|
|
34396
34571
|
}
|
|
34397
|
-
const hotSignals = input.
|
|
34572
|
+
const hotSignals = input.snapshotHotSignalsByNode.get(measurementNode);
|
|
34398
34573
|
if (!hotSignals) {
|
|
34399
34574
|
throw new Error(`missing hot signals for measurement node ${measurementNode.key}`);
|
|
34400
34575
|
}
|
|
@@ -34719,9 +34894,9 @@ function buildCohortSignalIndex(metrics) {
|
|
|
34719
34894
|
const verticalAlignCounts = /* @__PURE__ */ new Map();
|
|
34720
34895
|
const alignSelfCounts = /* @__PURE__ */ new Map();
|
|
34721
34896
|
const placeSelfCounts = /* @__PURE__ */ new Map();
|
|
34722
|
-
let verticalAlignMergedKind =
|
|
34723
|
-
let alignSelfMergedKind =
|
|
34724
|
-
let placeSelfMergedKind =
|
|
34897
|
+
let verticalAlignMergedKind = 0 /* Exact */;
|
|
34898
|
+
let alignSelfMergedKind = 0 /* Exact */;
|
|
34899
|
+
let placeSelfMergedKind = 0 /* Exact */;
|
|
34725
34900
|
let verticalAlignComparableCount = 0;
|
|
34726
34901
|
let alignSelfComparableCount = 0;
|
|
34727
34902
|
let placeSelfComparableCount = 0;
|
|
@@ -34735,12 +34910,12 @@ function buildCohortSignalIndex(metrics) {
|
|
|
34735
34910
|
const snapshot = metric.element.snapshot;
|
|
34736
34911
|
const alignSelf = metric.hotSignals.alignSelf;
|
|
34737
34912
|
const placeSelf = metric.hotSignals.placeSelf;
|
|
34738
|
-
const isControlOrReplaced = snapshot.isControl || snapshot.isReplaced;
|
|
34913
|
+
const isControlOrReplaced = snapshot.node.isControl || snapshot.node.isReplaced;
|
|
34739
34914
|
const verticalAlign = resolveComparableVerticalAlign(metric.hotSignals.verticalAlign, isControlOrReplaced);
|
|
34740
34915
|
if (isControlOrReplaced) controlOrReplacedCount++;
|
|
34741
|
-
if (snapshot.textualContent ===
|
|
34742
|
-
if (snapshot.textualContent ===
|
|
34743
|
-
if (snapshot.textualContent ===
|
|
34916
|
+
if (snapshot.node.textualContent === 0 /* Yes */ || snapshot.node.textualContent === 3 /* DynamicText */) textYesCount++;
|
|
34917
|
+
if (snapshot.node.textualContent === 1 /* No */) textNoCount++;
|
|
34918
|
+
if (snapshot.node.textualContent === 2 /* Unknown */) textUnknownCount++;
|
|
34744
34919
|
if (verticalAlign.value !== null) {
|
|
34745
34920
|
verticalAlignMergedKind = mergeEvidenceKind(verticalAlignMergedKind, verticalAlign.kind);
|
|
34746
34921
|
verticalAlignComparableCount++;
|
|
@@ -34760,24 +34935,24 @@ function buildCohortSignalIndex(metrics) {
|
|
|
34760
34935
|
verticalAlign,
|
|
34761
34936
|
alignSelf,
|
|
34762
34937
|
placeSelf,
|
|
34763
|
-
textualContent: snapshot.textualContent,
|
|
34938
|
+
textualContent: snapshot.node.textualContent,
|
|
34764
34939
|
isControlOrReplaced
|
|
34765
34940
|
});
|
|
34766
34941
|
}
|
|
34767
34942
|
return {
|
|
34768
34943
|
byKey,
|
|
34769
34944
|
verticalAlign: {
|
|
34770
|
-
mergedKind: verticalAlignComparableCount === 0 ?
|
|
34945
|
+
mergedKind: verticalAlignComparableCount === 0 ? 3 /* Unknown */ : verticalAlignMergedKind,
|
|
34771
34946
|
comparableCount: verticalAlignComparableCount,
|
|
34772
34947
|
countsByValue: verticalAlignCounts
|
|
34773
34948
|
},
|
|
34774
34949
|
alignSelf: {
|
|
34775
|
-
mergedKind: alignSelfComparableCount === 0 ?
|
|
34950
|
+
mergedKind: alignSelfComparableCount === 0 ? 3 /* Unknown */ : alignSelfMergedKind,
|
|
34776
34951
|
comparableCount: alignSelfComparableCount,
|
|
34777
34952
|
countsByValue: alignSelfCounts
|
|
34778
34953
|
},
|
|
34779
34954
|
placeSelf: {
|
|
34780
|
-
mergedKind: placeSelfComparableCount === 0 ?
|
|
34955
|
+
mergedKind: placeSelfComparableCount === 0 ? 3 /* Unknown */ : placeSelfMergedKind,
|
|
34781
34956
|
comparableCount: placeSelfComparableCount,
|
|
34782
34957
|
countsByValue: placeSelfCounts
|
|
34783
34958
|
},
|
|
@@ -34814,9 +34989,9 @@ function collectSubjectCohortSignals(index, subjectMetrics, context) {
|
|
|
34814
34989
|
sawComparableVerticalAlign,
|
|
34815
34990
|
sawVerticalAlignConflict
|
|
34816
34991
|
);
|
|
34817
|
-
const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value ===
|
|
34992
|
+
const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === 2 /* Unknown */ && index.byKey.size > index.controlOrReplacedCount;
|
|
34818
34993
|
const normalizedVerticalAlign = tableCellControlFallback ? {
|
|
34819
|
-
value:
|
|
34994
|
+
value: 0 /* Conflict */,
|
|
34820
34995
|
kind: verticalAlignKind
|
|
34821
34996
|
} : verticalAlign;
|
|
34822
34997
|
const textContrastWithPeers = resolveIndexedTextContrastWithPeers(
|
|
@@ -34849,7 +35024,7 @@ function resolveComparableVerticalAlign(verticalAlign, isControlOrReplaced) {
|
|
|
34849
35024
|
return {
|
|
34850
35025
|
present: verticalAlign.present,
|
|
34851
35026
|
value: "baseline",
|
|
34852
|
-
kind:
|
|
35027
|
+
kind: 0 /* Exact */
|
|
34853
35028
|
};
|
|
34854
35029
|
}
|
|
34855
35030
|
function hasComparablePeer(aggregate, subjectValue) {
|
|
@@ -34866,37 +35041,37 @@ function hasConflictPeer(aggregate, subjectValue) {
|
|
|
34866
35041
|
function finalizeConflictEvidence(subjectValue, kind, sawComparablePeer, sawConflict) {
|
|
34867
35042
|
if (subjectValue === null) {
|
|
34868
35043
|
return {
|
|
34869
|
-
value:
|
|
35044
|
+
value: 2 /* Unknown */,
|
|
34870
35045
|
kind
|
|
34871
35046
|
};
|
|
34872
35047
|
}
|
|
34873
35048
|
if (!sawComparablePeer) {
|
|
34874
35049
|
return {
|
|
34875
|
-
value:
|
|
35050
|
+
value: 2 /* Unknown */,
|
|
34876
35051
|
kind
|
|
34877
35052
|
};
|
|
34878
35053
|
}
|
|
34879
35054
|
return {
|
|
34880
|
-
value: sawConflict ?
|
|
35055
|
+
value: sawConflict ? 0 /* Conflict */ : 1 /* Aligned */,
|
|
34881
35056
|
kind
|
|
34882
35057
|
};
|
|
34883
35058
|
}
|
|
34884
35059
|
function resolveIndexedTextContrastWithPeers(index, subjectTextualContent, subjectIsControlOrReplaced, tableCellControlFallback) {
|
|
34885
|
-
if (subjectTextualContent ===
|
|
35060
|
+
if (subjectTextualContent === 2 /* Unknown */) return 2 /* Unknown */;
|
|
34886
35061
|
const unknownPeers = index.textUnknownCount;
|
|
34887
35062
|
const cohortSize = index.byKey.size;
|
|
34888
|
-
if (subjectTextualContent ===
|
|
34889
|
-
if (index.textNoCount > 0) return
|
|
34890
|
-
if (unknownPeers > 0) return
|
|
34891
|
-
return
|
|
35063
|
+
if (subjectTextualContent === 0 /* Yes */ || subjectTextualContent === 3 /* DynamicText */) {
|
|
35064
|
+
if (index.textNoCount > 0) return 0 /* Different */;
|
|
35065
|
+
if (unknownPeers > 0) return 2 /* Unknown */;
|
|
35066
|
+
return 1 /* Same */;
|
|
34892
35067
|
}
|
|
34893
|
-
if (index.textYesCount > 0) return
|
|
34894
|
-
if (tableCellControlFallback) return
|
|
35068
|
+
if (index.textYesCount > 0) return 0 /* Different */;
|
|
35069
|
+
if (tableCellControlFallback) return 0 /* Different */;
|
|
34895
35070
|
if (subjectIsControlOrReplaced && index.controlOrReplacedCount === 1 && cohortSize >= 3 && unknownPeers > 0) {
|
|
34896
|
-
return
|
|
35071
|
+
return 0 /* Different */;
|
|
34897
35072
|
}
|
|
34898
|
-
if (unknownPeers > 0) return
|
|
34899
|
-
return
|
|
35073
|
+
if (unknownPeers > 0) return 2 /* Unknown */;
|
|
35074
|
+
return 1 /* Same */;
|
|
34900
35075
|
}
|
|
34901
35076
|
function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineProfile, clusterSummary, signalIndex, cohortKind, cohortSize) {
|
|
34902
35077
|
const subjectClusterKey = toComparableClusterKey(subjectMetrics);
|
|
@@ -34912,7 +35087,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34912
35087
|
return {
|
|
34913
35088
|
dominantShare: profile.dominantClusterShare,
|
|
34914
35089
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34915
|
-
subjectMembership:
|
|
35090
|
+
subjectMembership: 3 /* Insufficient */,
|
|
34916
35091
|
ambiguous: true,
|
|
34917
35092
|
kind
|
|
34918
35093
|
};
|
|
@@ -34921,7 +35096,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34921
35096
|
return {
|
|
34922
35097
|
dominantShare: profile.dominantClusterShare,
|
|
34923
35098
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34924
|
-
subjectMembership:
|
|
35099
|
+
subjectMembership: 0 /* Dominant */,
|
|
34925
35100
|
ambiguous: false,
|
|
34926
35101
|
kind
|
|
34927
35102
|
};
|
|
@@ -34930,7 +35105,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34930
35105
|
return {
|
|
34931
35106
|
dominantShare: profile.dominantClusterShare,
|
|
34932
35107
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34933
|
-
subjectMembership:
|
|
35108
|
+
subjectMembership: 3 /* Insufficient */,
|
|
34934
35109
|
ambiguous: true,
|
|
34935
35110
|
kind
|
|
34936
35111
|
};
|
|
@@ -34940,7 +35115,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34940
35115
|
return {
|
|
34941
35116
|
dominantShare: profile.dominantClusterShare,
|
|
34942
35117
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34943
|
-
subjectMembership:
|
|
35118
|
+
subjectMembership: 3 /* Insufficient */,
|
|
34944
35119
|
ambiguous: true,
|
|
34945
35120
|
kind
|
|
34946
35121
|
};
|
|
@@ -34950,7 +35125,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34950
35125
|
return {
|
|
34951
35126
|
dominantShare: profile.dominantClusterShare,
|
|
34952
35127
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34953
|
-
subjectMembership:
|
|
35128
|
+
subjectMembership: 2 /* Ambiguous */,
|
|
34954
35129
|
ambiguous: true,
|
|
34955
35130
|
kind
|
|
34956
35131
|
};
|
|
@@ -34959,7 +35134,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34959
35134
|
return {
|
|
34960
35135
|
dominantShare: profile.dominantClusterShare,
|
|
34961
35136
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34962
|
-
subjectMembership:
|
|
35137
|
+
subjectMembership: 0 /* Dominant */,
|
|
34963
35138
|
ambiguous: false,
|
|
34964
35139
|
kind
|
|
34965
35140
|
};
|
|
@@ -34967,13 +35142,13 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
|
|
|
34967
35142
|
return {
|
|
34968
35143
|
dominantShare: profile.dominantClusterShare,
|
|
34969
35144
|
subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
|
|
34970
|
-
subjectMembership:
|
|
35145
|
+
subjectMembership: 1 /* Nondominant */,
|
|
34971
35146
|
ambiguous: false,
|
|
34972
35147
|
kind
|
|
34973
35148
|
};
|
|
34974
35149
|
}
|
|
34975
35150
|
function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, cohortSize) {
|
|
34976
|
-
const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.isControl || subjectMetrics.element.snapshot.isReplaced;
|
|
35151
|
+
const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.node.isControl || subjectMetrics.element.snapshot.node.isReplaced;
|
|
34977
35152
|
const controlCount = signalIndex.controlOrReplacedCount;
|
|
34978
35153
|
const nonControlCount = cohortSize - controlCount;
|
|
34979
35154
|
if (controlCount <= 0 || nonControlCount <= 0) return null;
|
|
@@ -34988,12 +35163,12 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
|
|
|
34988
35163
|
return {
|
|
34989
35164
|
dominantShare,
|
|
34990
35165
|
subjectExcludedDominantShare: excludedDominantShare,
|
|
34991
|
-
subjectMembership: subjectMembership ===
|
|
35166
|
+
subjectMembership: subjectMembership === 2 /* Ambiguous */ ? 0 /* Dominant */ : subjectMembership,
|
|
34992
35167
|
ambiguous: false,
|
|
34993
35168
|
kind
|
|
34994
35169
|
};
|
|
34995
35170
|
}
|
|
34996
|
-
if (subjectMembership ===
|
|
35171
|
+
if (subjectMembership === 2 /* Ambiguous */) {
|
|
34997
35172
|
return {
|
|
34998
35173
|
dominantShare,
|
|
34999
35174
|
subjectExcludedDominantShare: excludedDominantShare,
|
|
@@ -35011,9 +35186,9 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
|
|
|
35011
35186
|
};
|
|
35012
35187
|
}
|
|
35013
35188
|
function resolveRoleMembership(controlCount, nonControlCount, subjectIsControlOrReplaced) {
|
|
35014
|
-
if (controlCount === nonControlCount) return
|
|
35189
|
+
if (controlCount === nonControlCount) return 2 /* Ambiguous */;
|
|
35015
35190
|
const dominantRoleIsControl = controlCount > nonControlCount;
|
|
35016
|
-
return dominantRoleIsControl === subjectIsControlOrReplaced ?
|
|
35191
|
+
return dominantRoleIsControl === subjectIsControlOrReplaced ? 0 /* Dominant */ : 1 /* Nondominant */;
|
|
35017
35192
|
}
|
|
35018
35193
|
function resolveExcludedRoleDominantShare(controlCount, nonControlCount, subjectIsControlOrReplaced) {
|
|
35019
35194
|
const controlAfterExclusion = controlCount - (subjectIsControlOrReplaced ? 1 : 0);
|
|
@@ -35051,8 +35226,8 @@ function collectCohortProvenanceFromSnapshots(snapshots) {
|
|
|
35051
35226
|
const snapshot = snapshots[i];
|
|
35052
35227
|
if (!snapshot) continue;
|
|
35053
35228
|
for (const signal of snapshot.signals.values()) {
|
|
35054
|
-
for (let j = 0; j < signal.
|
|
35055
|
-
const guard = signal.
|
|
35229
|
+
for (let j = 0; j < signal.guard.conditions.length; j++) {
|
|
35230
|
+
const guard = signal.guard.conditions[j];
|
|
35056
35231
|
if (!guard) continue;
|
|
35057
35232
|
if (!byKey.has(guard.key)) byKey.set(guard.key, guard);
|
|
35058
35233
|
}
|
|
@@ -35082,7 +35257,7 @@ function buildGuardKey(guards) {
|
|
|
35082
35257
|
return keys.join("&");
|
|
35083
35258
|
}
|
|
35084
35259
|
function resolveCohortEvidenceKind(metrics) {
|
|
35085
|
-
let kind =
|
|
35260
|
+
let kind = 0 /* Exact */;
|
|
35086
35261
|
for (let i = 0; i < metrics.length; i++) {
|
|
35087
35262
|
const metric = metrics[i];
|
|
35088
35263
|
if (!metric) continue;
|
|
@@ -35099,9 +35274,9 @@ function incrementCount(counts, key) {
|
|
|
35099
35274
|
counts.set(key, existing + 1);
|
|
35100
35275
|
}
|
|
35101
35276
|
function toEvidenceKind2(certainty) {
|
|
35102
|
-
if (certainty ===
|
|
35103
|
-
if (certainty ===
|
|
35104
|
-
return
|
|
35277
|
+
if (certainty === 0 /* Resolved */) return 0 /* Exact */;
|
|
35278
|
+
if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
|
|
35279
|
+
return 3 /* Unknown */;
|
|
35105
35280
|
}
|
|
35106
35281
|
function computeMedian(values) {
|
|
35107
35282
|
if (values.length === 0) return null;
|
|
@@ -35121,66 +35296,6 @@ function computeMedianAbsoluteDeviation(values, median, scratch) {
|
|
|
35121
35296
|
}
|
|
35122
35297
|
return computeMedian(scratch);
|
|
35123
35298
|
}
|
|
35124
|
-
function selectKth(values, targetIndex) {
|
|
35125
|
-
let left = 0;
|
|
35126
|
-
let right = values.length - 1;
|
|
35127
|
-
while (left <= right) {
|
|
35128
|
-
if (left === right) {
|
|
35129
|
-
const result = values[left];
|
|
35130
|
-
if (result === void 0) return 0;
|
|
35131
|
-
return result;
|
|
35132
|
-
}
|
|
35133
|
-
const pivotIndex = choosePivotIndex(values, left, right);
|
|
35134
|
-
const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
|
|
35135
|
-
if (partitionIndex === targetIndex) {
|
|
35136
|
-
const result = values[partitionIndex];
|
|
35137
|
-
if (result === void 0) return 0;
|
|
35138
|
-
return result;
|
|
35139
|
-
}
|
|
35140
|
-
if (partitionIndex < targetIndex) {
|
|
35141
|
-
left = partitionIndex + 1;
|
|
35142
|
-
continue;
|
|
35143
|
-
}
|
|
35144
|
-
right = partitionIndex - 1;
|
|
35145
|
-
}
|
|
35146
|
-
const fallback = values[targetIndex];
|
|
35147
|
-
if (fallback === void 0) return 0;
|
|
35148
|
-
return fallback;
|
|
35149
|
-
}
|
|
35150
|
-
function choosePivotIndex(values, left, right) {
|
|
35151
|
-
const middle = Math.floor((left + right) / 2);
|
|
35152
|
-
const leftValue = values[left] ?? 0;
|
|
35153
|
-
const middleValue = values[middle] ?? 0;
|
|
35154
|
-
const rightValue = values[right] ?? 0;
|
|
35155
|
-
if (leftValue < middleValue) {
|
|
35156
|
-
if (middleValue < rightValue) return middle;
|
|
35157
|
-
if (leftValue < rightValue) return right;
|
|
35158
|
-
return left;
|
|
35159
|
-
}
|
|
35160
|
-
if (leftValue < rightValue) return left;
|
|
35161
|
-
if (middleValue < rightValue) return right;
|
|
35162
|
-
return middle;
|
|
35163
|
-
}
|
|
35164
|
-
function partitionAroundPivot(values, left, right, pivotIndex) {
|
|
35165
|
-
const pivotValue = values[pivotIndex] ?? 0;
|
|
35166
|
-
swap(values, pivotIndex, right);
|
|
35167
|
-
let storeIndex = left;
|
|
35168
|
-
for (let i = left; i < right; i++) {
|
|
35169
|
-
const current = values[i];
|
|
35170
|
-
if (current === void 0 || current > pivotValue) continue;
|
|
35171
|
-
swap(values, storeIndex, i);
|
|
35172
|
-
storeIndex++;
|
|
35173
|
-
}
|
|
35174
|
-
swap(values, storeIndex, right);
|
|
35175
|
-
return storeIndex;
|
|
35176
|
-
}
|
|
35177
|
-
function swap(values, left, right) {
|
|
35178
|
-
if (left === right) return;
|
|
35179
|
-
const leftValue = values[left] ?? 0;
|
|
35180
|
-
const rightValue = values[right] ?? 0;
|
|
35181
|
-
values[left] = rightValue;
|
|
35182
|
-
values[right] = leftValue;
|
|
35183
|
-
}
|
|
35184
35299
|
function resolveVerticalAlignConsensus(aggregate) {
|
|
35185
35300
|
if (aggregate.comparableCount === 0) return null;
|
|
35186
35301
|
if (aggregate.countsByValue.size !== 1) return null;
|
|
@@ -35279,7 +35394,7 @@ function resolveMeasurementCandidates(root, childrenByParentNode, snapshotByElem
|
|
|
35279
35394
|
if (firstControlOrReplacedDescendant === null && (child.isControl || child.isReplaced)) {
|
|
35280
35395
|
firstControlOrReplacedDescendant = child;
|
|
35281
35396
|
}
|
|
35282
|
-
if (firstTextualDescendant === null && child.textualContent ===
|
|
35397
|
+
if (firstTextualDescendant === null && child.textualContent === 0 /* Yes */) {
|
|
35283
35398
|
firstTextualDescendant = child;
|
|
35284
35399
|
}
|
|
35285
35400
|
if (firstControlOrReplacedDescendant !== null && firstTextualDescendant !== null) break;
|
|
@@ -35305,7 +35420,7 @@ function resolveMeasurementNode(root, candidates) {
|
|
|
35305
35420
|
if (candidates.firstControlOrReplacedDescendant !== null) return candidates.firstControlOrReplacedDescendant;
|
|
35306
35421
|
if (root.isControl || root.isReplaced) return root;
|
|
35307
35422
|
if (candidates.firstTextualDescendant !== null) return candidates.firstTextualDescendant;
|
|
35308
|
-
if (root.textualContent ===
|
|
35423
|
+
if (root.textualContent === 0 /* Yes */) return root;
|
|
35309
35424
|
return root;
|
|
35310
35425
|
}
|
|
35311
35426
|
|
|
@@ -35352,7 +35467,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
|
|
|
35352
35467
|
seenSelectorIds.add(selector.id);
|
|
35353
35468
|
const metadata = selectorMetadataById.get(selector.id);
|
|
35354
35469
|
if (!metadata) continue;
|
|
35355
|
-
if (metadata.guard.kind ===
|
|
35470
|
+
if (metadata.guard.kind === 1 /* Conditional */) {
|
|
35356
35471
|
if (!conditionalSelectorIds.has(selector.id)) {
|
|
35357
35472
|
conditionalSelectorIds.add(selector.id);
|
|
35358
35473
|
perf.selectorsGuardedConditional++;
|
|
@@ -35394,7 +35509,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
|
|
|
35394
35509
|
}
|
|
35395
35510
|
return out;
|
|
35396
35511
|
}
|
|
35397
|
-
function
|
|
35512
|
+
function buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf) {
|
|
35398
35513
|
const out = /* @__PURE__ */ new Map();
|
|
35399
35514
|
for (let i = 0; i < elements.length; i++) {
|
|
35400
35515
|
const node = elements[i];
|
|
@@ -35404,7 +35519,7 @@ function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFil
|
|
|
35404
35519
|
const byTag = node.tagName !== null ? collectSelectorCandidates(scoped.bySubjectTag.get(node.tagName), node.selectorDispatchKeys) : EMPTY_SELECTOR_LIST;
|
|
35405
35520
|
const withoutTag = collectSelectorCandidates(scoped.withoutSubjectTag, node.selectorDispatchKeys);
|
|
35406
35521
|
const merged = mergeSelectorCandidateIds(byTag, withoutTag);
|
|
35407
|
-
out.set(node
|
|
35522
|
+
out.set(node, merged);
|
|
35408
35523
|
perf.elementsScanned++;
|
|
35409
35524
|
perf.selectorCandidatesChecked += merged.length;
|
|
35410
35525
|
}
|
|
@@ -35863,12 +35978,6 @@ var EMPTY_EXPANSION_RESULT = [];
|
|
|
35863
35978
|
function collectMonitoredDeclarations(selector, layerOrder, guard) {
|
|
35864
35979
|
const out = [];
|
|
35865
35980
|
const declarations = selector.rule.declarations;
|
|
35866
|
-
const signalGuard = guard.kind === "conditional" ? "conditional" : "unconditional";
|
|
35867
|
-
const guardProvenance = {
|
|
35868
|
-
kind: signalGuard,
|
|
35869
|
-
conditions: guard.conditions,
|
|
35870
|
-
key: guard.key
|
|
35871
|
-
};
|
|
35872
35981
|
for (let i = 0; i < declarations.length; i++) {
|
|
35873
35982
|
const declaration = declarations[i];
|
|
35874
35983
|
if (!declaration) continue;
|
|
@@ -35879,8 +35988,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
|
|
|
35879
35988
|
out.push({
|
|
35880
35989
|
property: monitored,
|
|
35881
35990
|
value: declaration.value,
|
|
35882
|
-
|
|
35883
|
-
guardProvenance,
|
|
35991
|
+
guardProvenance: guard,
|
|
35884
35992
|
position: {
|
|
35885
35993
|
layer: declaration.cascadePosition.layer,
|
|
35886
35994
|
layerOrder,
|
|
@@ -35902,6 +36010,7 @@ function toMonitoredSignalKey(property) {
|
|
|
35902
36010
|
case "margin-block":
|
|
35903
36011
|
case "padding-block":
|
|
35904
36012
|
case "inset-block":
|
|
36013
|
+
case "flex-flow":
|
|
35905
36014
|
return property;
|
|
35906
36015
|
default:
|
|
35907
36016
|
return null;
|
|
@@ -35925,30 +36034,27 @@ function expandMonitoredDeclarationForDelta(declaration) {
|
|
|
35925
36034
|
if (signalName === void 0) return EMPTY_EXPANSION_RESULT;
|
|
35926
36035
|
return [{ name: signalName, value: value2 }];
|
|
35927
36036
|
}
|
|
35928
|
-
function appendMatchingEdgesFromSelectorIds(selectorIds, node,
|
|
35929
|
-
const fileRoots = rootElementsByFile.get(node.solidFile) ?? null;
|
|
36037
|
+
function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, appliesByElementNodeMutable) {
|
|
36038
|
+
const fileRoots = ctx.rootElementsByFile.get(node.solidFile) ?? null;
|
|
35930
36039
|
for (let i = 0; i < selectorIds.length; i++) {
|
|
35931
36040
|
const selectorId = selectorIds[i];
|
|
35932
36041
|
if (selectorId === void 0) continue;
|
|
35933
|
-
const metadata = selectorMetadataById.get(selectorId);
|
|
36042
|
+
const metadata = ctx.selectorMetadataById.get(selectorId);
|
|
35934
36043
|
if (!metadata || !metadata.matcher) {
|
|
35935
36044
|
throw new Error(`missing compiled selector matcher for selector ${selectorId}`);
|
|
35936
36045
|
}
|
|
35937
|
-
const selector = selectorsById.get(selectorId);
|
|
36046
|
+
const selector = ctx.selectorsById.get(selectorId);
|
|
35938
36047
|
if (!selector) {
|
|
35939
36048
|
throw new Error(`missing selector ${selectorId}`);
|
|
35940
36049
|
}
|
|
35941
|
-
if (!selectorMatchesLayoutElement(metadata.matcher, node, perf, fileRoots, logger)) continue;
|
|
36050
|
+
if (!selectorMatchesLayoutElement(metadata.matcher, node, ctx.perf, fileRoots, ctx.logger)) continue;
|
|
35942
36051
|
const edge = {
|
|
35943
|
-
solidFile: node.solidFile,
|
|
35944
|
-
elementId: node.elementId,
|
|
35945
|
-
elementKey: node.key,
|
|
35946
36052
|
selectorId: selector.id,
|
|
35947
36053
|
specificityScore: selector.specificityScore,
|
|
35948
36054
|
sourceOrder: selector.rule.sourceOrder
|
|
35949
36055
|
};
|
|
35950
36056
|
applies.push(edge);
|
|
35951
|
-
perf.matchEdgesCreated++;
|
|
36057
|
+
ctx.perf.matchEdgesCreated++;
|
|
35952
36058
|
const existing = appliesByElementNodeMutable.get(node);
|
|
35953
36059
|
if (existing) {
|
|
35954
36060
|
existing.push(edge);
|
|
@@ -35974,7 +36080,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
|
|
|
35974
36080
|
const classTokens = node.classTokens;
|
|
35975
36081
|
if (classTokens.length === 0) return;
|
|
35976
36082
|
const guardProvenance = {
|
|
35977
|
-
kind:
|
|
36083
|
+
kind: 0 /* Unconditional */,
|
|
35978
36084
|
conditions: [],
|
|
35979
36085
|
key: "always"
|
|
35980
36086
|
};
|
|
@@ -35991,8 +36097,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
|
|
|
35991
36097
|
if (cascade.has(property)) continue;
|
|
35992
36098
|
cascade.set(property, {
|
|
35993
36099
|
value: value2,
|
|
35994
|
-
source:
|
|
35995
|
-
guard: "unconditional",
|
|
36100
|
+
source: 0 /* Selector */,
|
|
35996
36101
|
guardProvenance
|
|
35997
36102
|
});
|
|
35998
36103
|
}
|
|
@@ -36012,8 +36117,7 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
|
|
|
36012
36117
|
const property = declaration.property;
|
|
36013
36118
|
const newDeclaration = {
|
|
36014
36119
|
value: declaration.value,
|
|
36015
|
-
source:
|
|
36016
|
-
guard: declaration.guard,
|
|
36120
|
+
source: 0 /* Selector */,
|
|
36017
36121
|
guardProvenance: declaration.guardProvenance
|
|
36018
36122
|
};
|
|
36019
36123
|
const existingPosition = positions.get(property);
|
|
@@ -36032,33 +36136,26 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
|
|
|
36032
36136
|
positions.set(property, declaration.position);
|
|
36033
36137
|
}
|
|
36034
36138
|
}
|
|
36035
|
-
const inlinePosition = createInlineCascadePosition();
|
|
36036
|
-
const inlineGuardProvenance = {
|
|
36037
|
-
kind: "unconditional",
|
|
36038
|
-
conditions: [],
|
|
36039
|
-
key: "always"
|
|
36040
|
-
};
|
|
36041
36139
|
for (const [property, value2] of node.inlineStyleValues) {
|
|
36042
36140
|
const newDeclaration = {
|
|
36043
36141
|
value: value2,
|
|
36044
|
-
source:
|
|
36045
|
-
|
|
36046
|
-
guardProvenance: inlineGuardProvenance
|
|
36142
|
+
source: 1 /* InlineStyle */,
|
|
36143
|
+
guardProvenance: INLINE_GUARD_PROVENANCE
|
|
36047
36144
|
};
|
|
36048
36145
|
const existingPosition = positions.get(property);
|
|
36049
36146
|
if (existingPosition === void 0) {
|
|
36050
36147
|
out.set(property, newDeclaration);
|
|
36051
|
-
positions.set(property,
|
|
36148
|
+
positions.set(property, INLINE_CASCADE_POSITION);
|
|
36052
36149
|
continue;
|
|
36053
36150
|
}
|
|
36054
36151
|
const existingDeclaration = out.get(property);
|
|
36055
36152
|
if (existingDeclaration === void 0) continue;
|
|
36056
36153
|
if (!doesCandidateOverride(
|
|
36057
36154
|
{ declaration: existingDeclaration, position: existingPosition },
|
|
36058
|
-
{ declaration: newDeclaration, position:
|
|
36155
|
+
{ declaration: newDeclaration, position: INLINE_CASCADE_POSITION }
|
|
36059
36156
|
)) continue;
|
|
36060
36157
|
out.set(property, newDeclaration);
|
|
36061
|
-
positions.set(property,
|
|
36158
|
+
positions.set(property, INLINE_CASCADE_POSITION);
|
|
36062
36159
|
}
|
|
36063
36160
|
if (tailwind !== null) {
|
|
36064
36161
|
augmentCascadeWithTailwind(out, node, tailwind);
|
|
@@ -36075,7 +36172,7 @@ function doesCandidateOverride(existing, incoming) {
|
|
|
36075
36172
|
const existingSource = existing.declaration.source;
|
|
36076
36173
|
const incomingSource = incoming.declaration.source;
|
|
36077
36174
|
if (existingSource !== incomingSource) {
|
|
36078
|
-
if (incomingSource ===
|
|
36175
|
+
if (incomingSource === 1 /* InlineStyle */) {
|
|
36079
36176
|
if (existing.position.isImportant && !incoming.position.isImportant) return false;
|
|
36080
36177
|
return true;
|
|
36081
36178
|
}
|
|
@@ -36083,16 +36180,19 @@ function doesCandidateOverride(existing, incoming) {
|
|
|
36083
36180
|
}
|
|
36084
36181
|
return compareCascadePositions(incoming.position, existing.position) > 0;
|
|
36085
36182
|
}
|
|
36086
|
-
|
|
36087
|
-
|
|
36088
|
-
|
|
36089
|
-
|
|
36090
|
-
|
|
36091
|
-
|
|
36092
|
-
|
|
36093
|
-
|
|
36094
|
-
|
|
36095
|
-
|
|
36183
|
+
var INLINE_CASCADE_POSITION = Object.freeze({
|
|
36184
|
+
layer: null,
|
|
36185
|
+
layerOrder: Number.MAX_SAFE_INTEGER,
|
|
36186
|
+
sourceOrder: Number.MAX_SAFE_INTEGER,
|
|
36187
|
+
specificity: [1, 0, 0, 0],
|
|
36188
|
+
specificityScore: Number.MAX_SAFE_INTEGER,
|
|
36189
|
+
isImportant: false
|
|
36190
|
+
});
|
|
36191
|
+
var INLINE_GUARD_PROVENANCE = Object.freeze({
|
|
36192
|
+
kind: 0 /* Unconditional */,
|
|
36193
|
+
conditions: [],
|
|
36194
|
+
key: "always"
|
|
36195
|
+
});
|
|
36096
36196
|
function resolveRuleLayerOrder(rule, css) {
|
|
36097
36197
|
const layer = rule.containingLayer;
|
|
36098
36198
|
if (!layer) return 0;
|
|
@@ -36100,14 +36200,14 @@ function resolveRuleLayerOrder(rule, css) {
|
|
|
36100
36200
|
if (!name) return 0;
|
|
36101
36201
|
return css.layerOrder.get(name) ?? 0;
|
|
36102
36202
|
}
|
|
36103
|
-
function buildConditionalDeltaIndex(elements,
|
|
36104
|
-
const
|
|
36203
|
+
function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
|
|
36204
|
+
const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
|
|
36105
36205
|
const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
|
|
36106
|
-
const
|
|
36206
|
+
const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
|
|
36107
36207
|
for (let i = 0; i < elements.length; i++) {
|
|
36108
36208
|
const node = elements[i];
|
|
36109
36209
|
if (!node) continue;
|
|
36110
|
-
const edges =
|
|
36210
|
+
const edges = appliesByNode.get(node);
|
|
36111
36211
|
let factByProperty = null;
|
|
36112
36212
|
if (edges !== void 0 && edges.length > 0) {
|
|
36113
36213
|
const byProperty = /* @__PURE__ */ new Map();
|
|
@@ -36132,7 +36232,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
|
|
|
36132
36232
|
};
|
|
36133
36233
|
byProperty.set(property, bucket);
|
|
36134
36234
|
}
|
|
36135
|
-
if (declaration.
|
|
36235
|
+
if (declaration.guardProvenance.kind === 1 /* Conditional */) {
|
|
36136
36236
|
bucket.conditional.add(expandedEntry.value);
|
|
36137
36237
|
continue;
|
|
36138
36238
|
}
|
|
@@ -36172,7 +36272,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
|
|
|
36172
36272
|
}
|
|
36173
36273
|
if (facts.size > 0) {
|
|
36174
36274
|
factByProperty = facts;
|
|
36175
|
-
|
|
36275
|
+
conditionalSignalDeltaFactsByNode.set(node, facts);
|
|
36176
36276
|
for (const [signal, fact] of facts) {
|
|
36177
36277
|
if (!fact.hasConditional) continue;
|
|
36178
36278
|
const existing = elementsWithConditionalDeltaBySignal.get(signal);
|
|
@@ -36209,13 +36309,13 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
|
|
|
36209
36309
|
baselineBySignal.set(signal, [...values]);
|
|
36210
36310
|
}
|
|
36211
36311
|
if (baselineBySignal.size > 0) {
|
|
36212
|
-
|
|
36312
|
+
baselineOffsetFactsByNode.set(node, baselineBySignal);
|
|
36213
36313
|
}
|
|
36214
36314
|
}
|
|
36215
36315
|
return {
|
|
36216
|
-
|
|
36316
|
+
conditionalSignalDeltaFactsByNode,
|
|
36217
36317
|
elementsWithConditionalDeltaBySignal,
|
|
36218
|
-
|
|
36318
|
+
baselineOffsetFactsByNode
|
|
36219
36319
|
};
|
|
36220
36320
|
}
|
|
36221
36321
|
var EMPTY_NODE_LIST2 = [];
|
|
@@ -36342,8 +36442,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
36342
36442
|
if (child.kind === "expression") {
|
|
36343
36443
|
if (isStructuralExpression(child.node)) {
|
|
36344
36444
|
if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
|
|
36345
|
-
memo.set(element.id,
|
|
36346
|
-
return
|
|
36445
|
+
memo.set(element.id, 2 /* Unknown */);
|
|
36446
|
+
return 2 /* Unknown */;
|
|
36347
36447
|
}
|
|
36348
36448
|
hasTextOnlyExpression = true;
|
|
36349
36449
|
continue;
|
|
@@ -36351,8 +36451,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
36351
36451
|
if (child.kind !== "text") continue;
|
|
36352
36452
|
if (child.node.type !== "JSXText") continue;
|
|
36353
36453
|
if (isBlank(child.node.value)) continue;
|
|
36354
|
-
memo.set(element.id,
|
|
36355
|
-
return
|
|
36454
|
+
memo.set(element.id, 0 /* Yes */);
|
|
36455
|
+
return 0 /* Yes */;
|
|
36356
36456
|
}
|
|
36357
36457
|
let childHasUnknown = false;
|
|
36358
36458
|
let childHasDynamicText = false;
|
|
@@ -36366,31 +36466,31 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
|
|
|
36366
36466
|
if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag}#${child.id} resolves to control tag=${childMeta.tagName}, skipping`);
|
|
36367
36467
|
continue;
|
|
36368
36468
|
}
|
|
36369
|
-
if (childState !==
|
|
36469
|
+
if (childState !== 1 /* No */) {
|
|
36370
36470
|
if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag ?? child.id}#${child.id} has state=${childState} \u2192 childHasUnknown`);
|
|
36371
36471
|
childHasUnknown = true;
|
|
36372
36472
|
}
|
|
36373
36473
|
continue;
|
|
36374
36474
|
}
|
|
36375
|
-
if (childState ===
|
|
36376
|
-
memo.set(element.id,
|
|
36377
|
-
return
|
|
36475
|
+
if (childState === 0 /* Yes */) {
|
|
36476
|
+
memo.set(element.id, 0 /* Yes */);
|
|
36477
|
+
return 0 /* Yes */;
|
|
36378
36478
|
}
|
|
36379
|
-
if (childState ===
|
|
36380
|
-
if (childState ===
|
|
36479
|
+
if (childState === 2 /* Unknown */) childHasUnknown = true;
|
|
36480
|
+
if (childState === 3 /* DynamicText */) childHasDynamicText = true;
|
|
36381
36481
|
}
|
|
36382
36482
|
if (childHasUnknown) {
|
|
36383
36483
|
if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
|
|
36384
|
-
memo.set(element.id,
|
|
36385
|
-
return
|
|
36484
|
+
memo.set(element.id, 2 /* Unknown */);
|
|
36485
|
+
return 2 /* Unknown */;
|
|
36386
36486
|
}
|
|
36387
36487
|
if (hasTextOnlyExpression || childHasDynamicText) {
|
|
36388
36488
|
if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
|
|
36389
|
-
memo.set(element.id,
|
|
36390
|
-
return
|
|
36489
|
+
memo.set(element.id, 3 /* DynamicText */);
|
|
36490
|
+
return 3 /* DynamicText */;
|
|
36391
36491
|
}
|
|
36392
|
-
memo.set(element.id,
|
|
36393
|
-
return
|
|
36492
|
+
memo.set(element.id, 1 /* No */);
|
|
36493
|
+
return 1 /* No */;
|
|
36394
36494
|
}
|
|
36395
36495
|
function isStructuralExpression(node) {
|
|
36396
36496
|
if (node.type !== "JSXExpressionContainer") return false;
|
|
@@ -36689,8 +36789,6 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36689
36789
|
classTokens: record.classTokens,
|
|
36690
36790
|
classTokenSet: record.classTokenSet,
|
|
36691
36791
|
inlineStyleKeys: record.inlineStyleKeys,
|
|
36692
|
-
parentElementId,
|
|
36693
|
-
parentElementKey: parentNode ? parentNode.key : parentElementId === null ? null : toLayoutElementKey(solid.file, parentElementId),
|
|
36694
36792
|
parentElementNode: parentNode,
|
|
36695
36793
|
previousSiblingNode,
|
|
36696
36794
|
siblingIndex,
|
|
@@ -36731,22 +36829,25 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36731
36829
|
logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
|
|
36732
36830
|
}
|
|
36733
36831
|
}
|
|
36734
|
-
const
|
|
36832
|
+
const selectorCandidatesByNode = buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf);
|
|
36833
|
+
const selectorMatchCtx = {
|
|
36834
|
+
selectorMetadataById,
|
|
36835
|
+
selectorsById,
|
|
36836
|
+
rootElementsByFile,
|
|
36837
|
+
perf,
|
|
36838
|
+
logger
|
|
36839
|
+
};
|
|
36735
36840
|
for (let i = 0; i < elements.length; i++) {
|
|
36736
36841
|
const node = elements[i];
|
|
36737
36842
|
if (!node) continue;
|
|
36738
|
-
const selectorIds =
|
|
36843
|
+
const selectorIds = selectorCandidatesByNode.get(node) ?? EMPTY_NUMBER_LIST2;
|
|
36739
36844
|
if (selectorIds.length === 0) continue;
|
|
36740
36845
|
appendMatchingEdgesFromSelectorIds(
|
|
36846
|
+
selectorMatchCtx,
|
|
36741
36847
|
selectorIds,
|
|
36742
36848
|
node,
|
|
36743
|
-
selectorMetadataById,
|
|
36744
|
-
selectorsById,
|
|
36745
36849
|
applies,
|
|
36746
|
-
appliesByElementNodeMutable
|
|
36747
|
-
perf,
|
|
36748
|
-
rootElementsByFile,
|
|
36749
|
-
logger
|
|
36850
|
+
appliesByElementNodeMutable
|
|
36750
36851
|
);
|
|
36751
36852
|
}
|
|
36752
36853
|
perf.selectorMatchMs = performance.now() - selectorMatchStartedAt;
|
|
@@ -36754,7 +36855,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36754
36855
|
for (const edges of appliesByElementNodeMutable.values()) {
|
|
36755
36856
|
edges.sort(compareLayoutEdge);
|
|
36756
36857
|
}
|
|
36757
|
-
const
|
|
36858
|
+
const appliesByNode = /* @__PURE__ */ new Map();
|
|
36758
36859
|
const tailwind = css.tailwind;
|
|
36759
36860
|
for (let i = 0; i < elements.length; i++) {
|
|
36760
36861
|
const node = elements[i];
|
|
@@ -36762,7 +36863,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36762
36863
|
const edges = appliesByElementNodeMutable.get(node) ?? [];
|
|
36763
36864
|
const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind);
|
|
36764
36865
|
cascadeByElementNode.set(node, cascade);
|
|
36765
|
-
|
|
36866
|
+
appliesByNode.set(node, edges);
|
|
36766
36867
|
}
|
|
36767
36868
|
perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
|
|
36768
36869
|
const snapshotByElementNode = buildSignalSnapshotIndex(elements, cascadeByElementNode, perf);
|
|
@@ -36770,7 +36871,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36770
36871
|
const factIndex = buildElementFactIndex(elements, snapshotByElementNode);
|
|
36771
36872
|
const conditionalDeltaIndex = buildConditionalDeltaIndex(
|
|
36772
36873
|
elements,
|
|
36773
|
-
|
|
36874
|
+
appliesByNode,
|
|
36774
36875
|
monitoredDeclarationsBySelectorId
|
|
36775
36876
|
);
|
|
36776
36877
|
const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
|
|
@@ -36788,7 +36889,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36788
36889
|
contextByParentNode,
|
|
36789
36890
|
measurementNodeByRootKey,
|
|
36790
36891
|
snapshotByElementNode,
|
|
36791
|
-
|
|
36892
|
+
snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode
|
|
36792
36893
|
});
|
|
36793
36894
|
finalizeTableCellBaselineRelevance(contextByParentNode, cohortIndex.verticalAlignConsensusByParent);
|
|
36794
36895
|
perf.conditionalSignals = cohortIndex.conditionalSignals;
|
|
@@ -36804,11 +36905,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36804
36905
|
childrenByParentNode: childrenByParentNodeMutable,
|
|
36805
36906
|
elementBySolidFileAndId: elementBySolidFileAndIdMutable,
|
|
36806
36907
|
elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
|
|
36807
|
-
|
|
36808
|
-
|
|
36908
|
+
appliesByNode,
|
|
36909
|
+
selectorCandidatesByNode,
|
|
36809
36910
|
selectorsById,
|
|
36810
36911
|
measurementNodeByRootKey,
|
|
36811
|
-
|
|
36912
|
+
snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode,
|
|
36812
36913
|
elementsByTagName: factIndex.elementsByTagName,
|
|
36813
36914
|
elementsWithConditionalDeltaBySignal: conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
|
|
36814
36915
|
elementsWithConditionalOverflowDelta,
|
|
@@ -36816,12 +36917,12 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36816
36917
|
elementsByKnownSignalValue: factIndex.elementsByKnownSignalValue,
|
|
36817
36918
|
dynamicSlotCandidateElements: factIndex.dynamicSlotCandidateElements,
|
|
36818
36919
|
scrollContainerElements: factIndex.scrollContainerElements,
|
|
36819
|
-
|
|
36820
|
-
|
|
36821
|
-
|
|
36822
|
-
|
|
36823
|
-
|
|
36824
|
-
|
|
36920
|
+
reservedSpaceFactsByNode: factIndex.reservedSpaceFactsByNode,
|
|
36921
|
+
scrollContainerFactsByNode: factIndex.scrollContainerFactsByNode,
|
|
36922
|
+
flowParticipationFactsByNode: factIndex.flowParticipationFactsByNode,
|
|
36923
|
+
containingBlockFactsByNode: factIndex.containingBlockFactsByNode,
|
|
36924
|
+
conditionalSignalDeltaFactsByNode: conditionalDeltaIndex.conditionalSignalDeltaFactsByNode,
|
|
36925
|
+
baselineOffsetFactsByNode: conditionalDeltaIndex.baselineOffsetFactsByNode,
|
|
36825
36926
|
statefulSelectorEntriesByRuleId: statefulRuleIndexes.selectorEntriesByRuleId,
|
|
36826
36927
|
statefulNormalizedDeclarationsByRuleId: statefulRuleIndexes.normalizedDeclarationsByRuleId,
|
|
36827
36928
|
statefulBaseValueIndex: statefulRuleIndexes.baseValueIndex,
|
|
@@ -36833,11 +36934,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
|
|
|
36833
36934
|
};
|
|
36834
36935
|
}
|
|
36835
36936
|
function buildElementFactIndex(elements, snapshotByElementNode) {
|
|
36836
|
-
const
|
|
36837
|
-
const
|
|
36838
|
-
const
|
|
36839
|
-
const
|
|
36840
|
-
const
|
|
36937
|
+
const reservedSpaceFactsByNode = /* @__PURE__ */ new Map();
|
|
36938
|
+
const scrollContainerFactsByNode = /* @__PURE__ */ new Map();
|
|
36939
|
+
const flowParticipationFactsByNode = /* @__PURE__ */ new Map();
|
|
36940
|
+
const containingBlockFactsByNode = /* @__PURE__ */ new Map();
|
|
36941
|
+
const snapshotHotSignalsByNode = /* @__PURE__ */ new Map();
|
|
36841
36942
|
const elementsByTagName = /* @__PURE__ */ new Map();
|
|
36842
36943
|
const elementsByKnownSignalValue = /* @__PURE__ */ new Map();
|
|
36843
36944
|
const dynamicSlotCandidateElements = [];
|
|
@@ -36847,7 +36948,7 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
|
|
|
36847
36948
|
const node = elements[i];
|
|
36848
36949
|
if (!node) continue;
|
|
36849
36950
|
const snapshot = snapshotByElementNode.get(node);
|
|
36850
|
-
if (node.textualContent ===
|
|
36951
|
+
if (node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2) {
|
|
36851
36952
|
dynamicSlotCandidateElements.push(node);
|
|
36852
36953
|
}
|
|
36853
36954
|
if (node.tagName) {
|
|
@@ -36868,18 +36969,18 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
|
|
|
36868
36969
|
nearestPositionedAncestorHasReservedSpace = parentPositioned.hasReservedSpace;
|
|
36869
36970
|
}
|
|
36870
36971
|
}
|
|
36871
|
-
|
|
36972
|
+
containingBlockFactsByNode.set(node, {
|
|
36872
36973
|
nearestPositionedAncestorKey,
|
|
36873
36974
|
nearestPositionedAncestorHasReservedSpace
|
|
36874
36975
|
});
|
|
36875
36976
|
if (!snapshot) continue;
|
|
36876
36977
|
const reservedSpaceFact = computeReservedSpaceFact(snapshot);
|
|
36877
|
-
|
|
36978
|
+
reservedSpaceFactsByNode.set(node, reservedSpaceFact);
|
|
36878
36979
|
const scrollFact = computeScrollContainerFact(snapshot);
|
|
36879
|
-
|
|
36980
|
+
scrollContainerFactsByNode.set(node, scrollFact);
|
|
36880
36981
|
if (scrollFact.isScrollContainer) scrollContainerElements.push(node);
|
|
36881
|
-
|
|
36882
|
-
|
|
36982
|
+
flowParticipationFactsByNode.set(node, computeFlowParticipationFact(snapshot));
|
|
36983
|
+
snapshotHotSignalsByNode.set(node, computeHotSignals(snapshot));
|
|
36883
36984
|
const positionSignal = snapshot.signals.get("position");
|
|
36884
36985
|
const isPositioned = positionSignal !== void 0 && positionSignal.kind === "known" && positionSignal.normalized !== "static";
|
|
36885
36986
|
if (isPositioned) {
|
|
@@ -36910,49 +37011,163 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
|
|
|
36910
37011
|
}
|
|
36911
37012
|
}
|
|
36912
37013
|
return {
|
|
36913
|
-
|
|
36914
|
-
|
|
37014
|
+
reservedSpaceFactsByNode,
|
|
37015
|
+
scrollContainerFactsByNode,
|
|
36915
37016
|
scrollContainerElements,
|
|
36916
|
-
|
|
36917
|
-
|
|
36918
|
-
|
|
37017
|
+
flowParticipationFactsByNode,
|
|
37018
|
+
containingBlockFactsByNode,
|
|
37019
|
+
snapshotHotSignalsByNode,
|
|
36919
37020
|
elementsByTagName,
|
|
36920
37021
|
elementsByKnownSignalValue,
|
|
36921
37022
|
dynamicSlotCandidateElements
|
|
36922
37023
|
};
|
|
36923
37024
|
}
|
|
36924
|
-
|
|
37025
|
+
var ABSENT_NUMERIC = Object.freeze({
|
|
37026
|
+
present: false,
|
|
37027
|
+
value: null,
|
|
37028
|
+
kind: 3 /* Unknown */
|
|
37029
|
+
});
|
|
37030
|
+
var ABSENT_NORMALIZED = Object.freeze({
|
|
37031
|
+
present: false,
|
|
37032
|
+
value: null,
|
|
37033
|
+
kind: 3 /* Unknown */
|
|
37034
|
+
});
|
|
37035
|
+
function toHotNumeric(signal) {
|
|
37036
|
+
if (signal.kind !== "known") {
|
|
37037
|
+
return {
|
|
37038
|
+
present: true,
|
|
37039
|
+
value: null,
|
|
37040
|
+
kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
|
|
37041
|
+
};
|
|
37042
|
+
}
|
|
36925
37043
|
return {
|
|
36926
|
-
|
|
36927
|
-
|
|
36928
|
-
|
|
36929
|
-
placeSelf: computeHotNormalized(snapshot, "place-self"),
|
|
36930
|
-
writingMode: computeHotNormalized(snapshot, "writing-mode"),
|
|
36931
|
-
direction: computeHotNormalized(snapshot, "direction"),
|
|
36932
|
-
display: computeHotNormalized(snapshot, "display"),
|
|
36933
|
-
alignItems: computeHotNormalized(snapshot, "align-items"),
|
|
36934
|
-
placeItems: computeHotNormalized(snapshot, "place-items"),
|
|
36935
|
-
position: computeHotNormalized(snapshot, "position"),
|
|
36936
|
-
insetBlockStart: computeHotNumeric(snapshot, "inset-block-start"),
|
|
36937
|
-
insetBlockEnd: computeHotNumeric(snapshot, "inset-block-end"),
|
|
36938
|
-
transform: computeHotNumeric(snapshot, "transform"),
|
|
36939
|
-
translate: computeHotNumeric(snapshot, "translate"),
|
|
36940
|
-
top: computeHotNumeric(snapshot, "top"),
|
|
36941
|
-
bottom: computeHotNumeric(snapshot, "bottom"),
|
|
36942
|
-
marginTop: computeHotNumeric(snapshot, "margin-top"),
|
|
36943
|
-
marginBottom: computeHotNumeric(snapshot, "margin-bottom")
|
|
37044
|
+
present: true,
|
|
37045
|
+
value: signal.px,
|
|
37046
|
+
kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
|
|
36944
37047
|
};
|
|
36945
37048
|
}
|
|
36946
|
-
function
|
|
37049
|
+
function toHotNormalized(signal) {
|
|
37050
|
+
if (signal.kind !== "known") {
|
|
37051
|
+
return {
|
|
37052
|
+
present: true,
|
|
37053
|
+
value: null,
|
|
37054
|
+
kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
|
|
37055
|
+
};
|
|
37056
|
+
}
|
|
36947
37057
|
return {
|
|
36948
|
-
present:
|
|
36949
|
-
|
|
37058
|
+
present: true,
|
|
37059
|
+
value: signal.normalized,
|
|
37060
|
+
kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
|
|
36950
37061
|
};
|
|
36951
37062
|
}
|
|
36952
|
-
function
|
|
37063
|
+
function computeHotSignals(snapshot) {
|
|
37064
|
+
let lineHeight = ABSENT_NUMERIC;
|
|
37065
|
+
let verticalAlign = ABSENT_NORMALIZED;
|
|
37066
|
+
let alignSelf = ABSENT_NORMALIZED;
|
|
37067
|
+
let placeSelf = ABSENT_NORMALIZED;
|
|
37068
|
+
let flexDirection = ABSENT_NORMALIZED;
|
|
37069
|
+
let gridAutoFlow = ABSENT_NORMALIZED;
|
|
37070
|
+
let writingMode = ABSENT_NORMALIZED;
|
|
37071
|
+
let direction = ABSENT_NORMALIZED;
|
|
37072
|
+
let display = ABSENT_NORMALIZED;
|
|
37073
|
+
let alignItems = ABSENT_NORMALIZED;
|
|
37074
|
+
let placeItems = ABSENT_NORMALIZED;
|
|
37075
|
+
let position = ABSENT_NORMALIZED;
|
|
37076
|
+
let insetBlockStart = ABSENT_NUMERIC;
|
|
37077
|
+
let insetBlockEnd = ABSENT_NUMERIC;
|
|
37078
|
+
let transform = ABSENT_NUMERIC;
|
|
37079
|
+
let translate = ABSENT_NUMERIC;
|
|
37080
|
+
let top = ABSENT_NUMERIC;
|
|
37081
|
+
let bottom = ABSENT_NUMERIC;
|
|
37082
|
+
let marginTop = ABSENT_NUMERIC;
|
|
37083
|
+
let marginBottom = ABSENT_NUMERIC;
|
|
37084
|
+
for (const [name, value2] of snapshot.signals) {
|
|
37085
|
+
switch (name) {
|
|
37086
|
+
case "line-height":
|
|
37087
|
+
lineHeight = toHotNumeric(value2);
|
|
37088
|
+
break;
|
|
37089
|
+
case "vertical-align":
|
|
37090
|
+
verticalAlign = toHotNormalized(value2);
|
|
37091
|
+
break;
|
|
37092
|
+
case "align-self":
|
|
37093
|
+
alignSelf = toHotNormalized(value2);
|
|
37094
|
+
break;
|
|
37095
|
+
case "place-self":
|
|
37096
|
+
placeSelf = toHotNormalized(value2);
|
|
37097
|
+
break;
|
|
37098
|
+
case "flex-direction":
|
|
37099
|
+
flexDirection = toHotNormalized(value2);
|
|
37100
|
+
break;
|
|
37101
|
+
case "grid-auto-flow":
|
|
37102
|
+
gridAutoFlow = toHotNormalized(value2);
|
|
37103
|
+
break;
|
|
37104
|
+
case "writing-mode":
|
|
37105
|
+
writingMode = toHotNormalized(value2);
|
|
37106
|
+
break;
|
|
37107
|
+
case "direction":
|
|
37108
|
+
direction = toHotNormalized(value2);
|
|
37109
|
+
break;
|
|
37110
|
+
case "display":
|
|
37111
|
+
display = toHotNormalized(value2);
|
|
37112
|
+
break;
|
|
37113
|
+
case "align-items":
|
|
37114
|
+
alignItems = toHotNormalized(value2);
|
|
37115
|
+
break;
|
|
37116
|
+
case "place-items":
|
|
37117
|
+
placeItems = toHotNormalized(value2);
|
|
37118
|
+
break;
|
|
37119
|
+
case "position":
|
|
37120
|
+
position = toHotNormalized(value2);
|
|
37121
|
+
break;
|
|
37122
|
+
case "inset-block-start":
|
|
37123
|
+
insetBlockStart = toHotNumeric(value2);
|
|
37124
|
+
break;
|
|
37125
|
+
case "inset-block-end":
|
|
37126
|
+
insetBlockEnd = toHotNumeric(value2);
|
|
37127
|
+
break;
|
|
37128
|
+
case "transform":
|
|
37129
|
+
transform = toHotNumeric(value2);
|
|
37130
|
+
break;
|
|
37131
|
+
case "translate":
|
|
37132
|
+
translate = toHotNumeric(value2);
|
|
37133
|
+
break;
|
|
37134
|
+
case "top":
|
|
37135
|
+
top = toHotNumeric(value2);
|
|
37136
|
+
break;
|
|
37137
|
+
case "bottom":
|
|
37138
|
+
bottom = toHotNumeric(value2);
|
|
37139
|
+
break;
|
|
37140
|
+
case "margin-top":
|
|
37141
|
+
marginTop = toHotNumeric(value2);
|
|
37142
|
+
break;
|
|
37143
|
+
case "margin-bottom":
|
|
37144
|
+
marginBottom = toHotNumeric(value2);
|
|
37145
|
+
break;
|
|
37146
|
+
default:
|
|
37147
|
+
break;
|
|
37148
|
+
}
|
|
37149
|
+
}
|
|
36953
37150
|
return {
|
|
36954
|
-
|
|
36955
|
-
|
|
37151
|
+
lineHeight,
|
|
37152
|
+
verticalAlign,
|
|
37153
|
+
alignSelf,
|
|
37154
|
+
placeSelf,
|
|
37155
|
+
flexDirection,
|
|
37156
|
+
gridAutoFlow,
|
|
37157
|
+
writingMode,
|
|
37158
|
+
direction,
|
|
37159
|
+
display,
|
|
37160
|
+
alignItems,
|
|
37161
|
+
placeItems,
|
|
37162
|
+
position,
|
|
37163
|
+
insetBlockStart,
|
|
37164
|
+
insetBlockEnd,
|
|
37165
|
+
transform,
|
|
37166
|
+
translate,
|
|
37167
|
+
top,
|
|
37168
|
+
bottom,
|
|
37169
|
+
marginTop,
|
|
37170
|
+
marginBottom
|
|
36956
37171
|
};
|
|
36957
37172
|
}
|
|
36958
37173
|
function computeReservedSpaceFact(snapshot) {
|
|
@@ -36987,15 +37202,14 @@ function computeReservedSpaceFact(snapshot) {
|
|
|
36987
37202
|
function hasPositiveOrDeclaredDimension(snapshot, property) {
|
|
36988
37203
|
const signal = snapshot.signals.get(property);
|
|
36989
37204
|
if (!signal) return false;
|
|
36990
|
-
if (signal.guard !==
|
|
37205
|
+
if (signal.guard.kind !== 0 /* Unconditional */) return false;
|
|
36991
37206
|
let normalized = "";
|
|
36992
37207
|
if (signal.kind === "known") {
|
|
36993
37208
|
if (signal.px !== null) return signal.px > 0;
|
|
36994
37209
|
normalized = signal.normalized.trim().toLowerCase();
|
|
36995
37210
|
}
|
|
36996
37211
|
if (signal.kind === "unknown") {
|
|
36997
|
-
|
|
36998
|
-
normalized = signal.raw.trim().toLowerCase();
|
|
37212
|
+
return signal.source !== null;
|
|
36999
37213
|
}
|
|
37000
37214
|
if (normalized.length === 0) return false;
|
|
37001
37215
|
if (isNonReservingDimension(normalized)) return false;
|
|
@@ -37004,15 +37218,14 @@ function hasPositiveOrDeclaredDimension(snapshot, property) {
|
|
|
37004
37218
|
function hasUsableAspectRatio(snapshot) {
|
|
37005
37219
|
const signal = snapshot.signals.get("aspect-ratio");
|
|
37006
37220
|
if (!signal) return false;
|
|
37007
|
-
if (signal.guard !==
|
|
37221
|
+
if (signal.guard.kind !== 0 /* Unconditional */) return false;
|
|
37222
|
+
if (signal.kind === "unknown") {
|
|
37223
|
+
return false;
|
|
37224
|
+
}
|
|
37008
37225
|
let normalized = "";
|
|
37009
37226
|
if (signal.kind === "known") {
|
|
37010
37227
|
normalized = signal.normalized.trim().toLowerCase();
|
|
37011
37228
|
}
|
|
37012
|
-
if (signal.kind === "unknown") {
|
|
37013
|
-
if (signal.raw === null) return false;
|
|
37014
|
-
normalized = signal.raw.trim().toLowerCase();
|
|
37015
|
-
}
|
|
37016
37229
|
if (normalized.length === 0) return false;
|
|
37017
37230
|
return normalized !== "auto";
|
|
37018
37231
|
}
|
|
@@ -37030,8 +37243,8 @@ function computeScrollContainerFact(snapshot) {
|
|
|
37030
37243
|
const yFromLonghand = parseSingleAxisScroll(overflowY);
|
|
37031
37244
|
const xScroll = shorthandAxis.x;
|
|
37032
37245
|
const yScroll = yFromLonghand === null ? shorthandAxis.y : yFromLonghand;
|
|
37033
|
-
const hasConditionalScroll = overflowSignal?.guard ===
|
|
37034
|
-
const hasUnconditionalScroll = overflowSignal?.guard ===
|
|
37246
|
+
const hasConditionalScroll = overflowSignal?.guard.kind === 1 /* Conditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 1 /* Conditional */ && yFromLonghand === true;
|
|
37247
|
+
const hasUnconditionalScroll = overflowSignal?.guard.kind === 0 /* Unconditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 0 /* Unconditional */ && yFromLonghand === true;
|
|
37035
37248
|
return {
|
|
37036
37249
|
isScrollContainer: xScroll || yScroll,
|
|
37037
37250
|
axis: toScrollAxis(xScroll, yScroll),
|
|
@@ -37041,18 +37254,18 @@ function computeScrollContainerFact(snapshot) {
|
|
|
37041
37254
|
hasUnconditionalScroll
|
|
37042
37255
|
};
|
|
37043
37256
|
}
|
|
37257
|
+
var NO_SCROLL = Object.freeze({ x: false, y: false });
|
|
37258
|
+
var BOTH_SCROLL = Object.freeze({ x: true, y: true });
|
|
37044
37259
|
function parseOverflowShorthandAxis(value2) {
|
|
37045
|
-
if (value2 === null) return
|
|
37046
|
-
const
|
|
37047
|
-
|
|
37048
|
-
|
|
37049
|
-
|
|
37050
|
-
|
|
37051
|
-
|
|
37052
|
-
|
|
37053
|
-
|
|
37054
|
-
const second = tokens[1];
|
|
37055
|
-
if (!second) return { x: SCROLLABLE_VALUES.has(first), y: false };
|
|
37260
|
+
if (value2 === null) return NO_SCROLL;
|
|
37261
|
+
const trimmed = value2.trim();
|
|
37262
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
37263
|
+
if (spaceIdx === -1) {
|
|
37264
|
+
const scroll = SCROLLABLE_VALUES.has(trimmed);
|
|
37265
|
+
return scroll ? BOTH_SCROLL : NO_SCROLL;
|
|
37266
|
+
}
|
|
37267
|
+
const first = trimmed.slice(0, spaceIdx);
|
|
37268
|
+
const second = trimmed.slice(spaceIdx + 1).trimStart();
|
|
37056
37269
|
return {
|
|
37057
37270
|
x: SCROLLABLE_VALUES.has(first),
|
|
37058
37271
|
y: SCROLLABLE_VALUES.has(second)
|
|
@@ -37060,16 +37273,16 @@ function parseOverflowShorthandAxis(value2) {
|
|
|
37060
37273
|
}
|
|
37061
37274
|
function parseSingleAxisScroll(value2) {
|
|
37062
37275
|
if (value2 === null) return null;
|
|
37063
|
-
const
|
|
37064
|
-
const
|
|
37065
|
-
|
|
37276
|
+
const trimmed = value2.trim();
|
|
37277
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
37278
|
+
const first = spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx);
|
|
37066
37279
|
return SCROLLABLE_VALUES.has(first);
|
|
37067
37280
|
}
|
|
37068
37281
|
function toScrollAxis(x, y) {
|
|
37069
|
-
if (x && y) return
|
|
37070
|
-
if (x) return
|
|
37071
|
-
if (y) return
|
|
37072
|
-
return
|
|
37282
|
+
if (x && y) return 3 /* Both */;
|
|
37283
|
+
if (x) return 1 /* X */;
|
|
37284
|
+
if (y) return 2 /* Y */;
|
|
37285
|
+
return 0 /* None */;
|
|
37073
37286
|
}
|
|
37074
37287
|
function computeFlowParticipationFact(snapshot) {
|
|
37075
37288
|
const signal = snapshot.signals.get("position");
|
|
@@ -37086,8 +37299,8 @@ function computeFlowParticipationFact(snapshot) {
|
|
|
37086
37299
|
return {
|
|
37087
37300
|
inFlow: !outOfFlow,
|
|
37088
37301
|
position,
|
|
37089
|
-
hasConditionalOutOfFlow: signal.guard ===
|
|
37090
|
-
hasUnconditionalOutOfFlow: signal.guard ===
|
|
37302
|
+
hasConditionalOutOfFlow: signal.guard.kind === 1 /* Conditional */ && outOfFlow,
|
|
37303
|
+
hasUnconditionalOutOfFlow: signal.guard.kind === 0 /* Unconditional */ && outOfFlow
|
|
37091
37304
|
};
|
|
37092
37305
|
}
|
|
37093
37306
|
function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf) {
|
|
@@ -37200,7 +37413,7 @@ function collectAlignmentCases(context) {
|
|
|
37200
37413
|
subjectDeclaredOffsetDeviation,
|
|
37201
37414
|
subjectEffectiveOffsetDeviation,
|
|
37202
37415
|
subjectLineHeightDeviation,
|
|
37203
|
-
subjectStats.element.snapshot.textualContent,
|
|
37416
|
+
subjectStats.element.snapshot.node.textualContent,
|
|
37204
37417
|
subjectStats.element,
|
|
37205
37418
|
subjectStats.contentComposition,
|
|
37206
37419
|
cohortContentCompositions
|
|
@@ -37293,26 +37506,26 @@ function coverageFromNumeric(value2) {
|
|
|
37293
37506
|
}
|
|
37294
37507
|
function coverageFromConflict(value2) {
|
|
37295
37508
|
const certainty = coverageFromKind(value2.kind);
|
|
37296
|
-
if (value2.value ===
|
|
37509
|
+
if (value2.value === 2 /* Unknown */) return certainty * 0.4;
|
|
37297
37510
|
return certainty;
|
|
37298
37511
|
}
|
|
37299
37512
|
function coverageFromTextContrast(value2) {
|
|
37300
|
-
if (value2 ===
|
|
37513
|
+
if (value2 === 2 /* Unknown */) return 0.35;
|
|
37301
37514
|
return 1;
|
|
37302
37515
|
}
|
|
37303
37516
|
function coverageFromSubjectText(subjectTextualContent) {
|
|
37304
|
-
if (subjectTextualContent ===
|
|
37517
|
+
if (subjectTextualContent === 2 /* Unknown */) return 0.35;
|
|
37305
37518
|
return 1;
|
|
37306
37519
|
}
|
|
37307
37520
|
function coverageFromContextCertainty(certainty) {
|
|
37308
|
-
if (certainty ===
|
|
37309
|
-
if (certainty ===
|
|
37521
|
+
if (certainty === 0 /* Resolved */) return 1;
|
|
37522
|
+
if (certainty === 1 /* Conditional */) return 0.55;
|
|
37310
37523
|
return 0.25;
|
|
37311
37524
|
}
|
|
37312
37525
|
function coverageFromKind(kind) {
|
|
37313
|
-
if (kind ===
|
|
37314
|
-
if (kind ===
|
|
37315
|
-
if (kind ===
|
|
37526
|
+
if (kind === 0 /* Exact */) return 1;
|
|
37527
|
+
if (kind === 1 /* Interval */) return 0.78;
|
|
37528
|
+
if (kind === 2 /* Conditional */) return 0.5;
|
|
37316
37529
|
return 0.2;
|
|
37317
37530
|
}
|
|
37318
37531
|
function averageCoverage(...values) {
|
|
@@ -37345,24 +37558,7 @@ function resolveEffectiveAlignmentContext(parentContext, child, measurementNode,
|
|
|
37345
37558
|
const childContext = contextByParentNode.get(child);
|
|
37346
37559
|
if (!childContext) return parentContext;
|
|
37347
37560
|
if (childContext.baselineRelevance !== "irrelevant") return parentContext;
|
|
37348
|
-
return {
|
|
37349
|
-
kind: parentContext.kind,
|
|
37350
|
-
certainty: parentContext.certainty,
|
|
37351
|
-
parentSolidFile: parentContext.parentSolidFile,
|
|
37352
|
-
parentElementId: parentContext.parentElementId,
|
|
37353
|
-
parentElementKey: parentContext.parentElementKey,
|
|
37354
|
-
parentTag: parentContext.parentTag,
|
|
37355
|
-
axis: parentContext.axis,
|
|
37356
|
-
axisCertainty: parentContext.axisCertainty,
|
|
37357
|
-
inlineDirection: parentContext.inlineDirection,
|
|
37358
|
-
inlineDirectionCertainty: parentContext.inlineDirectionCertainty,
|
|
37359
|
-
parentDisplay: parentContext.parentDisplay,
|
|
37360
|
-
parentAlignItems: parentContext.parentAlignItems,
|
|
37361
|
-
parentPlaceItems: parentContext.parentPlaceItems,
|
|
37362
|
-
hasPositionedOffset: parentContext.hasPositionedOffset,
|
|
37363
|
-
baselineRelevance: "irrelevant",
|
|
37364
|
-
evidence: parentContext.evidence
|
|
37365
|
-
};
|
|
37561
|
+
return deriveAlignmentContext(parentContext, { baselineRelevance: "irrelevant" });
|
|
37366
37562
|
}
|
|
37367
37563
|
function compareAlignmentCaseOrder(left, right) {
|
|
37368
37564
|
if (left.subject.solidFile < right.subject.solidFile) return -1;
|
|
@@ -37381,12 +37577,12 @@ function buildConsistencyEvidence(input) {
|
|
|
37381
37577
|
input.cohortProfile.medianLineHeightPx,
|
|
37382
37578
|
input.cohortProfile.medianDeclaredOffsetPx
|
|
37383
37579
|
);
|
|
37384
|
-
const
|
|
37580
|
+
const offsetRaw = normalizeDeviation(
|
|
37385
37581
|
input.subjectEffectiveOffsetDeviation,
|
|
37386
37582
|
input.cohortProfile.effectiveOffsetDispersionPx,
|
|
37387
37583
|
effectiveOffsetScaleReference
|
|
37388
37584
|
);
|
|
37389
|
-
const
|
|
37585
|
+
const declaredOffsetRaw = normalizeDeviation(
|
|
37390
37586
|
input.subjectDeclaredOffsetDeviation,
|
|
37391
37587
|
input.cohortProfile.declaredOffsetDispersionPx,
|
|
37392
37588
|
declaredOffsetScaleReference
|
|
@@ -37397,10 +37593,15 @@ function buildConsistencyEvidence(input) {
|
|
|
37397
37593
|
input.cohortProfile.medianLineHeightPx
|
|
37398
37594
|
);
|
|
37399
37595
|
const baselinesIrrelevant = input.context.baselineRelevance === "irrelevant";
|
|
37400
|
-
const
|
|
37401
|
-
const
|
|
37402
|
-
const
|
|
37403
|
-
const
|
|
37596
|
+
const blockAxisIsMainAxis = !input.context.crossAxisIsBlockAxis;
|
|
37597
|
+
const suppressAll = blockAxisIsMainAxis;
|
|
37598
|
+
const offset = suppressAll ? ZERO_STRENGTH : offsetRaw;
|
|
37599
|
+
const declaredOffset = suppressAll ? ZERO_STRENGTH : declaredOffsetRaw;
|
|
37600
|
+
const baselineStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
|
|
37601
|
+
const contextStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
|
|
37602
|
+
const replacedStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
|
|
37603
|
+
const compositionResult = baselinesIrrelevant || suppressAll ? null : resolveContentCompositionStrength(input);
|
|
37604
|
+
const compositionStrength = compositionResult ? compositionResult.evidence : ZERO_STRENGTH;
|
|
37404
37605
|
const contextCertaintyPenalty = resolveContextCertaintyPenalty(input);
|
|
37405
37606
|
const provenance = input.cohortProvenance;
|
|
37406
37607
|
const atoms = buildEvidenceAtoms(
|
|
@@ -37421,6 +37622,7 @@ function buildConsistencyEvidence(input) {
|
|
|
37421
37622
|
contextStrength: contextStrength.strength,
|
|
37422
37623
|
replacedStrength: replacedStrength.strength,
|
|
37423
37624
|
compositionStrength: compositionStrength.strength,
|
|
37625
|
+
majorityClassification: compositionResult ? compositionResult.divergence.majorityClassification : 5 /* Unknown */,
|
|
37424
37626
|
identifiability: input.subjectIdentifiability,
|
|
37425
37627
|
factSummary,
|
|
37426
37628
|
atoms
|
|
@@ -37456,7 +37658,7 @@ function resolveOffsetScaleReference(medianLineHeightPx, fallbackMedianOffsetPx)
|
|
|
37456
37658
|
}
|
|
37457
37659
|
function resolveBaselineStrength(input, lineHeight) {
|
|
37458
37660
|
const verticalAlign = input.cohortSignals.verticalAlign;
|
|
37459
|
-
const hasConflict = verticalAlign.value ===
|
|
37661
|
+
const hasConflict = verticalAlign.value === 0 /* Conflict */;
|
|
37460
37662
|
const conflict = hasConflict ? alignmentStrengthCalibration.baselineConflictBoost : 0;
|
|
37461
37663
|
const kind = resolveBaselineEvidenceKind(lineHeight.kind, verticalAlign.kind, hasConflict);
|
|
37462
37664
|
return {
|
|
@@ -37466,7 +37668,7 @@ function resolveBaselineStrength(input, lineHeight) {
|
|
|
37466
37668
|
}
|
|
37467
37669
|
function resolveBaselineEvidenceKind(lineHeightKind, verticalAlignKind, hasConflict) {
|
|
37468
37670
|
if (!hasConflict) return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
|
|
37469
|
-
if (lineHeightKind ===
|
|
37671
|
+
if (lineHeightKind === 3 /* Unknown */) return verticalAlignKind;
|
|
37470
37672
|
return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
|
|
37471
37673
|
}
|
|
37472
37674
|
function resolveContextStrength(input, lineHeight) {
|
|
@@ -37494,7 +37696,7 @@ function resolveContextConflictEvidence(input) {
|
|
|
37494
37696
|
const alignSelf = input.cohortSignals.alignSelf;
|
|
37495
37697
|
const placeSelf = input.cohortSignals.placeSelf;
|
|
37496
37698
|
const kind = mergeEvidenceKind(alignSelf.kind, placeSelf.kind);
|
|
37497
|
-
const hasConflict = alignSelf.value ===
|
|
37699
|
+
const hasConflict = alignSelf.value === 0 /* Conflict */ || placeSelf.value === 0 /* Conflict */;
|
|
37498
37700
|
if (!hasConflict) {
|
|
37499
37701
|
return {
|
|
37500
37702
|
strength: 0,
|
|
@@ -37508,23 +37710,23 @@ function resolveContextConflictEvidence(input) {
|
|
|
37508
37710
|
}
|
|
37509
37711
|
function resolveReplacedControlStrength(input, lineHeight) {
|
|
37510
37712
|
const subject = input.subject.snapshot;
|
|
37511
|
-
const hasReplacedPair = subject.isControl || subject.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
|
|
37713
|
+
const hasReplacedPair = subject.node.isControl || subject.node.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
|
|
37512
37714
|
if (!hasReplacedPair) {
|
|
37513
37715
|
return {
|
|
37514
37716
|
strength: 0,
|
|
37515
37717
|
kind: lineHeight.kind
|
|
37516
37718
|
};
|
|
37517
37719
|
}
|
|
37518
|
-
if (input.cohortSignals.textContrastWithPeers ===
|
|
37720
|
+
if (input.cohortSignals.textContrastWithPeers === 0 /* Different */) {
|
|
37519
37721
|
return {
|
|
37520
37722
|
strength: alignmentStrengthCalibration.replacedDifferentTextBoost,
|
|
37521
|
-
kind:
|
|
37723
|
+
kind: 0 /* Exact */
|
|
37522
37724
|
};
|
|
37523
37725
|
}
|
|
37524
|
-
if (input.cohortSignals.textContrastWithPeers ===
|
|
37726
|
+
if (input.cohortSignals.textContrastWithPeers === 2 /* Unknown */) {
|
|
37525
37727
|
return {
|
|
37526
37728
|
strength: alignmentStrengthCalibration.replacedUnknownTextBoost,
|
|
37527
|
-
kind:
|
|
37729
|
+
kind: 2 /* Conditional */
|
|
37528
37730
|
};
|
|
37529
37731
|
}
|
|
37530
37732
|
return {
|
|
@@ -37533,22 +37735,28 @@ function resolveReplacedControlStrength(input, lineHeight) {
|
|
|
37533
37735
|
};
|
|
37534
37736
|
}
|
|
37535
37737
|
function resolveContentCompositionStrength(input) {
|
|
37536
|
-
const
|
|
37738
|
+
const divergence = resolveCompositionDivergence(
|
|
37537
37739
|
input.subjectContentComposition,
|
|
37538
37740
|
input.cohortContentCompositions,
|
|
37539
37741
|
input.context
|
|
37540
37742
|
);
|
|
37541
|
-
if (
|
|
37743
|
+
if (divergence.strength <= 0) {
|
|
37542
37744
|
return {
|
|
37543
|
-
|
|
37544
|
-
|
|
37745
|
+
evidence: {
|
|
37746
|
+
strength: 0,
|
|
37747
|
+
kind: 0 /* Exact */
|
|
37748
|
+
},
|
|
37749
|
+
divergence
|
|
37545
37750
|
};
|
|
37546
37751
|
}
|
|
37547
37752
|
const subjectClassification = input.subjectContentComposition.classification;
|
|
37548
|
-
const kind = subjectClassification ===
|
|
37753
|
+
const kind = subjectClassification === 5 /* Unknown */ ? 2 /* Conditional */ : 0 /* Exact */;
|
|
37549
37754
|
return {
|
|
37550
|
-
|
|
37551
|
-
|
|
37755
|
+
evidence: {
|
|
37756
|
+
strength: clamp(divergence.strength, 0, 1),
|
|
37757
|
+
kind
|
|
37758
|
+
},
|
|
37759
|
+
divergence
|
|
37552
37760
|
};
|
|
37553
37761
|
}
|
|
37554
37762
|
function resolveContextCertaintyPenalty(input) {
|
|
@@ -37620,9 +37828,9 @@ function buildEvidenceAtoms(input, offset, declaredOffset, baselineStrength, con
|
|
|
37620
37828
|
return out;
|
|
37621
37829
|
}
|
|
37622
37830
|
function mapContextCertaintyToEvidenceKind(certainty) {
|
|
37623
|
-
if (certainty ===
|
|
37624
|
-
if (certainty ===
|
|
37625
|
-
return
|
|
37831
|
+
if (certainty === 0 /* Resolved */) return 0 /* Exact */;
|
|
37832
|
+
if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
|
|
37833
|
+
return 3 /* Unknown */;
|
|
37626
37834
|
}
|
|
37627
37835
|
function pushSupportAtom(out, factorId, valueKind, strength, coverage, provenance) {
|
|
37628
37836
|
pushAtom(out, factorId, valueKind, strength, coverage, provenance, "support");
|
|
@@ -37648,19 +37856,19 @@ function pushAtom(out, factorId, valueKind, strength, coverage, provenance, expe
|
|
|
37648
37856
|
}
|
|
37649
37857
|
function toPositiveContribution(strength, maxWeight, valueKind) {
|
|
37650
37858
|
const contribution = clamp(strength, 0, 2) * maxWeight;
|
|
37651
|
-
if (valueKind ===
|
|
37859
|
+
if (valueKind === 0 /* Exact */) {
|
|
37652
37860
|
return {
|
|
37653
37861
|
min: contribution,
|
|
37654
37862
|
max: contribution
|
|
37655
37863
|
};
|
|
37656
37864
|
}
|
|
37657
|
-
if (valueKind ===
|
|
37865
|
+
if (valueKind === 1 /* Interval */) {
|
|
37658
37866
|
return {
|
|
37659
37867
|
min: contribution * evidenceContributionCalibration.supportIntervalLowerScale,
|
|
37660
37868
|
max: contribution
|
|
37661
37869
|
};
|
|
37662
37870
|
}
|
|
37663
|
-
if (valueKind ===
|
|
37871
|
+
if (valueKind === 2 /* Conditional */) {
|
|
37664
37872
|
return {
|
|
37665
37873
|
min: 0,
|
|
37666
37874
|
max: contribution * evidenceContributionCalibration.supportConditionalUpperScale
|
|
@@ -37673,19 +37881,19 @@ function toPositiveContribution(strength, maxWeight, valueKind) {
|
|
|
37673
37881
|
}
|
|
37674
37882
|
function toNegativeContribution(strength, maxPenalty, valueKind) {
|
|
37675
37883
|
const penalty = clamp(strength, 0, 1) * maxPenalty;
|
|
37676
|
-
if (valueKind ===
|
|
37884
|
+
if (valueKind === 0 /* Exact */) {
|
|
37677
37885
|
return {
|
|
37678
37886
|
min: -penalty,
|
|
37679
37887
|
max: -penalty
|
|
37680
37888
|
};
|
|
37681
37889
|
}
|
|
37682
|
-
if (valueKind ===
|
|
37890
|
+
if (valueKind === 1 /* Interval */) {
|
|
37683
37891
|
return {
|
|
37684
37892
|
min: -penalty,
|
|
37685
37893
|
max: -penalty * evidenceContributionCalibration.penaltyIntervalUpperScale
|
|
37686
37894
|
};
|
|
37687
37895
|
}
|
|
37688
|
-
if (valueKind ===
|
|
37896
|
+
if (valueKind === 2 /* Conditional */) {
|
|
37689
37897
|
return {
|
|
37690
37898
|
min: -penalty,
|
|
37691
37899
|
max: 0
|
|
@@ -37696,7 +37904,7 @@ function toNegativeContribution(strength, maxPenalty, valueKind) {
|
|
|
37696
37904
|
max: 0
|
|
37697
37905
|
};
|
|
37698
37906
|
}
|
|
37699
|
-
var ZERO_STRENGTH = { strength: 0, kind:
|
|
37907
|
+
var ZERO_STRENGTH = { strength: 0, kind: 0 /* Exact */ };
|
|
37700
37908
|
|
|
37701
37909
|
// src/cross-file/layout/consistency-policy.ts
|
|
37702
37910
|
function applyConsistencyPolicy(input) {
|
|
@@ -37780,23 +37988,38 @@ function resolveConfidence(posterior, evidenceMass) {
|
|
|
37780
37988
|
const confidence = posterior.lower * weightedMass * (1 - intervalWidth * alignmentPolicyCalibration.confidenceIntervalPenalty);
|
|
37781
37989
|
return clamp(confidence, 0, 1);
|
|
37782
37990
|
}
|
|
37991
|
+
var EMPTY_FACTOR_LIST = Object.freeze([]);
|
|
37783
37992
|
function selectTopFactors(evidence) {
|
|
37784
|
-
const
|
|
37785
|
-
|
|
37786
|
-
|
|
37787
|
-
|
|
37788
|
-
|
|
37789
|
-
if (
|
|
37790
|
-
|
|
37993
|
+
const atoms = evidence.atoms;
|
|
37994
|
+
if (atoms.length === 0) return EMPTY_FACTOR_LIST;
|
|
37995
|
+
const top = [];
|
|
37996
|
+
for (let i = 0; i < atoms.length; i++) {
|
|
37997
|
+
const atom = atoms[i];
|
|
37998
|
+
if (!atom) continue;
|
|
37999
|
+
const mag = Math.abs((atom.contribution.min + atom.contribution.max) / 2);
|
|
38000
|
+
if (mag <= 0) continue;
|
|
38001
|
+
if (top.length < 4) {
|
|
38002
|
+
top.push({ id: atom.factorId, mag });
|
|
38003
|
+
continue;
|
|
38004
|
+
}
|
|
38005
|
+
let minIdx = 0;
|
|
38006
|
+
for (let j = 1; j < top.length; j++) {
|
|
38007
|
+
const curr = top[j];
|
|
38008
|
+
const best = top[minIdx];
|
|
38009
|
+
if (curr && best && curr.mag < best.mag) minIdx = j;
|
|
38010
|
+
}
|
|
38011
|
+
const minEntry = top[minIdx];
|
|
38012
|
+
if (minEntry && mag > minEntry.mag) {
|
|
38013
|
+
top[minIdx] = { id: atom.factorId, mag };
|
|
38014
|
+
}
|
|
38015
|
+
}
|
|
38016
|
+
top.sort((a, b) => {
|
|
38017
|
+
if (a.mag !== b.mag) return b.mag - a.mag;
|
|
38018
|
+
if (a.id < b.id) return -1;
|
|
38019
|
+
if (a.id > b.id) return 1;
|
|
37791
38020
|
return 0;
|
|
37792
38021
|
});
|
|
37793
|
-
|
|
37794
|
-
for (let i = 0; i < sorted.length && i < 4; i++) {
|
|
37795
|
-
const item = sorted[i];
|
|
37796
|
-
if (!item) continue;
|
|
37797
|
-
out.push(item.factorId);
|
|
37798
|
-
}
|
|
37799
|
-
return out;
|
|
38022
|
+
return top.map((t) => t.id);
|
|
37800
38023
|
}
|
|
37801
38024
|
function logistic(value2) {
|
|
37802
38025
|
if (value2 > 30) return 1;
|
|
@@ -37817,7 +38040,7 @@ function evaluateAlignmentCase(input) {
|
|
|
37817
38040
|
evidenceMass: policy.evidenceMass
|
|
37818
38041
|
};
|
|
37819
38042
|
}
|
|
37820
|
-
const signalFindings = buildFindingsFromAtoms(evidence.atoms, input);
|
|
38043
|
+
const signalFindings = buildFindingsFromAtoms(evidence.atoms, input, evidence);
|
|
37821
38044
|
return {
|
|
37822
38045
|
kind: "accept",
|
|
37823
38046
|
evaluation: {
|
|
@@ -37837,12 +38060,12 @@ function evaluateAlignmentCase(input) {
|
|
|
37837
38060
|
}
|
|
37838
38061
|
};
|
|
37839
38062
|
}
|
|
37840
|
-
function buildFindingsFromAtoms(atoms, input) {
|
|
38063
|
+
function buildFindingsFromAtoms(atoms, input, evidence) {
|
|
37841
38064
|
const byKind = /* @__PURE__ */ new Map();
|
|
37842
38065
|
for (let i = 0; i < atoms.length; i++) {
|
|
37843
38066
|
const atom = atoms[i];
|
|
37844
38067
|
if (!atom) continue;
|
|
37845
|
-
const factor = toFindingFactor(atom.factorId, input);
|
|
38068
|
+
const factor = toFindingFactor(atom.factorId, input, evidence);
|
|
37846
38069
|
if (factor === null) continue;
|
|
37847
38070
|
const meanContribution = (atom.contribution.min + atom.contribution.max) / 2;
|
|
37848
38071
|
if (meanContribution <= 0) continue;
|
|
@@ -37863,7 +38086,7 @@ function buildFindingsFromAtoms(atoms, input) {
|
|
|
37863
38086
|
}
|
|
37864
38087
|
return [...byKind.values()];
|
|
37865
38088
|
}
|
|
37866
|
-
function toFindingFactor(factorId, input) {
|
|
38089
|
+
function toFindingFactor(factorId, input, evidence) {
|
|
37867
38090
|
switch (factorId) {
|
|
37868
38091
|
case "offset-delta":
|
|
37869
38092
|
return {
|
|
@@ -37893,17 +38116,15 @@ function toFindingFactor(factorId, input) {
|
|
|
37893
38116
|
case "content-composition-conflict":
|
|
37894
38117
|
return {
|
|
37895
38118
|
kind: "content-composition-conflict",
|
|
37896
|
-
message: formatContentCompositionFinding(input)
|
|
38119
|
+
message: formatContentCompositionFinding(input, evidence)
|
|
37897
38120
|
};
|
|
37898
38121
|
default:
|
|
37899
38122
|
return null;
|
|
37900
38123
|
}
|
|
37901
38124
|
}
|
|
37902
|
-
function formatContentCompositionFinding(input) {
|
|
38125
|
+
function formatContentCompositionFinding(input, evidence) {
|
|
37903
38126
|
const subjectClassification = formatCompositionClassification(input.subjectContentComposition.classification);
|
|
37904
|
-
const majorityClassification = formatCompositionClassification(
|
|
37905
|
-
resolveMajorityClassification(input.cohortContentCompositions)
|
|
37906
|
-
);
|
|
38127
|
+
const majorityClassification = formatCompositionClassification(evidence.majorityClassification);
|
|
37907
38128
|
const fixSuggestion = formatCompositionFixSuggestion(input.subjectContentComposition);
|
|
37908
38129
|
return `siblings have identical CSS but different content composition (subject: ${subjectClassification}, majority: ${majorityClassification}; fix: ${fixSuggestion})`;
|
|
37909
38130
|
}
|
|
@@ -37962,7 +38183,7 @@ function recordPolicyMetrics(context, evidenceMass, posteriorLower, posteriorUpp
|
|
|
37962
38183
|
context.layout.perf.factorCoverageSum += clamp(evidenceMass, 0, 1);
|
|
37963
38184
|
context.layout.perf.factorCoverageCount++;
|
|
37964
38185
|
const width = clamp(posteriorUpper - posteriorLower, 0, 1);
|
|
37965
|
-
context.layout.perf.posteriorWidths
|
|
38186
|
+
reservoirPush(context.layout.perf.posteriorWidths, width);
|
|
37966
38187
|
if (width > 1e-3) context.layout.perf.uncertaintyEscalations++;
|
|
37967
38188
|
}
|
|
37968
38189
|
|
|
@@ -38068,16 +38289,16 @@ function readNodeRefById(layout, solidFile, elementId) {
|
|
|
38068
38289
|
}
|
|
38069
38290
|
function isFlowRelevantBySiblingsOrText(node, textualContent) {
|
|
38070
38291
|
if (node.siblingCount >= 2) return true;
|
|
38071
|
-
return textualContent ===
|
|
38292
|
+
return textualContent === 0 /* Yes */ || textualContent === 2 /* Unknown */ || textualContent === 3 /* DynamicText */;
|
|
38072
38293
|
}
|
|
38073
38294
|
function isDeferredContainerLike(node, textualContent) {
|
|
38074
38295
|
if (node.siblingCount >= 2) return true;
|
|
38075
|
-
if (textualContent ===
|
|
38296
|
+
if (textualContent === 2 /* Unknown */) return true;
|
|
38076
38297
|
if (node.tagName !== null && SECTIONING_CONTAINER_TAGS.has(node.tagName)) return true;
|
|
38077
38298
|
return false;
|
|
38078
38299
|
}
|
|
38079
38300
|
function isDynamicContainerLike(node) {
|
|
38080
|
-
return node.textualContent ===
|
|
38301
|
+
return node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2;
|
|
38081
38302
|
}
|
|
38082
38303
|
function isLikelyViewportAffectingContainer(node) {
|
|
38083
38304
|
if (node.siblingCount >= 2) return true;
|
|
@@ -39317,7 +39538,7 @@ var cssLayoutScrollbarGutterInstability = defineCrossRule({
|
|
|
39317
39538
|
const snapshot = collectSignalSnapshot(context, node);
|
|
39318
39539
|
const scroll = readScrollContainerFact(context.layout, node);
|
|
39319
39540
|
if (!scroll.isScrollContainer) continue;
|
|
39320
|
-
if (scroll.axis !==
|
|
39541
|
+
if (scroll.axis !== 2 /* Y */ && scroll.axis !== 3 /* Both */) continue;
|
|
39321
39542
|
const scrollbarWidth = readKnownNormalized(snapshot, "scrollbar-width");
|
|
39322
39543
|
if (scrollbarWidth === "none") continue;
|
|
39323
39544
|
const gutter = readKnownNormalized(snapshot, "scrollbar-gutter");
|
|
@@ -39447,10 +39668,10 @@ var cssLayoutConditionalDisplayCollapse = defineCrossRule({
|
|
|
39447
39668
|
const display = readKnownNormalizedWithGuard(snapshot, "display");
|
|
39448
39669
|
if (!display || !COLLAPSING_DISPLAYS.has(display)) continue;
|
|
39449
39670
|
const displaySignal = snapshot.signals.get("display");
|
|
39450
|
-
if (!displaySignal || displaySignal.guard !==
|
|
39671
|
+
if (!displaySignal || displaySignal.guard.kind !== 1 /* Conditional */) continue;
|
|
39451
39672
|
const flow = readFlowParticipationFact(context.layout, node);
|
|
39452
39673
|
if (!flow.inFlow) continue;
|
|
39453
|
-
if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
|
|
39674
|
+
if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
|
|
39454
39675
|
const reservedSpace = readReservedSpaceFact(context.layout, node);
|
|
39455
39676
|
if (reservedSpace.hasReservedSpace) continue;
|
|
39456
39677
|
if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalDisplayCollapse.id, "conditionalDisplayCollapse", messages152.conditionalDisplayCollapse, cssLayoutConditionalDisplayCollapse.severity, { display })) continue;
|
|
@@ -39486,10 +39707,10 @@ var cssLayoutConditionalWhiteSpaceWrapShift = defineCrossRule({
|
|
|
39486
39707
|
if (!hasWrapShiftDelta(whiteSpaceDelta)) continue;
|
|
39487
39708
|
if (!whiteSpace) continue;
|
|
39488
39709
|
const whiteSpaceSignal = snapshot.signals.get("white-space");
|
|
39489
|
-
if (!whiteSpaceSignal || whiteSpaceSignal.guard !==
|
|
39710
|
+
if (!whiteSpaceSignal || whiteSpaceSignal.guard.kind !== 1 /* Conditional */) continue;
|
|
39490
39711
|
const flow = readFlowParticipationFact(context.layout, node);
|
|
39491
39712
|
if (!flow.inFlow) continue;
|
|
39492
|
-
if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
|
|
39713
|
+
if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
|
|
39493
39714
|
if (hasStableTextShell(snapshot)) continue;
|
|
39494
39715
|
if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalWhiteSpaceWrapShift.id, "conditionalWhiteSpaceShift", messages153.conditionalWhiteSpaceShift, cssLayoutConditionalWhiteSpaceWrapShift.severity, { whiteSpace })) continue;
|
|
39495
39716
|
}
|
|
@@ -39626,7 +39847,7 @@ var cssLayoutContentVisibilityNoIntrinsicSize = defineCrossRule({
|
|
|
39626
39847
|
const node = candidates[i];
|
|
39627
39848
|
if (!node) continue;
|
|
39628
39849
|
const snapshot = collectSignalSnapshot(context, node);
|
|
39629
|
-
if (!isDeferredContainerLike(node, snapshot.textualContent)) continue;
|
|
39850
|
+
if (!isDeferredContainerLike(node, snapshot.node.textualContent)) continue;
|
|
39630
39851
|
const reservedSpace = readReservedSpaceFact(context.layout, node);
|
|
39631
39852
|
if (reservedSpace.hasReservedSpace) continue;
|
|
39632
39853
|
if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutContentVisibilityNoIntrinsicSize.id, "missingIntrinsicSize", messages156.missingIntrinsicSize, cssLayoutContentVisibilityNoIntrinsicSize.severity)) continue;
|
|
@@ -39685,11 +39906,11 @@ function collectConditionalOffsets(layout, node, snapshot) {
|
|
|
39685
39906
|
if (!delta.hasConditional || !delta.hasDelta) continue;
|
|
39686
39907
|
const signal = snapshot.signals.get(name);
|
|
39687
39908
|
if (!signal) continue;
|
|
39688
|
-
if (signal.guard !==
|
|
39909
|
+
if (signal.guard.kind !== 1 /* Conditional */) continue;
|
|
39689
39910
|
if (signal.kind !== "known") continue;
|
|
39690
39911
|
if (signal.px === null) continue;
|
|
39691
39912
|
if (Math.abs(signal.px) <= 0.25) continue;
|
|
39692
|
-
out.push({ property: name, value: signal.px, guardKey: signal.
|
|
39913
|
+
out.push({ property: name, value: signal.px, guardKey: signal.guard.key });
|
|
39693
39914
|
}
|
|
39694
39915
|
return out;
|
|
39695
39916
|
}
|
|
@@ -39710,8 +39931,8 @@ function hasEffectivePositionForConditionalOffset(snapshot, guardKey) {
|
|
|
39710
39931
|
const position = snapshot.signals.get("position");
|
|
39711
39932
|
if (!position) return false;
|
|
39712
39933
|
if (position.kind !== "known") return false;
|
|
39713
|
-
if (position.guard !==
|
|
39714
|
-
if (position.
|
|
39934
|
+
if (position.guard.kind !== 1 /* Conditional */) return false;
|
|
39935
|
+
if (position.guard.key !== guardKey) return false;
|
|
39715
39936
|
return position.normalized !== "static";
|
|
39716
39937
|
}
|
|
39717
39938
|
function hasStableBaseline(baselineBySignal, property, expectedPx) {
|
|
@@ -40227,4 +40448,4 @@ export {
|
|
|
40227
40448
|
rules3,
|
|
40228
40449
|
runCrossFileRules
|
|
40229
40450
|
};
|
|
40230
|
-
//# sourceMappingURL=chunk-
|
|
40451
|
+
//# sourceMappingURL=chunk-64TMAKYI.js.map
|