@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.
@@ -3533,6 +3533,10 @@ function getStaticStringFromJSXValue(node) {
3533
3533
  if (import_typescript4.default.isTemplateExpression(expression) && expression.templateSpans.length === 0) {
3534
3534
  return expression.head.text;
3535
3535
  }
3536
+ if (import_typescript4.default.isBinaryExpression(expression) && expression.operatorToken.kind === import_typescript4.default.SyntaxKind.QuestionQuestionToken) {
3537
+ const fallback = getStaticStringFromJSXValue(expression.right);
3538
+ if (fallback !== null) return fallback;
3539
+ }
3536
3540
  }
3537
3541
  return null;
3538
3542
  }
@@ -22979,7 +22983,7 @@ function splitWhitespaceTokens(value2) {
22979
22983
  return out;
22980
22984
  }
22981
22985
  function parseQuadShorthand(raw) {
22982
- const parts = splitWhitespaceTokens(raw);
22986
+ const parts = splitTopLevelWhitespace(raw);
22983
22987
  if (parts.length === 1) {
22984
22988
  const p0 = parts[0];
22985
22989
  if (!p0) return null;
@@ -23003,7 +23007,7 @@ function parseQuadShorthand(raw) {
23003
23007
  return null;
23004
23008
  }
23005
23009
  function parseBlockShorthand(raw) {
23006
- const parts = splitWhitespaceTokens(raw);
23010
+ const parts = splitTopLevelWhitespace(raw);
23007
23011
  if (parts.length === 1) {
23008
23012
  const p0 = parts[0];
23009
23013
  if (!p0) return null;
@@ -23088,8 +23092,14 @@ var NUMERIC_VALUE = /^([0-9]*\.?[0-9]+)(px|rem|em|pt)?$/;
23088
23092
  function parsePxValue(raw, contextFontSize = 16) {
23089
23093
  const trimmed = raw.trim().toLowerCase();
23090
23094
  if (trimmed.length === 0) return null;
23091
- if (trimmed.includes("var(") || trimmed.includes("calc(") || trimmed.includes("%")) return null;
23095
+ if (trimmed.includes("var(") || trimmed.includes("%")) return null;
23092
23096
  if (CSS_WIDE_KEYWORDS.has(trimmed)) return null;
23097
+ if (trimmed.includes("calc(")) {
23098
+ return tryEvalConstantCalc(trimmed, contextFontSize);
23099
+ }
23100
+ if (trimmed.startsWith("min(") || trimmed.startsWith("max(") || trimmed.startsWith("clamp(")) {
23101
+ return tryEvalMathFunction(trimmed, contextFontSize);
23102
+ }
23093
23103
  const match = NUMERIC_VALUE.exec(trimmed);
23094
23104
  if (!match) return null;
23095
23105
  const num = Number(match[1]);
@@ -23100,6 +23110,135 @@ function parsePxValue(raw, contextFontSize = 16) {
23100
23110
  if (unit === "pt") return num * 1.333;
23101
23111
  return null;
23102
23112
  }
23113
+ var CALC_CONSTANT_RE = /^calc\((.+)\)$/;
23114
+ var CALC_TOKEN_RE = /([0-9]*\.?[0-9]+)(px|rem|em|pt)?|([+\-*/])/g;
23115
+ function tryEvalConstantCalc(raw, contextFontSize) {
23116
+ const match = CALC_CONSTANT_RE.exec(raw);
23117
+ if (!match || !match[1]) return null;
23118
+ const inner = match[1].trim();
23119
+ if (inner.includes("var(") || inner.includes("%") || inner.includes("env(") || inner.includes("calc(")) return null;
23120
+ const values = [];
23121
+ const operators = [];
23122
+ let lastWasValue = false;
23123
+ CALC_TOKEN_RE.lastIndex = 0;
23124
+ let tokenMatch;
23125
+ while ((tokenMatch = CALC_TOKEN_RE.exec(inner)) !== null) {
23126
+ const op = tokenMatch[3];
23127
+ if (op !== void 0) {
23128
+ if (!lastWasValue && op === "-") {
23129
+ const nextToken = CALC_TOKEN_RE.exec(inner);
23130
+ if (!nextToken || nextToken[3] !== void 0) return null;
23131
+ const px2 = calcTokenToPx(nextToken, contextFontSize);
23132
+ if (px2 === null) return null;
23133
+ values.push(-px2);
23134
+ lastWasValue = true;
23135
+ continue;
23136
+ }
23137
+ if (!lastWasValue) return null;
23138
+ operators.push(op);
23139
+ lastWasValue = false;
23140
+ continue;
23141
+ }
23142
+ const px = calcTokenToPx(tokenMatch, contextFontSize);
23143
+ if (px === null) return null;
23144
+ values.push(px);
23145
+ lastWasValue = true;
23146
+ }
23147
+ if (values.length === 0 || values.length !== operators.length + 1) return null;
23148
+ const firstValue = values[0];
23149
+ if (firstValue === void 0) return null;
23150
+ const reducedValues = [firstValue];
23151
+ const reducedOps = [];
23152
+ for (let i = 0; i < operators.length; i++) {
23153
+ const op = operators[i];
23154
+ const right = values[i + 1];
23155
+ if (op === void 0 || right === void 0) return null;
23156
+ if (op === "*") {
23157
+ const last = reducedValues[reducedValues.length - 1];
23158
+ if (last === void 0) return null;
23159
+ reducedValues[reducedValues.length - 1] = last * right;
23160
+ } else if (op === "/") {
23161
+ if (right === 0) return null;
23162
+ const last = reducedValues[reducedValues.length - 1];
23163
+ if (last === void 0) return null;
23164
+ reducedValues[reducedValues.length - 1] = last / right;
23165
+ } else {
23166
+ reducedValues.push(right);
23167
+ reducedOps.push(op);
23168
+ }
23169
+ }
23170
+ const base = reducedValues[0];
23171
+ if (base === void 0) return null;
23172
+ let result = base;
23173
+ for (let i = 0; i < reducedOps.length; i++) {
23174
+ const op = reducedOps[i];
23175
+ const right = reducedValues[i + 1];
23176
+ if (op === void 0 || right === void 0) return null;
23177
+ if (op === "+") result += right;
23178
+ else if (op === "-") result -= right;
23179
+ else return null;
23180
+ }
23181
+ return Number.isFinite(result) ? result : null;
23182
+ }
23183
+ function calcTokenToPx(tokenMatch, contextFontSize) {
23184
+ const num = Number(tokenMatch[1]);
23185
+ if (Number.isNaN(num)) return null;
23186
+ const unit = tokenMatch[2] ?? "";
23187
+ if (unit === "px" || unit === "") return num;
23188
+ if (unit === "rem") return num * 16;
23189
+ if (unit === "em") return num * contextFontSize;
23190
+ if (unit === "pt") return num * 1.333;
23191
+ return null;
23192
+ }
23193
+ var MATH_FN_RE = /^(min|max|clamp)\((.+)\)$/;
23194
+ function tryEvalMathFunction(raw, contextFontSize) {
23195
+ const match = MATH_FN_RE.exec(raw);
23196
+ if (!match || !match[1] || !match[2]) return null;
23197
+ const fn = match[1];
23198
+ const inner = match[2];
23199
+ const args = splitMathArgs(inner);
23200
+ if (args === null) return null;
23201
+ const values = [];
23202
+ for (let i = 0; i < args.length; i++) {
23203
+ const arg = args[i];
23204
+ if (!arg) return null;
23205
+ const px = parsePxValue(arg.trim(), contextFontSize);
23206
+ if (px === null) return null;
23207
+ values.push(px);
23208
+ }
23209
+ if (values.length === 0) return null;
23210
+ if (fn === "min") return Math.min(...values);
23211
+ if (fn === "max") return Math.max(...values);
23212
+ if (fn === "clamp") {
23213
+ if (values.length !== 3) return null;
23214
+ const [lo, val, hi] = values;
23215
+ return Math.max(lo, Math.min(val, hi));
23216
+ }
23217
+ return null;
23218
+ }
23219
+ function splitMathArgs(inner) {
23220
+ const args = [];
23221
+ let depth = 0;
23222
+ let start = 0;
23223
+ for (let i = 0; i < inner.length; i++) {
23224
+ const ch = inner[i];
23225
+ if (ch === "(") depth++;
23226
+ else if (ch === ")") {
23227
+ if (depth > 0) depth--;
23228
+ else return null;
23229
+ } else if (ch === "," && depth === 0) {
23230
+ const arg = inner.slice(start, i).trim();
23231
+ if (arg.length === 0) return null;
23232
+ args.push(arg);
23233
+ start = i + 1;
23234
+ }
23235
+ }
23236
+ if (depth !== 0) return null;
23237
+ const tail = inner.slice(start).trim();
23238
+ if (tail.length === 0) return null;
23239
+ args.push(tail);
23240
+ return args;
23241
+ }
23103
23242
  function parseUnitlessValue(raw) {
23104
23243
  const trimmed = raw.trim().toLowerCase();
23105
23244
  if (trimmed.length === 0) return null;
@@ -25523,14 +25662,16 @@ function walkAndProcess(graph, file, container, context, collector) {
25523
25662
  if (parentAtRule) {
25524
25663
  parentAtRule.rules.push(rule);
25525
25664
  }
25526
- const selectorStrings = parseSelectorList(rule.selectorText);
25527
- for (let j = 0; j < selectorStrings.length; j++) {
25528
- const selectorText = selectorStrings[j];
25529
- if (!selectorText) continue;
25530
- const selector = createSelectorEntity(graph, selectorText, rule);
25531
- graph.addSelector(selector);
25532
- rule.selectors.push(selector);
25533
- graph.registerRuleBySelector(selectorText, rule);
25665
+ if (parentAtRule === null || parentAtRule.kind !== "keyframes") {
25666
+ const selectorStrings = parseSelectorList(rule.selectorText);
25667
+ for (let j = 0; j < selectorStrings.length; j++) {
25668
+ const selectorText = selectorStrings[j];
25669
+ if (!selectorText) continue;
25670
+ const selector = createSelectorEntity(graph, selectorText, rule);
25671
+ graph.addSelector(selector);
25672
+ rule.selectors.push(selector);
25673
+ graph.registerRuleBySelector(selectorText, rule);
25674
+ }
25534
25675
  }
25535
25676
  const ruleChildren = ruleNode.nodes;
25536
25677
  if (ruleChildren && ruleChildren.length > 0) {
@@ -30029,6 +30170,8 @@ var layoutSignalNames = [
30029
30170
  "min-width",
30030
30171
  "min-block-size",
30031
30172
  "min-height",
30173
+ "max-width",
30174
+ "max-height",
30032
30175
  "aspect-ratio",
30033
30176
  "vertical-align",
30034
30177
  "display",
@@ -30047,6 +30190,7 @@ var layoutSignalNames = [
30047
30190
  "place-items",
30048
30191
  "place-self",
30049
30192
  "flex-direction",
30193
+ "flex-basis",
30050
30194
  "grid-auto-flow",
30051
30195
  "appearance",
30052
30196
  "box-sizing",
@@ -30238,6 +30382,7 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
30238
30382
  "border-width",
30239
30383
  "margin-block",
30240
30384
  "padding-block",
30385
+ "padding-inline",
30241
30386
  "inset-block",
30242
30387
  "flex-flow"
30243
30388
  ]);
@@ -30250,6 +30395,9 @@ var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
30250
30395
  "min-width",
30251
30396
  "min-block-size",
30252
30397
  "min-height",
30398
+ "max-width",
30399
+ "max-height",
30400
+ "flex-basis",
30253
30401
  "top",
30254
30402
  "bottom",
30255
30403
  "margin-top",
@@ -30445,7 +30593,12 @@ var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
30445
30593
  "fit-content",
30446
30594
  "min-content",
30447
30595
  "max-content",
30448
- "stretch"
30596
+ "stretch",
30597
+ "inherit",
30598
+ "initial",
30599
+ "unset",
30600
+ "revert",
30601
+ "revert-layer"
30449
30602
  ]);
30450
30603
  function parseLength(name, raw, source, guard) {
30451
30604
  const px = parseSignedPxValue(raw);
@@ -30494,12 +30647,8 @@ function parseTranslateProperty(name, raw, source, guard) {
30494
30647
  }
30495
30648
  function hasDynamicExpression(raw) {
30496
30649
  if (raw.includes("var(")) return true;
30497
- if (raw.includes("calc(")) return true;
30498
30650
  if (raw.includes("env(")) return true;
30499
30651
  if (raw.includes("attr(")) return true;
30500
- if (raw.includes("min(")) return true;
30501
- if (raw.includes("max(")) return true;
30502
- if (raw.includes("clamp(")) return true;
30503
30652
  return false;
30504
30653
  }
30505
30654
  function createKnown(name, normalized, source, guard, px, unit, quality) {
@@ -31608,23 +31757,44 @@ function collectCSSScopeBySolidFile(solids, css, moduleResolver) {
31608
31757
  if (!imp) continue;
31609
31758
  if (imp.isTypeOnly) continue;
31610
31759
  const resolvedCssPath = resolver.resolveCss(solid.file, imp.source);
31611
- if (resolvedCssPath === null) continue;
31612
- const transitiveScope = getOrCollectTransitiveScope(
31613
- resolvedCssPath,
31614
- resolver,
31615
- cssFilesByNormalizedPath,
31616
- transitiveScopeByEntryPath
31617
- );
31618
- for (let k = 0; k < transitiveScope.length; k++) {
31619
- const ts137 = transitiveScope[k];
31620
- if (!ts137) continue;
31621
- scope.add(ts137);
31760
+ if (resolvedCssPath !== null) {
31761
+ const transitiveScope = getOrCollectTransitiveScope(
31762
+ resolvedCssPath,
31763
+ resolver,
31764
+ cssFilesByNormalizedPath,
31765
+ transitiveScopeByEntryPath
31766
+ );
31767
+ for (let k = 0; k < transitiveScope.length; k++) {
31768
+ const ts137 = transitiveScope[k];
31769
+ if (!ts137) continue;
31770
+ scope.add(ts137);
31771
+ }
31772
+ if (imp.specifiers.length === 0) {
31773
+ for (let k = 0; k < transitiveScope.length; k++) {
31774
+ const ts137 = transitiveScope[k];
31775
+ if (!ts137) continue;
31776
+ globalSideEffectScope.add(ts137);
31777
+ }
31778
+ }
31622
31779
  }
31623
- if (imp.specifiers.length !== 0) continue;
31624
- for (let k = 0; k < transitiveScope.length; k++) {
31625
- const ts137 = transitiveScope[k];
31626
- if (!ts137) continue;
31627
- globalSideEffectScope.add(ts137);
31780
+ if (imp.specifiers.length !== 0) {
31781
+ const resolvedSolidPath = resolver.resolveSolid(solid.file, imp.source);
31782
+ if (resolvedSolidPath !== null) {
31783
+ const componentCssPath = resolveColocatedCss(resolvedSolidPath, cssFilesByNormalizedPath);
31784
+ if (componentCssPath !== null) {
31785
+ const componentCssScope = getOrCollectTransitiveScope(
31786
+ componentCssPath,
31787
+ resolver,
31788
+ cssFilesByNormalizedPath,
31789
+ transitiveScopeByEntryPath
31790
+ );
31791
+ for (let k = 0; k < componentCssScope.length; k++) {
31792
+ const cs = componentCssScope[k];
31793
+ if (!cs) continue;
31794
+ scope.add(cs);
31795
+ }
31796
+ }
31797
+ }
31628
31798
  }
31629
31799
  }
31630
31800
  localScopeBySolidFile.set(solid.file, scope);
@@ -31863,6 +32033,7 @@ function createSolidInput(filePath, program, logger) {
31863
32033
 
31864
32034
  // src/cross-file/layout/component-host.ts
31865
32035
  var EMPTY_ATTRIBUTES = /* @__PURE__ */ new Map();
32036
+ var EMPTY_PROP_BINDINGS = /* @__PURE__ */ new Map();
31866
32037
  var TRANSPARENT_SOLID_PRIMITIVES = /* @__PURE__ */ new Set([
31867
32038
  "For",
31868
32039
  "Index",
@@ -31931,9 +32102,10 @@ function createLayoutComponentHostResolver(solids, moduleResolver, logger = noop
31931
32102
  const staticAttributes = innerHost !== null ? mergeStaticAttributes(entry.staticAttributes, innerHost.descriptor.staticAttributes) : entry.staticAttributes;
31932
32103
  const staticClassTokens = innerHost !== null ? mergeStaticClassTokens(entry.staticClassTokens, innerHost.descriptor.staticClassTokens) : entry.staticClassTokens;
31933
32104
  const forwardsChildren = entry.forwardsChildren || innerHost !== null && innerHost.descriptor.forwardsChildren;
32105
+ const attributePropBindings = innerHost !== null ? mergePropBindings(entry.attributePropBindings, innerHost.descriptor.attributePropBindings) : entry.attributePropBindings;
31934
32106
  if (logger.isLevelEnabled(Level.Trace)) logger.trace(`[component-host] resolved: tagName=${tagName}, attrs=[${[...staticAttributes.keys()]}], classes=[${staticClassTokens}]`);
31935
32107
  return {
31936
- descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren },
32108
+ descriptor: { tagName, staticAttributes, staticClassTokens, forwardsChildren, attributePropBindings },
31937
32109
  hostElementRef: innerHost?.hostElementRef ?? null
31938
32110
  };
31939
32111
  }
@@ -32360,7 +32532,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
32360
32532
  tagName: element.tagName,
32361
32533
  staticAttributes: collectStaticAttributes(element),
32362
32534
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
32363
- forwardsChildren: detectChildrenForwarding(element)
32535
+ forwardsChildren: detectChildrenForwarding(element),
32536
+ attributePropBindings: collectAttributePropBindings(element)
32364
32537
  },
32365
32538
  hostElementRef: { solid: graph, element }
32366
32539
  };
@@ -32375,7 +32548,8 @@ function resolveHostEntryFromJSXElement(graph, node) {
32375
32548
  filePath: graph.file,
32376
32549
  staticAttributes: collectStaticAttributes(element),
32377
32550
  staticClassTokens: getStaticClassTokensForElementEntity(graph, element),
32378
- forwardsChildren: detectChildrenForwarding(element)
32551
+ forwardsChildren: detectChildrenForwarding(element),
32552
+ attributePropBindings: collectAttributePropBindings(element)
32379
32553
  };
32380
32554
  }
32381
32555
  function isContextProviderTag(tag) {
@@ -32563,6 +32737,41 @@ function collectStaticAttributes(element) {
32563
32737
  if (out === null) return EMPTY_ATTRIBUTES;
32564
32738
  return out;
32565
32739
  }
32740
+ function extractPropMemberName(node) {
32741
+ if (!import_typescript125.default.isJsxExpression(node)) return null;
32742
+ const expression = node.expression;
32743
+ if (!expression) return null;
32744
+ return extractMemberNameFromExpression(expression);
32745
+ }
32746
+ function extractMemberNameFromExpression(expression) {
32747
+ if (import_typescript125.default.isPropertyAccessExpression(expression)) {
32748
+ return expression.name.text;
32749
+ }
32750
+ if (import_typescript125.default.isCallExpression(expression) && import_typescript125.default.isPropertyAccessExpression(expression.expression) && expression.arguments.length === 0) {
32751
+ return expression.expression.name.text;
32752
+ }
32753
+ if (import_typescript125.default.isBinaryExpression(expression) && expression.operatorToken.kind === import_typescript125.default.SyntaxKind.QuestionQuestionToken) {
32754
+ return extractMemberNameFromExpression(expression.left);
32755
+ }
32756
+ return null;
32757
+ }
32758
+ function collectAttributePropBindings(element) {
32759
+ let out = null;
32760
+ for (let i = 0; i < element.attributes.length; i++) {
32761
+ const attribute = element.attributes[i];
32762
+ if (!attribute) continue;
32763
+ if (!import_typescript125.default.isJsxAttribute(attribute.node)) continue;
32764
+ if (!attribute.name) continue;
32765
+ if (attribute.valueNode === null) continue;
32766
+ const propName = extractPropMemberName(attribute.valueNode);
32767
+ if (propName === null) continue;
32768
+ const attrName = attribute.name.toLowerCase();
32769
+ if (out === null) out = /* @__PURE__ */ new Map();
32770
+ out.set(attrName, propName);
32771
+ }
32772
+ if (out === null) return EMPTY_PROP_BINDINGS;
32773
+ return out;
32774
+ }
32566
32775
  function collectTopLevelVariableInitializers(graph) {
32567
32776
  const out = /* @__PURE__ */ new Map();
32568
32777
  for (let i = 0; i < graph.variables.length; i++) {
@@ -32688,7 +32897,12 @@ function areHostDescriptorsEqual(left, right) {
32688
32897
  if (left.tagName !== right.tagName) return false;
32689
32898
  if (left.forwardsChildren !== right.forwardsChildren) return false;
32690
32899
  if (!areStringListsEqual(left.staticClassTokens, right.staticClassTokens)) return false;
32691
- return areAttributeMapsEqual(left.staticAttributes, right.staticAttributes);
32900
+ if (!areAttributeMapsEqual(left.staticAttributes, right.staticAttributes)) return false;
32901
+ if (left.attributePropBindings.size !== right.attributePropBindings.size) return false;
32902
+ for (const [key, value2] of left.attributePropBindings) {
32903
+ if (right.attributePropBindings.get(key) !== value2) return false;
32904
+ }
32905
+ return true;
32692
32906
  }
32693
32907
  function areComponentHostEntriesEqual(left, right) {
32694
32908
  if (left.resolution !== right.resolution) return false;
@@ -32731,6 +32945,18 @@ function mergeStaticAttributes(outer, inner) {
32731
32945
  }
32732
32946
  return out;
32733
32947
  }
32948
+ function mergePropBindings(outer, inner) {
32949
+ if (inner.size === 0) return outer;
32950
+ if (outer.size === 0) return inner;
32951
+ const out = /* @__PURE__ */ new Map();
32952
+ for (const [name, value2] of inner) {
32953
+ out.set(name, value2);
32954
+ }
32955
+ for (const [name, value2] of outer) {
32956
+ out.set(name, value2);
32957
+ }
32958
+ return out;
32959
+ }
32734
32960
  var HTML_TAG_NAMES = /* @__PURE__ */ new Set([
32735
32961
  "a",
32736
32962
  "abbr",
@@ -35546,6 +35772,9 @@ var BLOCK_EXPANSIONS = /* @__PURE__ */ new Map([
35546
35772
  ["padding-block", ["padding-top", "padding-bottom"]],
35547
35773
  ["inset-block", ["inset-block-start", "inset-block-end"]]
35548
35774
  ]);
35775
+ var INLINE_EXPANSIONS = /* @__PURE__ */ new Map([
35776
+ ["padding-inline", ["padding-left", "padding-right"]]
35777
+ ]);
35549
35778
  function expandShorthand(property, value2) {
35550
35779
  const quadTarget = QUAD_EXPANSIONS.get(property);
35551
35780
  if (quadTarget !== void 0) {
@@ -35567,6 +35796,15 @@ function expandShorthand(property, value2) {
35567
35796
  { name: blockTarget[1], value: parsed.end }
35568
35797
  ];
35569
35798
  }
35799
+ const inlineTarget = INLINE_EXPANSIONS.get(property);
35800
+ if (inlineTarget !== void 0) {
35801
+ const parsed = parseBlockShorthand(value2);
35802
+ if (parsed === null) return null;
35803
+ return [
35804
+ { name: inlineTarget[0], value: parsed.start },
35805
+ { name: inlineTarget[1], value: parsed.end }
35806
+ ];
35807
+ }
35570
35808
  if (property === "flex-flow") {
35571
35809
  return expandFlexFlow(value2);
35572
35810
  }
@@ -35604,6 +35842,8 @@ function getShorthandLonghandNames(property) {
35604
35842
  if (quad !== void 0) return [...quad];
35605
35843
  const block = BLOCK_EXPANSIONS.get(property);
35606
35844
  if (block !== void 0) return [...block];
35845
+ const inline = INLINE_EXPANSIONS.get(property);
35846
+ if (inline !== void 0) return [...inline];
35607
35847
  if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
35608
35848
  return null;
35609
35849
  }
@@ -35825,7 +36065,7 @@ var DYNAMIC_ATTRIBUTE_GUARD = {
35825
36065
  key: "dynamic-attribute:*"
35826
36066
  };
35827
36067
  var SCROLLABLE_VALUES = /* @__PURE__ */ new Set(["auto", "scroll"]);
35828
- function collectMonitoredDeclarations(selector, layerOrder, guard) {
36068
+ function collectMonitoredDeclarations(selector, layerOrder, guard, variablesByName) {
35829
36069
  const out = [];
35830
36070
  const declarations = selector.rule.declarations;
35831
36071
  for (let i = 0; i < declarations.length; i++) {
@@ -35841,12 +36081,14 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
35841
36081
  specificityScore: selector.specificityScore,
35842
36082
  isImportant: declaration.cascadePosition.isImportant || declaration.node.important
35843
36083
  };
36084
+ const rawValue = declaration.value;
36085
+ const resolvedValue = variablesByName !== null && rawValue.includes("var(") ? substituteVarReferences(rawValue, variablesByName, 0) : rawValue;
35844
36086
  const directSignal = MONITORED_SIGNAL_NAME_MAP.get(property);
35845
36087
  if (directSignal !== void 0) {
35846
- out.push({ property: directSignal, value: declaration.value, guardProvenance: guard, position });
36088
+ out.push({ property: directSignal, value: resolvedValue, guardProvenance: guard, position });
35847
36089
  continue;
35848
36090
  }
35849
- const value2 = declaration.value.trim().toLowerCase();
36091
+ const value2 = resolvedValue.trim().toLowerCase();
35850
36092
  const expanded = expandShorthand(property, value2);
35851
36093
  if (expanded === void 0) continue;
35852
36094
  if (expanded === null) {
@@ -35857,7 +36099,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
35857
36099
  if (!longhand) continue;
35858
36100
  const signal = MONITORED_SIGNAL_NAME_MAP.get(longhand);
35859
36101
  if (signal === void 0) continue;
35860
- out.push({ property: signal, value: declaration.value, guardProvenance: guard, position });
36102
+ out.push({ property: signal, value: resolvedValue, guardProvenance: guard, position });
35861
36103
  }
35862
36104
  continue;
35863
36105
  }
@@ -35951,6 +36193,40 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
35951
36193
  }
35952
36194
  }
35953
36195
  }
36196
+ var MAX_VAR_SUBSTITUTION_DEPTH = 10;
36197
+ function substituteVarReferences(value2, variablesByName, depth) {
36198
+ if (depth >= MAX_VAR_SUBSTITUTION_DEPTH) return value2;
36199
+ const refs = extractVarReferences(value2);
36200
+ if (refs.length === 0) return value2;
36201
+ let result = value2;
36202
+ for (let i = refs.length - 1; i >= 0; i--) {
36203
+ const ref = refs[i];
36204
+ if (!ref) continue;
36205
+ const candidates = variablesByName.get(ref.name);
36206
+ const resolvedValue = candidates !== void 0 && candidates.length > 0 ? selectBestVariableValue(candidates) : ref.fallback;
36207
+ if (resolvedValue === null) continue;
36208
+ result = result.slice(0, ref.sourceIndex) + resolvedValue + result.slice(ref.sourceIndex + ref.raw.length);
36209
+ }
36210
+ if (result !== value2 && result.includes("var(")) {
36211
+ return substituteVarReferences(result, variablesByName, depth + 1);
36212
+ }
36213
+ return result;
36214
+ }
36215
+ function selectBestVariableValue(candidates) {
36216
+ let bestGlobal = null;
36217
+ for (let i = 0; i < candidates.length; i++) {
36218
+ const candidate = candidates[i];
36219
+ if (!candidate) continue;
36220
+ if (candidate.scope.type === "global") {
36221
+ if (bestGlobal === null || candidate.declaration.sourceOrder > bestGlobal.declaration.sourceOrder) {
36222
+ bestGlobal = candidate;
36223
+ }
36224
+ }
36225
+ }
36226
+ if (bestGlobal !== null) return bestGlobal.value;
36227
+ const first = candidates[0];
36228
+ return first ? first.value : null;
36229
+ }
35954
36230
  function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind) {
35955
36231
  const out = /* @__PURE__ */ new Map();
35956
36232
  const positions = /* @__PURE__ */ new Map();
@@ -36411,7 +36687,7 @@ function collectLayoutElementRecordsForSolid(solid, selectorRequirements, inline
36411
36687
  const classTokenSet = classTokens.length === 0 ? EMPTY_CLASS_TOKEN_SET : createClassTokenSet(classTokens);
36412
36688
  const inlineStyleKeys = getStaticStyleKeysForElement(solid, element.id);
36413
36689
  const localAttributes = selectorRequirements.needsAttributes ? collectStaticAttributes(element) : EMPTY_ATTRIBUTES2;
36414
- const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes);
36690
+ const attributes = mergeAttributes(localAttributes, meta.resolvedHost?.descriptor.staticAttributes, meta.resolvedHost?.descriptor.attributePropBindings);
36415
36691
  const selectorDispatchKeys = buildSelectorDispatchKeys(attributes, classTokens);
36416
36692
  const inlineStyleValues = inlineStyleValuesByElementId.get(element.id) ?? EMPTY_INLINE_STYLE_VALUES;
36417
36693
  const textualContent = getTextualContentState(element, textContentMemo, compositionMetaByElementId, logger);
@@ -36467,7 +36743,63 @@ function collectCompositionMetaByElementId(solid, componentHostResolver) {
36467
36743
  function resolveHostForElement(componentHostResolver, solidFile, element) {
36468
36744
  if (element.tag === null) return null;
36469
36745
  if (element.isDomElement) return null;
36470
- return componentHostResolver.resolveHost(solidFile, element.tag);
36746
+ const defaultHost = componentHostResolver.resolveHost(solidFile, element.tag);
36747
+ const asTag = extractPolymorphicAsTag(element);
36748
+ if (asTag !== null) {
36749
+ const asHost = componentHostResolver.resolveHost(solidFile, asTag);
36750
+ if (asHost !== null) return composePolymorphicHost(defaultHost, asHost);
36751
+ }
36752
+ return defaultHost;
36753
+ }
36754
+ function extractPolymorphicAsTag(element) {
36755
+ for (let i = 0; i < element.attributes.length; i++) {
36756
+ const attr = element.attributes[i];
36757
+ if (!attr) continue;
36758
+ if (attr.name !== "as") continue;
36759
+ if (attr.valueNode === null) continue;
36760
+ if (!import_typescript126.default.isJsxExpression(attr.valueNode)) continue;
36761
+ const expression = attr.valueNode.expression;
36762
+ if (!expression) continue;
36763
+ if (import_typescript126.default.isIdentifier(expression)) return expression.text;
36764
+ if (import_typescript126.default.isPropertyAccessExpression(expression)) return expression.getText();
36765
+ return null;
36766
+ }
36767
+ return null;
36768
+ }
36769
+ function composePolymorphicHost(outerHost, asHost) {
36770
+ if (outerHost === null) return asHost;
36771
+ const outerDesc = outerHost.descriptor;
36772
+ const asDesc = asHost.descriptor;
36773
+ const staticAttributes = /* @__PURE__ */ new Map();
36774
+ for (const [name, value2] of outerDesc.staticAttributes) staticAttributes.set(name, value2);
36775
+ for (const [name, value2] of asDesc.staticAttributes) staticAttributes.set(name, value2);
36776
+ const classTokenSet = /* @__PURE__ */ new Set();
36777
+ const staticClassTokens = [];
36778
+ for (const token of outerDesc.staticClassTokens) {
36779
+ if (!classTokenSet.has(token)) {
36780
+ classTokenSet.add(token);
36781
+ staticClassTokens.push(token);
36782
+ }
36783
+ }
36784
+ for (const token of asDesc.staticClassTokens) {
36785
+ if (!classTokenSet.has(token)) {
36786
+ classTokenSet.add(token);
36787
+ staticClassTokens.push(token);
36788
+ }
36789
+ }
36790
+ const attributePropBindings = /* @__PURE__ */ new Map();
36791
+ for (const [name, value2] of outerDesc.attributePropBindings) attributePropBindings.set(name, value2);
36792
+ for (const [name, value2] of asDesc.attributePropBindings) attributePropBindings.set(name, value2);
36793
+ return {
36794
+ descriptor: {
36795
+ tagName: asDesc.tagName ?? outerDesc.tagName,
36796
+ staticAttributes,
36797
+ staticClassTokens,
36798
+ forwardsChildren: asDesc.forwardsChildren || outerDesc.forwardsChildren,
36799
+ attributePropBindings
36800
+ },
36801
+ hostElementRef: asHost.hostElementRef ?? outerHost.hostElementRef
36802
+ };
36471
36803
  }
36472
36804
  function resolveTransparentPrimitiveStatus(componentHostResolver, solidFile, element, resolvedHost) {
36473
36805
  if (element.tag === null) return false;
@@ -36510,11 +36842,21 @@ function mergeClassTokens(localTokens, hostTokens) {
36510
36842
  }
36511
36843
  return out;
36512
36844
  }
36513
- function mergeAttributes(localAttributes, hostAttributes) {
36845
+ function mergeAttributes(localAttributes, hostAttributes, propBindings) {
36514
36846
  if (hostAttributes === void 0 || hostAttributes.size === 0) return localAttributes;
36515
- if (localAttributes.size === 0) return hostAttributes;
36847
+ if (localAttributes.size === 0 && (propBindings === void 0 || propBindings.size === 0)) return hostAttributes;
36516
36848
  const out = /* @__PURE__ */ new Map();
36517
36849
  for (const [name, value2] of hostAttributes) {
36850
+ if (propBindings !== void 0) {
36851
+ const propName = propBindings.get(name);
36852
+ if (propName !== void 0) {
36853
+ const callSiteValue = localAttributes.get(propName);
36854
+ if (callSiteValue !== void 0 && callSiteValue !== null) {
36855
+ out.set(name, callSiteValue);
36856
+ continue;
36857
+ }
36858
+ }
36859
+ }
36518
36860
  out.set(name, value2);
36519
36861
  }
36520
36862
  for (const [name, value2] of localAttributes) {
@@ -36581,7 +36923,7 @@ function resolveSiblingTypeCount(totalsByParentId, parentElementId, tagName, sib
36581
36923
  // src/cross-file/layout/build.ts
36582
36924
  var EMPTY_NUMBER_LIST2 = [];
36583
36925
  var EMPTY_EDGE_LIST = Object.freeze([]);
36584
- var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch"]);
36926
+ var NON_RESERVING_DIMENSION_KEYWORDS = /* @__PURE__ */ new Set(["auto", "none", "fit-content", "min-content", "max-content", "stretch", "inherit", "initial", "unset", "revert", "revert-layer"]);
36585
36927
  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"]);
36586
36928
  function buildLayoutGraph(solids, css, logger = noopLogger) {
36587
36929
  const perf = createLayoutPerfStats();
@@ -36611,7 +36953,8 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36611
36953
  const monitoredDeclarations = collectMonitoredDeclarations(
36612
36954
  selector,
36613
36955
  resolveRuleLayerOrder(selector.rule, css),
36614
- guard
36956
+ guard,
36957
+ css.variablesByName
36615
36958
  );
36616
36959
  selectorsById.set(selector.id, selector);
36617
36960
  monitoredDeclarationsBySelectorId.set(selector.id, monitoredDeclarations);
@@ -37164,7 +37507,7 @@ function computeReservedSpaceFact(snapshot) {
37164
37507
  hasContainIntrinsicSize: hasContainIntrinsic,
37165
37508
  hasUsableAspectRatio: hasAspectRatio,
37166
37509
  hasDeclaredBlockDimension: hasHeight || hasBlockSize || hasMinHeight || hasMinBlockSize,
37167
- hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || isBlockLevelDisplay(snapshot)
37510
+ hasDeclaredInlineDimension: hasDeclaredDimension(snapshot, "width") || hasDeclaredDimension(snapshot, "inline-size") || hasDeclaredDimension(snapshot, "min-width") || hasDeclaredDimension(snapshot, "flex-basis") || isBlockLevelDisplay(snapshot)
37168
37511
  };
37169
37512
  }
37170
37513
  function hasDeclaredDimension(snapshot, property) {
@@ -40409,6 +40752,9 @@ function isVisuallyHidden(snapshot) {
40409
40752
  const opacityAttr = node.inlineStyleValues.get("opacity");
40410
40753
  if (opacityAttr === "0") return true;
40411
40754
  if (node.classTokenSet.has("opacity-0")) return true;
40755
+ const width = readKnownPx(snapshot, "width");
40756
+ const height = readKnownPx(snapshot, "height");
40757
+ if (width === 1 && height === 1) return true;
40412
40758
  return false;
40413
40759
  }
40414
40760
  var jsxLayoutPolicyTouchTarget = defineCrossRule({
@@ -40460,6 +40806,18 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40460
40806
  tag,
40461
40807
  policyName
40462
40808
  );
40809
+ checkDimension(
40810
+ snapshot,
40811
+ "max-height",
40812
+ kind === "button" ? policy.minButtonHeight : policy.minInputHeight,
40813
+ layout,
40814
+ node,
40815
+ emit,
40816
+ "heightTooSmall",
40817
+ messages161.heightTooSmall,
40818
+ tag,
40819
+ policyName
40820
+ );
40463
40821
  checkDimension(
40464
40822
  snapshot,
40465
40823
  "width",
@@ -40484,6 +40842,18 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40484
40842
  tag,
40485
40843
  policyName
40486
40844
  );
40845
+ checkDimension(
40846
+ snapshot,
40847
+ "max-width",
40848
+ kind === "button" ? policy.minButtonWidth : policy.minTouchTarget,
40849
+ layout,
40850
+ node,
40851
+ emit,
40852
+ "widthTooSmall",
40853
+ messages161.widthTooSmall,
40854
+ tag,
40855
+ policyName
40856
+ );
40487
40857
  if (kind === "button") {
40488
40858
  checkDimension(
40489
40859
  snapshot,
@@ -40541,7 +40911,13 @@ var jsxLayoutPolicyTouchTarget = defineCrossRule({
40541
40911
  }
40542
40912
  });
40543
40913
  function checkDimension(snapshot, signal, min, layout, node, emit, messageId, template, tag, policyName) {
40544
- const px = readKnownPx(snapshot, signal);
40914
+ let px = readKnownPx(snapshot, signal);
40915
+ if (px === null) {
40916
+ const signalValue = readKnownSignalWithGuard(snapshot, signal);
40917
+ if (signalValue !== null && signalValue.guard.kind === 1 /* Conditional */) {
40918
+ px = resolveUnconditionalFallbackPx(layout, node, signal);
40919
+ }
40920
+ }
40545
40921
  if (px === null) return;
40546
40922
  if (px >= min) return;
40547
40923
  emitLayoutDiagnostic(
@@ -40561,6 +40937,20 @@ function checkDimension(snapshot, signal, min, layout, node, emit, messageId, te
40561
40937
  }
40562
40938
  );
40563
40939
  }
40940
+ function resolveUnconditionalFallbackPx(layout, node, signal) {
40941
+ const delta = readConditionalSignalDeltaFact(layout, node, signal);
40942
+ if (!delta.hasConditional) return null;
40943
+ const values = delta.unconditionalValues;
40944
+ let bestPx = null;
40945
+ for (let i = 0; i < values.length; i++) {
40946
+ const raw = values[i];
40947
+ if (!raw) continue;
40948
+ const px = parsePxValue(raw);
40949
+ if (px === null) continue;
40950
+ if (bestPx === null || px > bestPx) bestPx = px;
40951
+ }
40952
+ return bestPx;
40953
+ }
40564
40954
 
40565
40955
  // src/cross-file/rules/index.ts
40566
40956
  var rules3 = [