@react-email/tailwind 2.0.0-canary.0 → 2.0.0-canary.2

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.d.mts CHANGED
@@ -1,6 +1,13 @@
1
1
  import * as React$1 from "react";
2
2
  import { Config } from "tailwindcss";
3
+ import { StyleSheet } from "css-tree";
3
4
 
5
+ //#region src/inline-styles.d.ts
6
+ declare function inlineStyles(styleSheet: StyleSheet, classes: string[]): Record<string, string>;
7
+ //#endregion
8
+ //#region src/sanitize-stylesheet.d.ts
9
+ declare function sanitizeStyleSheet(styleSheet: StyleSheet): void;
10
+ //#endregion
4
11
  //#region src/tailwind.d.ts
5
12
  type TailwindConfig = Omit<Config, 'content'>;
6
13
  interface TailwindProps {
@@ -18,5 +25,12 @@ declare function Tailwind({
18
25
  config
19
26
  }: TailwindProps): React$1.ReactNode;
20
27
  //#endregion
21
- export { EmailElementProps, Tailwind, TailwindConfig, TailwindProps, pixelBasedPreset };
28
+ //#region src/utils/tailwindcss/setup-tailwind.d.ts
29
+ type TailwindSetup = Awaited<ReturnType<typeof setupTailwind>>;
30
+ declare function setupTailwind(config: TailwindConfig): Promise<{
31
+ addUtilities: (candidates: string[]) => void;
32
+ getStyleSheet: () => StyleSheet;
33
+ }>;
34
+ //#endregion
35
+ export { EmailElementProps, Tailwind, TailwindConfig, TailwindProps, TailwindSetup, inlineStyles, pixelBasedPreset, sanitizeStyleSheet, setupTailwind };
22
36
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/tailwind.tsx"],"sourcesContent":[],"mappings":";;;;KAcY,cAAA,GAAiB,KAAK;UAEjB,aAAA;EAFL,QAAA,EAGA,OAAA,CAAM,SAHQ;EAAA,MAAA,CAAA,EAIf,cAJe;;AAAG,UAOZ,iBAAA,CAPY;EAAI,QAAA,CAAA,EAQpB,OAAA,CAAM,SARc;EAEhB,SAAA,CAAA,EAAA,MAAa;EAAA,KAAA,CAAA,EAQpB,OAAA,CAAM,aARc;;AAEnB,cASE,gBATF,EASoB,cATpB;AAAc,iBAoET,QAAA,CApES;EAAA,QAAA;EAAA;AAAA,CAAA,EAoEsB,aApEtB,CAAA,EAoEmC,OAAA,CAAA,SApEnC"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/inline-styles.ts","../src/sanitize-stylesheet.ts","../src/tailwind.tsx","../src/utils/tailwindcss/setup-tailwind.ts"],"sourcesContent":[],"mappings":";;;;;iBAKgB,YAAA,aACF,gCAEX;;;iBCHa,kBAAA,aAA+B;;;KCOnC,cAAA,GAAiB,KAAK;UAEjB,aAAA;YACL,OAAA,CAAM;EFVF,MAAA,CAAA,EEWL,cFXiB;;AACd,UEaG,iBAAA,CFbH;UAEX,CAAA,EEYU,OAAA,CAAM,SFZhB;EAAM,SAAA,CAAA,EAAA,MAAA;UEcC,OAAA,CAAM;;cAGH,kBAAkB;ADpBf,iBC+EA,QAAA,CD/EkB;EAAa,QAAA;EAAA;AAAU,CAAA,EC+EV,aD/EU,CAAA,EC+EG,OAAA,CAAA,SD/EH;;;KEG7C,aAAA,GAAgB,QAAQ,kBAAkB;iBAEhC,aAAA,SAAsB,iBAAc;;EHL1C,aAAA,EAAY,GAAA,GGyED,UHzEC;CAAA,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,13 @@
1
+ import { StyleSheet } from "css-tree";
1
2
  import * as React from "react";
2
3
  import { Config } from "tailwindcss";
3
4
 
5
+ //#region src/inline-styles.d.ts
6
+ declare function inlineStyles(styleSheet: StyleSheet, classes: string[]): Record<string, string>;
7
+ //#endregion
8
+ //#region src/sanitize-stylesheet.d.ts
9
+ declare function sanitizeStyleSheet(styleSheet: StyleSheet): void;
10
+ //#endregion
4
11
  //#region src/tailwind.d.ts
5
12
  type TailwindConfig = Omit<Config, 'content'>;
6
13
  interface TailwindProps {
@@ -18,5 +25,12 @@ declare function Tailwind({
18
25
  config
19
26
  }: TailwindProps): React.ReactNode;
20
27
  //#endregion
21
- export { EmailElementProps, Tailwind, TailwindConfig, TailwindProps, pixelBasedPreset };
28
+ //#region src/utils/tailwindcss/setup-tailwind.d.ts
29
+ type TailwindSetup = Awaited<ReturnType<typeof setupTailwind>>;
30
+ declare function setupTailwind(config: TailwindConfig): Promise<{
31
+ addUtilities: (candidates: string[]) => void;
32
+ getStyleSheet: () => StyleSheet;
33
+ }>;
34
+ //#endregion
35
+ export { EmailElementProps, Tailwind, TailwindConfig, TailwindProps, TailwindSetup, inlineStyles, pixelBasedPreset, sanitizeStyleSheet, setupTailwind };
22
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/tailwind.tsx"],"sourcesContent":[],"mappings":";;;;KAcY,cAAA,GAAiB,KAAK;UAEjB,aAAA;EAFL,QAAA,EAGA,KAAA,CAAM,SAHQ;EAAA,MAAA,CAAA,EAIf,cAJe;;AAAG,UAOZ,iBAAA,CAPY;EAAI,QAAA,CAAA,EAQpB,KAAA,CAAM,SARc;EAEhB,SAAA,CAAA,EAAA,MAAa;EAAA,KAAA,CAAA,EAQpB,KAAA,CAAM,aARc;;AAEnB,cASE,gBATF,EASoB,cATpB;AAAc,iBAoET,QAAA,CApES;EAAA,QAAA;EAAA;AAAA,CAAA,EAoEsB,aApEtB,CAAA,EAoEmC,KAAA,CAAA,SApEnC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/inline-styles.ts","../src/sanitize-stylesheet.ts","../src/tailwind.tsx","../src/utils/tailwindcss/setup-tailwind.ts"],"sourcesContent":[],"mappings":";;;;;iBAKgB,YAAA,aACF,gCAEX;;;iBCHa,kBAAA,aAA+B;;;KCOnC,cAAA,GAAiB,KAAK;UAEjB,aAAA;YACL,KAAA,CAAM;EFVF,MAAA,CAAA,EEWL,cFXiB;;AACd,UEaG,iBAAA,CFbH;UAEX,CAAA,EEYU,KAAA,CAAM,SFZhB;EAAM,SAAA,CAAA,EAAA,MAAA;UEcC,KAAA,CAAM;;cAGH,kBAAkB;ADpBf,iBC+EA,QAAA,CD/EkB;EAAa,QAAA;EAAA;AAAU,CAAA,EC+EV,aD/EU,CAAA,EC+EG,KAAA,CAAA,SD/EH;;;KEG7C,aAAA,GAAgB,QAAQ,kBAAkB;iBAEhC,aAAA,SAAsB,iBAAc;;EHL1C,aAAA,EAAY,GAAA,GGyED,UHzEC;CAAA,CAAA"}
package/dist/index.js CHANGED
@@ -19038,21 +19038,6 @@ const { version } = {
19038
19038
  //#region ../../node_modules/.pnpm/css-tree@3.1.0/node_modules/css-tree/lib/index.js
19039
19039
  const { tokenize, parse, generate, lexer, createLexer, walk, find, findLast, findAll, toPlainObject, fromPlainObject, fork } = syntax_default;
19040
19040
 
19041
- //#endregion
19042
- //#region src/hooks/use-suspended-promise.ts
19043
- const promiseStates = /* @__PURE__ */ new Map();
19044
- function useSuspensedPromise(promiseFn, key) {
19045
- const previousState = promiseStates.get(key);
19046
- if (previousState) {
19047
- if ("error" in previousState) throw previousState.error;
19048
- if ("result" in previousState) return previousState.result;
19049
- throw previousState.promise;
19050
- }
19051
- const state = { promise: promiseFn().then((result) => state.result = result).catch((error) => state.error = error) };
19052
- promiseStates.set(key, state);
19053
- throw state.promise;
19054
- }
19055
-
19056
19041
  //#endregion
19057
19042
  //#region src/utils/css/is-rule-inlinable.ts
19058
19043
  function isRuleInlinable(rule) {
@@ -19121,6 +19106,82 @@ function getCustomProperties(node) {
19121
19106
  return customProperties;
19122
19107
  }
19123
19108
 
19109
+ //#endregion
19110
+ //#region src/utils/text/from-dash-case-to-camel-case.ts
19111
+ const fromDashCaseToCamelCase = (text) => {
19112
+ return text.replace(/-(\w|$)/g, (_, p1) => p1.toUpperCase());
19113
+ };
19114
+
19115
+ //#endregion
19116
+ //#region src/utils/compatibility/get-react-property.ts
19117
+ function getReactProperty(prop) {
19118
+ const modifiedProp = prop.toLowerCase();
19119
+ if (modifiedProp.startsWith("--")) return modifiedProp;
19120
+ if (modifiedProp.startsWith("-ms-")) return fromDashCaseToCamelCase(modifiedProp.slice(1));
19121
+ return fromDashCaseToCamelCase(modifiedProp);
19122
+ }
19123
+
19124
+ //#endregion
19125
+ //#region src/utils/css/unwrap-value.ts
19126
+ function unwrapValue(value) {
19127
+ if (value.type === "Value" && value.children.size === 1) return value.children.first ?? value;
19128
+ return value;
19129
+ }
19130
+
19131
+ //#endregion
19132
+ //#region src/utils/css/make-inline-styles-for.ts
19133
+ function makeInlineStylesFor(inlinableRules, customProperties) {
19134
+ const styles = {};
19135
+ const localVariableDeclarations = /* @__PURE__ */ new Map();
19136
+ for (const rule of inlinableRules) walk(rule, {
19137
+ visit: "Declaration",
19138
+ enter(declaration) {
19139
+ if (declaration.property.startsWith("--")) localVariableDeclarations.set(declaration.property, declaration);
19140
+ }
19141
+ });
19142
+ for (const rule of inlinableRules) {
19143
+ walk(rule, {
19144
+ visit: "Function",
19145
+ enter(func, funcParentListItem) {
19146
+ if (func.name === "var") {
19147
+ let variableName;
19148
+ walk(func, {
19149
+ visit: "Identifier",
19150
+ enter(identifier) {
19151
+ variableName = identifier.name;
19152
+ return this.break;
19153
+ }
19154
+ });
19155
+ if (variableName) {
19156
+ const definition = localVariableDeclarations.get(variableName);
19157
+ if (definition) funcParentListItem.data = unwrapValue(definition.value);
19158
+ else {
19159
+ const customProperty = customProperties.get(variableName);
19160
+ if (customProperty?.initialValue) funcParentListItem.data = unwrapValue(customProperty.initialValue.value);
19161
+ }
19162
+ }
19163
+ }
19164
+ }
19165
+ });
19166
+ walk(rule, {
19167
+ visit: "Declaration",
19168
+ enter(declaration) {
19169
+ if (declaration.property.startsWith("--")) return;
19170
+ styles[getReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19171
+ }
19172
+ });
19173
+ }
19174
+ return styles;
19175
+ }
19176
+
19177
+ //#endregion
19178
+ //#region src/inline-styles.ts
19179
+ function inlineStyles(styleSheet, classes) {
19180
+ const { inlinable: inlinableRules } = extractRulesPerClass(styleSheet, classes);
19181
+ const customProperties = getCustomProperties(styleSheet);
19182
+ return makeInlineStylesFor(Array.from(inlinableRules.values()), customProperties);
19183
+ }
19184
+
19124
19185
  //#endregion
19125
19186
  //#region src/utils/css/resolve-all-css-variables.ts
19126
19187
  function doSelectorsIntersect(first, second) {
@@ -19587,6 +19648,29 @@ function sanitizeDeclarations(nodeContainingDeclarations) {
19587
19648
  });
19588
19649
  }
19589
19650
 
19651
+ //#endregion
19652
+ //#region src/sanitize-stylesheet.ts
19653
+ function sanitizeStyleSheet(styleSheet) {
19654
+ resolveAllCssVariables(styleSheet);
19655
+ resolveCalcExpressions(styleSheet);
19656
+ sanitizeDeclarations(styleSheet);
19657
+ }
19658
+
19659
+ //#endregion
19660
+ //#region src/hooks/use-suspended-promise.ts
19661
+ const promiseStates = /* @__PURE__ */ new Map();
19662
+ function useSuspensedPromise(promiseFn, key) {
19663
+ const previousState = promiseStates.get(key);
19664
+ if (previousState) {
19665
+ if ("error" in previousState) throw previousState.error;
19666
+ if ("result" in previousState) return previousState.result;
19667
+ throw previousState.promise;
19668
+ }
19669
+ const state = { promise: promiseFn().then((result) => state.result = result).catch((error) => state.error = error) };
19670
+ promiseStates.set(key, state);
19671
+ throw state.promise;
19672
+ }
19673
+
19590
19674
  //#endregion
19591
19675
  //#region src/utils/compatibility/sanitize-class-name.ts
19592
19676
  const digitToNameMap = {
@@ -19690,74 +19774,6 @@ function mapReactTree(value, process) {
19690
19774
  return mapped && mapped.length === 1 ? mapped[0] : mapped;
19691
19775
  }
19692
19776
 
19693
- //#endregion
19694
- //#region src/utils/text/from-dash-case-to-camel-case.ts
19695
- const fromDashCaseToCamelCase = (text) => {
19696
- return text.replace(/-(\w|$)/g, (_, p1) => p1.toUpperCase());
19697
- };
19698
-
19699
- //#endregion
19700
- //#region src/utils/compatibility/get-react-property.ts
19701
- function getReactProperty(prop) {
19702
- const modifiedProp = prop.toLowerCase();
19703
- if (modifiedProp.startsWith("--")) return modifiedProp;
19704
- if (modifiedProp.startsWith("-ms-")) return fromDashCaseToCamelCase(modifiedProp.slice(1));
19705
- return fromDashCaseToCamelCase(modifiedProp);
19706
- }
19707
-
19708
- //#endregion
19709
- //#region src/utils/css/unwrap-value.ts
19710
- function unwrapValue(value) {
19711
- if (value.type === "Value" && value.children.size === 1) return value.children.first ?? value;
19712
- return value;
19713
- }
19714
-
19715
- //#endregion
19716
- //#region src/utils/css/make-inline-styles-for.ts
19717
- function makeInlineStylesFor(inlinableRules, customProperties) {
19718
- const styles = {};
19719
- const localVariableDeclarations = /* @__PURE__ */ new Map();
19720
- for (const rule of inlinableRules) walk(rule, {
19721
- visit: "Declaration",
19722
- enter(declaration) {
19723
- if (declaration.property.startsWith("--")) localVariableDeclarations.set(declaration.property, declaration);
19724
- }
19725
- });
19726
- for (const rule of inlinableRules) {
19727
- walk(rule, {
19728
- visit: "Function",
19729
- enter(func, funcParentListItem) {
19730
- if (func.name === "var") {
19731
- let variableName;
19732
- walk(func, {
19733
- visit: "Identifier",
19734
- enter(identifier) {
19735
- variableName = identifier.name;
19736
- return this.break;
19737
- }
19738
- });
19739
- if (variableName) {
19740
- const definition = localVariableDeclarations.get(variableName);
19741
- if (definition) funcParentListItem.data = unwrapValue(definition.value);
19742
- else {
19743
- const customProperty = customProperties.get(variableName);
19744
- if (customProperty?.initialValue) funcParentListItem.data = unwrapValue(customProperty.initialValue.value);
19745
- }
19746
- }
19747
- }
19748
- }
19749
- });
19750
- walk(rule, {
19751
- visit: "Declaration",
19752
- enter(declaration) {
19753
- if (declaration.property.startsWith("--")) return;
19754
- styles[getReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19755
- }
19756
- });
19757
- }
19758
- return styles;
19759
- }
19760
-
19761
19777
  //#endregion
19762
19778
  //#region src/utils/tailwindcss/clone-element-with-inlined-styles.ts
19763
19779
  function cloneElementWithInlinedStyles(element, inlinableRules, nonInlinableRules, customProperties) {
@@ -21688,16 +21704,14 @@ function Tailwind({ children, config }) {
21688
21704
  return node;
21689
21705
  });
21690
21706
  const styleSheet = tailwindSetup.getStyleSheet();
21691
- resolveAllCssVariables(styleSheet);
21692
- resolveCalcExpressions(styleSheet);
21693
- sanitizeDeclarations(styleSheet);
21707
+ sanitizeStyleSheet(styleSheet);
21694
21708
  const { inlinable: inlinableRules, nonInlinable: nonInlinableRules } = extractRulesPerClass(styleSheet, classesUsed);
21695
- sanitizeNonInlinableRules(styleSheet);
21696
21709
  const customProperties = getCustomProperties(styleSheet);
21697
21710
  const nonInlineStyles = {
21698
21711
  type: "StyleSheet",
21699
21712
  children: new List().fromArray(Array.from(nonInlinableRules.values()))
21700
21713
  };
21714
+ sanitizeNonInlinableRules(nonInlineStyles);
21701
21715
  const hasNonInlineStylesToApply = nonInlinableRules.size > 0;
21702
21716
  let appliedNonInlineStyles = false;
21703
21717
  mappedChildren = mapReactTree(mappedChildren, (node) => {
@@ -21726,4 +21740,7 @@ please file a bug https://github.com/resend/react-email/issues/new?assignees=&la
21726
21740
 
21727
21741
  //#endregion
21728
21742
  exports.Tailwind = Tailwind;
21729
- exports.pixelBasedPreset = pixelBasedPreset;
21743
+ exports.inlineStyles = inlineStyles;
21744
+ exports.pixelBasedPreset = pixelBasedPreset;
21745
+ exports.sanitizeStyleSheet = sanitizeStyleSheet;
21746
+ exports.setupTailwind = setupTailwind;
package/dist/index.mjs CHANGED
@@ -19025,21 +19025,6 @@ const { version } = {
19025
19025
  //#region ../../node_modules/.pnpm/css-tree@3.1.0/node_modules/css-tree/lib/index.js
19026
19026
  const { tokenize, parse, generate, lexer, createLexer, walk, find, findLast, findAll, toPlainObject, fromPlainObject, fork } = syntax_default;
19027
19027
 
19028
- //#endregion
19029
- //#region src/hooks/use-suspended-promise.ts
19030
- const promiseStates = /* @__PURE__ */ new Map();
19031
- function useSuspensedPromise(promiseFn, key) {
19032
- const previousState = promiseStates.get(key);
19033
- if (previousState) {
19034
- if ("error" in previousState) throw previousState.error;
19035
- if ("result" in previousState) return previousState.result;
19036
- throw previousState.promise;
19037
- }
19038
- const state = { promise: promiseFn().then((result) => state.result = result).catch((error) => state.error = error) };
19039
- promiseStates.set(key, state);
19040
- throw state.promise;
19041
- }
19042
-
19043
19028
  //#endregion
19044
19029
  //#region src/utils/css/is-rule-inlinable.ts
19045
19030
  function isRuleInlinable(rule) {
@@ -19108,6 +19093,82 @@ function getCustomProperties(node) {
19108
19093
  return customProperties;
19109
19094
  }
19110
19095
 
19096
+ //#endregion
19097
+ //#region src/utils/text/from-dash-case-to-camel-case.ts
19098
+ const fromDashCaseToCamelCase = (text) => {
19099
+ return text.replace(/-(\w|$)/g, (_, p1) => p1.toUpperCase());
19100
+ };
19101
+
19102
+ //#endregion
19103
+ //#region src/utils/compatibility/get-react-property.ts
19104
+ function getReactProperty(prop) {
19105
+ const modifiedProp = prop.toLowerCase();
19106
+ if (modifiedProp.startsWith("--")) return modifiedProp;
19107
+ if (modifiedProp.startsWith("-ms-")) return fromDashCaseToCamelCase(modifiedProp.slice(1));
19108
+ return fromDashCaseToCamelCase(modifiedProp);
19109
+ }
19110
+
19111
+ //#endregion
19112
+ //#region src/utils/css/unwrap-value.ts
19113
+ function unwrapValue(value) {
19114
+ if (value.type === "Value" && value.children.size === 1) return value.children.first ?? value;
19115
+ return value;
19116
+ }
19117
+
19118
+ //#endregion
19119
+ //#region src/utils/css/make-inline-styles-for.ts
19120
+ function makeInlineStylesFor(inlinableRules, customProperties) {
19121
+ const styles = {};
19122
+ const localVariableDeclarations = /* @__PURE__ */ new Map();
19123
+ for (const rule of inlinableRules) walk(rule, {
19124
+ visit: "Declaration",
19125
+ enter(declaration) {
19126
+ if (declaration.property.startsWith("--")) localVariableDeclarations.set(declaration.property, declaration);
19127
+ }
19128
+ });
19129
+ for (const rule of inlinableRules) {
19130
+ walk(rule, {
19131
+ visit: "Function",
19132
+ enter(func, funcParentListItem) {
19133
+ if (func.name === "var") {
19134
+ let variableName;
19135
+ walk(func, {
19136
+ visit: "Identifier",
19137
+ enter(identifier) {
19138
+ variableName = identifier.name;
19139
+ return this.break;
19140
+ }
19141
+ });
19142
+ if (variableName) {
19143
+ const definition = localVariableDeclarations.get(variableName);
19144
+ if (definition) funcParentListItem.data = unwrapValue(definition.value);
19145
+ else {
19146
+ const customProperty = customProperties.get(variableName);
19147
+ if (customProperty?.initialValue) funcParentListItem.data = unwrapValue(customProperty.initialValue.value);
19148
+ }
19149
+ }
19150
+ }
19151
+ }
19152
+ });
19153
+ walk(rule, {
19154
+ visit: "Declaration",
19155
+ enter(declaration) {
19156
+ if (declaration.property.startsWith("--")) return;
19157
+ styles[getReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19158
+ }
19159
+ });
19160
+ }
19161
+ return styles;
19162
+ }
19163
+
19164
+ //#endregion
19165
+ //#region src/inline-styles.ts
19166
+ function inlineStyles(styleSheet, classes) {
19167
+ const { inlinable: inlinableRules } = extractRulesPerClass(styleSheet, classes);
19168
+ const customProperties = getCustomProperties(styleSheet);
19169
+ return makeInlineStylesFor(Array.from(inlinableRules.values()), customProperties);
19170
+ }
19171
+
19111
19172
  //#endregion
19112
19173
  //#region src/utils/css/resolve-all-css-variables.ts
19113
19174
  function doSelectorsIntersect(first, second) {
@@ -19574,6 +19635,29 @@ function sanitizeDeclarations(nodeContainingDeclarations) {
19574
19635
  });
19575
19636
  }
19576
19637
 
19638
+ //#endregion
19639
+ //#region src/sanitize-stylesheet.ts
19640
+ function sanitizeStyleSheet(styleSheet) {
19641
+ resolveAllCssVariables(styleSheet);
19642
+ resolveCalcExpressions(styleSheet);
19643
+ sanitizeDeclarations(styleSheet);
19644
+ }
19645
+
19646
+ //#endregion
19647
+ //#region src/hooks/use-suspended-promise.ts
19648
+ const promiseStates = /* @__PURE__ */ new Map();
19649
+ function useSuspensedPromise(promiseFn, key) {
19650
+ const previousState = promiseStates.get(key);
19651
+ if (previousState) {
19652
+ if ("error" in previousState) throw previousState.error;
19653
+ if ("result" in previousState) return previousState.result;
19654
+ throw previousState.promise;
19655
+ }
19656
+ const state = { promise: promiseFn().then((result) => state.result = result).catch((error) => state.error = error) };
19657
+ promiseStates.set(key, state);
19658
+ throw state.promise;
19659
+ }
19660
+
19577
19661
  //#endregion
19578
19662
  //#region src/utils/compatibility/sanitize-class-name.ts
19579
19663
  const digitToNameMap = {
@@ -19677,74 +19761,6 @@ function mapReactTree(value, process) {
19677
19761
  return mapped && mapped.length === 1 ? mapped[0] : mapped;
19678
19762
  }
19679
19763
 
19680
- //#endregion
19681
- //#region src/utils/text/from-dash-case-to-camel-case.ts
19682
- const fromDashCaseToCamelCase = (text) => {
19683
- return text.replace(/-(\w|$)/g, (_, p1) => p1.toUpperCase());
19684
- };
19685
-
19686
- //#endregion
19687
- //#region src/utils/compatibility/get-react-property.ts
19688
- function getReactProperty(prop) {
19689
- const modifiedProp = prop.toLowerCase();
19690
- if (modifiedProp.startsWith("--")) return modifiedProp;
19691
- if (modifiedProp.startsWith("-ms-")) return fromDashCaseToCamelCase(modifiedProp.slice(1));
19692
- return fromDashCaseToCamelCase(modifiedProp);
19693
- }
19694
-
19695
- //#endregion
19696
- //#region src/utils/css/unwrap-value.ts
19697
- function unwrapValue(value) {
19698
- if (value.type === "Value" && value.children.size === 1) return value.children.first ?? value;
19699
- return value;
19700
- }
19701
-
19702
- //#endregion
19703
- //#region src/utils/css/make-inline-styles-for.ts
19704
- function makeInlineStylesFor(inlinableRules, customProperties) {
19705
- const styles = {};
19706
- const localVariableDeclarations = /* @__PURE__ */ new Map();
19707
- for (const rule of inlinableRules) walk(rule, {
19708
- visit: "Declaration",
19709
- enter(declaration) {
19710
- if (declaration.property.startsWith("--")) localVariableDeclarations.set(declaration.property, declaration);
19711
- }
19712
- });
19713
- for (const rule of inlinableRules) {
19714
- walk(rule, {
19715
- visit: "Function",
19716
- enter(func, funcParentListItem) {
19717
- if (func.name === "var") {
19718
- let variableName;
19719
- walk(func, {
19720
- visit: "Identifier",
19721
- enter(identifier) {
19722
- variableName = identifier.name;
19723
- return this.break;
19724
- }
19725
- });
19726
- if (variableName) {
19727
- const definition = localVariableDeclarations.get(variableName);
19728
- if (definition) funcParentListItem.data = unwrapValue(definition.value);
19729
- else {
19730
- const customProperty = customProperties.get(variableName);
19731
- if (customProperty?.initialValue) funcParentListItem.data = unwrapValue(customProperty.initialValue.value);
19732
- }
19733
- }
19734
- }
19735
- }
19736
- });
19737
- walk(rule, {
19738
- visit: "Declaration",
19739
- enter(declaration) {
19740
- if (declaration.property.startsWith("--")) return;
19741
- styles[getReactProperty(declaration.property)] = generate(declaration.value) + (declaration.important ? "!important" : "");
19742
- }
19743
- });
19744
- }
19745
- return styles;
19746
- }
19747
-
19748
19764
  //#endregion
19749
19765
  //#region src/utils/tailwindcss/clone-element-with-inlined-styles.ts
19750
19766
  function cloneElementWithInlinedStyles(element, inlinableRules, nonInlinableRules, customProperties) {
@@ -21675,16 +21691,14 @@ function Tailwind({ children, config }) {
21675
21691
  return node;
21676
21692
  });
21677
21693
  const styleSheet = tailwindSetup.getStyleSheet();
21678
- resolveAllCssVariables(styleSheet);
21679
- resolveCalcExpressions(styleSheet);
21680
- sanitizeDeclarations(styleSheet);
21694
+ sanitizeStyleSheet(styleSheet);
21681
21695
  const { inlinable: inlinableRules, nonInlinable: nonInlinableRules } = extractRulesPerClass(styleSheet, classesUsed);
21682
- sanitizeNonInlinableRules(styleSheet);
21683
21696
  const customProperties = getCustomProperties(styleSheet);
21684
21697
  const nonInlineStyles = {
21685
21698
  type: "StyleSheet",
21686
21699
  children: new List().fromArray(Array.from(nonInlinableRules.values()))
21687
21700
  };
21701
+ sanitizeNonInlinableRules(nonInlineStyles);
21688
21702
  const hasNonInlineStylesToApply = nonInlinableRules.size > 0;
21689
21703
  let appliedNonInlineStyles = false;
21690
21704
  mappedChildren = mapReactTree(mappedChildren, (node) => {
@@ -21712,5 +21726,5 @@ please file a bug https://github.com/resend/react-email/issues/new?assignees=&la
21712
21726
  }
21713
21727
 
21714
21728
  //#endregion
21715
- export { Tailwind, pixelBasedPreset };
21729
+ export { Tailwind, inlineStyles, pixelBasedPreset, sanitizeStyleSheet, setupTailwind };
21716
21730
  //# sourceMappingURL=index.mjs.map