pasika 0.10.111 → 0.10.112

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.
@@ -10391,6 +10391,41 @@ function themeCandidate(name, utilityText) {
10391
10391
  if (property === "font-size" && value.startsWith("-")) return void 0;
10392
10392
  return { token: `--${name}`, property, value };
10393
10393
  }
10394
+ var builtInTextSizes = /* @__PURE__ */ new Set([
10395
+ "xs",
10396
+ "sm",
10397
+ "base",
10398
+ "lg",
10399
+ "xl",
10400
+ "2xl",
10401
+ "3xl",
10402
+ "4xl",
10403
+ "5xl",
10404
+ "6xl",
10405
+ "7xl",
10406
+ "8xl",
10407
+ "9xl"
10408
+ ]);
10409
+ var builtInTracking = /* @__PURE__ */ new Set(["tighter", "tight", "normal", "wide", "wider", "widest"]);
10410
+ function lengthIdentity(value) {
10411
+ const match = /^(?<number>-?(?:\d+(?:\.\d*)?|\.\d+))(?<unit>px|rem|em|%)$/u.exec(value);
10412
+ const number = match?.groups?.number;
10413
+ const unit = match?.groups?.unit;
10414
+ if (!number || !unit) return void 0;
10415
+ return `${String(Number(number))}${unit}`;
10416
+ }
10417
+ function declarationValue(text) {
10418
+ const match = /^--[\w-]+\s*:\s*(?<value>[^;{}]+);?$/u.exec(text.trim());
10419
+ return match?.groups?.value?.trim();
10420
+ }
10421
+ function canonicalToken(name) {
10422
+ if (name.startsWith("--text-")) return builtInTextSizes.has(name.slice("--text-".length));
10423
+ if (name.startsWith("--tracking-")) return builtInTracking.has(name.slice("--tracking-".length));
10424
+ return false;
10425
+ }
10426
+ function isTypographySize(name) {
10427
+ return /^--text-(?!.*--)(?:[a-z0-9]+-)*[a-z0-9]+$/u.test(name);
10428
+ }
10394
10429
  var utilityMappingRule = {
10395
10430
  meta: {
10396
10431
  schema: [
@@ -10414,6 +10449,16 @@ var utilityMappingRule = {
10414
10449
  const themeTokens = /* @__PURE__ */ new Set();
10415
10450
  const nameCounts = /* @__PURE__ */ new Map();
10416
10451
  if (preferThemeTokens) {
10452
+ let identity2 = function(value) {
10453
+ const variable = /^var\((?<name>--[a-z][a-z0-9-]*)\)$/u.exec(value);
10454
+ if (!variable) return lengthIdentity(value);
10455
+ const name = variable.groups?.name;
10456
+ if (!name || overriddenVariables.has(name)) return void 0;
10457
+ const definitions = rootValues.get(name);
10458
+ const definition = definitions?.length === 1 ? definitions[0] : void 0;
10459
+ return definition ? lengthIdentity(definition) : void 0;
10460
+ };
10461
+ var identity = identity2;
10417
10462
  for (const theme of atrulesNamed(node, "theme")) {
10418
10463
  for (const child of blockChildren2(theme)) {
10419
10464
  if (child.type === "Declaration") themeTokens.add(child.property);
@@ -10423,6 +10468,59 @@ var utilityMappingRule = {
10423
10468
  const name = preludeIdentifiers(utility)[0] ?? "";
10424
10469
  nameCounts.set(name, (nameCounts.get(name) ?? 0) + 1);
10425
10470
  }
10471
+ const themeDefinitions = /* @__PURE__ */ new Map();
10472
+ for (const theme of atrulesNamed(node, "theme")) {
10473
+ for (const child of blockChildren2(theme)) {
10474
+ if (child.type !== "Declaration") continue;
10475
+ const value = declarationValue(context.sourceCode.getText(child));
10476
+ if (!value) continue;
10477
+ const definitions = themeDefinitions.get(child.property) ?? [];
10478
+ definitions.push({ node: child, value });
10479
+ themeDefinitions.set(child.property, definitions);
10480
+ }
10481
+ }
10482
+ const rootValues = /* @__PURE__ */ new Map();
10483
+ const overriddenVariables = /* @__PURE__ */ new Set();
10484
+ for (const cssRule of rules(node)) {
10485
+ if (!("prelude" in cssRule) || !cssRule.prelude) continue;
10486
+ const isRoot = context.sourceCode.getText(cssRule.prelude).trim() === ":root";
10487
+ for (const child of blockChildren2(cssRule)) {
10488
+ if (child.type !== "Declaration" || !child.property.startsWith("--")) continue;
10489
+ if (!isRoot) {
10490
+ overriddenVariables.add(child.property);
10491
+ continue;
10492
+ }
10493
+ const value = declarationValue(context.sourceCode.getText(child));
10494
+ if (!value) continue;
10495
+ const definitions = rootValues.get(child.property) ?? [];
10496
+ definitions.push(value);
10497
+ rootValues.set(child.property, definitions);
10498
+ }
10499
+ }
10500
+ for (const [name, definitions] of themeDefinitions) {
10501
+ const definition = definitions.length === 1 ? definitions[0] : void 0;
10502
+ if (!definition || canonicalToken(name)) continue;
10503
+ if (!isTypographySize(name) && !name.startsWith("--tracking-")) continue;
10504
+ if (name.includes("--", 2)) continue;
10505
+ const value = identity2(definition.value);
10506
+ if (!value) continue;
10507
+ const prefix = name.startsWith("--text-") ? "--text-" : "--tracking-";
10508
+ for (const [other, otherDefinitions] of themeDefinitions) {
10509
+ const otherDefinition = otherDefinitions.length === 1 ? otherDefinitions[0] : void 0;
10510
+ if (!canonicalToken(other) || !other.startsWith(prefix) || !otherDefinition) continue;
10511
+ if (identity2(otherDefinition.value) !== value) continue;
10512
+ if (prefix === "--text-" && ["--line-height", "--letter-spacing", "--font-weight"].some(
10513
+ (suffix) => themeDefinitions.has(`${name}${suffix}`) || themeDefinitions.has(`${other}${suffix}`)
10514
+ )) {
10515
+ continue;
10516
+ }
10517
+ context.report({
10518
+ node: definition.node,
10519
+ message: `Theme token "${name}" duplicates the configured built-in "${other}" (${value}); reuse the "${other.slice(2)}" utility instead of defining an equivalent theme token.`
10520
+ });
10521
+ break;
10522
+ }
10523
+ }
10426
10524
  }
10427
10525
  for (const utility of utilities) {
10428
10526
  const name = preludeIdentifiers(utility)[0] ?? "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.111",
3
+ "version": "0.10.112",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",