@react-email/tailwind 2.0.0-tailwindv4.2 → 2.0.0-tailwindv4.3

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.js CHANGED
@@ -1079,9 +1079,7 @@ function sourceFragment({ source, line, column, baseLine, baseColumn }, extraLin
1079
1079
  function processLines(start, end) {
1080
1080
  return lines.slice(start, end).map((line$1, idx) => String(start + idx + 1).padStart(maxNumLength) + " |" + line$1).join("\n");
1081
1081
  }
1082
- const prelines = "\n".repeat(Math.max(baseLine - 1, 0));
1083
- const precolumns = " ".repeat(Math.max(baseColumn - 1, 0));
1084
- const lines = (prelines + precolumns + source).split(/\r\n?|\n|\f/);
1082
+ const lines = ("\n".repeat(Math.max(baseLine - 1, 0)) + " ".repeat(Math.max(baseColumn - 1, 0)) + source).split(/\r\n?|\n|\f/);
1085
1083
  const startLine = Math.max(1, line - extraLines) - 1;
1086
1084
  const endLine = Math.min(line + extraLines, lines.length + 1);
1087
1085
  const maxNumLength = Math.max(4, String(endLine).length) + 1;
@@ -1364,8 +1362,7 @@ function createParser(config) {
1364
1362
  if (typeof onComment === "function") parser.forEachToken((type, start, end) => {
1365
1363
  if (type === Comment) {
1366
1364
  const loc = parser.getLocation(start, end);
1367
- const value = cmpStr(source, end - 2, end, "*/") ? source.slice(start + 2, end - 2) : source.slice(start + 2, end);
1368
- onComment(value, loc);
1365
+ onComment(cmpStr(source, end - 2, end, "*/") ? source.slice(start + 2, end - 2) : source.slice(start + 2, end), loc);
1369
1366
  }
1370
1367
  });
1371
1368
  const ast = parser.context[context].call(parser, options);
@@ -4800,8 +4797,7 @@ function processStructure(name$49, nodeType) {
4800
4797
  const docs = { type: "\"" + name$49 + "\"" };
4801
4798
  for (const key in structure$49) {
4802
4799
  if (hasOwnProperty$1.call(structure$49, key) === false) continue;
4803
- const fieldTypes = fields[key] = Array.isArray(structure$49[key]) ? structure$49[key].slice() : [structure$49[key]];
4804
- docs[key] = genTypesList(fieldTypes, name$49 + "." + key);
4800
+ docs[key] = genTypesList(fields[key] = Array.isArray(structure$49[key]) ? structure$49[key].slice() : [structure$49[key]], name$49 + "." + key);
4805
4801
  }
4806
4802
  return {
4807
4803
  docs,
@@ -19090,9 +19086,7 @@ function populateParentsForNodeTree(node) {
19090
19086
  //#endregion
19091
19087
  //#region src/utils/css/resolve-all-css-variables.ts
19092
19088
  function doSelectorsIntersect(first, second) {
19093
- const firstStringified = generate(first);
19094
- const secondStringified = generate(second);
19095
- if (firstStringified === secondStringified) return true;
19089
+ if (generate(first) === generate(second)) return true;
19096
19090
  let hasSomeUniversal = false;
19097
19091
  const walker = (node) => {
19098
19092
  if (hasSomeUniversal) return;
@@ -19104,12 +19098,6 @@ function doSelectorsIntersect(first, second) {
19104
19098
  if (hasSomeUniversal) return true;
19105
19099
  return false;
19106
19100
  }
19107
- function removeAndRepeatIfEmptyRecursively(node) {
19108
- if (node.parent) if (node.containedIn && node.containingItem) {
19109
- node.containedIn.remove(node.containingItem);
19110
- if (node.containedIn.isEmpty) removeAndRepeatIfEmptyRecursively(node.parent);
19111
- } else removeAndRepeatIfEmptyRecursively(node.parent);
19112
- }
19113
19101
  function someParent(node, predicate) {
19114
19102
  if (node.parent) {
19115
19103
  if (predicate(node.parent)) return true;
@@ -19127,11 +19115,8 @@ function resolveAllCssVariables(node) {
19127
19115
  if (someParent(declaration, (ancestor) => ancestor.type === "Atrule" && ancestor.name === "layer" && ancestor.prelude !== null && generate(ancestor.prelude).includes("properties"))) return;
19128
19116
  if (/--[\S]+/.test(declaration.property)) variableDefinitions.add({
19129
19117
  declaration,
19130
- variableName: `${declaration.property}`,
19131
- definition: generate(declaration.value),
19132
- remove() {
19133
- removeAndRepeatIfEmptyRecursively(declaration);
19134
- }
19118
+ variableName: declaration.property,
19119
+ definition: generate(declaration.value)
19135
19120
  });
19136
19121
  else {
19137
19122
  function parseVariableUsesFrom(node$1) {
@@ -19148,10 +19133,7 @@ function resolveAllCssVariables(node) {
19148
19133
  variableName: name$49,
19149
19134
  raw: generate(funcNode)
19150
19135
  });
19151
- if (fallback?.includes("var(")) {
19152
- const parsedFallback = parse(fallback, { context: "value" });
19153
- parseVariableUsesFrom(parsedFallback);
19154
- }
19136
+ if (fallback?.includes("var(")) parseVariableUsesFrom(parse(fallback, { context: "value" }));
19155
19137
  }
19156
19138
  }
19157
19139
  });
@@ -19177,7 +19159,6 @@ function resolveAllCssVariables(node) {
19177
19159
  }
19178
19160
  if (!hasReplaced && use.fallback) use.declaration.value = parse(generate(use.declaration.value).replaceAll(use.raw, use.fallback), { context: "value" });
19179
19161
  }
19180
- for (const definition of variableDefinitions) definition.remove();
19181
19162
  }
19182
19163
 
19183
19164
  //#endregion
@@ -19466,48 +19447,26 @@ function sanitizeDeclarations(nodeContainingDeclarations) {
19466
19447
  enter(hash, hashParentListItem) {
19467
19448
  const hex = hash.value.trim();
19468
19449
  if (hex.length === 3) {
19469
- const r$1 = Number.parseInt(hex.charAt(0) + hex.charAt(0), 16);
19470
- const g$1 = Number.parseInt(hex.charAt(1) + hex.charAt(1), 16);
19471
- const b$1 = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
19472
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1})`, { context: "value" });
19450
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.charAt(0) + hex.charAt(0), 16)},${Number.parseInt(hex.charAt(1) + hex.charAt(1), 16)},${Number.parseInt(hex.charAt(2) + hex.charAt(2), 16)})`, { context: "value" });
19473
19451
  return;
19474
19452
  }
19475
19453
  if (hex.length === 4) {
19476
- const r$1 = Number.parseInt(hex.charAt(0) + hex.charAt(0), 16);
19477
- const g$1 = Number.parseInt(hex.charAt(1) + hex.charAt(1), 16);
19478
- const b$1 = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
19479
- const a$1 = Number.parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255;
19480
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1},${a$1.toFixed(1)})`, { context: "value" });
19454
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.charAt(0) + hex.charAt(0), 16)},${Number.parseInt(hex.charAt(1) + hex.charAt(1), 16)},${Number.parseInt(hex.charAt(2) + hex.charAt(2), 16)},${(Number.parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255).toFixed(1)})`, { context: "value" });
19481
19455
  return;
19482
19456
  }
19483
19457
  if (hex.length === 5) {
19484
- const r$1 = Number.parseInt(hex.slice(0, 2), 16);
19485
- const g$1 = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
19486
- const b$1 = Number.parseInt(hex.charAt(3) + hex.charAt(3), 16);
19487
- const a$1 = Number.parseInt(hex.charAt(4) + hex.charAt(4), 16) / 255;
19488
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1},${a$1.toFixed(1)})`, { context: "value" });
19458
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.charAt(2) + hex.charAt(2), 16)},${Number.parseInt(hex.charAt(3) + hex.charAt(3), 16)},${(Number.parseInt(hex.charAt(4) + hex.charAt(4), 16) / 255).toFixed(1)})`, { context: "value" });
19489
19459
  return;
19490
19460
  }
19491
19461
  if (hex.length === 6) {
19492
- const r$1 = Number.parseInt(hex.slice(0, 2), 16);
19493
- const g$1 = Number.parseInt(hex.slice(2, 4), 16);
19494
- const b$1 = Number.parseInt(hex.slice(4, 6), 16);
19495
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1})`, { context: "value" });
19462
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.slice(2, 4), 16)},${Number.parseInt(hex.slice(4, 6), 16)})`, { context: "value" });
19496
19463
  return;
19497
19464
  }
19498
19465
  if (hex.length === 7) {
19499
- const r$1 = Number.parseInt(hex.slice(0, 2), 16);
19500
- const g$1 = Number.parseInt(hex.slice(2, 4), 16);
19501
- const b$1 = Number.parseInt(hex.slice(4, 6), 16);
19502
- const a$1 = Number.parseInt(hex.charAt(6) + hex.charAt(6), 16) / 255;
19503
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1},${a$1.toFixed(1)})`, { context: "value" });
19466
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.slice(2, 4), 16)},${Number.parseInt(hex.slice(4, 6), 16)},${(Number.parseInt(hex.charAt(6) + hex.charAt(6), 16) / 255).toFixed(1)})`, { context: "value" });
19504
19467
  return;
19505
19468
  }
19506
- const r = Number.parseInt(hex.slice(0, 2), 16);
19507
- const g = Number.parseInt(hex.slice(2, 4), 16);
19508
- const b = Number.parseInt(hex.slice(4, 6), 16);
19509
- const a = Number.parseInt(hex.slice(6, 8), 16) / 255;
19510
- hashParentListItem.data = parse(`rgb(${r},${g},${b},${a.toFixed(1)})`, { context: "value" });
19469
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.slice(2, 4), 16)},${Number.parseInt(hex.slice(4, 6), 16)},${(Number.parseInt(hex.slice(6, 8), 16) / 255).toFixed(1)})`, { context: "value" });
19511
19470
  }
19512
19471
  });
19513
19472
  walk(declaration, {
@@ -19594,10 +19553,7 @@ function sanitizeNonInlinableRules(node) {
19594
19553
  enter(rule) {
19595
19554
  if (!isRuleInlinable(rule)) {
19596
19555
  walk(rule.prelude, (node$1) => {
19597
- if (node$1.type === "ClassSelector") {
19598
- const unescapedClassName = decode$1(node$1.name);
19599
- node$1.name = sanitizeClassName(unescapedClassName);
19600
- }
19556
+ if (node$1.type === "ClassSelector") node$1.name = sanitizeClassName(decode$1(node$1.name));
19601
19557
  });
19602
19558
  walk(rule, {
19603
19559
  visit: "Declaration",
@@ -19636,10 +19592,7 @@ function mapReactTree(value, process) {
19636
19592
  const newProps = { ...node.props };
19637
19593
  if (node.props.children && !isComponent(node)) newProps.children = mapReactTree(node.props.children, process);
19638
19594
  const processed = process(react.default.cloneElement(node, newProps, newProps.children));
19639
- if (react.default.isValidElement(processed) && isComponent(processed)) {
19640
- const rendered = (typeof processed.type === "object" ? processed.type.render : processed.type)(processed.props);
19641
- return mapReactTree(rendered, process);
19642
- }
19595
+ if (react.default.isValidElement(processed) && isComponent(processed)) return mapReactTree((typeof processed.type === "object" ? processed.type.render : processed.type)(processed.props), process);
19643
19596
  return processed;
19644
19597
  }
19645
19598
  return process(node);
@@ -19654,8 +19607,8 @@ const fromDashCaseToCamelCase = (text) => {
19654
19607
  };
19655
19608
 
19656
19609
  //#endregion
19657
- //#region src/utils/compatibility/convert-css-property-to-react-property.ts
19658
- function convertCssPropertyToReactProperty(prop) {
19610
+ //#region src/utils/compatibility/get-react-property.ts
19611
+ function getReactProperty(prop) {
19659
19612
  const modifiedProp = prop.toLowerCase();
19660
19613
  if (modifiedProp.startsWith("--")) return modifiedProp;
19661
19614
  if (modifiedProp.startsWith("-ms-")) return fromDashCaseToCamelCase(modifiedProp.slice(1));
@@ -19666,12 +19619,41 @@ function convertCssPropertyToReactProperty(prop) {
19666
19619
  //#region src/utils/css/make-inline-styles-for.ts
19667
19620
  function makeInlineStylesFor(inlinableRules) {
19668
19621
  const styles = {};
19622
+ const localVariableDeclarations = /* @__PURE__ */ new Set();
19669
19623
  for (const rule of inlinableRules) walk(rule, {
19670
19624
  visit: "Declaration",
19671
19625
  enter(declaration) {
19672
- styles[convertCssPropertyToReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19626
+ if (declaration.property.startsWith("--")) localVariableDeclarations.add(declaration);
19673
19627
  }
19674
19628
  });
19629
+ for (const rule of inlinableRules) {
19630
+ walk(rule, {
19631
+ visit: "Function",
19632
+ enter(func, funcParentListItem) {
19633
+ if (func.name === "var") {
19634
+ let variableName;
19635
+ walk(func, {
19636
+ visit: "Identifier",
19637
+ enter(identifier) {
19638
+ variableName = identifier.name;
19639
+ return this.break;
19640
+ }
19641
+ });
19642
+ if (variableName) {
19643
+ const definition = Array.from(localVariableDeclarations).find((declaration) => variableName === declaration.property);
19644
+ if (definition) funcParentListItem.data = definition.value;
19645
+ }
19646
+ }
19647
+ }
19648
+ });
19649
+ walk(rule, {
19650
+ visit: "Declaration",
19651
+ enter(declaration) {
19652
+ if (declaration.property.startsWith("--")) return;
19653
+ styles[getReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19654
+ }
19655
+ });
19656
+ }
19675
19657
  return styles;
19676
19658
  }
19677
19659
 
package/dist/index.mjs CHANGED
@@ -1077,9 +1077,7 @@ function sourceFragment({ source, line, column, baseLine, baseColumn }, extraLin
1077
1077
  function processLines(start, end) {
1078
1078
  return lines.slice(start, end).map((line$1, idx) => String(start + idx + 1).padStart(maxNumLength) + " |" + line$1).join("\n");
1079
1079
  }
1080
- const prelines = "\n".repeat(Math.max(baseLine - 1, 0));
1081
- const precolumns = " ".repeat(Math.max(baseColumn - 1, 0));
1082
- const lines = (prelines + precolumns + source).split(/\r\n?|\n|\f/);
1080
+ const lines = ("\n".repeat(Math.max(baseLine - 1, 0)) + " ".repeat(Math.max(baseColumn - 1, 0)) + source).split(/\r\n?|\n|\f/);
1083
1081
  const startLine = Math.max(1, line - extraLines) - 1;
1084
1082
  const endLine = Math.min(line + extraLines, lines.length + 1);
1085
1083
  const maxNumLength = Math.max(4, String(endLine).length) + 1;
@@ -1362,8 +1360,7 @@ function createParser(config) {
1362
1360
  if (typeof onComment === "function") parser.forEachToken((type, start, end) => {
1363
1361
  if (type === Comment) {
1364
1362
  const loc = parser.getLocation(start, end);
1365
- const value = cmpStr(source, end - 2, end, "*/") ? source.slice(start + 2, end - 2) : source.slice(start + 2, end);
1366
- onComment(value, loc);
1363
+ onComment(cmpStr(source, end - 2, end, "*/") ? source.slice(start + 2, end - 2) : source.slice(start + 2, end), loc);
1367
1364
  }
1368
1365
  });
1369
1366
  const ast = parser.context[context].call(parser, options);
@@ -4798,8 +4795,7 @@ function processStructure(name$49, nodeType) {
4798
4795
  const docs = { type: "\"" + name$49 + "\"" };
4799
4796
  for (const key in structure$49) {
4800
4797
  if (hasOwnProperty$1.call(structure$49, key) === false) continue;
4801
- const fieldTypes = fields[key] = Array.isArray(structure$49[key]) ? structure$49[key].slice() : [structure$49[key]];
4802
- docs[key] = genTypesList(fieldTypes, name$49 + "." + key);
4798
+ docs[key] = genTypesList(fields[key] = Array.isArray(structure$49[key]) ? structure$49[key].slice() : [structure$49[key]], name$49 + "." + key);
4803
4799
  }
4804
4800
  return {
4805
4801
  docs,
@@ -19088,9 +19084,7 @@ function populateParentsForNodeTree(node) {
19088
19084
  //#endregion
19089
19085
  //#region src/utils/css/resolve-all-css-variables.ts
19090
19086
  function doSelectorsIntersect(first, second) {
19091
- const firstStringified = generate(first);
19092
- const secondStringified = generate(second);
19093
- if (firstStringified === secondStringified) return true;
19087
+ if (generate(first) === generate(second)) return true;
19094
19088
  let hasSomeUniversal = false;
19095
19089
  const walker = (node) => {
19096
19090
  if (hasSomeUniversal) return;
@@ -19102,12 +19096,6 @@ function doSelectorsIntersect(first, second) {
19102
19096
  if (hasSomeUniversal) return true;
19103
19097
  return false;
19104
19098
  }
19105
- function removeAndRepeatIfEmptyRecursively(node) {
19106
- if (node.parent) if (node.containedIn && node.containingItem) {
19107
- node.containedIn.remove(node.containingItem);
19108
- if (node.containedIn.isEmpty) removeAndRepeatIfEmptyRecursively(node.parent);
19109
- } else removeAndRepeatIfEmptyRecursively(node.parent);
19110
- }
19111
19099
  function someParent(node, predicate) {
19112
19100
  if (node.parent) {
19113
19101
  if (predicate(node.parent)) return true;
@@ -19125,11 +19113,8 @@ function resolveAllCssVariables(node) {
19125
19113
  if (someParent(declaration, (ancestor) => ancestor.type === "Atrule" && ancestor.name === "layer" && ancestor.prelude !== null && generate(ancestor.prelude).includes("properties"))) return;
19126
19114
  if (/--[\S]+/.test(declaration.property)) variableDefinitions.add({
19127
19115
  declaration,
19128
- variableName: `${declaration.property}`,
19129
- definition: generate(declaration.value),
19130
- remove() {
19131
- removeAndRepeatIfEmptyRecursively(declaration);
19132
- }
19116
+ variableName: declaration.property,
19117
+ definition: generate(declaration.value)
19133
19118
  });
19134
19119
  else {
19135
19120
  function parseVariableUsesFrom(node$1) {
@@ -19146,10 +19131,7 @@ function resolveAllCssVariables(node) {
19146
19131
  variableName: name$49,
19147
19132
  raw: generate(funcNode)
19148
19133
  });
19149
- if (fallback?.includes("var(")) {
19150
- const parsedFallback = parse(fallback, { context: "value" });
19151
- parseVariableUsesFrom(parsedFallback);
19152
- }
19134
+ if (fallback?.includes("var(")) parseVariableUsesFrom(parse(fallback, { context: "value" }));
19153
19135
  }
19154
19136
  }
19155
19137
  });
@@ -19175,7 +19157,6 @@ function resolveAllCssVariables(node) {
19175
19157
  }
19176
19158
  if (!hasReplaced && use.fallback) use.declaration.value = parse(generate(use.declaration.value).replaceAll(use.raw, use.fallback), { context: "value" });
19177
19159
  }
19178
- for (const definition of variableDefinitions) definition.remove();
19179
19160
  }
19180
19161
 
19181
19162
  //#endregion
@@ -19464,48 +19445,26 @@ function sanitizeDeclarations(nodeContainingDeclarations) {
19464
19445
  enter(hash, hashParentListItem) {
19465
19446
  const hex = hash.value.trim();
19466
19447
  if (hex.length === 3) {
19467
- const r$1 = Number.parseInt(hex.charAt(0) + hex.charAt(0), 16);
19468
- const g$1 = Number.parseInt(hex.charAt(1) + hex.charAt(1), 16);
19469
- const b$1 = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
19470
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1})`, { context: "value" });
19448
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.charAt(0) + hex.charAt(0), 16)},${Number.parseInt(hex.charAt(1) + hex.charAt(1), 16)},${Number.parseInt(hex.charAt(2) + hex.charAt(2), 16)})`, { context: "value" });
19471
19449
  return;
19472
19450
  }
19473
19451
  if (hex.length === 4) {
19474
- const r$1 = Number.parseInt(hex.charAt(0) + hex.charAt(0), 16);
19475
- const g$1 = Number.parseInt(hex.charAt(1) + hex.charAt(1), 16);
19476
- const b$1 = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
19477
- const a$1 = Number.parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255;
19478
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1},${a$1.toFixed(1)})`, { context: "value" });
19452
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.charAt(0) + hex.charAt(0), 16)},${Number.parseInt(hex.charAt(1) + hex.charAt(1), 16)},${Number.parseInt(hex.charAt(2) + hex.charAt(2), 16)},${(Number.parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255).toFixed(1)})`, { context: "value" });
19479
19453
  return;
19480
19454
  }
19481
19455
  if (hex.length === 5) {
19482
- const r$1 = Number.parseInt(hex.slice(0, 2), 16);
19483
- const g$1 = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
19484
- const b$1 = Number.parseInt(hex.charAt(3) + hex.charAt(3), 16);
19485
- const a$1 = Number.parseInt(hex.charAt(4) + hex.charAt(4), 16) / 255;
19486
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1},${a$1.toFixed(1)})`, { context: "value" });
19456
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.charAt(2) + hex.charAt(2), 16)},${Number.parseInt(hex.charAt(3) + hex.charAt(3), 16)},${(Number.parseInt(hex.charAt(4) + hex.charAt(4), 16) / 255).toFixed(1)})`, { context: "value" });
19487
19457
  return;
19488
19458
  }
19489
19459
  if (hex.length === 6) {
19490
- const r$1 = Number.parseInt(hex.slice(0, 2), 16);
19491
- const g$1 = Number.parseInt(hex.slice(2, 4), 16);
19492
- const b$1 = Number.parseInt(hex.slice(4, 6), 16);
19493
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1})`, { context: "value" });
19460
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.slice(2, 4), 16)},${Number.parseInt(hex.slice(4, 6), 16)})`, { context: "value" });
19494
19461
  return;
19495
19462
  }
19496
19463
  if (hex.length === 7) {
19497
- const r$1 = Number.parseInt(hex.slice(0, 2), 16);
19498
- const g$1 = Number.parseInt(hex.slice(2, 4), 16);
19499
- const b$1 = Number.parseInt(hex.slice(4, 6), 16);
19500
- const a$1 = Number.parseInt(hex.charAt(6) + hex.charAt(6), 16) / 255;
19501
- hashParentListItem.data = parse(`rgb(${r$1},${g$1},${b$1},${a$1.toFixed(1)})`, { context: "value" });
19464
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.slice(2, 4), 16)},${Number.parseInt(hex.slice(4, 6), 16)},${(Number.parseInt(hex.charAt(6) + hex.charAt(6), 16) / 255).toFixed(1)})`, { context: "value" });
19502
19465
  return;
19503
19466
  }
19504
- const r = Number.parseInt(hex.slice(0, 2), 16);
19505
- const g = Number.parseInt(hex.slice(2, 4), 16);
19506
- const b = Number.parseInt(hex.slice(4, 6), 16);
19507
- const a = Number.parseInt(hex.slice(6, 8), 16) / 255;
19508
- hashParentListItem.data = parse(`rgb(${r},${g},${b},${a.toFixed(1)})`, { context: "value" });
19467
+ hashParentListItem.data = parse(`rgb(${Number.parseInt(hex.slice(0, 2), 16)},${Number.parseInt(hex.slice(2, 4), 16)},${Number.parseInt(hex.slice(4, 6), 16)},${(Number.parseInt(hex.slice(6, 8), 16) / 255).toFixed(1)})`, { context: "value" });
19509
19468
  }
19510
19469
  });
19511
19470
  walk(declaration, {
@@ -19592,10 +19551,7 @@ function sanitizeNonInlinableRules(node) {
19592
19551
  enter(rule) {
19593
19552
  if (!isRuleInlinable(rule)) {
19594
19553
  walk(rule.prelude, (node$1) => {
19595
- if (node$1.type === "ClassSelector") {
19596
- const unescapedClassName = decode$1(node$1.name);
19597
- node$1.name = sanitizeClassName(unescapedClassName);
19598
- }
19554
+ if (node$1.type === "ClassSelector") node$1.name = sanitizeClassName(decode$1(node$1.name));
19599
19555
  });
19600
19556
  walk(rule, {
19601
19557
  visit: "Declaration",
@@ -19634,10 +19590,7 @@ function mapReactTree(value, process) {
19634
19590
  const newProps = { ...node.props };
19635
19591
  if (node.props.children && !isComponent(node)) newProps.children = mapReactTree(node.props.children, process);
19636
19592
  const processed = process(React.cloneElement(node, newProps, newProps.children));
19637
- if (React.isValidElement(processed) && isComponent(processed)) {
19638
- const rendered = (typeof processed.type === "object" ? processed.type.render : processed.type)(processed.props);
19639
- return mapReactTree(rendered, process);
19640
- }
19593
+ if (React.isValidElement(processed) && isComponent(processed)) return mapReactTree((typeof processed.type === "object" ? processed.type.render : processed.type)(processed.props), process);
19641
19594
  return processed;
19642
19595
  }
19643
19596
  return process(node);
@@ -19652,8 +19605,8 @@ const fromDashCaseToCamelCase = (text) => {
19652
19605
  };
19653
19606
 
19654
19607
  //#endregion
19655
- //#region src/utils/compatibility/convert-css-property-to-react-property.ts
19656
- function convertCssPropertyToReactProperty(prop) {
19608
+ //#region src/utils/compatibility/get-react-property.ts
19609
+ function getReactProperty(prop) {
19657
19610
  const modifiedProp = prop.toLowerCase();
19658
19611
  if (modifiedProp.startsWith("--")) return modifiedProp;
19659
19612
  if (modifiedProp.startsWith("-ms-")) return fromDashCaseToCamelCase(modifiedProp.slice(1));
@@ -19664,12 +19617,41 @@ function convertCssPropertyToReactProperty(prop) {
19664
19617
  //#region src/utils/css/make-inline-styles-for.ts
19665
19618
  function makeInlineStylesFor(inlinableRules) {
19666
19619
  const styles = {};
19620
+ const localVariableDeclarations = /* @__PURE__ */ new Set();
19667
19621
  for (const rule of inlinableRules) walk(rule, {
19668
19622
  visit: "Declaration",
19669
19623
  enter(declaration) {
19670
- styles[convertCssPropertyToReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19624
+ if (declaration.property.startsWith("--")) localVariableDeclarations.add(declaration);
19671
19625
  }
19672
19626
  });
19627
+ for (const rule of inlinableRules) {
19628
+ walk(rule, {
19629
+ visit: "Function",
19630
+ enter(func, funcParentListItem) {
19631
+ if (func.name === "var") {
19632
+ let variableName;
19633
+ walk(func, {
19634
+ visit: "Identifier",
19635
+ enter(identifier) {
19636
+ variableName = identifier.name;
19637
+ return this.break;
19638
+ }
19639
+ });
19640
+ if (variableName) {
19641
+ const definition = Array.from(localVariableDeclarations).find((declaration) => variableName === declaration.property);
19642
+ if (definition) funcParentListItem.data = definition.value;
19643
+ }
19644
+ }
19645
+ }
19646
+ });
19647
+ walk(rule, {
19648
+ visit: "Declaration",
19649
+ enter(declaration) {
19650
+ if (declaration.property.startsWith("--")) return;
19651
+ styles[getReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19652
+ }
19653
+ });
19654
+ }
19673
19655
  return styles;
19674
19656
  }
19675
19657