@drskillissue/ganko 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TNKZGWOR.js → chunk-4W4KAPRH.js} +5 -5
- package/dist/chunk-4W4KAPRH.js.map +1 -0
- package/dist/{chunk-AXFVBCJD.js → chunk-D2TKH7AJ.js} +1956 -1734
- package/dist/chunk-D2TKH7AJ.js.map +1 -0
- package/dist/eslint-plugin.cjs +1913 -1720
- package/dist/eslint-plugin.cjs.map +1 -1
- package/dist/eslint-plugin.js +5 -5
- package/dist/eslint-plugin.js.map +1 -1
- package/dist/index.cjs +2345 -2148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +173 -9
- package/dist/index.d.ts +173 -9
- package/dist/index.js +201 -215
- package/dist/index.js.map +1 -1
- package/dist/rules-manifest-BvNUyXdr.d.cts +38 -0
- package/dist/rules-manifest-BvNUyXdr.d.ts +38 -0
- package/dist/rules-manifest.cjs +4 -4
- package/dist/rules-manifest.cjs.map +1 -1
- package/dist/rules-manifest.d.cts +1 -33
- package/dist/rules-manifest.d.ts +1 -33
- package/dist/rules-manifest.js +1 -2
- package/package.json +5 -4
- package/dist/chunk-AXFVBCJD.js.map +0 -1
- package/dist/chunk-EGRHWZRV.js +0 -1
- package/dist/chunk-EGRHWZRV.js.map +0 -1
- package/dist/chunk-TNKZGWOR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
RULES,
|
|
3
3
|
RULES_BY_CATEGORY,
|
|
4
4
|
getRule
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4W4KAPRH.js";
|
|
6
6
|
import {
|
|
7
7
|
ACCESSIBILITY_POLICIES,
|
|
8
8
|
CSS_EXTENSIONS,
|
|
@@ -24,6 +24,11 @@ import {
|
|
|
24
24
|
SEL_HAS_ID,
|
|
25
25
|
SEL_HAS_UNIVERSAL,
|
|
26
26
|
SOLID_EXTENSIONS,
|
|
27
|
+
TS_ANY_OR_UNKNOWN,
|
|
28
|
+
TS_BOOLEAN_LIKE,
|
|
29
|
+
TS_NUMBER_LIKE,
|
|
30
|
+
TS_OBJECT_LIKE,
|
|
31
|
+
TS_STRING_LIKE,
|
|
27
32
|
VAR_IS_GLOBAL,
|
|
28
33
|
VAR_IS_SCSS,
|
|
29
34
|
VAR_IS_USED,
|
|
@@ -83,8 +88,7 @@ import {
|
|
|
83
88
|
splitTopLevelWhitespace,
|
|
84
89
|
splitWhitespaceTokens,
|
|
85
90
|
toKebabCase
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import "./chunk-EGRHWZRV.js";
|
|
91
|
+
} from "./chunk-D2TKH7AJ.js";
|
|
88
92
|
|
|
89
93
|
// src/runner.ts
|
|
90
94
|
function createOverrideEmit(target, overrides) {
|
|
@@ -2715,7 +2719,7 @@ function buildElementNodes(solidTree, compilation) {
|
|
|
2715
2719
|
const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
|
|
2716
2720
|
const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
|
|
2717
2721
|
const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId);
|
|
2718
|
-
const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId);
|
|
2722
|
+
const parentElementId = resolveComposedParentElementId(element, compositionMetaByElementId, solidTree.compoundComponentParents);
|
|
2719
2723
|
records.push({
|
|
2720
2724
|
element,
|
|
2721
2725
|
key: `${solidTree.filePath}::${element.id}`,
|
|
@@ -2748,12 +2752,32 @@ function buildElementNodes(solidTree, compilation) {
|
|
|
2748
2752
|
byType.set(record.tagName, (byType.get(record.tagName) ?? 0) + 1);
|
|
2749
2753
|
}
|
|
2750
2754
|
}
|
|
2755
|
+
const recordsByElementId = /* @__PURE__ */ new Map();
|
|
2756
|
+
for (let i = 0; i < records.length; i++) {
|
|
2757
|
+
const r = records[i];
|
|
2758
|
+
if (r) recordsByElementId.set(r.element.id, r);
|
|
2759
|
+
}
|
|
2760
|
+
const sorted = [];
|
|
2761
|
+
const visited = /* @__PURE__ */ new Set();
|
|
2762
|
+
function visitRecord(r) {
|
|
2763
|
+
if (visited.has(r.element.id)) return;
|
|
2764
|
+
visited.add(r.element.id);
|
|
2765
|
+
if (r.parentElementId !== null) {
|
|
2766
|
+
const parent = recordsByElementId.get(r.parentElementId);
|
|
2767
|
+
if (parent) visitRecord(parent);
|
|
2768
|
+
}
|
|
2769
|
+
sorted.push(r);
|
|
2770
|
+
}
|
|
2771
|
+
for (let i = 0; i < records.length; i++) {
|
|
2772
|
+
const r = records[i];
|
|
2773
|
+
if (r) visitRecord(r);
|
|
2774
|
+
}
|
|
2751
2775
|
const elements = [];
|
|
2752
2776
|
const nodeByElementId = /* @__PURE__ */ new Map();
|
|
2753
2777
|
const lastChildByParentId = /* @__PURE__ */ new Map();
|
|
2754
2778
|
const siblingTypeSeenByParentId = /* @__PURE__ */ new Map();
|
|
2755
|
-
for (let i = 0; i <
|
|
2756
|
-
const record =
|
|
2779
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
2780
|
+
const record = sorted[i];
|
|
2757
2781
|
if (!record) continue;
|
|
2758
2782
|
const parentElementId = record.parentElementId;
|
|
2759
2783
|
const parentNode = parentElementId === null ? null : nodeByElementId.get(parentElementId) ?? null;
|
|
@@ -2917,13 +2941,19 @@ function resolveEffectiveTag(element, hostDescriptor) {
|
|
|
2917
2941
|
if (!element.isDomElement) return null;
|
|
2918
2942
|
return element.tag;
|
|
2919
2943
|
}
|
|
2920
|
-
function resolveComposedParentElementId(element, compositionMetaByElementId) {
|
|
2944
|
+
function resolveComposedParentElementId(element, compositionMetaByElementId, compoundComponentParents) {
|
|
2921
2945
|
let parent = element.parent;
|
|
2922
2946
|
while (parent !== null) {
|
|
2923
2947
|
const meta = compositionMetaByElementId.get(parent.id);
|
|
2924
2948
|
if (meta && meta.participates) return parent.id;
|
|
2925
2949
|
parent = parent.parent;
|
|
2926
2950
|
}
|
|
2951
|
+
let scope = element.scope;
|
|
2952
|
+
while (scope !== null) {
|
|
2953
|
+
const compoundParent = compoundComponentParents.get(scope.id);
|
|
2954
|
+
if (compoundParent !== void 0) return compoundParent;
|
|
2955
|
+
scope = scope.parent;
|
|
2956
|
+
}
|
|
2927
2957
|
return null;
|
|
2928
2958
|
}
|
|
2929
2959
|
function getTextualContentState(element, memo, compositionMetaByElementId, logger = noopLogger) {
|
|
@@ -4213,6 +4243,136 @@ function compareCascadePositions(posA, posB) {
|
|
|
4213
4243
|
return posA.sourceOrder - posB.sourceOrder;
|
|
4214
4244
|
}
|
|
4215
4245
|
|
|
4246
|
+
// src/compilation/analysis/layout-fact.ts
|
|
4247
|
+
var SCROLLABLE_VALUES = /* @__PURE__ */ new Set(["auto", "scroll"]);
|
|
4248
|
+
var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch", "inherit", "initial", "unset", "revert", "revert-layer"]);
|
|
4249
|
+
var BLOCK_LEVEL_DISPLAY_VALUES = /* @__PURE__ */ new Set(["block", "flex", "grid", "table", "list-item", "flow-root", "table-row", "table-cell", "table-caption", "table-row-group", "table-header-group", "table-footer-group", "table-column", "table-column-group"]);
|
|
4250
|
+
function computeReservedSpaceFact(snapshot) {
|
|
4251
|
+
const reasons = [];
|
|
4252
|
+
const hasHeight = hasDeclaredDimension(snapshot, "height");
|
|
4253
|
+
if (hasHeight) reasons.push("height");
|
|
4254
|
+
const hasBlockSize = hasDeclaredDimension(snapshot, "block-size");
|
|
4255
|
+
if (hasBlockSize) reasons.push("block-size");
|
|
4256
|
+
const hasMinHeight = hasDeclaredDimension(snapshot, "min-height");
|
|
4257
|
+
if (hasMinHeight) reasons.push("min-height");
|
|
4258
|
+
const hasMinBlockSize = hasDeclaredDimension(snapshot, "min-block-size");
|
|
4259
|
+
if (hasMinBlockSize) reasons.push("min-block-size");
|
|
4260
|
+
const hasContainIntrinsic = hasDeclaredDimension(snapshot, "contain-intrinsic-size");
|
|
4261
|
+
if (hasContainIntrinsic) reasons.push("contain-intrinsic-size");
|
|
4262
|
+
const hasAspectRatio = hasUsableAspectRatio(snapshot);
|
|
4263
|
+
if (hasAspectRatio) {
|
|
4264
|
+
if (hasDeclaredDimension(snapshot, "width")) reasons.push("aspect-ratio+width");
|
|
4265
|
+
if (hasDeclaredDimension(snapshot, "inline-size")) reasons.push("aspect-ratio+inline-size");
|
|
4266
|
+
if (hasDeclaredDimension(snapshot, "min-width")) reasons.push("aspect-ratio+min-width");
|
|
4267
|
+
if (hasMinBlockSize) reasons.push("aspect-ratio+min-block-size");
|
|
4268
|
+
if (hasMinHeight) reasons.push("aspect-ratio+min-height");
|
|
4269
|
+
}
|
|
4270
|
+
return {
|
|
4271
|
+
hasReservedSpace: reasons.length > 0,
|
|
4272
|
+
reasons,
|
|
4273
|
+
hasContainIntrinsicSize: hasContainIntrinsic,
|
|
4274
|
+
hasUsableAspectRatio: hasAspectRatio,
|
|
4275
|
+
hasDeclaredBlockDimension: hasHeight || hasBlockSize || hasMinHeight || hasMinBlockSize,
|
|
4276
|
+
hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || hasDeclaredDimension(snapshot, "flex-basis") || isBlockLevelDisplay(snapshot)
|
|
4277
|
+
};
|
|
4278
|
+
}
|
|
4279
|
+
function hasDeclaredDimension(snapshot, property) {
|
|
4280
|
+
const signal = snapshot.signals.get(property);
|
|
4281
|
+
if (!signal) return false;
|
|
4282
|
+
if (signal.kind === 0 /* Known */) {
|
|
4283
|
+
if (signal.px !== null) return signal.px > 0;
|
|
4284
|
+
if (signal.normalized.length === 0) return false;
|
|
4285
|
+
return !isNonReservingDimension(signal.normalized);
|
|
4286
|
+
}
|
|
4287
|
+
if (signal.kind === 1 /* Unknown */) {
|
|
4288
|
+
return signal.source !== null;
|
|
4289
|
+
}
|
|
4290
|
+
return false;
|
|
4291
|
+
}
|
|
4292
|
+
function isBlockLevelDisplay(snapshot) {
|
|
4293
|
+
const signal = snapshot.signals.get("display");
|
|
4294
|
+
if (!signal || signal.kind !== 0 /* Known */) return false;
|
|
4295
|
+
return BLOCK_LEVEL_DISPLAY_VALUES.has(signal.normalized);
|
|
4296
|
+
}
|
|
4297
|
+
function hasUsableAspectRatio(snapshot) {
|
|
4298
|
+
const signal = snapshot.signals.get("aspect-ratio");
|
|
4299
|
+
if (!signal) return false;
|
|
4300
|
+
if (signal.guard.kind === 1) return false;
|
|
4301
|
+
if (signal.kind === 1 /* Unknown */) return false;
|
|
4302
|
+
if (signal.kind !== 0 /* Known */) return false;
|
|
4303
|
+
if (signal.normalized.length === 0) return false;
|
|
4304
|
+
return signal.normalized !== "auto";
|
|
4305
|
+
}
|
|
4306
|
+
function isNonReservingDimension(value) {
|
|
4307
|
+
if (NON_RESERVING_DIMENSION_KEYWORDS.has(value)) return true;
|
|
4308
|
+
if (value.startsWith("fit-content(")) return true;
|
|
4309
|
+
return false;
|
|
4310
|
+
}
|
|
4311
|
+
function computeScrollContainerFact(snapshot) {
|
|
4312
|
+
const overflowSignal = snapshot.signals.get("overflow");
|
|
4313
|
+
const overflowYSignal = snapshot.signals.get("overflow-y");
|
|
4314
|
+
const overflow = overflowSignal && overflowSignal.kind === 0 /* Known */ ? overflowSignal.normalized : null;
|
|
4315
|
+
const overflowY = overflowYSignal && overflowYSignal.kind === 0 /* Known */ ? overflowYSignal.normalized : null;
|
|
4316
|
+
const shorthandAxis = parseOverflowShorthandAxis(overflow);
|
|
4317
|
+
const yFromLonghand = parseSingleAxisScroll(overflowY);
|
|
4318
|
+
const xScroll = shorthandAxis.x;
|
|
4319
|
+
const yScroll = yFromLonghand === null ? shorthandAxis.y : yFromLonghand;
|
|
4320
|
+
const hasConditionalScroll = overflowSignal?.guard.kind === 1 && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 1 && yFromLonghand === true;
|
|
4321
|
+
const hasUnconditionalScroll = overflowSignal?.guard.kind === 0 && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 0 && yFromLonghand === true;
|
|
4322
|
+
return {
|
|
4323
|
+
isScrollContainer: xScroll || yScroll,
|
|
4324
|
+
axis: toScrollAxis(xScroll, yScroll),
|
|
4325
|
+
overflow,
|
|
4326
|
+
overflowY,
|
|
4327
|
+
hasConditionalScroll,
|
|
4328
|
+
hasUnconditionalScroll
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
var NO_SCROLL = Object.freeze({ x: false, y: false });
|
|
4332
|
+
var BOTH_SCROLL = Object.freeze({ x: true, y: true });
|
|
4333
|
+
function parseOverflowShorthandAxis(value) {
|
|
4334
|
+
if (value === null) return NO_SCROLL;
|
|
4335
|
+
const trimmed = value.trim();
|
|
4336
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
4337
|
+
if (spaceIdx === -1) {
|
|
4338
|
+
const scroll = SCROLLABLE_VALUES.has(trimmed);
|
|
4339
|
+
return scroll ? BOTH_SCROLL : NO_SCROLL;
|
|
4340
|
+
}
|
|
4341
|
+
const first = trimmed.slice(0, spaceIdx);
|
|
4342
|
+
const second = trimmed.slice(spaceIdx + 1).trimStart();
|
|
4343
|
+
return {
|
|
4344
|
+
x: SCROLLABLE_VALUES.has(first),
|
|
4345
|
+
y: SCROLLABLE_VALUES.has(second)
|
|
4346
|
+
};
|
|
4347
|
+
}
|
|
4348
|
+
function parseSingleAxisScroll(value) {
|
|
4349
|
+
if (value === null) return null;
|
|
4350
|
+
const trimmed = value.trim();
|
|
4351
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
4352
|
+
const first = spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx);
|
|
4353
|
+
return SCROLLABLE_VALUES.has(first);
|
|
4354
|
+
}
|
|
4355
|
+
function toScrollAxis(x, y) {
|
|
4356
|
+
if (x && y) return 3 /* Both */;
|
|
4357
|
+
if (x) return 1 /* X */;
|
|
4358
|
+
if (y) return 2 /* Y */;
|
|
4359
|
+
return 0 /* None */;
|
|
4360
|
+
}
|
|
4361
|
+
function computeFlowParticipationFact(snapshot) {
|
|
4362
|
+
const signal = snapshot.signals.get("position");
|
|
4363
|
+
if (!signal || signal.kind !== 0 /* Known */) {
|
|
4364
|
+
return { inFlow: true, position: null, hasConditionalOutOfFlow: false, hasUnconditionalOutOfFlow: false };
|
|
4365
|
+
}
|
|
4366
|
+
const position = signal.normalized;
|
|
4367
|
+
const outOfFlow = position === "absolute" || position === "fixed";
|
|
4368
|
+
return {
|
|
4369
|
+
inFlow: !outOfFlow,
|
|
4370
|
+
position,
|
|
4371
|
+
hasConditionalOutOfFlow: signal.guard.kind === 1 && outOfFlow,
|
|
4372
|
+
hasUnconditionalOutOfFlow: signal.guard.kind === 0 && outOfFlow
|
|
4373
|
+
};
|
|
4374
|
+
}
|
|
4375
|
+
|
|
4216
4376
|
// src/compilation/binding/cascade-binder.ts
|
|
4217
4377
|
var bindCacheBySymbolTable = /* @__PURE__ */ new WeakMap();
|
|
4218
4378
|
function getOrBuildBindState(symbolTable) {
|
|
@@ -4901,126 +5061,21 @@ function augmentCascadeWithTailwindFromSymbolTable(cascade, element, symbolTable
|
|
|
4901
5061
|
}
|
|
4902
5062
|
}
|
|
4903
5063
|
}
|
|
4904
|
-
|
|
4905
|
-
var OUT_OF_FLOW_POSITIONS = /* @__PURE__ */ new Set(["absolute", "fixed", "sticky"]);
|
|
4906
|
-
function computeLayoutFact(factKind, elementId, declarations, allElements, getCascadeForElement) {
|
|
5064
|
+
function computeLayoutFact(factKind, elementId, snapshot, allElements, getSnapshotForElement) {
|
|
4907
5065
|
switch (factKind) {
|
|
4908
5066
|
case "reservedSpace":
|
|
4909
|
-
return computeReservedSpaceFact(
|
|
5067
|
+
return computeReservedSpaceFact(snapshot);
|
|
4910
5068
|
case "scrollContainer":
|
|
4911
|
-
return computeScrollContainerFact(
|
|
5069
|
+
return computeScrollContainerFact(snapshot);
|
|
4912
5070
|
case "flowParticipation":
|
|
4913
|
-
return computeFlowParticipationFact(
|
|
5071
|
+
return computeFlowParticipationFact(snapshot);
|
|
4914
5072
|
case "containingBlock":
|
|
4915
|
-
return computeContainingBlockFact(elementId, allElements,
|
|
5073
|
+
return computeContainingBlockFact(elementId, allElements, getSnapshotForElement);
|
|
4916
5074
|
default:
|
|
4917
5075
|
throw new Error(`Unknown layout fact kind: ${factKind}`);
|
|
4918
5076
|
}
|
|
4919
5077
|
}
|
|
4920
|
-
function
|
|
4921
|
-
const decl = declarations.get(property);
|
|
4922
|
-
if (!decl) return null;
|
|
4923
|
-
return decl.value.trim().toLowerCase();
|
|
4924
|
-
}
|
|
4925
|
-
function computeReservedSpaceFact(declarations) {
|
|
4926
|
-
const reasons = [];
|
|
4927
|
-
const height = getCascadeValue(declarations, "height");
|
|
4928
|
-
if (height !== null && height !== "auto" && height !== "fit-content" && height !== "min-content" && height !== "max-content") {
|
|
4929
|
-
reasons.push("height");
|
|
4930
|
-
}
|
|
4931
|
-
const blockSize = getCascadeValue(declarations, "block-size");
|
|
4932
|
-
if (blockSize !== null && blockSize !== "auto" && blockSize !== "fit-content" && blockSize !== "min-content" && blockSize !== "max-content") {
|
|
4933
|
-
reasons.push("block-size");
|
|
4934
|
-
}
|
|
4935
|
-
const minHeight = getCascadeValue(declarations, "min-height");
|
|
4936
|
-
if (minHeight !== null && minHeight !== "0" && minHeight !== "0px" && minHeight !== "auto") {
|
|
4937
|
-
reasons.push("min-height");
|
|
4938
|
-
}
|
|
4939
|
-
const minBlockSize = getCascadeValue(declarations, "min-block-size");
|
|
4940
|
-
if (minBlockSize !== null && minBlockSize !== "0" && minBlockSize !== "0px" && minBlockSize !== "auto") {
|
|
4941
|
-
reasons.push("min-block-size");
|
|
4942
|
-
}
|
|
4943
|
-
const containIntrinsicSize = getCascadeValue(declarations, "contain-intrinsic-size");
|
|
4944
|
-
const hasContainIntrinsicSize = containIntrinsicSize !== null;
|
|
4945
|
-
if (hasContainIntrinsicSize) {
|
|
4946
|
-
reasons.push("contain-intrinsic-size");
|
|
4947
|
-
}
|
|
4948
|
-
const aspectRatio = getCascadeValue(declarations, "aspect-ratio");
|
|
4949
|
-
const hasUsableAspectRatio = aspectRatio !== null && aspectRatio !== "auto";
|
|
4950
|
-
const width = getCascadeValue(declarations, "width");
|
|
4951
|
-
const inlineSize = getCascadeValue(declarations, "inline-size");
|
|
4952
|
-
const hasDeclaredInlineDimension = width !== null && width !== "auto" || inlineSize !== null && inlineSize !== "auto";
|
|
4953
|
-
const hasDeclaredBlockDimension = height !== null && height !== "auto";
|
|
4954
|
-
if (hasUsableAspectRatio && hasDeclaredInlineDimension) {
|
|
4955
|
-
if (width !== null) reasons.push("aspect-ratio+width");
|
|
4956
|
-
if (inlineSize !== null) reasons.push("aspect-ratio+inline-size");
|
|
4957
|
-
}
|
|
4958
|
-
return {
|
|
4959
|
-
hasReservedSpace: reasons.length > 0,
|
|
4960
|
-
reasons,
|
|
4961
|
-
hasContainIntrinsicSize,
|
|
4962
|
-
hasUsableAspectRatio,
|
|
4963
|
-
hasDeclaredInlineDimension,
|
|
4964
|
-
hasDeclaredBlockDimension
|
|
4965
|
-
};
|
|
4966
|
-
}
|
|
4967
|
-
function computeScrollContainerFact(declarations) {
|
|
4968
|
-
const overflow = getCascadeValue(declarations, "overflow");
|
|
4969
|
-
const overflowY = getCascadeValue(declarations, "overflow-y");
|
|
4970
|
-
let axis = 0;
|
|
4971
|
-
let isScrollContainer = false;
|
|
4972
|
-
let hasConditionalScroll = false;
|
|
4973
|
-
let hasUnconditionalScroll = false;
|
|
4974
|
-
if (overflow !== null && SCROLLABLE_VALUES.has(overflow)) {
|
|
4975
|
-
isScrollContainer = true;
|
|
4976
|
-
axis = 3;
|
|
4977
|
-
const decl = declarations.get("overflow");
|
|
4978
|
-
if (decl && decl.guardProvenance.kind === 1 /* Conditional */) {
|
|
4979
|
-
hasConditionalScroll = true;
|
|
4980
|
-
} else {
|
|
4981
|
-
hasUnconditionalScroll = true;
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
if (overflowY !== null && SCROLLABLE_VALUES.has(overflowY)) {
|
|
4985
|
-
isScrollContainer = true;
|
|
4986
|
-
if (axis === 0) axis = 2;
|
|
4987
|
-
const decl = declarations.get("overflow-y");
|
|
4988
|
-
if (decl && decl.guardProvenance.kind === 1 /* Conditional */) {
|
|
4989
|
-
hasConditionalScroll = true;
|
|
4990
|
-
} else {
|
|
4991
|
-
hasUnconditionalScroll = true;
|
|
4992
|
-
}
|
|
4993
|
-
}
|
|
4994
|
-
return {
|
|
4995
|
-
isScrollContainer,
|
|
4996
|
-
axis,
|
|
4997
|
-
overflow,
|
|
4998
|
-
overflowY,
|
|
4999
|
-
hasConditionalScroll,
|
|
5000
|
-
hasUnconditionalScroll
|
|
5001
|
-
};
|
|
5002
|
-
}
|
|
5003
|
-
function computeFlowParticipationFact(declarations) {
|
|
5004
|
-
const position = getCascadeValue(declarations, "position");
|
|
5005
|
-
const isOutOfFlow = position !== null && OUT_OF_FLOW_POSITIONS.has(position);
|
|
5006
|
-
let hasConditionalOutOfFlow = false;
|
|
5007
|
-
let hasUnconditionalOutOfFlow = false;
|
|
5008
|
-
if (isOutOfFlow) {
|
|
5009
|
-
const decl = declarations.get("position");
|
|
5010
|
-
if (decl && decl.guardProvenance.kind === 1 /* Conditional */) {
|
|
5011
|
-
hasConditionalOutOfFlow = true;
|
|
5012
|
-
} else {
|
|
5013
|
-
hasUnconditionalOutOfFlow = true;
|
|
5014
|
-
}
|
|
5015
|
-
}
|
|
5016
|
-
return {
|
|
5017
|
-
inFlow: !isOutOfFlow,
|
|
5018
|
-
position,
|
|
5019
|
-
hasConditionalOutOfFlow,
|
|
5020
|
-
hasUnconditionalOutOfFlow
|
|
5021
|
-
};
|
|
5022
|
-
}
|
|
5023
|
-
function computeContainingBlockFact(elementId, allElements, getCascadeForElement) {
|
|
5078
|
+
function computeContainingBlockFact(elementId, allElements, getSnapshotForElement) {
|
|
5024
5079
|
let current = null;
|
|
5025
5080
|
for (let i = 0; i < allElements.length; i++) {
|
|
5026
5081
|
const el = allElements[i];
|
|
@@ -5034,10 +5089,11 @@ function computeContainingBlockFact(elementId, allElements, getCascadeForElement
|
|
|
5034
5089
|
}
|
|
5035
5090
|
let ancestor = current.parentElementNode;
|
|
5036
5091
|
while (ancestor !== null) {
|
|
5037
|
-
const
|
|
5038
|
-
const
|
|
5092
|
+
const ancestorSnapshot = getSnapshotForElement(ancestor.elementId);
|
|
5093
|
+
const posSignal = ancestorSnapshot.signals.get("position");
|
|
5094
|
+
const pos = posSignal && posSignal.kind === 0 ? posSignal.normalized : null;
|
|
5039
5095
|
if (pos !== null && pos !== "static") {
|
|
5040
|
-
const reservedFact = computeReservedSpaceFact(
|
|
5096
|
+
const reservedFact = computeReservedSpaceFact(ancestorSnapshot);
|
|
5041
5097
|
return {
|
|
5042
5098
|
nearestPositionedAncestorKey: ancestor.key,
|
|
5043
5099
|
nearestPositionedAncestorHasReservedSpace: reservedFact.hasReservedSpace
|
|
@@ -5096,59 +5152,6 @@ function buildScopedSelectorIndex(scopedCSSFiles, symbolTable) {
|
|
|
5096
5152
|
};
|
|
5097
5153
|
}
|
|
5098
5154
|
|
|
5099
|
-
// src/compilation/analysis/layout-fact.ts
|
|
5100
|
-
var SCROLLABLE_VALUES2 = /* @__PURE__ */ new Set(["auto", "scroll"]);
|
|
5101
|
-
function computeScrollContainerFact2(snapshot) {
|
|
5102
|
-
const overflowSignal = snapshot.signals.get("overflow");
|
|
5103
|
-
const overflowYSignal = snapshot.signals.get("overflow-y");
|
|
5104
|
-
const overflow = overflowSignal && overflowSignal.kind === 0 /* Known */ ? overflowSignal.normalized : null;
|
|
5105
|
-
const overflowY = overflowYSignal && overflowYSignal.kind === 0 /* Known */ ? overflowYSignal.normalized : null;
|
|
5106
|
-
const shorthandAxis = parseOverflowShorthandAxis(overflow);
|
|
5107
|
-
const yFromLonghand = parseSingleAxisScroll(overflowY);
|
|
5108
|
-
const xScroll = shorthandAxis.x;
|
|
5109
|
-
const yScroll = yFromLonghand === null ? shorthandAxis.y : yFromLonghand;
|
|
5110
|
-
const hasConditionalScroll = overflowSignal?.guard.kind === 1 && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 1 && yFromLonghand === true;
|
|
5111
|
-
const hasUnconditionalScroll = overflowSignal?.guard.kind === 0 && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 0 && yFromLonghand === true;
|
|
5112
|
-
return {
|
|
5113
|
-
isScrollContainer: xScroll || yScroll,
|
|
5114
|
-
axis: toScrollAxis(xScroll, yScroll),
|
|
5115
|
-
overflow,
|
|
5116
|
-
overflowY,
|
|
5117
|
-
hasConditionalScroll,
|
|
5118
|
-
hasUnconditionalScroll
|
|
5119
|
-
};
|
|
5120
|
-
}
|
|
5121
|
-
var NO_SCROLL = Object.freeze({ x: false, y: false });
|
|
5122
|
-
var BOTH_SCROLL = Object.freeze({ x: true, y: true });
|
|
5123
|
-
function parseOverflowShorthandAxis(value) {
|
|
5124
|
-
if (value === null) return NO_SCROLL;
|
|
5125
|
-
const trimmed = value.trim();
|
|
5126
|
-
const spaceIdx = trimmed.indexOf(" ");
|
|
5127
|
-
if (spaceIdx === -1) {
|
|
5128
|
-
const scroll = SCROLLABLE_VALUES2.has(trimmed);
|
|
5129
|
-
return scroll ? BOTH_SCROLL : NO_SCROLL;
|
|
5130
|
-
}
|
|
5131
|
-
const first = trimmed.slice(0, spaceIdx);
|
|
5132
|
-
const second = trimmed.slice(spaceIdx + 1).trimStart();
|
|
5133
|
-
return {
|
|
5134
|
-
x: SCROLLABLE_VALUES2.has(first),
|
|
5135
|
-
y: SCROLLABLE_VALUES2.has(second)
|
|
5136
|
-
};
|
|
5137
|
-
}
|
|
5138
|
-
function parseSingleAxisScroll(value) {
|
|
5139
|
-
if (value === null) return null;
|
|
5140
|
-
const trimmed = value.trim();
|
|
5141
|
-
const spaceIdx = trimmed.indexOf(" ");
|
|
5142
|
-
const first = spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx);
|
|
5143
|
-
return SCROLLABLE_VALUES2.has(first);
|
|
5144
|
-
}
|
|
5145
|
-
function toScrollAxis(x, y) {
|
|
5146
|
-
if (x && y) return 3 /* Both */;
|
|
5147
|
-
if (x) return 1 /* X */;
|
|
5148
|
-
if (y) return 2 /* Y */;
|
|
5149
|
-
return 0 /* None */;
|
|
5150
|
-
}
|
|
5151
|
-
|
|
5152
5155
|
// src/compilation/analysis/alignment.ts
|
|
5153
5156
|
var CONTROL_ELEMENT_TAGS2 = /* @__PURE__ */ new Set(["input", "select", "textarea", "button"]);
|
|
5154
5157
|
var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set(["img", "svg", "video", "canvas", "iframe", "object", "embed"]);
|
|
@@ -6876,7 +6879,7 @@ function formatPrimaryFix(findings) {
|
|
|
6876
6879
|
}
|
|
6877
6880
|
|
|
6878
6881
|
// src/compilation/analysis/cascade-analyzer.ts
|
|
6879
|
-
var
|
|
6882
|
+
var SCROLLABLE_VALUES2 = /* @__PURE__ */ new Set(["auto", "scroll"]);
|
|
6880
6883
|
function computeConditionalDelta(elements, cascadeByElementId, monitoredDeclarationsBySelectorId, symbolTable) {
|
|
6881
6884
|
const deltaByElementId = /* @__PURE__ */ new Map();
|
|
6882
6885
|
const elementsWithDeltaBySignal = /* @__PURE__ */ new Map();
|
|
@@ -7084,7 +7087,7 @@ function containsScrollToken(value) {
|
|
|
7084
7087
|
for (let i = 0; i < tokens.length; i++) {
|
|
7085
7088
|
const token = tokens[i];
|
|
7086
7089
|
if (token === void 0) continue;
|
|
7087
|
-
if (
|
|
7090
|
+
if (SCROLLABLE_VALUES2.has(token)) return true;
|
|
7088
7091
|
}
|
|
7089
7092
|
return false;
|
|
7090
7093
|
}
|
|
@@ -7531,14 +7534,14 @@ function createFileSemanticModel(solidTree, symbolTable, dependencyGraph, compil
|
|
|
7531
7534
|
return out;
|
|
7532
7535
|
},
|
|
7533
7536
|
getLayoutFact(elementId, factKind) {
|
|
7534
|
-
const
|
|
7537
|
+
const snapshot = this.getSignalSnapshot(elementId);
|
|
7535
7538
|
const allElements = this.getElementNodes();
|
|
7536
7539
|
return computeLayoutFact(
|
|
7537
7540
|
factKind,
|
|
7538
7541
|
elementId,
|
|
7539
|
-
|
|
7542
|
+
snapshot,
|
|
7540
7543
|
allElements,
|
|
7541
|
-
(id) => this.
|
|
7544
|
+
(id) => this.getSignalSnapshot(id)
|
|
7542
7545
|
);
|
|
7543
7546
|
},
|
|
7544
7547
|
// ── Tier 4-5: Signal + fact + alignment queries ────────────────────
|
|
@@ -7577,7 +7580,7 @@ function createFileSemanticModel(solidTree, symbolTable, dependencyGraph, compil
|
|
|
7577
7580
|
if (!el) continue;
|
|
7578
7581
|
const snapshot = snapshotIndex.get(el.elementId);
|
|
7579
7582
|
if (!snapshot) continue;
|
|
7580
|
-
const fact =
|
|
7583
|
+
const fact = computeScrollContainerFact(snapshot);
|
|
7581
7584
|
if (fact.isScrollContainer) out.push(el);
|
|
7582
7585
|
}
|
|
7583
7586
|
return out;
|
|
@@ -8565,7 +8568,7 @@ function dispatchCompilationActions(actions, compilation, symbolTable, emit) {
|
|
|
8565
8568
|
}
|
|
8566
8569
|
|
|
8567
8570
|
// src/css/rules/animation/layout-animation-exempt.ts
|
|
8568
|
-
var
|
|
8571
|
+
var OUT_OF_FLOW_POSITIONS = /* @__PURE__ */ new Set(["fixed", "absolute"]);
|
|
8569
8572
|
var OVERFLOW_CONTAINMENT_VALUES = /* @__PURE__ */ new Set(["hidden", "clip"]);
|
|
8570
8573
|
var IDENTITY_ATTRIBUTE_NAMES = /* @__PURE__ */ new Set(["data-component", "data-slot"]);
|
|
8571
8574
|
function isLayoutAnimationExempt(declaration, layoutProperty) {
|
|
@@ -8595,7 +8598,7 @@ function hasOutOfFlowPosition(rule) {
|
|
|
8595
8598
|
const decl = positionDecls[i];
|
|
8596
8599
|
if (!decl) continue;
|
|
8597
8600
|
const value = decl.value.trim().toLowerCase();
|
|
8598
|
-
if (
|
|
8601
|
+
if (OUT_OF_FLOW_POSITIONS.has(value)) return true;
|
|
8599
8602
|
}
|
|
8600
8603
|
return false;
|
|
8601
8604
|
}
|
|
@@ -9017,11 +9020,6 @@ var cssNoUnreferencedComponentClass = defineAnalysisRule({
|
|
|
9017
9020
|
import ts2 from "typescript";
|
|
9018
9021
|
|
|
9019
9022
|
// src/solid/util/type-flags.ts
|
|
9020
|
-
var TS_ANY_OR_UNKNOWN = 1 | 2;
|
|
9021
|
-
var TS_BOOLEAN_LIKE = 528;
|
|
9022
|
-
var TS_NUMBER_LIKE = 296;
|
|
9023
|
-
var TS_STRING_LIKE = 402653316;
|
|
9024
|
-
var TS_OBJECT_LIKE = 524288;
|
|
9025
9023
|
function isBooleanType(solid, node) {
|
|
9026
9024
|
const info = solid.typeResolver.getType(node);
|
|
9027
9025
|
if (!info) return false;
|
|
@@ -9318,7 +9316,7 @@ import ts9 from "typescript";
|
|
|
9318
9316
|
var messages13 = {
|
|
9319
9317
|
classListGeometryToggle: "classList toggles '{{className}}', and matching CSS changes layout-affecting '{{property}}', which can cause CLS."
|
|
9320
9318
|
};
|
|
9321
|
-
var
|
|
9319
|
+
var OUT_OF_FLOW_POSITIONS2 = /* @__PURE__ */ new Set(["fixed", "absolute"]);
|
|
9322
9320
|
var jsxLayoutClasslistGeometryToggle = defineAnalysisRule({
|
|
9323
9321
|
id: "jsx-layout-classlist-geometry-toggle",
|
|
9324
9322
|
severity: "warn",
|
|
@@ -9371,7 +9369,7 @@ function classEstablishesOutOfFlow(className, symbolTable) {
|
|
|
9371
9369
|
const decl = positionDecls[j];
|
|
9372
9370
|
if (!decl) continue;
|
|
9373
9371
|
const value = decl.value.trim().toLowerCase();
|
|
9374
|
-
if (
|
|
9372
|
+
if (OUT_OF_FLOW_POSITIONS2.has(value)) return true;
|
|
9375
9373
|
}
|
|
9376
9374
|
}
|
|
9377
9375
|
return false;
|
|
@@ -10360,7 +10358,7 @@ var messages25 = {
|
|
|
10360
10358
|
noReservedBlockSize: "Interactive element `<{{tag}}>` has no declared height (minimum `{{min}}px` required by policy `{{policy}}`). The element is content-sized and may not meet the touch-target threshold.",
|
|
10361
10359
|
noReservedInlineSize: "Interactive element `<{{tag}}>` has no declared width (minimum `{{min}}px` required by policy `{{policy}}`). The element is content-sized and may not meet the touch-target threshold."
|
|
10362
10360
|
};
|
|
10363
|
-
var INTERACTIVE_HTML_TAGS2 = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "
|
|
10361
|
+
var INTERACTIVE_HTML_TAGS2 = /* @__PURE__ */ new Set(["button", "a", "input", "select", "textarea", "summary"]);
|
|
10364
10362
|
var INTERACTIVE_ARIA_ROLES2 = /* @__PURE__ */ new Set([
|
|
10365
10363
|
"button",
|
|
10366
10364
|
"link",
|
|
@@ -10521,9 +10519,12 @@ var jsxLayoutPolicyTouchTarget = defineAnalysisRule({
|
|
|
10521
10519
|
}
|
|
10522
10520
|
});
|
|
10523
10521
|
function classifyInteractive(element, semanticModel) {
|
|
10522
|
+
if (element.attributes.has("hidden")) return null;
|
|
10524
10523
|
const tag = element.tagName;
|
|
10525
10524
|
if (tag !== null && INTERACTIVE_HTML_TAGS2.has(tag)) {
|
|
10525
|
+
if (tag === "input" && element.attributes.get("type") === "hidden") return null;
|
|
10526
10526
|
if (tag === "input" || tag === "select" || tag === "textarea") return "input";
|
|
10527
|
+
if (tag === "a" && isInlineTextLink(element)) return null;
|
|
10527
10528
|
return "button";
|
|
10528
10529
|
}
|
|
10529
10530
|
const roleAttr = getJSXAttributeEntity(semanticModel.solidTree, element.jsxEntity, "role");
|
|
@@ -10553,6 +10554,14 @@ function isVisuallyHidden(element, snapshot) {
|
|
|
10553
10554
|
if (widthSignal && widthSignal.kind === 0 /* Known */ && widthSignal.px === 1 && heightSignal && heightSignal.kind === 0 /* Known */ && heightSignal.px === 1) return true;
|
|
10554
10555
|
return false;
|
|
10555
10556
|
}
|
|
10557
|
+
function isInlineTextLink(element) {
|
|
10558
|
+
const content = element.textualContent;
|
|
10559
|
+
if (content !== 0 /* Yes */ && content !== 3 /* DynamicText */) return false;
|
|
10560
|
+
const parent = element.parentElementNode;
|
|
10561
|
+
if (parent === null) return false;
|
|
10562
|
+
const parentContent = parent.textualContent;
|
|
10563
|
+
return parentContent === 0 /* Yes */ || parentContent === 3 /* DynamicText */ || parentContent === 2 /* Unknown */;
|
|
10564
|
+
}
|
|
10556
10565
|
function checkDimension(snapshot, signal, min, element, semanticModel, emit, messageId, template, tag, policyName) {
|
|
10557
10566
|
let px = readKnownPx2(snapshot, signal);
|
|
10558
10567
|
if (px === null) {
|
|
@@ -10563,6 +10572,7 @@ function checkDimension(snapshot, signal, min, element, semanticModel, emit, mes
|
|
|
10563
10572
|
}
|
|
10564
10573
|
if (px === null) return;
|
|
10565
10574
|
if (px >= min) return;
|
|
10575
|
+
if (px === 0 && (signal === "min-width" || signal === "min-height")) return;
|
|
10566
10576
|
emit(createDiagnostic(
|
|
10567
10577
|
element.solidFile,
|
|
10568
10578
|
element.jsxEntity.node,
|
|
@@ -12681,10 +12691,8 @@ var cssPolicyTypography = defineAnalysisRule({
|
|
|
12681
12691
|
var messages57 = {
|
|
12682
12692
|
letterSpacingTooSmall: "Letter spacing `{{value}}` ({{resolved}}em) is below the minimum `{{min}}em` for policy `{{policy}}`.",
|
|
12683
12693
|
wordSpacingTooSmall: "Word spacing `{{value}}` ({{resolved}}em) is below the minimum `{{min}}em` for policy `{{policy}}`.",
|
|
12684
|
-
paragraphSpacingTooSmall: "Paragraph spacing `{{value}}` ({{resolved}}em) is below the minimum `{{min}}em` ({{minMultiplier}}\xD7 font-size) for policy `{{policy}}`."
|
|
12685
|
-
touchTargetTooSmall: "`{{property}}: {{value}}` ({{resolved}}px) is below the minimum `{{min}}px` for interactive elements in policy `{{policy}}`."
|
|
12694
|
+
paragraphSpacingTooSmall: "Paragraph spacing `{{value}}` ({{resolved}}em) is below the minimum `{{min}}em` ({{minMultiplier}}\xD7 font-size) for policy `{{policy}}`."
|
|
12686
12695
|
};
|
|
12687
|
-
var INTERACTIVE_SELECTORS = /button|input|select|textarea|\[role=/i;
|
|
12688
12696
|
var cssPolicySpacing = defineAnalysisRule({
|
|
12689
12697
|
id: "css-policy-spacing",
|
|
12690
12698
|
severity: "warn",
|
|
@@ -12732,28 +12740,6 @@ var cssPolicySpacing = defineAnalysisRule({
|
|
|
12732
12740
|
));
|
|
12733
12741
|
}
|
|
12734
12742
|
}
|
|
12735
|
-
for (const prop of ["height", "min-height"]) {
|
|
12736
|
-
const decls = tree.declarationsByProperty.get(prop);
|
|
12737
|
-
if (!decls) continue;
|
|
12738
|
-
for (let i = 0; i < decls.length; i++) {
|
|
12739
|
-
const d = decls[i];
|
|
12740
|
-
if (!d) continue;
|
|
12741
|
-
const rule = d.rule;
|
|
12742
|
-
if (!rule) continue;
|
|
12743
|
-
if (!INTERACTIVE_SELECTORS.test(rule.selectorText)) continue;
|
|
12744
|
-
const px = parsePxValue(d.value);
|
|
12745
|
-
if (px === null || px >= policy.minButtonHeight) continue;
|
|
12746
|
-
emit(createCSSDiagnostic(
|
|
12747
|
-
d.file.path,
|
|
12748
|
-
d.startLine,
|
|
12749
|
-
d.startColumn,
|
|
12750
|
-
cssPolicySpacing.id,
|
|
12751
|
-
"touchTargetTooSmall",
|
|
12752
|
-
resolveMessage(messages57.touchTargetTooSmall, { property: prop, value: d.value.trim(), resolved: String(Math.round(px * 100) / 100), min: String(policy.minButtonHeight), policy: name }),
|
|
12753
|
-
"warn"
|
|
12754
|
-
));
|
|
12755
|
-
}
|
|
12756
|
-
}
|
|
12757
12743
|
for (const prop of ["margin-bottom", "margin-block-end"]) {
|
|
12758
12744
|
const decls = tree.declarationsByProperty.get(prop);
|
|
12759
12745
|
if (!decls) continue;
|