@drskillissue/ganko 0.3.0 → 0.3.1

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/index.d.cts CHANGED
@@ -1681,7 +1681,7 @@ declare function prepareTailwindEval(files: readonly {
1681
1681
  * and preloads the results before rule execution.
1682
1682
  */
1683
1683
  interface BatchableTailwindValidator extends TailwindValidator {
1684
- preloadBatch(classNames: readonly string[], results: readonly boolean[]): void;
1684
+ preloadBatch(classNames: readonly string[], results: readonly (string | null)[]): void;
1685
1685
  }
1686
1686
  /**
1687
1687
  * Build a TailwindValidator from evaluation results with batch preloading.
@@ -2765,6 +2765,7 @@ interface ClassNameSymbol {
2765
2765
  readonly name: string;
2766
2766
  readonly filePath: string | null;
2767
2767
  readonly source: ClassNameSource;
2768
+ readonly tailwindResolvedCSS: string | null;
2768
2769
  }
2769
2770
 
2770
2771
  /**
@@ -2908,6 +2909,7 @@ interface SymbolTable {
2908
2909
  readonly layers: ReadonlyMap<string, LayerSymbol>;
2909
2910
  readonly containers: ReadonlyMap<string, ContainerSymbol>;
2910
2911
  readonly themeTokens: ReadonlyMap<string, ThemeTokenSymbol>;
2912
+ readonly referencedCustomPropertyNames: ReadonlySet<string>;
2911
2913
  readonly selectorsByDispatchKey: ReadonlyMap<string, readonly SelectorSymbol[]>;
2912
2914
  readonly selectorsBySubjectTag: ReadonlyMap<string, readonly SelectorSymbol[]>;
2913
2915
  readonly selectorsWithoutSubjectTag: readonly SelectorSymbol[];
package/dist/index.d.ts CHANGED
@@ -1681,7 +1681,7 @@ declare function prepareTailwindEval(files: readonly {
1681
1681
  * and preloads the results before rule execution.
1682
1682
  */
1683
1683
  interface BatchableTailwindValidator extends TailwindValidator {
1684
- preloadBatch(classNames: readonly string[], results: readonly boolean[]): void;
1684
+ preloadBatch(classNames: readonly string[], results: readonly (string | null)[]): void;
1685
1685
  }
1686
1686
  /**
1687
1687
  * Build a TailwindValidator from evaluation results with batch preloading.
@@ -2765,6 +2765,7 @@ interface ClassNameSymbol {
2765
2765
  readonly name: string;
2766
2766
  readonly filePath: string | null;
2767
2767
  readonly source: ClassNameSource;
2768
+ readonly tailwindResolvedCSS: string | null;
2768
2769
  }
2769
2770
 
2770
2771
  /**
@@ -2908,6 +2909,7 @@ interface SymbolTable {
2908
2909
  readonly layers: ReadonlyMap<string, LayerSymbol>;
2909
2910
  readonly containers: ReadonlyMap<string, ContainerSymbol>;
2910
2911
  readonly themeTokens: ReadonlyMap<string, ThemeTokenSymbol>;
2912
+ readonly referencedCustomPropertyNames: ReadonlySet<string>;
2911
2913
  readonly selectorsByDispatchKey: ReadonlyMap<string, readonly SelectorSymbol[]>;
2912
2914
  readonly selectorsBySubjectTag: ReadonlyMap<string, readonly SelectorSymbol[]>;
2913
2915
  readonly selectorsWithoutSubjectTag: readonly SelectorSymbol[];
package/dist/index.js CHANGED
@@ -83,7 +83,7 @@ import {
83
83
  splitTopLevelWhitespace,
84
84
  splitWhitespaceTokens,
85
85
  toKebabCase
86
- } from "./chunk-2VRVUMIE.js";
86
+ } from "./chunk-AXFVBCJD.js";
87
87
  import "./chunk-EGRHWZRV.js";
88
88
 
89
89
  // src/runner.ts
@@ -300,24 +300,26 @@ function buildTailwindValidatorFromEval(utilities, variants, logger) {
300
300
  has(className) {
301
301
  if (staticValidator.has(className)) return true;
302
302
  const cached = batchCache.get(className);
303
- if (cached !== void 0) return cached;
303
+ if (cached !== void 0) return cached !== null;
304
304
  return false;
305
305
  },
306
- resolve() {
306
+ resolve(className) {
307
+ const cached = batchCache.get(className);
308
+ if (cached !== void 0) return cached;
307
309
  return null;
308
310
  },
309
311
  preloadBatch(classNames, results) {
310
312
  for (let i = 0; i < classNames.length; i++) {
311
313
  const name = classNames[i];
312
- const valid = results[i];
313
- if (name !== void 0 && valid !== void 0) {
314
- batchCache.set(name, valid);
314
+ const css = results[i];
315
+ if (name !== void 0 && css !== void 0) {
316
+ batchCache.set(name, css);
315
317
  }
316
318
  }
317
319
  if (logger?.isLevelEnabled(Level.Debug)) {
318
320
  let validCount = 0;
319
321
  for (let i = 0; i < results.length; i++) {
320
- if (results[i]) validCount++;
322
+ if (results[i] !== null) validCount++;
321
323
  }
322
324
  logger.debug(`tailwind: preloaded ${classNames.length} candidates (${validCount} valid)`);
323
325
  }
@@ -513,7 +515,7 @@ function getActivePolicy() {
513
515
  }
514
516
 
515
517
  // src/compilation/symbols/class-name.ts
516
- function createClassNameSymbol(name, selectors, filePaths) {
518
+ function createClassNameSymbol(name, selectors, filePaths, tailwindResolvedCSS) {
517
519
  return {
518
520
  symbolKind: "className",
519
521
  name,
@@ -522,7 +524,8 @@ function createClassNameSymbol(name, selectors, filePaths) {
522
524
  kind: "css",
523
525
  selectors,
524
526
  filePaths
525
- }
527
+ },
528
+ tailwindResolvedCSS: tailwindResolvedCSS ?? null
526
529
  };
527
530
  }
528
531
 
@@ -993,7 +996,7 @@ function pushToMapArray(map, key, value) {
993
996
  if (arr !== void 0) arr.push(value);
994
997
  else map.set(key, [value]);
995
998
  }
996
- function buildSymbolTable(trees, tailwindValidator) {
999
+ function buildSymbolTable(trees, tailwindValidator, solidClassTokens) {
997
1000
  const classNamesMap = /* @__PURE__ */ new Map();
998
1001
  const selectorsMap = /* @__PURE__ */ new Map();
999
1002
  const customPropertiesMap = /* @__PURE__ */ new Map();
@@ -1020,6 +1023,7 @@ function buildSymbolTable(trees, tailwindValidator) {
1020
1023
  const allSelectors = [];
1021
1024
  const allDeclarations = [];
1022
1025
  const allVariables = [];
1026
+ const referencedCustomPropertyNamesSet = /* @__PURE__ */ new Set();
1023
1027
  const allAtRules = [];
1024
1028
  const allKeyframeAtRules = [];
1025
1029
  const allFontFaceAtRules = [];
@@ -1130,6 +1134,11 @@ function buildSymbolTable(trees, tailwindValidator) {
1130
1134
  customPropertiesMap.set(entity.name, createCustomPropertySymbol(entity, filePath));
1131
1135
  }
1132
1136
  }
1137
+ const treeVariableRefs = tree.variableRefs;
1138
+ for (let i = 0; i < treeVariableRefs.length; i++) {
1139
+ const ref = treeVariableRefs[i];
1140
+ if (ref) referencedCustomPropertyNamesSet.add(ref.name);
1141
+ }
1133
1142
  const treeAtRules = tree.atRules;
1134
1143
  for (let i = 0; i < treeAtRules.length; i++) {
1135
1144
  const entity = treeAtRules[i];
@@ -1183,11 +1192,32 @@ function buildSymbolTable(trees, tailwindValidator) {
1183
1192
  if (!placeholdersByNameMap.has(ph.name)) placeholdersByNameMap.set(ph.name, ph);
1184
1193
  }
1185
1194
  }
1195
+ const twValidator = tailwindValidator ?? null;
1186
1196
  const classNameSymbols = /* @__PURE__ */ new Map();
1187
1197
  for (const [name, entry] of classNamesMap) {
1188
- classNameSymbols.set(name, createClassNameSymbol(name, entry.selectors, [...entry.filePaths]));
1198
+ const twCSS = twValidator !== null && twValidator.has(name) ? twValidator.resolve(name) : null;
1199
+ classNameSymbols.set(name, createClassNameSymbol(name, entry.selectors, [...entry.filePaths], twCSS));
1200
+ }
1201
+ if (twValidator !== null && solidClassTokens !== null && solidClassTokens !== void 0) {
1202
+ for (const name of solidClassTokens) {
1203
+ if (classNameSymbols.has(name)) continue;
1204
+ if (!twValidator.has(name)) continue;
1205
+ const resolvedCSS = twValidator.resolve(name);
1206
+ classNameSymbols.set(name, {
1207
+ symbolKind: "className",
1208
+ name,
1209
+ filePath: null,
1210
+ source: {
1211
+ kind: "tailwind",
1212
+ candidate: { raw: name, variants: [], utility: name, value: null, modifier: null, important: false, negative: false },
1213
+ resolvedCSS,
1214
+ declarations: [],
1215
+ diagnostics: []
1216
+ },
1217
+ tailwindResolvedCSS: resolvedCSS
1218
+ });
1219
+ }
1189
1220
  }
1190
- const twValidator = tailwindValidator ?? null;
1191
1221
  const knownKeyframeNames = /* @__PURE__ */ new Set();
1192
1222
  for (let i = 0; i < allKeyframeAtRules.length; i++) {
1193
1223
  const kf = allKeyframeAtRules[i];
@@ -1544,8 +1574,9 @@ function buildSymbolTable(trees, tailwindValidator) {
1544
1574
  unusedFunctions: unusedFunctionsArr,
1545
1575
  unusedPlaceholders: unusedPlaceholdersArr,
1546
1576
  tokenCategories: [...tokensByCategoryMap.keys()],
1577
+ referencedCustomPropertyNames: referencedCustomPropertyNamesSet,
1547
1578
  hasClassName(name) {
1548
- return classNameSymbols.has(name) || twValidator !== null && twValidator.has(name);
1579
+ return classNameSymbols.has(name);
1549
1580
  },
1550
1581
  getClassName(name) {
1551
1582
  return classNameSymbols.get(name) ?? null;
@@ -4643,8 +4674,6 @@ function matchesRequiredAttributes(required, actual) {
4643
4674
  if (constraint === void 0) continue;
4644
4675
  if (!actual.has(constraint.name)) return 1 /* NoMatch */;
4645
4676
  if (constraint.operator === "exists") {
4646
- const existsValue = actual.get(constraint.name);
4647
- if (existsValue === null) hasConditional = true;
4648
4677
  continue;
4649
4678
  }
4650
4679
  const actualValue = actual.get(constraint.name);
@@ -4854,10 +4883,9 @@ function augmentCascadeWithTailwindFromSymbolTable(cascade, element, symbolTable
4854
4883
  for (let i = 0; i < classTokens.length; i++) {
4855
4884
  const token = classTokens[i];
4856
4885
  if (token === void 0) continue;
4857
- const classSymbol = symbolTable.classNames.get(token);
4858
- if (!classSymbol) continue;
4859
- if (classSymbol.source.kind !== "tailwind") continue;
4860
- const resolvedCSS = classSymbol.source.resolvedCSS;
4886
+ const classSymbol = symbolTable.getClassName(token);
4887
+ if (classSymbol === null) continue;
4888
+ const resolvedCSS = classSymbol.tailwindResolvedCSS;
4861
4889
  if (resolvedCSS === null) continue;
4862
4890
  const declarations = parseTailwindCssDeclarations(resolvedCSS);
4863
4891
  for (let j = 0; j < declarations.length; j++) {
@@ -6545,13 +6573,13 @@ function buildConsistencyEvidence(input) {
6545
6573
  const lineHeight = normalizeDeviation(input.subjectLineHeightDeviation, input.cohortProfile.lineHeightDispersionPx, input.cohortProfile.medianLineHeightPx);
6546
6574
  const baselinesIrrelevant = input.context.baselineRelevance === "irrelevant";
6547
6575
  const blockAxisIsMainAxis = !input.context.crossAxisIsBlockAxis;
6548
- const suppressAll = blockAxisIsMainAxis;
6576
+ const suppressAll = blockAxisIsMainAxis || baselinesIrrelevant;
6549
6577
  const offset = suppressAll ? ZERO_STRENGTH : offsetRaw;
6550
6578
  const declaredOffset = suppressAll ? ZERO_STRENGTH : declaredOffsetRaw;
6551
- const baselineStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
6552
- const contextStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
6553
- const replacedStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
6554
- const compositionResult = baselinesIrrelevant || suppressAll ? null : resolveContentCompositionStrength(input);
6579
+ const baselineStrength = suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
6580
+ const contextStrength = suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
6581
+ const replacedStrength = suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
6582
+ const compositionResult = suppressAll ? null : resolveContentCompositionStrength(input);
6555
6583
  const compositionStrength = compositionResult ? compositionResult.evidence : ZERO_STRENGTH;
6556
6584
  const contextCertaintyPenalty = resolveContextCertaintyPenalty(input);
6557
6585
  const provenance = input.cohortProvenance;
@@ -7614,7 +7642,26 @@ function makeCompilation(solidTrees, cssTrees, tailwindConfig, packageManifest,
7614
7642
  if (cachedSymbolTable === null) {
7615
7643
  const allCssTrees = [];
7616
7644
  for (const tree of cssTrees.values()) allCssTrees.push(tree);
7617
- cachedSymbolTable = buildSymbolTable(allCssTrees, tailwindConfig?.validator ?? null);
7645
+ let solidClassTokens = null;
7646
+ if (tailwindConfig?.validator !== null && tailwindConfig?.validator !== void 0) {
7647
+ const tokens = /* @__PURE__ */ new Set();
7648
+ for (const st of solidTrees.values()) {
7649
+ for (const [, idx] of st.staticClassTokensByElementId) {
7650
+ for (let i = 0; i < idx.tokens.length; i++) {
7651
+ const t = idx.tokens[i];
7652
+ if (t) tokens.add(t);
7653
+ }
7654
+ }
7655
+ for (const [, idx] of st.staticClassListKeysByElementId) {
7656
+ for (let i = 0; i < idx.keys.length; i++) {
7657
+ const t = idx.keys[i];
7658
+ if (t) tokens.add(t);
7659
+ }
7660
+ }
7661
+ }
7662
+ solidClassTokens = tokens;
7663
+ }
7664
+ cachedSymbolTable = buildSymbolTable(allCssTrees, tailwindConfig?.validator ?? null, solidClassTokens);
7618
7665
  }
7619
7666
  return cachedSymbolTable;
7620
7667
  },
@@ -9233,10 +9280,7 @@ var jsxStyleNoUnusedCustomProp = defineAnalysisRule({
9233
9280
  requirement: { tier: 1 /* CrossSyntax */ },
9234
9281
  register(registry) {
9235
9282
  registry.registerCrossSyntaxAction((solidTree, symbolTable, emit) => {
9236
- const usedVarNames = /* @__PURE__ */ new Set();
9237
- for (const [name] of symbolTable.customProperties) {
9238
- usedVarNames.add(name);
9239
- }
9283
+ const usedVarNames = symbolTable.referencedCustomPropertyNames;
9240
9284
  if (solidTree.jsxClassListAttributes.length > 0) return;
9241
9285
  let hasNonStaticClass = false;
9242
9286
  for (const [, idx] of solidTree.staticClassTokensByElementId) {
@@ -10196,7 +10240,7 @@ function normalizeStylePropertyKey(key) {
10196
10240
  if (key.includes("-")) return key.toLowerCase();
10197
10241
  return toKebabCase(key);
10198
10242
  }
10199
- function isExemptFromCLS(element, flowFact, property, _semanticModel) {
10243
+ function isExemptFromCLS(element, flowFact, property, semanticModel) {
10200
10244
  if (!flowFact.inFlow) return true;
10201
10245
  if (POSITIONED_OFFSET_PROPERTIES.has(property) && flowFact.position !== null && flowFact.position !== "static") {
10202
10246
  return true;
@@ -10204,8 +10248,17 @@ function isExemptFromCLS(element, flowFact, property, _semanticModel) {
10204
10248
  if (hasLayoutContainment(element) || element.parentElementNode !== null && hasLayoutContainment(element.parentElementNode)) {
10205
10249
  return true;
10206
10250
  }
10251
+ if (element.parentElementNode !== null && parentClipsOverflow(element.parentElementNode, semanticModel)) {
10252
+ return true;
10253
+ }
10207
10254
  return false;
10208
10255
  }
10256
+ var CLIPPING_OVERFLOW_VALUES = /* @__PURE__ */ new Set(["hidden", "clip"]);
10257
+ function parentClipsOverflow(parent, semanticModel) {
10258
+ const snapshot = semanticModel.getSignalSnapshot(parent.elementId);
10259
+ const signal = snapshot.signals.get("overflow");
10260
+ return signal !== void 0 && signal.kind === 0 /* Known */ && CLIPPING_OVERFLOW_VALUES.has(signal.normalized);
10261
+ }
10209
10262
  function hasLayoutContainment(node) {
10210
10263
  const contain = node.inlineStyleValues.get("contain");
10211
10264
  if (contain === void 0) return false;