@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.
@@ -4018,6 +4018,10 @@ function getStaticStringFromJSXValue(node) {
4018
4018
  if (ts7.isTemplateExpression(expression) && expression.templateSpans.length === 0) {
4019
4019
  return expression.head.text;
4020
4020
  }
4021
+ if (ts7.isBinaryExpression(expression) && expression.operatorToken.kind === ts7.SyntaxKind.QuestionQuestionToken) {
4022
+ const fallback = getStaticStringFromJSXValue(expression.right);
4023
+ if (fallback !== null) return fallback;
4024
+ }
4021
4025
  }
4022
4026
  return null;
4023
4027
  }
@@ -23551,7 +23555,7 @@ function splitWhitespaceTokens(value2) {
23551
23555
  return out;
23552
23556
  }
23553
23557
  function parseQuadShorthand(raw) {
23554
- const parts = splitWhitespaceTokens(raw);
23558
+ const parts = splitTopLevelWhitespace(raw);
23555
23559
  if (parts.length === 1) {
23556
23560
  const p0 = parts[0];
23557
23561
  if (!p0) return null;
@@ -23575,7 +23579,7 @@ function parseQuadShorthand(raw) {
23575
23579
  return null;
23576
23580
  }
23577
23581
  function parseBlockShorthand(raw) {
23578
- const parts = splitWhitespaceTokens(raw);
23582
+ const parts = splitTopLevelWhitespace(raw);
23579
23583
  if (parts.length === 1) {
23580
23584
  const p0 = parts[0];
23581
23585
  if (!p0) return null;
@@ -23660,8 +23664,14 @@ var NUMERIC_VALUE = /^([0-9]*\.?[0-9]+)(px|rem|em|pt)?$/;
23660
23664
  function parsePxValue(raw, contextFontSize = 16) {
23661
23665
  const trimmed = raw.trim().toLowerCase();
23662
23666
  if (trimmed.length === 0) return null;
23663
- if (trimmed.includes("var(") || trimmed.includes("calc(") || trimmed.includes("%")) return null;
23667
+ if (trimmed.includes("var(") || trimmed.includes("%")) return null;
23664
23668
  if (CSS_WIDE_KEYWORDS.has(trimmed)) return null;
23669
+ if (trimmed.includes("calc(")) {
23670
+ return tryEvalConstantCalc(trimmed, contextFontSize);
23671
+ }
23672
+ if (trimmed.startsWith("min(") || trimmed.startsWith("max(") || trimmed.startsWith("clamp(")) {
23673
+ return tryEvalMathFunction(trimmed, contextFontSize);
23674
+ }
23665
23675
  const match = NUMERIC_VALUE.exec(trimmed);
23666
23676
  if (!match) return null;
23667
23677
  const num = Number(match[1]);
@@ -23672,6 +23682,135 @@ function parsePxValue(raw, contextFontSize = 16) {
23672
23682
  if (unit === "pt") return num * 1.333;
23673
23683
  return null;
23674
23684
  }
23685
+ var CALC_CONSTANT_RE = /^calc\((.+)\)$/;
23686
+ var CALC_TOKEN_RE = /([0-9]*\.?[0-9]+)(px|rem|em|pt)?|([+\-*/])/g;
23687
+ function tryEvalConstantCalc(raw, contextFontSize) {
23688
+ const match = CALC_CONSTANT_RE.exec(raw);
23689
+ if (!match || !match[1]) return null;
23690
+ const inner = match[1].trim();
23691
+ if (inner.includes("var(") || inner.includes("%") || inner.includes("env(") || inner.includes("calc(")) return null;
23692
+ const values = [];
23693
+ const operators = [];
23694
+ let lastWasValue = false;
23695
+ CALC_TOKEN_RE.lastIndex = 0;
23696
+ let tokenMatch;
23697
+ while ((tokenMatch = CALC_TOKEN_RE.exec(inner)) !== null) {
23698
+ const op = tokenMatch[3];
23699
+ if (op !== void 0) {
23700
+ if (!lastWasValue && op === "-") {
23701
+ const nextToken = CALC_TOKEN_RE.exec(inner);
23702
+ if (!nextToken || nextToken[3] !== void 0) return null;
23703
+ const px2 = calcTokenToPx(nextToken, contextFontSize);
23704
+ if (px2 === null) return null;
23705
+ values.push(-px2);
23706
+ lastWasValue = true;
23707
+ continue;
23708
+ }
23709
+ if (!lastWasValue) return null;
23710
+ operators.push(op);
23711
+ lastWasValue = false;
23712
+ continue;
23713
+ }
23714
+ const px = calcTokenToPx(tokenMatch, contextFontSize);
23715
+ if (px === null) return null;
23716
+ values.push(px);
23717
+ lastWasValue = true;
23718
+ }
23719
+ if (values.length === 0 || values.length !== operators.length + 1) return null;
23720
+ const firstValue = values[0];
23721
+ if (firstValue === void 0) return null;
23722
+ const reducedValues = [firstValue];
23723
+ const reducedOps = [];
23724
+ for (let i = 0; i < operators.length; i++) {
23725
+ const op = operators[i];
23726
+ const right = values[i + 1];
23727
+ if (op === void 0 || right === void 0) return null;
23728
+ if (op === "*") {
23729
+ const last = reducedValues[reducedValues.length - 1];
23730
+ if (last === void 0) return null;
23731
+ reducedValues[reducedValues.length - 1] = last * right;
23732
+ } else if (op === "/") {
23733
+ if (right === 0) return null;
23734
+ const last = reducedValues[reducedValues.length - 1];
23735
+ if (last === void 0) return null;
23736
+ reducedValues[reducedValues.length - 1] = last / right;
23737
+ } else {
23738
+ reducedValues.push(right);
23739
+ reducedOps.push(op);
23740
+ }
23741
+ }
23742
+ const base = reducedValues[0];
23743
+ if (base === void 0) return null;
23744
+ let result = base;
23745
+ for (let i = 0; i < reducedOps.length; i++) {
23746
+ const op = reducedOps[i];
23747
+ const right = reducedValues[i + 1];
23748
+ if (op === void 0 || right === void 0) return null;
23749
+ if (op === "+") result += right;
23750
+ else if (op === "-") result -= right;
23751
+ else return null;
23752
+ }
23753
+ return Number.isFinite(result) ? result : null;
23754
+ }
23755
+ function calcTokenToPx(tokenMatch, contextFontSize) {
23756
+ const num = Number(tokenMatch[1]);
23757
+ if (Number.isNaN(num)) return null;
23758
+ const unit = tokenMatch[2] ?? "";
23759
+ if (unit === "px" || unit === "") return num;
23760
+ if (unit === "rem") return num * 16;
23761
+ if (unit === "em") return num * contextFontSize;
23762
+ if (unit === "pt") return num * 1.333;
23763
+ return null;
23764
+ }
23765
+ var MATH_FN_RE = /^(min|max|clamp)\((.+)\)$/;
23766
+ function tryEvalMathFunction(raw, contextFontSize) {
23767
+ const match = MATH_FN_RE.exec(raw);
23768
+ if (!match || !match[1] || !match[2]) return null;
23769
+ const fn = match[1];
23770
+ const inner = match[2];
23771
+ const args = splitMathArgs(inner);
23772
+ if (args === null) return null;
23773
+ const values = [];
23774
+ for (let i = 0; i < args.length; i++) {
23775
+ const arg = args[i];
23776
+ if (!arg) return null;
23777
+ const px = parsePxValue(arg.trim(), contextFontSize);
23778
+ if (px === null) return null;
23779
+ values.push(px);
23780
+ }
23781
+ if (values.length === 0) return null;
23782
+ if (fn === "min") return Math.min(...values);
23783
+ if (fn === "max") return Math.max(...values);
23784
+ if (fn === "clamp") {
23785
+ if (values.length !== 3) return null;
23786
+ const [lo, val, hi] = values;
23787
+ return Math.max(lo, Math.min(val, hi));
23788
+ }
23789
+ return null;
23790
+ }
23791
+ function splitMathArgs(inner) {
23792
+ const args = [];
23793
+ let depth = 0;
23794
+ let start = 0;
23795
+ for (let i = 0; i < inner.length; i++) {
23796
+ const ch = inner[i];
23797
+ if (ch === "(") depth++;
23798
+ else if (ch === ")") {
23799
+ if (depth > 0) depth--;
23800
+ else return null;
23801
+ } else if (ch === "," && depth === 0) {
23802
+ const arg = inner.slice(start, i).trim();
23803
+ if (arg.length === 0) return null;
23804
+ args.push(arg);
23805
+ start = i + 1;
23806
+ }
23807
+ }
23808
+ if (depth !== 0) return null;
23809
+ const tail = inner.slice(start).trim();
23810
+ if (tail.length === 0) return null;
23811
+ args.push(tail);
23812
+ return args;
23813
+ }
23675
23814
  function parseUnitlessValue(raw) {
23676
23815
  const trimmed = raw.trim().toLowerCase();
23677
23816
  if (trimmed.length === 0) return null;
@@ -28245,14 +28384,16 @@ function walkAndProcess(graph, file, container, context, collector) {
28245
28384
  if (parentAtRule) {
28246
28385
  parentAtRule.rules.push(rule);
28247
28386
  }
28248
- const selectorStrings = parseSelectorList(rule.selectorText);
28249
- for (let j = 0; j < selectorStrings.length; j++) {
28250
- const selectorText = selectorStrings[j];
28251
- if (!selectorText) continue;
28252
- const selector = createSelectorEntity(graph, selectorText, rule);
28253
- graph.addSelector(selector);
28254
- rule.selectors.push(selector);
28255
- graph.registerRuleBySelector(selectorText, rule);
28387
+ if (parentAtRule === null || parentAtRule.kind !== "keyframes") {
28388
+ const selectorStrings = parseSelectorList(rule.selectorText);
28389
+ for (let j = 0; j < selectorStrings.length; j++) {
28390
+ const selectorText = selectorStrings[j];
28391
+ if (!selectorText) continue;
28392
+ const selector = createSelectorEntity(graph, selectorText, rule);
28393
+ graph.addSelector(selector);
28394
+ rule.selectors.push(selector);
28395
+ graph.registerRuleBySelector(selectorText, rule);
28396
+ }
28256
28397
  }
28257
28398
  const ruleChildren = ruleNode.nodes;
28258
28399
  if (ruleChildren && ruleChildren.length > 0) {
@@ -30721,23 +30862,44 @@ function collectCSSScopeBySolidFile(solids, css, moduleResolver) {
30721
30862
  if (!imp) continue;
30722
30863
  if (imp.isTypeOnly) continue;
30723
30864
  const resolvedCssPath = resolver.resolveCss(solid.file, imp.source);
30724
- if (resolvedCssPath === null) continue;
30725
- const transitiveScope = getOrCollectTransitiveScope(
30726
- resolvedCssPath,
30727
- resolver,
30728
- cssFilesByNormalizedPath,
30729
- transitiveScopeByEntryPath
30730
- );
30731
- for (let k = 0; k < transitiveScope.length; k++) {
30732
- const ts137 = transitiveScope[k];
30733
- if (!ts137) continue;
30734
- scope.add(ts137);
30865
+ if (resolvedCssPath !== null) {
30866
+ const transitiveScope = getOrCollectTransitiveScope(
30867
+ resolvedCssPath,
30868
+ resolver,
30869
+ cssFilesByNormalizedPath,
30870
+ transitiveScopeByEntryPath
30871
+ );
30872
+ for (let k = 0; k < transitiveScope.length; k++) {
30873
+ const ts137 = transitiveScope[k];
30874
+ if (!ts137) continue;
30875
+ scope.add(ts137);
30876
+ }
30877
+ if (imp.specifiers.length === 0) {
30878
+ for (let k = 0; k < transitiveScope.length; k++) {
30879
+ const ts137 = transitiveScope[k];
30880
+ if (!ts137) continue;
30881
+ globalSideEffectScope.add(ts137);
30882
+ }
30883
+ }
30735
30884
  }
30736
- if (imp.specifiers.length !== 0) continue;
30737
- for (let k = 0; k < transitiveScope.length; k++) {
30738
- const ts137 = transitiveScope[k];
30739
- if (!ts137) continue;
30740
- globalSideEffectScope.add(ts137);
30885
+ if (imp.specifiers.length !== 0) {
30886
+ const resolvedSolidPath = resolver.resolveSolid(solid.file, imp.source);
30887
+ if (resolvedSolidPath !== null) {
30888
+ const componentCssPath = resolveColocatedCss(resolvedSolidPath, cssFilesByNormalizedPath);
30889
+ if (componentCssPath !== null) {
30890
+ const componentCssScope = getOrCollectTransitiveScope(
30891
+ componentCssPath,
30892
+ resolver,
30893
+ cssFilesByNormalizedPath,
30894
+ transitiveScopeByEntryPath
30895
+ );
30896
+ for (let k = 0; k < componentCssScope.length; k++) {
30897
+ const cs = componentCssScope[k];
30898
+ if (!cs) continue;
30899
+ scope.add(cs);
30900
+ }
30901
+ }
30902
+ }
30741
30903
  }
30742
30904
  }
30743
30905
  localScopeBySolidFile.set(solid.file, scope);
@@ -30821,6 +30983,8 @@ var layoutSignalNames = [
30821
30983
  "min-width",
30822
30984
  "min-block-size",
30823
30985
  "min-height",
30986
+ "max-width",
30987
+ "max-height",
30824
30988
  "aspect-ratio",
30825
30989
  "vertical-align",
30826
30990
  "display",
@@ -30839,6 +31003,7 @@ var layoutSignalNames = [
30839
31003
  "place-items",
30840
31004
  "place-self",
30841
31005
  "flex-direction",
31006
+ "flex-basis",
30842
31007
  "grid-auto-flow",
30843
31008
  "appearance",
30844
31009
  "box-sizing",
@@ -31107,6 +31272,7 @@ import { readFileSync as readFileSync4 } from "fs";
31107
31272
  import { resolve as resolve4 } from "path";
31108
31273
  import ts123 from "typescript";
31109
31274
  var EMPTY_ATTRIBUTES = /* @__PURE__ */ new Map();
31275
+ var EMPTY_PROP_BINDINGS = /* @__PURE__ */ new Map();
31110
31276
  var TRANSPARENT_SOLID_PRIMITIVES = /* @__PURE__ */ new Set([
31111
31277
  "For",
31112
31278
  "Index",
@@ -31175,9 +31341,10 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31175
31341
  const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
31176
31342
  const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
31177
31343
  const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
31344
+ const attributePropBindings = innerHost !== null ? mergePropBindings(entry.attributePropBindings, innerHost.descriptor.attributePropBindings) : entry.attributePropBindings;
31178
31345
  if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
31179
31346
  return {
31180
- descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
31347
+ descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren, attributePropBindings },
31181
31348
  hostElementRef: innerHost?.hostElementRef ?? null
31182
31349
  };
31183
31350
  }
@@ -31604,7 +31771,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
31604
31771
  tagName: element.tagName,
31605
31772
  staticAttributes: collectStaticAttributes(element),
31606
31773
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
31607
- forwardsChildren: detectChildrenForwarding(element)
31774
+ forwardsChildren: detectChildrenForwarding(element),
31775
+ attributePropBindings: collectAttributePropBindings(element)
31608
31776
  },
31609
31777
  hostElementRef: { solid: graph, element }
31610
31778
  };
@@ -31619,7 +31787,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
31619
31787
  filePath: graph.file,
31620
31788
  staticAttributes: collectStaticAttributes(element),
31621
31789
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
31622
- forwardsChildren: detectChildrenForwarding(element)
31790
+ forwardsChildren: detectChildrenForwarding(element),
31791
+ attributePropBindings: collectAttributePropBindings(element)
31623
31792
  };
31624
31793
  }
31625
31794
  function isContextProviderTag(tag) {
@@ -31807,6 +31976,41 @@ function collectStaticAttributes(element) {
31807
31976
  if (out === null) return EMPTY_ATTRIBUTES;
31808
31977
  return out;
31809
31978
  }
31979
+ function extractPropMemberName(node) {
31980
+ if (!ts123.isJsxExpression(node)) return null;
31981
+ const expression = node.expression;
31982
+ if (!expression) return null;
31983
+ return extractMemberNameFromExpression(expression);
31984
+ }
31985
+ function extractMemberNameFromExpression(expression) {
31986
+ if (ts123.isPropertyAccessExpression(expression)) {
31987
+ return expression.name.text;
31988
+ }
31989
+ if (ts123.isCallExpression(expression) && ts123.isPropertyAccessExpression(expression.expression) && expression.arguments.length === 0) {
31990
+ return expression.expression.name.text;
31991
+ }
31992
+ if (ts123.isBinaryExpression(expression) && expression.operatorToken.kind === ts123.SyntaxKind.QuestionQuestionToken) {
31993
+ return extractMemberNameFromExpression(expression.left);
31994
+ }
31995
+ return null;
31996
+ }
31997
+ function collectAttributePropBindings(element) {
31998
+ let out = null;
31999
+ for (let i = 0; i < element.attributes.length; i++) {
32000
+ const attribute = element.attributes[i];
32001
+ if (!attribute) continue;
32002
+ if (!ts123.isJsxAttribute(attribute.node)) continue;
32003
+ if (!attribute.name) continue;
32004
+ if (attribute.valueNode === null) continue;
32005
+ const propName = extractPropMemberName(attribute.valueNode);
32006
+ if (propName === null) continue;
32007
+ const attrName = attribute.name.toLowerCase();
32008
+ if (out === null) out = /* @__PURE__ */ new Map();
32009
+ out.set(attrName, propName);
32010
+ }
32011
+ if (out === null) return EMPTY_PROP_BINDINGS;
32012
+ return out;
32013
+ }
31810
32014
  function collectTopLevelVariableInitializers(graph) {
31811
32015
  const out = /* @__PURE__ */ new Map();
31812
32016
  for (let i = 0; i < graph.variables.length; i++) {
@@ -31932,7 +32136,12 @@ function areHostDescriptorsEqual(left, right) {
31932
32136
  if (left.tagName !== right.tagName) return false;
31933
32137
  if (left.forwardsChildren !== right.forwardsChildren) return false;
31934
32138
  if (!areStringListsEqual(left.staticClassTokens, right.staticClassTokens)) return false;
31935
- return areAttributeMapsEqual(left.staticAttributes, right.staticAttributes);
32139
+ if (!areAttributeMapsEqual(left.staticAttributes, right.staticAttributes)) return false;
32140
+ if (left.attributePropBindings.size !== right.attributePropBindings.size) return false;
32141
+ for (const [key, value2] of left.attributePropBindings) {
32142
+ if (right.attributePropBindings.get(key) !== value2) return false;
32143
+ }
32144
+ return true;
31936
32145
  }
31937
32146
  function areComponentHostEntriesEqual(left, right) {
31938
32147
  if (left.resolution !== right.resolution) return false;
@@ -31975,6 +32184,18 @@ function mergeStaticAttributes(outer, inner) {
31975
32184
  }
31976
32185
  return out;
31977
32186
  }
32187
+ function mergePropBindings(outer, inner) {
32188
+ if (inner.size === 0) return outer;
32189
+ if (outer.size === 0) return inner;
32190
+ const out = /* @__PURE__ */ new Map();
32191
+ for (const [name, value2] of inner) {
32192
+ out.set(name, value2);
32193
+ }
32194
+ for (const [name, value2] of outer) {
32195
+ out.set(name, value2);
32196
+ }
32197
+ return out;
32198
+ }
31978
32199
  var HTML_TAG_NAMES = /* @__PURE__ */ new Set([
31979
32200
  "a",
31980
32201
  "abbr",
@@ -32190,6 +32411,7 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
32190
32411
  "border-width",
32191
32412
  "margin-block",
32192
32413
  "padding-block",
32414
+ "padding-inline",
32193
32415
  "inset-block",
32194
32416
  "flex-flow"
32195
32417
  ]);
@@ -32202,6 +32424,9 @@ var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
32202
32424
  "min-width",
32203
32425
  "min-block-size",
32204
32426
  "min-height",
32427
+ "max-width",
32428
+ "max-height",
32429
+ "flex-basis",
32205
32430
  "top",
32206
32431
  "bottom",
32207
32432
  "margin-top",
@@ -32397,7 +32622,12 @@ var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
32397
32622
  "fit-content",
32398
32623
  "min-content",
32399
32624
  "max-content",
32400
- "stretch"
32625
+ "stretch",
32626
+ "inherit",
32627
+ "initial",
32628
+ "unset",
32629
+ "revert",
32630
+ "revert-layer"
32401
32631
  ]);
32402
32632
  function parseLength(name, raw, source, guard) {
32403
32633
  const px = parseSignedPxValue(raw);
@@ -32446,12 +32676,8 @@ function parseTranslateProperty(name, raw, source, guard) {
32446
32676
  }
32447
32677
  function hasDynamicExpression(raw) {
32448
32678
  if (raw.includes("var(")) return true;
32449
- if (raw.includes("calc(")) return true;
32450
32679
  if (raw.includes("env(")) return true;
32451
32680
  if (raw.includes("attr(")) return true;
32452
- if (raw.includes("min(")) return true;
32453
- if (raw.includes("max(")) return true;
32454
- if (raw.includes("clamp(")) return true;
32455
32681
  return false;
32456
32682
  }
32457
32683
  function createKnown(name, normalized, source, guard, px, unit, quality) {
@@ -35744,6 +35970,9 @@ var BLOCK_EXPANSIONS = /* @__PURE__ */ new Map([
35744
35970
  ["padding-block", ["padding-top", "padding-bottom"]],
35745
35971
  ["inset-block", ["inset-block-start", "inset-block-end"]]
35746
35972
  ]);
35973
+ var INLINE_EXPANSIONS = /* @__PURE__ */ new Map([
35974
+ ["padding-inline", ["padding-left", "padding-right"]]
35975
+ ]);
35747
35976
  function expandShorthand(property, value2) {
35748
35977
  const quadTarget = QUAD_EXPANSIONS.get(property);
35749
35978
  if (quadTarget !== void 0) {
@@ -35765,6 +35994,15 @@ function expandShorthand(property, value2) {
35765
35994
  { name: blockTarget[1], value: parsed.end }
35766
35995
  ];
35767
35996
  }
35997
+ const inlineTarget = INLINE_EXPANSIONS.get(property);
35998
+ if (inlineTarget !== void 0) {
35999
+ const parsed = parseBlockShorthand(value2);
36000
+ if (parsed === null) return null;
36001
+ return [
36002
+ { name: inlineTarget[0], value: parsed.start },
36003
+ { name: inlineTarget[1], value: parsed.end }
36004
+ ];
36005
+ }
35768
36006
  if (property === "flex-flow") {
35769
36007
  return expandFlexFlow(value2);
35770
36008
  }
@@ -35802,6 +36040,8 @@ function getShorthandLonghandNames(property) {
35802
36040
  if (quad !== void 0) return [...quad];
35803
36041
  const block = BLOCK_EXPANSIONS.get(property);
35804
36042
  if (block !== void 0) return [...block];
36043
+ const inline = INLINE_EXPANSIONS.get(property);
36044
+ if (inline !== void 0) return [...inline];
35805
36045
  if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
35806
36046
  return null;
35807
36047
  }
@@ -36023,7 +36263,7 @@ var DYNAMIC_ATTRIBUTE_GUARD = {
36023
36263
  key: "dynamic-attribute:*"
36024
36264
  };
36025
36265
  var SCROLLABLE_VALUES = /* @__PURE__ */ new Set(["auto", "scroll"]);
36026
- function collectMonitoredDeclarations(selector, layerOrder, guard) {
36266
+ function collectMonitoredDeclarations(selector, layerOrder, guard, variablesByName) {
36027
36267
  const out = [];
36028
36268
  const declarations = selector.rule.declarations;
36029
36269
  for (let i = 0; i < declarations.length; i++) {
@@ -36039,12 +36279,14 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36039
36279
  specificityScore: selector.specificityScore,
36040
36280
  isImportant: declaration.cascadePosition.isImportant || declaration.node.important
36041
36281
  };
36282
+ const rawValue = declaration.value;
36283
+ const resolvedValue = variablesByName !== null && rawValue.includes("var(") ? substituteVarReferences(rawValue, variablesByName, 0) : rawValue;
36042
36284
  const directSignal = MONITORED_SIGNAL_NAME_MAP.get(property);
36043
36285
  if (directSignal !== void 0) {
36044
- out.push({ property: directSignal, value: declaration.value, guardProvenance: guard, position });
36286
+ out.push({ property: directSignal, value: resolvedValue, guardProvenance: guard, position });
36045
36287
  continue;
36046
36288
  }
36047
- const value2 = declaration.value.trim().toLowerCase();
36289
+ const value2 = resolvedValue.trim().toLowerCase();
36048
36290
  const expanded = expandShorthand(property, value2);
36049
36291
  if (expanded === void 0) continue;
36050
36292
  if (expanded === null) {
@@ -36055,7 +36297,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
36055
36297
  if (!longhand) continue;
36056
36298
  const signal = MONITORED_SIGNAL_NAME_MAP.get(longhand);
36057
36299
  if (signal === void 0) continue;
36058
- out.push({ property: signal, value: declaration.value, guardProvenance: guard, position });
36300
+ out.push({ property: signal, value: resolvedValue, guardProvenance: guard, position });
36059
36301
  }
36060
36302
  continue;
36061
36303
  }
@@ -36149,6 +36391,40 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
36149
36391
  }
36150
36392
  }
36151
36393
  }
36394
+ var MAX_VAR_SUBSTITUTION_DEPTH = 10;
36395
+ function substituteVarReferences(value2, variablesByName, depth) {
36396
+ if (depth >= MAX_VAR_SUBSTITUTION_DEPTH) return value2;
36397
+ const refs = extractVarReferences(value2);
36398
+ if (refs.length === 0) return value2;
36399
+ let result = value2;
36400
+ for (let i = refs.length - 1; i >= 0; i--) {
36401
+ const ref = refs[i];
36402
+ if (!ref) continue;
36403
+ const candidates = variablesByName.get(ref.name);
36404
+ const resolvedValue = candidates !== void 0 && candidates.length > 0 ? selectBestVariableValue(candidates) : ref.fallback;
36405
+ if (resolvedValue === null) continue;
36406
+ result = result.slice(0, ref.sourceIndex) + resolvedValue + result.slice(ref.sourceIndex + ref.raw.length);
36407
+ }
36408
+ if (result !== value2 && result.includes("var(")) {
36409
+ return substituteVarReferences(result, variablesByName, depth + 1);
36410
+ }
36411
+ return result;
36412
+ }
36413
+ function selectBestVariableValue(candidates) {
36414
+ let bestGlobal = null;
36415
+ for (let i = 0; i < candidates.length; i++) {
36416
+ const candidate = candidates[i];
36417
+ if (!candidate) continue;
36418
+ if (candidate.scope.type === "global") {
36419
+ if (bestGlobal === null || candidate.declaration.sourceOrder > bestGlobal.declaration.sourceOrder) {
36420
+ bestGlobal = candidate;
36421
+ }
36422
+ }
36423
+ }
36424
+ if (bestGlobal !== null) return bestGlobal.value;
36425
+ const first = candidates[0];
36426
+ return first ? first.value : null;
36427
+ }
36152
36428
  function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind) {
36153
36429
  const out = /* @__PURE__ */ new Map();
36154
36430
  const positions = /* @__PURE__ */ new Map();
@@ -36609,7 +36885,7 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
36609
36885
  const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
36610
36886
  const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
36611
36887
  const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
36612
- const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
36888
+ const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes, meta.resolvedHost?.descriptor.attributePropBindings);
36613
36889
  const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
36614
36890
  const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
36615
36891
  const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
@@ -36665,7 +36941,63 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
36665
36941
  function resolveHostForElement(componentHostResolver, solidFile, element) {
36666
36942
  if (element.tag === null) return null;
36667
36943
  if (element.isDomElement) return null;
36668
- return componentHostResolver.resolveHost(solidFile, element.tag);
36944
+ const defaultHost = componentHostResolver.resolveHost(solidFile, element.tag);
36945
+ const asTag = extractPolymorphicAsTag(element);
36946
+ if (asTag !== null) {
36947
+ const asHost = componentHostResolver.resolveHost(solidFile, asTag);
36948
+ if (asHost !== null) return composePolymorphicHost(defaultHost, asHost);
36949
+ }
36950
+ return defaultHost;
36951
+ }
36952
+ function extractPolymorphicAsTag(element) {
36953
+ for (let i = 0; i < element.attributes.length; i++) {
36954
+ const attr = element.attributes[i];
36955
+ if (!attr) continue;
36956
+ if (attr.name !== "as") continue;
36957
+ if (attr.valueNode === null) continue;
36958
+ if (!ts124.isJsxExpression(attr.valueNode)) continue;
36959
+ const expression = attr.valueNode.expression;
36960
+ if (!expression) continue;
36961
+ if (ts124.isIdentifier(expression)) return expression.text;
36962
+ if (ts124.isPropertyAccessExpression(expression)) return expression.getText();
36963
+ return null;
36964
+ }
36965
+ return null;
36966
+ }
36967
+ function composePolymorphicHost(outerHost, asHost) {
36968
+ if (outerHost === null) return asHost;
36969
+ const outerDesc = outerHost.descriptor;
36970
+ const asDesc = asHost.descriptor;
36971
+ const staticAttributes = /* @__PURE__ */ new Map();
36972
+ for (const [name, value2] of outerDesc.staticAttributes) staticAttributes.set(name, value2);
36973
+ for (const [name, value2] of asDesc.staticAttributes) staticAttributes.set(name, value2);
36974
+ const classTokenSet = /* @__PURE__ */ new Set();
36975
+ const staticClassTokens = [];
36976
+ for (const token of outerDesc.staticClassTokens) {
36977
+ if (!classTokenSet.has(token)) {
36978
+ classTokenSet.add(token);
36979
+ staticClassTokens.push(token);
36980
+ }
36981
+ }
36982
+ for (const token of asDesc.staticClassTokens) {
36983
+ if (!classTokenSet.has(token)) {
36984
+ classTokenSet.add(token);
36985
+ staticClassTokens.push(token);
36986
+ }
36987
+ }
36988
+ const attributePropBindings = /* @__PURE__ */ new Map();
36989
+ for (const [name, value2] of outerDesc.attributePropBindings) attributePropBindings.set(name, value2);
36990
+ for (const [name, value2] of asDesc.attributePropBindings) attributePropBindings.set(name, value2);
36991
+ return {
36992
+ descriptor: {
36993
+ tagName: asDesc.tagName ?? outerDesc.tagName,
36994
+ staticAttributes,
36995
+ staticClassTokens,
36996
+ forwardsChildren: asDesc.forwardsChildren || outerDesc.forwardsChildren,
36997
+ attributePropBindings
36998
+ },
36999
+ hostElementRef: asHost.hostElementRef ?? outerHost.hostElementRef
37000
+ };
36669
37001
  }
36670
37002
  function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
36671
37003
  if (element.tag === null) return false;
@@ -36708,11 +37040,21 @@ function mergeClassTokens(localTokens, hostTokens) {
36708
37040
  }
36709
37041
  return out;
36710
37042
  }
36711
- function mergeAttributes(localAttributes, hostAttributes) {
37043
+ function mergeAttributes(localAttributes, hostAttributes, propBindings) {
36712
37044
  if (hostAttributes === void 0 || hostAttributes.size === 0) return localAttributes;
36713
- if (localAttributes.size === 0) return hostAttributes;
37045
+ if (localAttributes.size === 0 && (propBindings === void 0 || propBindings.size === 0)) return hostAttributes;
36714
37046
  const out = /* @__PURE__ */ new Map();
36715
37047
  for (const [name, value2] of hostAttributes) {
37048
+ if (propBindings !== void 0) {
37049
+ const propName = propBindings.get(name);
37050
+ if (propName !== void 0) {
37051
+ const callSiteValue = localAttributes.get(propName);
37052
+ if (callSiteValue !== void 0 && callSiteValue !== null) {
37053
+ out.set(name, callSiteValue);
37054
+ continue;
37055
+ }
37056
+ }
37057
+ }
36716
37058
  out.set(name, value2);
36717
37059
  }
36718
37060
  for (const [name, value2] of localAttributes) {
@@ -36779,7 +37121,7 @@ function resolveSiblingTypeCount(totalsByParentId, parentElementId, tagName, sib
36779
37121
  // src/cross-file/layout/build.ts
36780
37122
  var EMPTY_NUMBER_LIST2 = [];
36781
37123
  var EMPTY_EDGE_LIST = Object.freeze([]);
36782
- var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch"]);
37124
+ var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch", "inherit", "initial", "unset", "revert", "revert-layer"]);
36783
37125
  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"]);
36784
37126
  function buildLayoutGraph(solids, css, logger = noopLogger) {
36785
37127
  const perf = createLayoutPerfStats();
@@ -36809,7 +37151,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36809
37151
  const monitoredDeclarations = collectMonitoredDeclarations(
36810
37152
  selector,
36811
37153
  resolveRuleLayerOrder(selector.rule, css),
36812
- guard
37154
+ guard,
37155
+ css.variablesByName
36813
37156
  );
36814
37157
  selectorsById.set(selector.id, selector);
36815
37158
  monitoredDeclarationsBySelectorId.set(selector.id, monitoredDeclarations);
@@ -37362,7 +37705,7 @@ function computeReservedSpaceFact(snapshot) {
37362
37705
  hasContainIntrinsicSize: hasContainIntrinsic,
37363
37706
  hasUsableAspectRatio: hasAspectRatio,
37364
37707
  hasDeclaredBlockDimension: hasHeight || hasBlockSize || hasMinHeight || hasMinBlockSize,
37365
- hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || isBlockLevelDisplay(snapshot)
37708
+ hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || hasDeclaredDimension(snapshot, "flex-basis") || isBlockLevelDisplay(snapshot)
37366
37709
  };
37367
37710
  }
37368
37711
  function hasDeclaredDimension(snapshot, property) {
@@ -40651,6 +40994,9 @@ function isVisuallyHidden(snapshot) {
40651
40994
  const opacityAttr = node.inlineStyleValues.get("opacity");
40652
40995
  if (opacityAttr === "0") return true;
40653
40996
  if (node.classTokenSet.has("opacity-0")) return true;
40997
+ const width = readKnownPx(snapshot, "width");
40998
+ const height = readKnownPx(snapshot, "height");
40999
+ if (width === 1 && height === 1) return true;
40654
41000
  return false;
40655
41001
  }
40656
41002
  var jsxLayoutPolicyTouchTarget = defineCrossRule({
@@ -40702,6 +41048,18 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40702
41048
  tag,
40703
41049
  policyName
40704
41050
  );
41051
+ checkDimension(
41052
+ snapshot,
41053
+ "max-height",
41054
+ kind === "button" ? policy.minButtonHeight : policy.minInputHeight,
41055
+ layout,
41056
+ node,
41057
+ emit,
41058
+ "heightTooSmall",
41059
+ messages161.heightTooSmall,
41060
+ tag,
41061
+ policyName
41062
+ );
40705
41063
  checkDimension(
40706
41064
  snapshot,
40707
41065
  "width",
@@ -40726,6 +41084,18 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40726
41084
  tag,
40727
41085
  policyName
40728
41086
  );
41087
+ checkDimension(
41088
+ snapshot,
41089
+ "max-width",
41090
+ kind === "button" ? policy.minButtonWidth : policy.minTouchTarget,
41091
+ layout,
41092
+ node,
41093
+ emit,
41094
+ "widthTooSmall",
41095
+ messages161.widthTooSmall,
41096
+ tag,
41097
+ policyName
41098
+ );
40729
41099
  if (kind === "button") {
40730
41100
  checkDimension(
40731
41101
  snapshot,
@@ -40783,7 +41153,13 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40783
41153
  }
40784
41154
  });
40785
41155
  function checkDimension(snapshot, signal, min, layout, node, emit, messageId, template, tag, policyName) {
40786
- const px = readKnownPx(snapshot, signal);
41156
+ let px = readKnownPx(snapshot, signal);
41157
+ if (px === null) {
41158
+ const signalValue = readKnownSignalWithGuard(snapshot, signal);
41159
+ if (signalValue !== null && signalValue.guard.kind === 1 /* Conditional */) {
41160
+ px = resolveUnconditionalFallbackPx(layout, node, signal);
41161
+ }
41162
+ }
40787
41163
  if (px === null) return;
40788
41164
  if (px >= min) return;
40789
41165
  emitLayoutDiagnostic(
@@ -40803,6 +41179,20 @@ function checkDimension(snapshot, signal, min, layout, node, emit, messageId, te
40803
41179
  }
40804
41180
  );
40805
41181
  }
41182
+ function resolveUnconditionalFallbackPx(layout, node, signal) {
41183
+ const delta = readConditionalSignalDeltaFact(layout, node, signal);
41184
+ if (!delta.hasConditional) return null;
41185
+ const values = delta.unconditionalValues;
41186
+ let bestPx = null;
41187
+ for (let i = 0; i < values.length; i++) {
41188
+ const raw = values[i];
41189
+ if (!raw) continue;
41190
+ const px = parsePxValue(raw);
41191
+ if (px === null) continue;
41192
+ if (bestPx === null || px > bestPx) bestPx = px;
41193
+ }
41194
+ return bestPx;
41195
+ }
40806
41196
 
40807
41197
  // src/cross-file/rules/index.ts
40808
41198
  var rules3 = [
@@ -40933,4 +41323,4 @@ export {
40933
41323
  rules3,
40934
41324
  runCrossFileRules
40935
41325
  };
40936
- //# sourceMappingURL=chunk-SSLKXOHI.js.map
41326
+ //# sourceMappingURL=chunk-F5F7F4LG.js.map