@drskillissue/ganko 0.2.8 → 0.2.9

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.cjs CHANGED
@@ -3978,6 +3978,10 @@ function getStaticStringFromJSXValue(node) {
3978
3978
  if (import_typescript4.default.isTemplateExpression(expression) && expression.templateSpans.length === 0) {
3979
3979
  return expression.head.text;
3980
3980
  }
3981
+ if (import_typescript4.default.isBinaryExpression(expression) && expression.operatorToken.kind === import_typescript4.default.SyntaxKind.QuestionQuestionToken) {
3982
+ const fallback = getStaticStringFromJSXValue(expression.right);
3983
+ if (fallback !== null) return fallback;
3984
+ }
3981
3985
  }
3982
3986
  return null;
3983
3987
  }
@@ -23266,7 +23270,7 @@ function splitWhitespaceTokens(value2) {
23266
23270
  return out;
23267
23271
  }
23268
23272
  function parseQuadShorthand(raw) {
23269
- const parts = splitWhitespaceTokens(raw);
23273
+ const parts = splitTopLevelWhitespace(raw);
23270
23274
  if (parts.length === 1) {
23271
23275
  const p0 = parts[0];
23272
23276
  if (!p0) return null;
@@ -23290,7 +23294,7 @@ function parseQuadShorthand(raw) {
23290
23294
  return null;
23291
23295
  }
23292
23296
  function parseBlockShorthand(raw) {
23293
- const parts = splitWhitespaceTokens(raw);
23297
+ const parts = splitTopLevelWhitespace(raw);
23294
23298
  if (parts.length === 1) {
23295
23299
  const p0 = parts[0];
23296
23300
  if (!p0) return null;
@@ -23375,8 +23379,14 @@ var NUMERIC_VALUE = /^([0-9]*\.?[0-9]+)(px|rem|em|pt)?$/;
23375
23379
  function parsePxValue(raw, contextFontSize = 16) {
23376
23380
  const trimmed = raw.trim().toLowerCase();
23377
23381
  if (trimmed.length === 0) return null;
23378
- if (trimmed.includes("var(") || trimmed.includes("calc(") || trimmed.includes("%")) return null;
23382
+ if (trimmed.includes("var(") || trimmed.includes("%")) return null;
23379
23383
  if (CSS_WIDE_KEYWORDS.has(trimmed)) return null;
23384
+ if (trimmed.includes("calc(")) {
23385
+ return tryEvalConstantCalc(trimmed, contextFontSize);
23386
+ }
23387
+ if (trimmed.startsWith("min(") || trimmed.startsWith("max(") || trimmed.startsWith("clamp(")) {
23388
+ return tryEvalMathFunction(trimmed, contextFontSize);
23389
+ }
23380
23390
  const match = NUMERIC_VALUE.exec(trimmed);
23381
23391
  if (!match) return null;
23382
23392
  const num = Number(match[1]);
@@ -23387,6 +23397,135 @@ function parsePxValue(raw, contextFontSize = 16) {
23387
23397
  if (unit === "pt") return num * 1.333;
23388
23398
  return null;
23389
23399
  }
23400
+ var CALC_CONSTANT_RE = /^calc\((.+)\)$/;
23401
+ var CALC_TOKEN_RE = /([0-9]*\.?[0-9]+)(px|rem|em|pt)?|([+\-*/])/g;
23402
+ function tryEvalConstantCalc(raw, contextFontSize) {
23403
+ const match = CALC_CONSTANT_RE.exec(raw);
23404
+ if (!match || !match[1]) return null;
23405
+ const inner = match[1].trim();
23406
+ if (inner.includes("var(") || inner.includes("%") || inner.includes("env(") || inner.includes("calc(")) return null;
23407
+ const values = [];
23408
+ const operators = [];
23409
+ let lastWasValue = false;
23410
+ CALC_TOKEN_RE.lastIndex = 0;
23411
+ let tokenMatch;
23412
+ while ((tokenMatch = CALC_TOKEN_RE.exec(inner)) !== null) {
23413
+ const op = tokenMatch[3];
23414
+ if (op !== void 0) {
23415
+ if (!lastWasValue && op === "-") {
23416
+ const nextToken = CALC_TOKEN_RE.exec(inner);
23417
+ if (!nextToken || nextToken[3] !== void 0) return null;
23418
+ const px2 = calcTokenToPx(nextToken, contextFontSize);
23419
+ if (px2 === null) return null;
23420
+ values.push(-px2);
23421
+ lastWasValue = true;
23422
+ continue;
23423
+ }
23424
+ if (!lastWasValue) return null;
23425
+ operators.push(op);
23426
+ lastWasValue = false;
23427
+ continue;
23428
+ }
23429
+ const px = calcTokenToPx(tokenMatch, contextFontSize);
23430
+ if (px === null) return null;
23431
+ values.push(px);
23432
+ lastWasValue = true;
23433
+ }
23434
+ if (values.length === 0 || values.length !== operators.length + 1) return null;
23435
+ const firstValue = values[0];
23436
+ if (firstValue === void 0) return null;
23437
+ const reducedValues = [firstValue];
23438
+ const reducedOps = [];
23439
+ for (let i = 0; i < operators.length; i++) {
23440
+ const op = operators[i];
23441
+ const right = values[i + 1];
23442
+ if (op === void 0 || right === void 0) return null;
23443
+ if (op === "*") {
23444
+ const last = reducedValues[reducedValues.length - 1];
23445
+ if (last === void 0) return null;
23446
+ reducedValues[reducedValues.length - 1] = last * right;
23447
+ } else if (op === "/") {
23448
+ if (right === 0) return null;
23449
+ const last = reducedValues[reducedValues.length - 1];
23450
+ if (last === void 0) return null;
23451
+ reducedValues[reducedValues.length - 1] = last / right;
23452
+ } else {
23453
+ reducedValues.push(right);
23454
+ reducedOps.push(op);
23455
+ }
23456
+ }
23457
+ const base = reducedValues[0];
23458
+ if (base === void 0) return null;
23459
+ let result = base;
23460
+ for (let i = 0; i < reducedOps.length; i++) {
23461
+ const op = reducedOps[i];
23462
+ const right = reducedValues[i + 1];
23463
+ if (op === void 0 || right === void 0) return null;
23464
+ if (op === "+") result += right;
23465
+ else if (op === "-") result -= right;
23466
+ else return null;
23467
+ }
23468
+ return Number.isFinite(result) ? result : null;
23469
+ }
23470
+ function calcTokenToPx(tokenMatch, contextFontSize) {
23471
+ const num = Number(tokenMatch[1]);
23472
+ if (Number.isNaN(num)) return null;
23473
+ const unit = tokenMatch[2] ?? "";
23474
+ if (unit === "px" || unit === "") return num;
23475
+ if (unit === "rem") return num * 16;
23476
+ if (unit === "em") return num * contextFontSize;
23477
+ if (unit === "pt") return num * 1.333;
23478
+ return null;
23479
+ }
23480
+ var MATH_FN_RE = /^(min|max|clamp)\((.+)\)$/;
23481
+ function tryEvalMathFunction(raw, contextFontSize) {
23482
+ const match = MATH_FN_RE.exec(raw);
23483
+ if (!match || !match[1] || !match[2]) return null;
23484
+ const fn = match[1];
23485
+ const inner = match[2];
23486
+ const args = splitMathArgs(inner);
23487
+ if (args === null) return null;
23488
+ const values = [];
23489
+ for (let i = 0; i < args.length; i++) {
23490
+ const arg = args[i];
23491
+ if (!arg) return null;
23492
+ const px = parsePxValue(arg.trim(), contextFontSize);
23493
+ if (px === null) return null;
23494
+ values.push(px);
23495
+ }
23496
+ if (values.length === 0) return null;
23497
+ if (fn === "min") return Math.min(...values);
23498
+ if (fn === "max") return Math.max(...values);
23499
+ if (fn === "clamp") {
23500
+ if (values.length !== 3) return null;
23501
+ const [lo, val, hi] = values;
23502
+ return Math.max(lo, Math.min(val, hi));
23503
+ }
23504
+ return null;
23505
+ }
23506
+ function splitMathArgs(inner) {
23507
+ const args = [];
23508
+ let depth = 0;
23509
+ let start = 0;
23510
+ for (let i = 0; i < inner.length; i++) {
23511
+ const ch = inner[i];
23512
+ if (ch === "(") depth++;
23513
+ else if (ch === ")") {
23514
+ if (depth > 0) depth--;
23515
+ else return null;
23516
+ } else if (ch === "," && depth === 0) {
23517
+ const arg = inner.slice(start, i).trim();
23518
+ if (arg.length === 0) return null;
23519
+ args.push(arg);
23520
+ start = i + 1;
23521
+ }
23522
+ }
23523
+ if (depth !== 0) return null;
23524
+ const tail = inner.slice(start).trim();
23525
+ if (tail.length === 0) return null;
23526
+ args.push(tail);
23527
+ return args;
23528
+ }
23390
23529
  function parseUnitlessValue(raw) {
23391
23530
  const trimmed = raw.trim().toLowerCase();
23392
23531
  if (trimmed.length === 0) return null;
@@ -25810,14 +25949,16 @@ function walkAndProcess(graph, file, container, context, collector) {
25810
25949
  if (parentAtRule) {
25811
25950
  parentAtRule.rules.push(rule);
25812
25951
  }
25813
- const selectorStrings = parseSelectorList(rule.selectorText);
25814
- for (let j = 0; j < selectorStrings.length; j++) {
25815
- const selectorText = selectorStrings[j];
25816
- if (!selectorText) continue;
25817
- const selector = createSelectorEntity(graph, selectorText, rule);
25818
- graph.addSelector(selector);
25819
- rule.selectors.push(selector);
25820
- graph.registerRuleBySelector(selectorText, rule);
25952
+ if (parentAtRule === null || parentAtRule.kind !== "keyframes") {
25953
+ const selectorStrings = parseSelectorList(rule.selectorText);
25954
+ for (let j = 0; j < selectorStrings.length; j++) {
25955
+ const selectorText = selectorStrings[j];
25956
+ if (!selectorText) continue;
25957
+ const selector = createSelectorEntity(graph, selectorText, rule);
25958
+ graph.addSelector(selector);
25959
+ rule.selectors.push(selector);
25960
+ graph.registerRuleBySelector(selectorText, rule);
25961
+ }
25821
25962
  }
25822
25963
  const ruleChildren = ruleNode.nodes;
25823
25964
  if (ruleChildren && ruleChildren.length > 0) {
@@ -30770,6 +30911,8 @@ var layoutSignalNames = [
30770
30911
  "min-width",
30771
30912
  "min-block-size",
30772
30913
  "min-height",
30914
+ "max-width",
30915
+ "max-height",
30773
30916
  "aspect-ratio",
30774
30917
  "vertical-align",
30775
30918
  "display",
@@ -30788,6 +30931,7 @@ var layoutSignalNames = [
30788
30931
  "place-items",
30789
30932
  "place-self",
30790
30933
  "flex-direction",
30934
+ "flex-basis",
30791
30935
  "grid-auto-flow",
30792
30936
  "appearance",
30793
30937
  "box-sizing",
@@ -30979,6 +31123,7 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
30979
31123
  "border-width",
30980
31124
  "margin-block",
30981
31125
  "padding-block",
31126
+ "padding-inline",
30982
31127
  "inset-block",
30983
31128
  "flex-flow"
30984
31129
  ]);
@@ -30991,6 +31136,9 @@ var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
30991
31136
  "min-width",
30992
31137
  "min-block-size",
30993
31138
  "min-height",
31139
+ "max-width",
31140
+ "max-height",
31141
+ "flex-basis",
30994
31142
  "top",
30995
31143
  "bottom",
30996
31144
  "margin-top",
@@ -31186,7 +31334,12 @@ var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
31186
31334
  "fit-content",
31187
31335
  "min-content",
31188
31336
  "max-content",
31189
- "stretch"
31337
+ "stretch",
31338
+ "inherit",
31339
+ "initial",
31340
+ "unset",
31341
+ "revert",
31342
+ "revert-layer"
31190
31343
  ]);
31191
31344
  function parseLength(name, raw, source, guard) {
31192
31345
  const px = parseSignedPxValue(raw);
@@ -31235,12 +31388,8 @@ function parseTranslateProperty(name, raw, source, guard) {
31235
31388
  }
31236
31389
  function hasDynamicExpression(raw) {
31237
31390
  if (raw.includes("var(")) return true;
31238
- if (raw.includes("calc(")) return true;
31239
31391
  if (raw.includes("env(")) return true;
31240
31392
  if (raw.includes("attr(")) return true;
31241
- if (raw.includes("min(")) return true;
31242
- if (raw.includes("max(")) return true;
31243
- if (raw.includes("clamp(")) return true;
31244
31393
  return false;
31245
31394
  }
31246
31395
  function createKnown(name, normalized, source, guard, px, unit, quality) {
@@ -32349,23 +32498,44 @@ function collectCSSScopeBySolidFile(solids, css, moduleResolver) {
32349
32498
  if (!imp) continue;
32350
32499
  if (imp.isTypeOnly) continue;
32351
32500
  const resolvedCssPath = resolver.resolveCss(solid.file, imp.source);
32352
- if (resolvedCssPath === null) continue;
32353
- const transitiveScope = getOrCollectTransitiveScope(
32354
- resolvedCssPath,
32355
- resolver,
32356
- cssFilesByNormalizedPath,
32357
- transitiveScopeByEntryPath
32358
- );
32359
- for (let k = 0; k < transitiveScope.length; k++) {
32360
- const ts137 = transitiveScope[k];
32361
- if (!ts137) continue;
32362
- scope.add(ts137);
32501
+ if (resolvedCssPath !== null) {
32502
+ const transitiveScope = getOrCollectTransitiveScope(
32503
+ resolvedCssPath,
32504
+ resolver,
32505
+ cssFilesByNormalizedPath,
32506
+ transitiveScopeByEntryPath
32507
+ );
32508
+ for (let k = 0; k < transitiveScope.length; k++) {
32509
+ const ts137 = transitiveScope[k];
32510
+ if (!ts137) continue;
32511
+ scope.add(ts137);
32512
+ }
32513
+ if (imp.specifiers.length === 0) {
32514
+ for (let k = 0; k < transitiveScope.length; k++) {
32515
+ const ts137 = transitiveScope[k];
32516
+ if (!ts137) continue;
32517
+ globalSideEffectScope.add(ts137);
32518
+ }
32519
+ }
32363
32520
  }
32364
- if (imp.specifiers.length !== 0) continue;
32365
- for (let k = 0; k < transitiveScope.length; k++) {
32366
- const ts137 = transitiveScope[k];
32367
- if (!ts137) continue;
32368
- globalSideEffectScope.add(ts137);
32521
+ if (imp.specifiers.length !== 0) {
32522
+ const resolvedSolidPath = resolver.resolveSolid(solid.file, imp.source);
32523
+ if (resolvedSolidPath !== null) {
32524
+ const componentCssPath = resolveColocatedCss(resolvedSolidPath, cssFilesByNormalizedPath);
32525
+ if (componentCssPath !== null) {
32526
+ const componentCssScope = getOrCollectTransitiveScope(
32527
+ componentCssPath,
32528
+ resolver,
32529
+ cssFilesByNormalizedPath,
32530
+ transitiveScopeByEntryPath
32531
+ );
32532
+ for (let k = 0; k < componentCssScope.length; k++) {
32533
+ const cs = componentCssScope[k];
32534
+ if (!cs) continue;
32535
+ scope.add(cs);
32536
+ }
32537
+ }
32538
+ }
32369
32539
  }
32370
32540
  }
32371
32541
  localScopeBySolidFile.set(solid.file, scope);
@@ -32587,6 +32757,7 @@ var import_node_fs5 = require("fs");
32587
32757
  var import_node_path4 = require("path");
32588
32758
  var import_typescript126 = __toESM(require("typescript"), 1);
32589
32759
  var EMPTY_ATTRIBUTES = /* @__PURE__ */ new Map();
32760
+ var EMPTY_PROP_BINDINGS = /* @__PURE__ */ new Map();
32590
32761
  var TRANSPARENT_SOLID_PRIMITIVES = /* @__PURE__ */ new Set([
32591
32762
  "For",
32592
32763
  "Index",
@@ -32655,9 +32826,10 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
32655
32826
  const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
32656
32827
  const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
32657
32828
  const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
32829
+ const attributePropBindings = innerHost !== null ? mergePropBindings(entry.attributePropBindings, innerHost.descriptor.attributePropBindings) : entry.attributePropBindings;
32658
32830
  if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
32659
32831
  return {
32660
- descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
32832
+ descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren, attributePropBindings },
32661
32833
  hostElementRef: innerHost?.hostElementRef ?? null
32662
32834
  };
32663
32835
  }
@@ -33084,7 +33256,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
33084
33256
  tagName: element.tagName,
33085
33257
  staticAttributes: collectStaticAttributes(element),
33086
33258
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
33087
- forwardsChildren: detectChildrenForwarding(element)
33259
+ forwardsChildren: detectChildrenForwarding(element),
33260
+ attributePropBindings: collectAttributePropBindings(element)
33088
33261
  },
33089
33262
  hostElementRef: { solid: graph, element }
33090
33263
  };
@@ -33099,7 +33272,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
33099
33272
  filePath: graph.file,
33100
33273
  staticAttributes: collectStaticAttributes(element),
33101
33274
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
33102
- forwardsChildren: detectChildrenForwarding(element)
33275
+ forwardsChildren: detectChildrenForwarding(element),
33276
+ attributePropBindings: collectAttributePropBindings(element)
33103
33277
  };
33104
33278
  }
33105
33279
  function isContextProviderTag(tag) {
@@ -33287,6 +33461,41 @@ function collectStaticAttributes(element) {
33287
33461
  if (out === null) return EMPTY_ATTRIBUTES;
33288
33462
  return out;
33289
33463
  }
33464
+ function extractPropMemberName(node) {
33465
+ if (!import_typescript126.default.isJsxExpression(node)) return null;
33466
+ const expression = node.expression;
33467
+ if (!expression) return null;
33468
+ return extractMemberNameFromExpression(expression);
33469
+ }
33470
+ function extractMemberNameFromExpression(expression) {
33471
+ if (import_typescript126.default.isPropertyAccessExpression(expression)) {
33472
+ return expression.name.text;
33473
+ }
33474
+ if (import_typescript126.default.isCallExpression(expression) && import_typescript126.default.isPropertyAccessExpression(expression.expression) && expression.arguments.length === 0) {
33475
+ return expression.expression.name.text;
33476
+ }
33477
+ if (import_typescript126.default.isBinaryExpression(expression) && expression.operatorToken.kind === import_typescript126.default.SyntaxKind.QuestionQuestionToken) {
33478
+ return extractMemberNameFromExpression(expression.left);
33479
+ }
33480
+ return null;
33481
+ }
33482
+ function collectAttributePropBindings(element) {
33483
+ let out = null;
33484
+ for (let i = 0; i < element.attributes.length; i++) {
33485
+ const attribute = element.attributes[i];
33486
+ if (!attribute) continue;
33487
+ if (!import_typescript126.default.isJsxAttribute(attribute.node)) continue;
33488
+ if (!attribute.name) continue;
33489
+ if (attribute.valueNode === null) continue;
33490
+ const propName = extractPropMemberName(attribute.valueNode);
33491
+ if (propName === null) continue;
33492
+ const attrName = attribute.name.toLowerCase();
33493
+ if (out === null) out = /* @__PURE__ */ new Map();
33494
+ out.set(attrName, propName);
33495
+ }
33496
+ if (out === null) return EMPTY_PROP_BINDINGS;
33497
+ return out;
33498
+ }
33290
33499
  function collectTopLevelVariableInitializers(graph) {
33291
33500
  const out = /* @__PURE__ */ new Map();
33292
33501
  for (let i = 0; i < graph.variables.length; i++) {
@@ -33412,7 +33621,12 @@ function areHostDescriptorsEqual(left, right) {
33412
33621
  if (left.tagName !== right.tagName) return false;
33413
33622
  if (left.forwardsChildren !== right.forwardsChildren) return false;
33414
33623
  if (!areStringListsEqual(left.staticClassTokens, right.staticClassTokens)) return false;
33415
- return areAttributeMapsEqual(left.staticAttributes, right.staticAttributes);
33624
+ if (!areAttributeMapsEqual(left.staticAttributes, right.staticAttributes)) return false;
33625
+ if (left.attributePropBindings.size !== right.attributePropBindings.size) return false;
33626
+ for (const [key, value2] of left.attributePropBindings) {
33627
+ if (right.attributePropBindings.get(key) !== value2) return false;
33628
+ }
33629
+ return true;
33416
33630
  }
33417
33631
  function areComponentHostEntriesEqual(left, right) {
33418
33632
  if (left.resolution !== right.resolution) return false;
@@ -33455,6 +33669,18 @@ function mergeStaticAttributes(outer, inner) {
33455
33669
  }
33456
33670
  return out;
33457
33671
  }
33672
+ function mergePropBindings(outer, inner) {
33673
+ if (inner.size === 0) return outer;
33674
+ if (outer.size === 0) return inner;
33675
+ const out = /* @__PURE__ */ new Map();
33676
+ for (const [name, value2] of inner) {
33677
+ out.set(name, value2);
33678
+ }
33679
+ for (const [name, value2] of outer) {
33680
+ out.set(name, value2);
33681
+ }
33682
+ return out;
33683
+ }
33458
33684
  var HTML_TAG_NAMES = /* @__PURE__ */ new Set([
33459
33685
  "a",
33460
33686
  "abbr",
@@ -36270,6 +36496,9 @@ var BLOCK_EXPANSIONS = /* @__PURE__ */ new Map([
36270
36496
  ["padding-block", ["padding-top", "padding-bottom"]],
36271
36497
  ["inset-block", ["inset-block-start", "inset-block-end"]]
36272
36498
  ]);
36499
+ var INLINE_EXPANSIONS = /* @__PURE__ */ new Map([
36500
+ ["padding-inline", ["padding-left", "padding-right"]]
36501
+ ]);
36273
36502
  function expandShorthand(property, value2) {
36274
36503
  const quadTarget = QUAD_EXPANSIONS.get(property);
36275
36504
  if (quadTarget !== void 0) {
@@ -36291,6 +36520,15 @@ function expandShorthand(property, value2) {
36291
36520
  { name: blockTarget[1], value: parsed.end }
36292
36521
  ];
36293
36522
  }
36523
+ const inlineTarget = INLINE_EXPANSIONS.get(property);
36524
+ if (inlineTarget !== void 0) {
36525
+ const parsed = parseBlockShorthand(value2);
36526
+ if (parsed === null) return null;
36527
+ return [
36528
+ { name: inlineTarget[0], value: parsed.start },
36529
+ { name: inlineTarget[1], value: parsed.end }
36530
+ ];
36531
+ }
36294
36532
  if (property === "flex-flow") {
36295
36533
  return expandFlexFlow(value2);
36296
36534
  }
@@ -36328,6 +36566,8 @@ function getShorthandLonghandNames(property) {
36328
36566
  if (quad !== void 0) return [...quad];
36329
36567
  const block = BLOCK_EXPANSIONS.get(property);
36330
36568
  if (block !== void 0) return [...block];
36569
+ const inline = INLINE_EXPANSIONS.get(property);
36570
+ if (inline !== void 0) return [...inline];
36331
36571
  if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
36332
36572
  return null;
36333
36573
  }
@@ -36549,7 +36789,7 @@ var DYNAMIC_ATTRIBUTE_GUARD = {
36549
36789
  key: "dynamic-attribute:*"
36550
36790
  };
36551
36791
  var SCROLLABLE_VALUES = /* @__PURE__ */ new Set(["auto", "scroll"]);
36552
- function collectMonitoredDeclarations(selector, layerOrder, guard) {
36792
+ function collectMonitoredDeclarations(selector, layerOrder, guard, variablesByName) {
36553
36793
  const out = [];
36554
36794
  const declarations = selector.rule.declarations;
36555
36795
  for (let i = 0; i < declarations.length; i++) {
@@ -36565,12 +36805,14 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36565
36805
  specificityScore: selector.specificityScore,
36566
36806
  isImportant: declaration.cascadePosition.isImportant || declaration.node.important
36567
36807
  };
36808
+ const rawValue = declaration.value;
36809
+ const resolvedValue = variablesByName !== null && rawValue.includes("var(") ? substituteVarReferences(rawValue, variablesByName, 0) : rawValue;
36568
36810
  const directSignal = MONITORED_SIGNAL_NAME_MAP.get(property);
36569
36811
  if (directSignal !== void 0) {
36570
- out.push({ property: directSignal, value: declaration.value, guardProvenance: guard, position });
36812
+ out.push({ property: directSignal, value: resolvedValue, guardProvenance: guard, position });
36571
36813
  continue;
36572
36814
  }
36573
- const value2 = declaration.value.trim().toLowerCase();
36815
+ const value2 = resolvedValue.trim().toLowerCase();
36574
36816
  const expanded = expandShorthand(property, value2);
36575
36817
  if (expanded === void 0) continue;
36576
36818
  if (expanded === null) {
@@ -36581,7 +36823,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36581
36823
  if (!longhand) continue;
36582
36824
  const signal = MONITORED_SIGNAL_NAME_MAP.get(longhand);
36583
36825
  if (signal === void 0) continue;
36584
- out.push({ property: signal, value: declaration.value, guardProvenance: guard, position });
36826
+ out.push({ property: signal, value: resolvedValue, guardProvenance: guard, position });
36585
36827
  }
36586
36828
  continue;
36587
36829
  }
@@ -36675,6 +36917,40 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
36675
36917
  }
36676
36918
  }
36677
36919
  }
36920
+ var MAX_VAR_SUBSTITUTION_DEPTH = 10;
36921
+ function substituteVarReferences(value2, variablesByName, depth) {
36922
+ if (depth >= MAX_VAR_SUBSTITUTION_DEPTH) return value2;
36923
+ const refs = extractVarReferences(value2);
36924
+ if (refs.length === 0) return value2;
36925
+ let result = value2;
36926
+ for (let i = refs.length - 1; i >= 0; i--) {
36927
+ const ref = refs[i];
36928
+ if (!ref) continue;
36929
+ const candidates = variablesByName.get(ref.name);
36930
+ const resolvedValue = candidates !== void 0 && candidates.length > 0 ? selectBestVariableValue(candidates) : ref.fallback;
36931
+ if (resolvedValue === null) continue;
36932
+ result = result.slice(0, ref.sourceIndex) + resolvedValue + result.slice(ref.sourceIndex + ref.raw.length);
36933
+ }
36934
+ if (result !== value2 && result.includes("var(")) {
36935
+ return substituteVarReferences(result, variablesByName, depth + 1);
36936
+ }
36937
+ return result;
36938
+ }
36939
+ function selectBestVariableValue(candidates) {
36940
+ let bestGlobal = null;
36941
+ for (let i = 0; i < candidates.length; i++) {
36942
+ const candidate = candidates[i];
36943
+ if (!candidate) continue;
36944
+ if (candidate.scope.type === "global") {
36945
+ if (bestGlobal === null || candidate.declaration.sourceOrder > bestGlobal.declaration.sourceOrder) {
36946
+ bestGlobal = candidate;
36947
+ }
36948
+ }
36949
+ }
36950
+ if (bestGlobal !== null) return bestGlobal.value;
36951
+ const first = candidates[0];
36952
+ return first ? first.value : null;
36953
+ }
36678
36954
  function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind) {
36679
36955
  const out = /* @__PURE__ */ new Map();
36680
36956
  const positions = /* @__PURE__ */ new Map();
@@ -37135,7 +37411,7 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
37135
37411
  const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
37136
37412
  const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
37137
37413
  const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
37138
- const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
37414
+ const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes, meta.resolvedHost?.descriptor.attributePropBindings);
37139
37415
  const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
37140
37416
  const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
37141
37417
  const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
@@ -37191,7 +37467,63 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
37191
37467
  function resolveHostForElement(componentHostResolver, solidFile, element) {
37192
37468
  if (element.tag === null) return null;
37193
37469
  if (element.isDomElement) return null;
37194
- return componentHostResolver.resolveHost(solidFile, element.tag);
37470
+ const defaultHost = componentHostResolver.resolveHost(solidFile, element.tag);
37471
+ const asTag = extractPolymorphicAsTag(element);
37472
+ if (asTag !== null) {
37473
+ const asHost = componentHostResolver.resolveHost(solidFile, asTag);
37474
+ if (asHost !== null) return composePolymorphicHost(defaultHost, asHost);
37475
+ }
37476
+ return defaultHost;
37477
+ }
37478
+ function extractPolymorphicAsTag(element) {
37479
+ for (let i = 0; i < element.attributes.length; i++) {
37480
+ const attr = element.attributes[i];
37481
+ if (!attr) continue;
37482
+ if (attr.name !== "as") continue;
37483
+ if (attr.valueNode === null) continue;
37484
+ if (!import_typescript127.default.isJsxExpression(attr.valueNode)) continue;
37485
+ const expression = attr.valueNode.expression;
37486
+ if (!expression) continue;
37487
+ if (import_typescript127.default.isIdentifier(expression)) return expression.text;
37488
+ if (import_typescript127.default.isPropertyAccessExpression(expression)) return expression.getText();
37489
+ return null;
37490
+ }
37491
+ return null;
37492
+ }
37493
+ function composePolymorphicHost(outerHost, asHost) {
37494
+ if (outerHost === null) return asHost;
37495
+ const outerDesc = outerHost.descriptor;
37496
+ const asDesc = asHost.descriptor;
37497
+ const staticAttributes = /* @__PURE__ */ new Map();
37498
+ for (const [name, value2] of outerDesc.staticAttributes) staticAttributes.set(name, value2);
37499
+ for (const [name, value2] of asDesc.staticAttributes) staticAttributes.set(name, value2);
37500
+ const classTokenSet = /* @__PURE__ */ new Set();
37501
+ const staticClassTokens = [];
37502
+ for (const token of outerDesc.staticClassTokens) {
37503
+ if (!classTokenSet.has(token)) {
37504
+ classTokenSet.add(token);
37505
+ staticClassTokens.push(token);
37506
+ }
37507
+ }
37508
+ for (const token of asDesc.staticClassTokens) {
37509
+ if (!classTokenSet.has(token)) {
37510
+ classTokenSet.add(token);
37511
+ staticClassTokens.push(token);
37512
+ }
37513
+ }
37514
+ const attributePropBindings = /* @__PURE__ */ new Map();
37515
+ for (const [name, value2] of outerDesc.attributePropBindings) attributePropBindings.set(name, value2);
37516
+ for (const [name, value2] of asDesc.attributePropBindings) attributePropBindings.set(name, value2);
37517
+ return {
37518
+ descriptor: {
37519
+ tagName: asDesc.tagName ?? outerDesc.tagName,
37520
+ staticAttributes,
37521
+ staticClassTokens,
37522
+ forwardsChildren: asDesc.forwardsChildren || outerDesc.forwardsChildren,
37523
+ attributePropBindings
37524
+ },
37525
+ hostElementRef: asHost.hostElementRef ?? outerHost.hostElementRef
37526
+ };
37195
37527
  }
37196
37528
  function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
37197
37529
  if (element.tag === null) return false;
@@ -37234,11 +37566,21 @@ function mergeClassTokens(localTokens, hostTokens) {
37234
37566
  }
37235
37567
  return out;
37236
37568
  }
37237
- function mergeAttributes(localAttributes, hostAttributes) {
37569
+ function mergeAttributes(localAttributes, hostAttributes, propBindings) {
37238
37570
  if (hostAttributes === void 0 || hostAttributes.size === 0) return localAttributes;
37239
- if (localAttributes.size === 0) return hostAttributes;
37571
+ if (localAttributes.size === 0 && (propBindings === void 0 || propBindings.size === 0)) return hostAttributes;
37240
37572
  const out = /* @__PURE__ */ new Map();
37241
37573
  for (const [name, value2] of hostAttributes) {
37574
+ if (propBindings !== void 0) {
37575
+ const propName = propBindings.get(name);
37576
+ if (propName !== void 0) {
37577
+ const callSiteValue = localAttributes.get(propName);
37578
+ if (callSiteValue !== void 0 && callSiteValue !== null) {
37579
+ out.set(name, callSiteValue);
37580
+ continue;
37581
+ }
37582
+ }
37583
+ }
37242
37584
  out.set(name, value2);
37243
37585
  }
37244
37586
  for (const [name, value2] of localAttributes) {
@@ -37305,7 +37647,7 @@ function resolveSiblingTypeCount(totalsByParentId, parentElementId, tagName, sib
37305
37647
  // src/cross-file/layout/build.ts
37306
37648
  var EMPTY_NUMBER_LIST2 = [];
37307
37649
  var EMPTY_EDGE_LIST = Object.freeze([]);
37308
- var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch"]);
37650
+ var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch", "inherit", "initial", "unset", "revert", "revert-layer"]);
37309
37651
  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"]);
37310
37652
  function buildLayoutGraph(solids, css, logger = noopLogger) {
37311
37653
  const perf = createLayoutPerfStats();
@@ -37335,7 +37677,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
37335
37677
  const monitoredDeclarations = collectMonitoredDeclarations(
37336
37678
  selector,
37337
37679
  resolveRuleLayerOrder(selector.rule, css),
37338
- guard
37680
+ guard,
37681
+ css.variablesByName
37339
37682
  );
37340
37683
  selectorsById.set(selector.id, selector);
37341
37684
  monitoredDeclarationsBySelectorId.set(selector.id, monitoredDeclarations);
@@ -37888,7 +38231,7 @@ function computeReservedSpaceFact(snapshot) {
37888
38231
  hasContainIntrinsicSize: hasContainIntrinsic,
37889
38232
  hasUsableAspectRatio: hasAspectRatio,
37890
38233
  hasDeclaredBlockDimension: hasHeight || hasBlockSize || hasMinHeight || hasMinBlockSize,
37891
- hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || isBlockLevelDisplay(snapshot)
38234
+ hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || hasDeclaredDimension(snapshot, "flex-basis") || isBlockLevelDisplay(snapshot)
37892
38235
  };
37893
38236
  }
37894
38237
  function hasDeclaredDimension(snapshot, property) {
@@ -41038,6 +41381,9 @@ function isVisuallyHidden(snapshot) {
41038
41381
  const opacityAttr = node.inlineStyleValues.get("opacity");
41039
41382
  if (opacityAttr === "0") return true;
41040
41383
  if (node.classTokenSet.has("opacity-0")) return true;
41384
+ const width = readKnownPx(snapshot, "width");
41385
+ const height = readKnownPx(snapshot, "height");
41386
+ if (width === 1 && height === 1) return true;
41041
41387
  return false;
41042
41388
  }
41043
41389
  var jsxLayoutPolicyTouchTarget = defineCrossRule({
@@ -41089,6 +41435,18 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
41089
41435
  tag,
41090
41436
  policyName
41091
41437
  );
41438
+ checkDimension(
41439
+ snapshot,
41440
+ "max-height",
41441
+ kind === "button" ? policy.minButtonHeight : policy.minInputHeight,
41442
+ layout,
41443
+ node,
41444
+ emit,
41445
+ "heightTooSmall",
41446
+ messages161.heightTooSmall,
41447
+ tag,
41448
+ policyName
41449
+ );
41092
41450
  checkDimension(
41093
41451
  snapshot,
41094
41452
  "width",
@@ -41113,6 +41471,18 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
41113
41471
  tag,
41114
41472
  policyName
41115
41473
  );
41474
+ checkDimension(
41475
+ snapshot,
41476
+ "max-width",
41477
+ kind === "button" ? policy.minButtonWidth : policy.minTouchTarget,
41478
+ layout,
41479
+ node,
41480
+ emit,
41481
+ "widthTooSmall",
41482
+ messages161.widthTooSmall,
41483
+ tag,
41484
+ policyName
41485
+ );
41116
41486
  if (kind === "button") {
41117
41487
  checkDimension(
41118
41488
  snapshot,
@@ -41170,7 +41540,13 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
41170
41540
  }
41171
41541
  });
41172
41542
  function checkDimension(snapshot, signal, min, layout, node, emit, messageId, template, tag, policyName) {
41173
- const px = readKnownPx(snapshot, signal);
41543
+ let px = readKnownPx(snapshot, signal);
41544
+ if (px === null) {
41545
+ const signalValue = readKnownSignalWithGuard(snapshot, signal);
41546
+ if (signalValue !== null && signalValue.guard.kind === 1 /* Conditional */) {
41547
+ px = resolveUnconditionalFallbackPx(layout, node, signal);
41548
+ }
41549
+ }
41174
41550
  if (px === null) return;
41175
41551
  if (px >= min) return;
41176
41552
  emitLayoutDiagnostic(
@@ -41190,6 +41566,20 @@ function checkDimension(snapshot, signal, min, layout, node, emit, messageId, te
41190
41566
  }
41191
41567
  );
41192
41568
  }
41569
+ function resolveUnconditionalFallbackPx(layout, node, signal) {
41570
+ const delta = readConditionalSignalDeltaFact(layout, node, signal);
41571
+ if (!delta.hasConditional) return null;
41572
+ const values = delta.unconditionalValues;
41573
+ let bestPx = null;
41574
+ for (let i = 0; i < values.length; i++) {
41575
+ const raw = values[i];
41576
+ if (!raw) continue;
41577
+ const px = parsePxValue(raw);
41578
+ if (px === null) continue;
41579
+ if (bestPx === null || px > bestPx) bestPx = px;
41580
+ }
41581
+ return bestPx;
41582
+ }
41193
41583
 
41194
41584
  // src/cross-file/rules/index.ts
41195
41585
  var rules3 = [