react-email 3.0.3 → 3.0.5

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.
Files changed (224) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli/index.js +96 -100
  3. package/dist/cli/index.mjs +75 -64
  4. package/dist/index.d.mts +20 -0
  5. package/dist/index.d.ts +20 -0
  6. package/dist/index.js +96 -0
  7. package/dist/index.mjs +21 -0
  8. package/dist/package/index.d.mts +33 -0
  9. package/dist/package/index.d.ts +33 -0
  10. package/dist/package/index.js +62 -0
  11. package/dist/package/index.mjs +7 -0
  12. package/dist/preview/.next/BUILD_ID +1 -1
  13. package/dist/preview/.next/app-build-manifest.json +31 -31
  14. package/dist/preview/.next/app-path-routes-manifest.json +1 -1
  15. package/dist/preview/.next/build-manifest.json +16 -15
  16. package/dist/preview/.next/cache/.rscinfo +1 -0
  17. package/dist/preview/.next/cache/eslint/.cache_1vyas3k +1 -0
  18. package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
  19. package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
  20. package/dist/preview/.next/cache/webpack/edge-server-production/0.pack +0 -0
  21. package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
  22. package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
  23. package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
  24. package/dist/preview/.next/diagnostics/build-diagnostics.json +6 -0
  25. package/dist/preview/.next/diagnostics/framework.json +1 -0
  26. package/dist/preview/.next/images-manifest.json +1 -1
  27. package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
  28. package/dist/preview/.next/next-server.js.nft.json +1 -1
  29. package/dist/preview/.next/prerender-manifest.json +1 -1
  30. package/dist/preview/.next/required-server-files.json +1 -1
  31. package/dist/preview/.next/routes-manifest.json +1 -1
  32. package/dist/preview/.next/server/app/_not-found/page.js +1 -1
  33. package/dist/preview/.next/server/app/_not-found/page.js.nft.json +1 -1
  34. package/dist/preview/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  35. package/dist/preview/.next/server/app/favicon.ico/route.js +1 -12
  36. package/dist/preview/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  37. package/dist/preview/.next/server/app/page.js +1 -1
  38. package/dist/preview/.next/server/app/page.js.nft.json +1 -1
  39. package/dist/preview/.next/server/app/page_client-reference-manifest.js +1 -1
  40. package/dist/preview/.next/server/app/preview/[...slug]/page.js +6 -6
  41. package/dist/preview/.next/server/app/preview/[...slug]/page.js.nft.json +1 -1
  42. package/dist/preview/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +1 -1
  43. package/dist/preview/.next/server/app-paths-manifest.json +1 -1
  44. package/dist/preview/.next/server/chunks/300.js +13 -0
  45. package/dist/preview/.next/server/chunks/420.js +1 -0
  46. package/dist/preview/.next/server/chunks/625.js +5 -0
  47. package/dist/preview/.next/server/chunks/631.js +6 -0
  48. package/dist/preview/.next/server/chunks/720.js +10 -0
  49. package/dist/preview/.next/server/functions-config-manifest.json +1 -1
  50. package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
  51. package/dist/preview/.next/server/next-font-manifest.js +1 -1
  52. package/dist/preview/.next/server/next-font-manifest.json +1 -1
  53. package/dist/preview/.next/server/pages/500.html +1 -1
  54. package/dist/preview/.next/server/pages/_app.js +1 -1
  55. package/dist/preview/.next/server/pages/_app.js.nft.json +1 -1
  56. package/dist/preview/.next/server/pages/_document.js +1 -1
  57. package/dist/preview/.next/server/pages/_document.js.nft.json +1 -1
  58. package/dist/preview/.next/server/pages/_error.js +1 -1
  59. package/dist/preview/.next/server/pages/_error.js.nft.json +1 -1
  60. package/dist/preview/.next/server/server-reference-manifest.js +1 -1
  61. package/dist/preview/.next/server/server-reference-manifest.json +1 -1
  62. package/dist/preview/.next/server/webpack-runtime.js +1 -1
  63. package/dist/preview/.next/static/6K68y2QEZ1dLbv-Xhi30p/_buildManifest.js +1 -0
  64. package/dist/preview/.next/static/chunks/12-b9450aa0845e7574.js +1 -0
  65. package/dist/preview/.next/static/chunks/154-69b91a0c2fd801b8.js +1 -0
  66. package/dist/preview/.next/static/chunks/447-886131c35ca42b91.js +1 -0
  67. package/dist/preview/.next/static/chunks/5fec7a0a-5179023f3f5a9421.js +1 -0
  68. package/dist/preview/.next/static/chunks/797-46f6c20952f0a280.js +2 -0
  69. package/dist/preview/.next/static/chunks/860-38d96c8819ba6f19.js +1 -0
  70. package/dist/preview/.next/static/chunks/app/_not-found/page-96d3eac723be3ee2.js +1 -0
  71. package/dist/preview/.next/static/chunks/app/layout-e1b6f1534cbbe5bd.js +1 -0
  72. package/dist/preview/.next/static/chunks/app/page-2c3e297e38c526ef.js +1 -0
  73. package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-2b4988ba6daf34e1.js +1 -0
  74. package/dist/preview/.next/static/chunks/framework-e7cae9cecd5c9ba2.js +1 -0
  75. package/dist/preview/.next/static/chunks/main-app-2c7f96205a73f128.js +1 -0
  76. package/dist/preview/.next/static/chunks/main-df761fde212f9cda.js +1 -0
  77. package/dist/preview/.next/static/chunks/pages/_app-203a61b355820ccf.js +1 -0
  78. package/dist/preview/.next/static/chunks/pages/_error-1764ca54938748c8.js +1 -0
  79. package/dist/preview/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  80. package/dist/preview/.next/static/chunks/webpack-9255716c9496e606.js +1 -0
  81. package/dist/preview/.next/static/css/ec5d7e66bd3b6cb8.css +1 -0
  82. package/dist/preview/.next/trace +20 -52
  83. package/dist/preview/.next/types/app/layout.ts +11 -6
  84. package/dist/preview/.next/types/app/preview/[...slug]/page.ts +11 -6
  85. package/dist/preview/.next/types/cache-life.d.ts +141 -0
  86. package/next-env.d.ts +1 -1
  87. package/package.json +12 -12
  88. package/src/actions/get-email-path-from-slug.ts +3 -2
  89. package/src/actions/get-emails-directory-metadata.spec.ts +1 -0
  90. package/src/actions/get-emails-directory-metadata.ts +62 -59
  91. package/src/actions/render-email-by-path.tsx +16 -5
  92. package/src/app/preview/[...slug]/page.tsx +19 -9
  93. package/src/app/preview/[...slug]/preview.tsx +6 -7
  94. package/src/contexts/emails.tsx +2 -56
  95. package/src/hooks/use-email-rendering-result.ts +44 -0
  96. package/src/hooks/use-rendering-metadata.ts +5 -5
  97. package/src/package/body/dist/index.d.mts +6 -0
  98. package/src/package/body/dist/index.d.ts +6 -0
  99. package/src/package/body/dist/index.js +79 -0
  100. package/src/package/body/dist/index.mjs +45 -0
  101. package/src/package/button/dist/index.d.mts +6 -0
  102. package/src/package/button/dist/index.d.ts +6 -0
  103. package/src/package/button/dist/index.js +252 -0
  104. package/src/package/button/dist/index.mjs +218 -0
  105. package/src/package/code-block/dist/index.d.mts +4906 -0
  106. package/src/package/code-block/dist/index.d.ts +4906 -0
  107. package/src/package/code-block/dist/index.js +18205 -0
  108. package/src/package/code-block/dist/index.mjs +18133 -0
  109. package/src/package/code-inline/dist/index.d.mts +11 -0
  110. package/src/package/code-inline/dist/index.d.ts +11 -0
  111. package/src/package/code-inline/dist/index.js +106 -0
  112. package/src/package/code-inline/dist/index.mjs +72 -0
  113. package/src/package/column/dist/index.d.mts +6 -0
  114. package/src/package/column/dist/index.d.ts +6 -0
  115. package/src/package/column/dist/index.js +79 -0
  116. package/src/package/column/dist/index.mjs +45 -0
  117. package/src/package/components/dist/index.d.mts +20 -0
  118. package/src/package/components/dist/index.d.ts +20 -0
  119. package/src/package/components/dist/index.js +62 -0
  120. package/src/package/components/dist/index.mjs +21 -0
  121. package/src/package/container/dist/index.d.mts +6 -0
  122. package/src/package/container/dist/index.d.ts +6 -0
  123. package/src/package/container/dist/index.js +93 -0
  124. package/src/package/container/dist/index.mjs +59 -0
  125. package/src/package/font/dist/index.d.mts +25 -0
  126. package/src/package/font/dist/index.d.ts +25 -0
  127. package/src/package/font/dist/index.js +55 -0
  128. package/src/package/font/dist/index.mjs +28 -0
  129. package/src/package/head/dist/index.d.mts +6 -0
  130. package/src/package/head/dist/index.d.ts +6 -0
  131. package/src/package/head/dist/index.js +83 -0
  132. package/src/package/head/dist/index.mjs +49 -0
  133. package/src/package/heading/dist/index.d.mts +43 -0
  134. package/src/package/heading/dist/index.d.ts +43 -0
  135. package/src/package/heading/dist/index.js +113 -0
  136. package/src/package/heading/dist/index.mjs +79 -0
  137. package/src/package/hr/dist/index.d.mts +6 -0
  138. package/src/package/hr/dist/index.d.ts +6 -0
  139. package/src/package/hr/dist/index.js +89 -0
  140. package/src/package/hr/dist/index.mjs +55 -0
  141. package/src/package/html/dist/index.d.mts +6 -0
  142. package/src/package/html/dist/index.d.ts +6 -0
  143. package/src/package/html/dist/index.js +79 -0
  144. package/src/package/html/dist/index.mjs +45 -0
  145. package/src/package/img/dist/index.d.mts +6 -0
  146. package/src/package/img/dist/index.d.ts +6 -0
  147. package/src/package/img/dist/index.js +94 -0
  148. package/src/package/img/dist/index.mjs +60 -0
  149. package/src/package/link/dist/index.d.mts +6 -0
  150. package/src/package/link/dist/index.d.ts +6 -0
  151. package/src/package/link/dist/index.js +90 -0
  152. package/src/package/link/dist/index.mjs +56 -0
  153. package/src/package/markdown/dist/index.d.mts +15 -0
  154. package/src/package/markdown/dist/index.d.ts +15 -0
  155. package/src/package/markdown/dist/index.js +92 -0
  156. package/src/package/markdown/dist/index.mjs +58 -0
  157. package/src/package/preview/dist/index.d.mts +12 -0
  158. package/src/package/preview/dist/index.d.ts +12 -0
  159. package/src/package/preview/dist/index.js +108 -0
  160. package/src/package/preview/dist/index.mjs +73 -0
  161. package/src/package/render/dist/browser/index.d.mts +24 -0
  162. package/src/package/render/dist/browser/index.d.ts +24 -0
  163. package/src/package/render/dist/browser/index.js +250 -0
  164. package/src/package/render/dist/browser/index.mjs +214 -0
  165. package/src/package/render/dist/index.d.mts +23 -0
  166. package/src/package/render/dist/index.d.ts +23 -0
  167. package/src/package/render/dist/index.js +768 -0
  168. package/src/package/render/dist/index.mjs +733 -0
  169. package/src/package/render/dist/node/index.d.mts +27 -0
  170. package/src/package/render/dist/node/index.d.ts +27 -0
  171. package/src/package/render/dist/node/index.js +212 -0
  172. package/src/package/render/dist/node/index.mjs +176 -0
  173. package/src/package/row/dist/index.d.mts +10 -0
  174. package/src/package/row/dist/index.d.ts +10 -0
  175. package/src/package/row/dist/index.js +93 -0
  176. package/src/package/row/dist/index.mjs +59 -0
  177. package/src/package/section/dist/index.d.mts +6 -0
  178. package/src/package/section/dist/index.d.ts +6 -0
  179. package/src/package/section/dist/index.js +93 -0
  180. package/src/package/section/dist/index.mjs +59 -0
  181. package/src/package/tailwind/dist/index.d.ts +19 -0
  182. package/src/package/tailwind/dist/index.js +48 -0
  183. package/src/package/tailwind/dist/index.mjs +17167 -0
  184. package/src/package/tailwind/dist/tailwindcss/config.d.ts +376 -0
  185. package/src/package/tailwind/dist/tailwindcss/generated/.gitkeep +0 -0
  186. package/src/package/tailwind/dist/tailwindcss/generated/colors.d.ts +298 -0
  187. package/src/package/tailwind/dist/tailwindcss/generated/corePluginList.d.ts +1 -0
  188. package/src/package/tailwind/dist/tailwindcss/generated/default-theme.d.ts +397 -0
  189. package/src/package/tailwind/dist/tailwindcss/index.d.ts +11 -0
  190. package/src/package/text/dist/index.d.mts +6 -0
  191. package/src/package/text/dist/index.d.ts +6 -0
  192. package/src/package/text/dist/index.js +89 -0
  193. package/src/package/text/dist/index.mjs +55 -0
  194. package/src/utils/types/hot-reload-event.ts +3 -6
  195. package/dist/preview/.next/cache/eslint/.cache_117y9un +0 -1
  196. package/dist/preview/.next/server/chunks/128.js +0 -7
  197. package/dist/preview/.next/server/chunks/176.js +0 -2
  198. package/dist/preview/.next/server/chunks/287.js +0 -4
  199. package/dist/preview/.next/server/chunks/303.js +0 -6
  200. package/dist/preview/.next/server/chunks/359.js +0 -10
  201. package/dist/preview/.next/server/chunks/6.js +0 -1
  202. package/dist/preview/.next/server/chunks/894.js +0 -4
  203. package/dist/preview/.next/server/chunks/font-manifest.json +0 -1
  204. package/dist/preview/.next/server/font-manifest.json +0 -1
  205. package/dist/preview/.next/static/9wK7iUJPUvFYJNYOqHNpo/_buildManifest.js +0 -1
  206. package/dist/preview/.next/static/chunks/121-c9990f9db62882f2.js +0 -2
  207. package/dist/preview/.next/static/chunks/262-1ec6780d76508af8.js +0 -1
  208. package/dist/preview/.next/static/chunks/599-b4e686757f7b900d.js +0 -1
  209. package/dist/preview/.next/static/chunks/732-2b6186d8c8624033.js +0 -1
  210. package/dist/preview/.next/static/chunks/783-41562adc25d0c844.js +0 -9
  211. package/dist/preview/.next/static/chunks/app/_not-found/page-02dfc5a8a0bd636e.js +0 -1
  212. package/dist/preview/.next/static/chunks/app/layout-62d01ca567f6fd12.js +0 -1
  213. package/dist/preview/.next/static/chunks/app/page-630c6c846e3efc69.js +0 -1
  214. package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-6547e9f3ba86c271.js +0 -1
  215. package/dist/preview/.next/static/chunks/f38cb6f6-40e76da092bb0490.js +0 -1
  216. package/dist/preview/.next/static/chunks/framework-bef83a85c94ff7de.js +0 -1
  217. package/dist/preview/.next/static/chunks/main-app-6ed588927d8fd56c.js +0 -1
  218. package/dist/preview/.next/static/chunks/main-ee2ceeb6c8bf53ac.js +0 -1
  219. package/dist/preview/.next/static/chunks/pages/_app-02aac361ebb5625a.js +0 -1
  220. package/dist/preview/.next/static/chunks/pages/_error-52f603c388364756.js +0 -1
  221. package/dist/preview/.next/static/chunks/polyfills-78c92fac7aa8fdd8.js +0 -1
  222. package/dist/preview/.next/static/chunks/webpack-cf1ab84f284a4073.js +0 -1
  223. package/dist/preview/.next/static/css/0a13d10225a26b9d.css +0 -1
  224. /package/dist/preview/.next/static/{9wK7iUJPUvFYJNYOqHNpo → 6K68y2QEZ1dLbv-Xhi30p}/_ssgManifest.js +0 -0
@@ -0,0 +1,733 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __async = (__this, __arguments, generator) => {
18
+ return new Promise((resolve, reject) => {
19
+ var fulfilled = (value) => {
20
+ try {
21
+ step(generator.next(value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ };
26
+ var rejected = (value) => {
27
+ try {
28
+ step(generator.throw(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ };
33
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
+ step((generator = generator.apply(__this, __arguments)).next());
35
+ });
36
+ };
37
+
38
+ // src/render.tsx
39
+ import { convert } from "html-to-text";
40
+
41
+ // src/utils/pretty.ts
42
+ import { format } from "prettier/standalone";
43
+ import html from "prettier/plugins/html";
44
+ var defaults = {
45
+ endOfLine: "lf",
46
+ tabWidth: 2,
47
+ plugins: [html],
48
+ parser: "html"
49
+ };
50
+ var pretty = (str, options = {}) => {
51
+ return format(str, __spreadValues(__spreadValues({}, defaults), options));
52
+ };
53
+
54
+ // src/plain-text-selectors.ts
55
+ var plainTextSelectors = [
56
+ { selector: "img", format: "skip" },
57
+ { selector: "#__react-email-preview", format: "skip" },
58
+ {
59
+ selector: "a",
60
+ options: { linkBrackets: false }
61
+ }
62
+ ];
63
+
64
+ // src/renderer/renderer.tsx
65
+ import ReactServer from "react-server";
66
+
67
+ // src/renderer/escape-html.ts
68
+ var matchHtmlRegExp = /["'&<>]/;
69
+ function escapeHtml(string) {
70
+ const str = "" + string;
71
+ const match = matchHtmlRegExp.exec(str);
72
+ if (!match) {
73
+ return str;
74
+ }
75
+ let escape;
76
+ let html2 = "";
77
+ let index;
78
+ let lastIndex = 0;
79
+ for (index = match.index; index < str.length; index++) {
80
+ switch (str.charCodeAt(index)) {
81
+ case 34:
82
+ escape = "&quot;";
83
+ break;
84
+ case 38:
85
+ escape = "&amp;";
86
+ break;
87
+ case 39:
88
+ escape = "&#x27;";
89
+ break;
90
+ case 60:
91
+ escape = "&lt;";
92
+ break;
93
+ case 62:
94
+ escape = "&gt;";
95
+ break;
96
+ default:
97
+ continue;
98
+ }
99
+ if (lastIndex !== index) {
100
+ html2 += str.slice(lastIndex, index);
101
+ }
102
+ lastIndex = index + 1;
103
+ html2 += escape;
104
+ }
105
+ return lastIndex !== index ? html2 + str.slice(lastIndex, index) : html2;
106
+ }
107
+ function escapeTextForBrowser(text) {
108
+ if (typeof text === "object")
109
+ return JSON.stringify(text);
110
+ if (typeof text === "boolean" || typeof text === "number" || typeof text === "bigint") {
111
+ return "" + text;
112
+ }
113
+ return escapeHtml(text);
114
+ }
115
+
116
+ // src/renderer/attribute-processing/boolean-prop-to-html-attribute.ts
117
+ function booleanPropToHtmlAttribute(name, value) {
118
+ if (value === true) {
119
+ return ` ${name}=""`;
120
+ }
121
+ return "";
122
+ }
123
+
124
+ // src/renderer/attribute-processing/get-attribute-alias.ts
125
+ var aliases = /* @__PURE__ */ new Map([
126
+ ["acceptCharset", "accept-charset"],
127
+ ["htmlFor", "for"],
128
+ ["httpEquiv", "http-equiv"],
129
+ // HTML and SVG attributes, but the SVG attribute is case sensitive.],
130
+ ["crossOrigin", "crossorigin"],
131
+ // This is a list of all SVG attributes that need special casing.
132
+ // Regular attributes that just accept strings.],
133
+ ["accentHeight", "accent-height"],
134
+ ["alignmentBaseline", "alignment-baseline"],
135
+ ["arabicForm", "arabic-form"],
136
+ ["baselineShift", "baseline-shift"],
137
+ ["capHeight", "cap-height"],
138
+ ["clipPath", "clip-path"],
139
+ ["clipRule", "clip-rule"],
140
+ ["colorInterpolation", "color-interpolation"],
141
+ ["colorInterpolationFilters", "color-interpolation-filters"],
142
+ ["colorProfile", "color-profile"],
143
+ ["colorRendering", "color-rendering"],
144
+ ["dominantBaseline", "dominant-baseline"],
145
+ ["enableBackground", "enable-background"],
146
+ ["fillOpacity", "fill-opacity"],
147
+ ["fillRule", "fill-rule"],
148
+ ["floodColor", "flood-color"],
149
+ ["floodOpacity", "flood-opacity"],
150
+ ["fontFamily", "font-family"],
151
+ ["fontSize", "font-size"],
152
+ ["fontSizeAdjust", "font-size-adjust"],
153
+ ["fontStretch", "font-stretch"],
154
+ ["fontStyle", "font-style"],
155
+ ["fontVariant", "font-variant"],
156
+ ["fontWeight", "font-weight"],
157
+ ["glyphName", "glyph-name"],
158
+ ["glyphOrientationHorizontal", "glyph-orientation-horizontal"],
159
+ ["glyphOrientationVertical", "glyph-orientation-vertical"],
160
+ ["horizAdvX", "horiz-adv-x"],
161
+ ["horizOriginX", "horiz-origin-x"],
162
+ ["imageRendering", "image-rendering"],
163
+ ["letterSpacing", "letter-spacing"],
164
+ ["lightingColor", "lighting-color"],
165
+ ["markerEnd", "marker-end"],
166
+ ["markerMid", "marker-mid"],
167
+ ["markerStart", "marker-start"],
168
+ ["overlinePosition", "overline-position"],
169
+ ["overlineThickness", "overline-thickness"],
170
+ ["paintOrder", "paint-order"],
171
+ ["panose-1", "panose-1"],
172
+ ["pointerEvents", "pointer-events"],
173
+ ["renderingIntent", "rendering-intent"],
174
+ ["shapeRendering", "shape-rendering"],
175
+ ["stopColor", "stop-color"],
176
+ ["stopOpacity", "stop-opacity"],
177
+ ["strikethroughPosition", "strikethrough-position"],
178
+ ["strikethroughThickness", "strikethrough-thickness"],
179
+ ["strokeDasharray", "stroke-dasharray"],
180
+ ["strokeDashoffset", "stroke-dashoffset"],
181
+ ["strokeLinecap", "stroke-linecap"],
182
+ ["strokeLinejoin", "stroke-linejoin"],
183
+ ["strokeMiterlimit", "stroke-miterlimit"],
184
+ ["strokeOpacity", "stroke-opacity"],
185
+ ["strokeWidth", "stroke-width"],
186
+ ["textAnchor", "text-anchor"],
187
+ ["textDecoration", "text-decoration"],
188
+ ["textRendering", "text-rendering"],
189
+ ["transformOrigin", "transform-origin"],
190
+ ["underlinePosition", "underline-position"],
191
+ ["underlineThickness", "underline-thickness"],
192
+ ["unicodeBidi", "unicode-bidi"],
193
+ ["unicodeRange", "unicode-range"],
194
+ ["unitsPerEm", "units-per-em"],
195
+ ["vAlphabetic", "v-alphabetic"],
196
+ ["vHanging", "v-hanging"],
197
+ ["vIdeographic", "v-ideographic"],
198
+ ["vMathematical", "v-mathematical"],
199
+ ["vectorEffect", "vector-effect"],
200
+ ["vertAdvY", "vert-adv-y"],
201
+ ["vertOriginX", "vert-origin-x"],
202
+ ["vertOriginY", "vert-origin-y"],
203
+ ["wordSpacing", "word-spacing"],
204
+ ["writingMode", "writing-mode"],
205
+ ["xmlnsXlink", "xmlns:xlink"],
206
+ ["xHeight", "x-height"]
207
+ ]);
208
+ function getAttributeAlias(name) {
209
+ return aliases.get(name) || name;
210
+ }
211
+
212
+ // src/renderer/attribute-processing/is-attribute-name-safe.ts
213
+ var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
214
+ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
215
+ var VALID_ATTRIBUTE_NAME_REGEX = new RegExp(
216
+ "^[" + ATTRIBUTE_NAME_START_CHAR + "][" + ATTRIBUTE_NAME_CHAR + "]*$"
217
+ );
218
+ var illegalAttributeNameCache = {};
219
+ var validatedAttributeNameCache = {};
220
+ function isAttributeNameSafe(attributeName) {
221
+ if (Object.hasOwn(validatedAttributeNameCache, attributeName)) {
222
+ return true;
223
+ }
224
+ if (Object.hasOwn(illegalAttributeNameCache, attributeName)) {
225
+ return false;
226
+ }
227
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
228
+ validatedAttributeNameCache[attributeName] = true;
229
+ return true;
230
+ }
231
+ illegalAttributeNameCache[attributeName] = true;
232
+ console.error("Invalid attribute name: `%s`", attributeName);
233
+ return false;
234
+ }
235
+
236
+ // src/renderer/attribute-processing/string-prop-to-html-attribute.ts
237
+ function stringPropToHtmlAttribute(name, value) {
238
+ if (typeof value !== "function" && typeof value !== "symbol" && typeof value !== "boolean") {
239
+ return ` ${name}="${escapeTextForBrowser(value)}"`;
240
+ }
241
+ return "";
242
+ }
243
+
244
+ // src/renderer/attribute-processing/style/is-unitless-number.ts
245
+ var unitlessNumbers = /* @__PURE__ */ new Set([
246
+ "animationIterationCount",
247
+ "aspectRatio",
248
+ "borderImageOutset",
249
+ "borderImageSlice",
250
+ "borderImageWidth",
251
+ "boxFlex",
252
+ "boxFlexGroup",
253
+ "boxOrdinalGroup",
254
+ "columnCount",
255
+ "columns",
256
+ "flex",
257
+ "flexGrow",
258
+ "flexPositive",
259
+ "flexShrink",
260
+ "flexNegative",
261
+ "flexOrder",
262
+ "gridArea",
263
+ "gridRow",
264
+ "gridRowEnd",
265
+ "gridRowSpan",
266
+ "gridRowStart",
267
+ "gridColumn",
268
+ "gridColumnEnd",
269
+ "gridColumnSpan",
270
+ "gridColumnStart",
271
+ "fontWeight",
272
+ "lineClamp",
273
+ "lineHeight",
274
+ "opacity",
275
+ "order",
276
+ "orphans",
277
+ "scale",
278
+ "tabSize",
279
+ "widows",
280
+ "zIndex",
281
+ "zoom",
282
+ "fillOpacity",
283
+ // SVG-related properties
284
+ "floodOpacity",
285
+ "stopOpacity",
286
+ "strokeDasharray",
287
+ "strokeDashoffset",
288
+ "strokeMiterlimit",
289
+ "strokeOpacity",
290
+ "strokeWidth",
291
+ "MozAnimationIterationCount",
292
+ // Known Prefixed Properties
293
+ "MozBoxFlex",
294
+ // TODO: Remove these since they shouldn't be used in modern code
295
+ "MozBoxFlexGroup",
296
+ "MozLineClamp",
297
+ "msAnimationIterationCount",
298
+ "msFlex",
299
+ "msZoom",
300
+ "msFlexGrow",
301
+ "msFlexNegative",
302
+ "msFlexOrder",
303
+ "msFlexPositive",
304
+ "msFlexShrink",
305
+ "msGridColumn",
306
+ "msGridColumnSpan",
307
+ "msGridRow",
308
+ "msGridRowSpan",
309
+ "WebkitAnimationIterationCount",
310
+ "WebkitBoxFlex",
311
+ "WebKitBoxFlexGroup",
312
+ "WebkitBoxOrdinalGroup",
313
+ "WebkitColumnCount",
314
+ "WebkitColumns",
315
+ "WebkitFlex",
316
+ "WebkitFlexGrow",
317
+ "WebkitFlexPositive",
318
+ "WebkitFlexShrink",
319
+ "WebkitLineClamp"
320
+ ]);
321
+ function isUnitlessNumber(name) {
322
+ return unitlessNumbers.has(name);
323
+ }
324
+
325
+ // src/renderer/attribute-processing/style/hyphenate-style-name.ts
326
+ var uppercasePattern = /([A-Z])/g;
327
+ var msPattern = /^ms-/;
328
+ function hyphenateStyleName(name) {
329
+ return name.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-");
330
+ }
331
+
332
+ // src/renderer/attribute-processing/style/process-style-name.ts
333
+ var styleNameCache = /* @__PURE__ */ new Map();
334
+ function processStyleName(styleName) {
335
+ if (!styleNameCache.has(styleName)) {
336
+ styleNameCache.set(styleName, hyphenateStyleName(styleName));
337
+ }
338
+ return styleNameCache.get(styleName);
339
+ }
340
+
341
+ // src/renderer/attribute-processing/style-prop-to-html-attribute.ts
342
+ function stylePropToHtmlAttribute(style) {
343
+ if (typeof style !== "object") {
344
+ throw new Error(
345
+ "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX."
346
+ );
347
+ }
348
+ let styles = [];
349
+ for (const [styleName, styleValue] of Object.entries(style)) {
350
+ if (styleValue == null || typeof styleValue === "boolean" || styleValue === "") {
351
+ continue;
352
+ }
353
+ let nameChunk;
354
+ let valueChunk;
355
+ const isCustomProperty = styleName.indexOf("--") === 0;
356
+ if (isCustomProperty) {
357
+ nameChunk = styleName;
358
+ valueChunk = ("" + styleValue).trim();
359
+ } else {
360
+ nameChunk = processStyleName(styleName);
361
+ if (typeof styleValue === "number") {
362
+ if (styleValue !== 0 && !isUnitlessNumber(styleName)) {
363
+ valueChunk = styleValue + "px";
364
+ } else {
365
+ valueChunk = "" + styleValue;
366
+ }
367
+ } else {
368
+ valueChunk = ("" + styleValue).trim();
369
+ }
370
+ }
371
+ styles.push(`${nameChunk}:${valueChunk}`);
372
+ }
373
+ return ` style="${styles.join(";").replaceAll('"', "'")}"`;
374
+ }
375
+
376
+ // src/renderer/attribute-processing/prop-to-html-attribute.ts
377
+ function propToHtmlAttribute(name, value) {
378
+ if (value === void 0)
379
+ return "";
380
+ switch (name) {
381
+ case "className": {
382
+ return stringPropToHtmlAttribute("class", value);
383
+ }
384
+ case "tabIndex": {
385
+ return stringPropToHtmlAttribute("tabindex", value);
386
+ }
387
+ case "dir":
388
+ case "role":
389
+ case "viewBox":
390
+ case "width":
391
+ case "height": {
392
+ return stringPropToHtmlAttribute(name, value);
393
+ }
394
+ case "style": {
395
+ return stylePropToHtmlAttribute(value);
396
+ }
397
+ case "defaultValue":
398
+ case "defaultChecked":
399
+ case "innerHTML":
400
+ case "suppressContentEditableWarning":
401
+ case "suppressHydrationWarning":
402
+ case "ref":
403
+ return "";
404
+ case "autoFocus":
405
+ case "multiple":
406
+ case "muted": {
407
+ return booleanPropToHtmlAttribute(name, value);
408
+ }
409
+ case "xlinkHref": {
410
+ if (typeof value === "function" || typeof value === "symbol" || typeof value === "boolean") {
411
+ return "";
412
+ }
413
+ return ` xlink:href="${escapeTextForBrowser(value)}"`;
414
+ }
415
+ case "contentEditable":
416
+ case "spellCheck":
417
+ case "draggable":
418
+ case "value":
419
+ case "autoReverse":
420
+ case "externalResourcesRequired":
421
+ case "focusable":
422
+ case "preserveAlpha": {
423
+ if (typeof value !== "function" && typeof value !== "symbol") {
424
+ return ` ${name}="${escapeTextForBrowser(value)}"`;
425
+ }
426
+ return "";
427
+ }
428
+ case "allowFullScreen":
429
+ case "async":
430
+ case "autoPlay":
431
+ case "controls":
432
+ case "default":
433
+ case "defer":
434
+ case "disabled":
435
+ case "disablePictureInPicture":
436
+ case "disableRemotePlayback":
437
+ case "formNoValidate":
438
+ case "hidden":
439
+ case "loop":
440
+ case "noModule":
441
+ case "noValidate":
442
+ case "open":
443
+ case "playsInline":
444
+ case "readOnly":
445
+ case "required":
446
+ case "reversed":
447
+ case "scoped":
448
+ case "seamless":
449
+ case "itemScope": {
450
+ if (value && typeof value !== "function" && typeof value !== "symbol") {
451
+ return ` ${name}=""`;
452
+ }
453
+ return "";
454
+ }
455
+ case "capture":
456
+ case "download": {
457
+ if (value === true) {
458
+ return ` ${name}=""`;
459
+ } else if (value === false) {
460
+ } else if (typeof value !== "function" && typeof value !== "symbol") {
461
+ return ` ${name}="${escapeTextForBrowser(value)}"`;
462
+ }
463
+ return "";
464
+ }
465
+ case "cols":
466
+ case "rows":
467
+ case "size":
468
+ case "span": {
469
+ if (typeof value !== "function" && typeof value !== "symbol" && !isNaN(value) && value >= 1) {
470
+ return ` ${name}="${escapeTextForBrowser(value)}"`;
471
+ }
472
+ return "";
473
+ }
474
+ case "rowSpan":
475
+ case "start": {
476
+ if (typeof value !== "function" && typeof value !== "symbol" && !isNaN(value)) {
477
+ return ` ${name}="${escapeTextForBrowser(value)}"`;
478
+ }
479
+ return "";
480
+ }
481
+ case "xlinkActuate":
482
+ return stringPropToHtmlAttribute("xlink:actuate", escapeTextForBrowser(value));
483
+ case "xlinkArcrole":
484
+ return stringPropToHtmlAttribute("xlink:arcrole", escapeTextForBrowser(value));
485
+ case "xlinkRole":
486
+ return stringPropToHtmlAttribute("xlink:role", escapeTextForBrowser(value));
487
+ case "xlinkShow":
488
+ return stringPropToHtmlAttribute("xlink:show", escapeTextForBrowser(value));
489
+ case "xlinkTitle":
490
+ return stringPropToHtmlAttribute("xlink:title", escapeTextForBrowser(value));
491
+ case "xlinkType":
492
+ return stringPropToHtmlAttribute("xlink:type", escapeTextForBrowser(value));
493
+ case "xmlBase":
494
+ return stringPropToHtmlAttribute("xml:base", escapeTextForBrowser(value));
495
+ case "xmlLang":
496
+ return stringPropToHtmlAttribute("xml:lang", escapeTextForBrowser(value));
497
+ case "xmlSpace":
498
+ return stringPropToHtmlAttribute("xml:space", escapeTextForBrowser(value));
499
+ default:
500
+ if (
501
+ // shouldIgnoreAttribute
502
+ // We have already filtered out null/undefined and reserved words.
503
+ name.length > 2 && (name[0] === "o" || name[0] === "O") && (name[1] === "n" || name[1] === "N")
504
+ ) {
505
+ return "";
506
+ }
507
+ const attributeName = getAttributeAlias(name);
508
+ if (isAttributeNameSafe(attributeName)) {
509
+ switch (typeof value) {
510
+ case "function":
511
+ case "symbol":
512
+ return "";
513
+ case "boolean": {
514
+ const prefix = attributeName.toLowerCase().slice(0, 5);
515
+ if (prefix !== "data-" && prefix !== "aria-") {
516
+ return "";
517
+ }
518
+ }
519
+ }
520
+ return ` ${name}="${escapeTextForBrowser(value)}"`;
521
+ }
522
+ }
523
+ return "";
524
+ }
525
+
526
+ // src/renderer/renderer.tsx
527
+ var Destination = class {
528
+ constructor() {
529
+ this.html = "";
530
+ this.decoder = new TextDecoder("utf8", {
531
+ fatal: true
532
+ });
533
+ this.listeners = [];
534
+ }
535
+ write(content) {
536
+ this.html += content;
537
+ }
538
+ writeEncoded(buffer) {
539
+ this.html += this.decoder.decode(buffer, { stream: true });
540
+ }
541
+ promise() {
542
+ return new Promise((resolve, reject) => {
543
+ this.listeners.push([resolve, reject]);
544
+ });
545
+ }
546
+ completeWithError(error) {
547
+ this.listeners.forEach(([_, reject]) => reject(error));
548
+ }
549
+ complete() {
550
+ this.listeners.forEach(([resolve]) => resolve(this.html));
551
+ }
552
+ };
553
+ var encoder = new TextEncoder();
554
+ var Renderer = ReactServer({
555
+ scheduleMicrotask(callback) {
556
+ queueMicrotask(() => callback());
557
+ },
558
+ scheduleWork(callback) {
559
+ setTimeout(() => {
560
+ callback();
561
+ });
562
+ },
563
+ beginWriting(destination) {
564
+ },
565
+ writeChunk(destination, buffer) {
566
+ destination.writeEncoded(buffer);
567
+ },
568
+ writeChunkAndReturn(destination, buffer) {
569
+ destination.writeEncoded(buffer);
570
+ return true;
571
+ },
572
+ completeWriting(destination) {
573
+ },
574
+ close(destination) {
575
+ destination.complete();
576
+ },
577
+ closeWithError(destination, error) {
578
+ destination.completeWithError(error);
579
+ },
580
+ flushBuffered(destination) {
581
+ },
582
+ getChildFormatContext() {
583
+ return null;
584
+ },
585
+ resetResumableState() {
586
+ },
587
+ completeResumableState() {
588
+ },
589
+ pushTextInstance(target, text, renderState, textEmbedded) {
590
+ target.push(encoder.encode(escapeTextForBrowser(text)));
591
+ return true;
592
+ },
593
+ pushStartInstance(target, type, props) {
594
+ target.push(encoder.encode(`<${type}`));
595
+ let dangerouslySetInnerHTML = void 0;
596
+ let children = void 0;
597
+ for (const [name, value] of Object.entries(props)) {
598
+ if (name === "children") {
599
+ children = value;
600
+ continue;
601
+ } else if (name === "dangerouslySetInnerHTML") {
602
+ dangerouslySetInnerHTML = value;
603
+ continue;
604
+ }
605
+ target.push(encoder.encode(propToHtmlAttribute(name, value)));
606
+ }
607
+ target.push(encoder.encode(">"));
608
+ if (dangerouslySetInnerHTML !== void 0) {
609
+ if (children !== void 0) {
610
+ throw new Error(
611
+ "Can only set one of `children` or `props.dangerouslySetInnerHTML`."
612
+ );
613
+ }
614
+ if (typeof dangerouslySetInnerHTML !== "object" || !("__html" in dangerouslySetInnerHTML)) {
615
+ throw new Error(
616
+ "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://react.dev/link/dangerously-set-inner-html for more information."
617
+ );
618
+ }
619
+ const html2 = dangerouslySetInnerHTML.__html;
620
+ if (html2 !== null && html2 !== void 0) {
621
+ target.push(encoder.encode("" + html2));
622
+ }
623
+ }
624
+ if (typeof children === "string" || typeof children === "number" || typeof children === "boolean" || typeof children === "bigint") {
625
+ target.push(encoder.encode(escapeTextForBrowser("" + children)));
626
+ return null;
627
+ }
628
+ return children;
629
+ },
630
+ pushEndInstance(target, type) {
631
+ switch (type) {
632
+ case "area":
633
+ case "base":
634
+ case "br":
635
+ case "col":
636
+ case "embed":
637
+ case "hr":
638
+ case "img":
639
+ case "input":
640
+ case "keygen":
641
+ case "link":
642
+ case "meta":
643
+ case "param":
644
+ case "source":
645
+ case "track":
646
+ case "wbr": {
647
+ return;
648
+ }
649
+ }
650
+ target.push(encoder.encode(`</${type}>`));
651
+ },
652
+ pushSegmentFinale(target, _, lastPushedText, textEmbedded) {
653
+ },
654
+ writeCompletedRoot() {
655
+ return true;
656
+ },
657
+ writePlaceholder() {
658
+ return true;
659
+ },
660
+ writeStartCompletedSuspenseBoundary() {
661
+ return true;
662
+ },
663
+ writeStartPendingSuspenseBoundary() {
664
+ return true;
665
+ },
666
+ writeStartClientRenderedSuspenseBoundary() {
667
+ return true;
668
+ },
669
+ writeEndCompletedSuspenseBoundary(destination) {
670
+ return true;
671
+ },
672
+ writeEndPendingSuspenseBoundary(destination) {
673
+ return true;
674
+ },
675
+ writeEndClientRenderedSuspenseBoundary(destination) {
676
+ return true;
677
+ },
678
+ writeStartSegment(destination, renderState, formatContext, id) {
679
+ return true;
680
+ },
681
+ writeEndSegment(destination, formatContext) {
682
+ return true;
683
+ },
684
+ writeCompletedSegmentInstruction(destination, renderState, contentSegmentID) {
685
+ return true;
686
+ },
687
+ writeCompletedBoundaryInstruction() {
688
+ return true;
689
+ },
690
+ writeClientRenderBoundaryInstruction() {
691
+ return true;
692
+ },
693
+ writePreamble(destination) {
694
+ destination.write(
695
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
696
+ );
697
+ },
698
+ writeHoistables() {
699
+ },
700
+ writeHoistablesForBoundary() {
701
+ },
702
+ writePostamble() {
703
+ },
704
+ hoistHoistables(parent, child) {
705
+ },
706
+ createHoistableState() {
707
+ return null;
708
+ },
709
+ emitEarlyPreloads() {
710
+ }
711
+ });
712
+
713
+ // src/render.tsx
714
+ var render = (element, options) => __async(void 0, null, function* () {
715
+ const destination = new Destination();
716
+ const request = Renderer.createRequest(element, null, null, null, void 0);
717
+ Renderer.startWork(request);
718
+ Renderer.startFlowing(request, destination);
719
+ const html2 = yield destination.promise();
720
+ if (options == null ? void 0 : options.plainText) {
721
+ return convert(html2, __spreadValues({
722
+ selectors: plainTextSelectors
723
+ }, options.htmlToTextOptions));
724
+ }
725
+ if (options == null ? void 0 : options.pretty) {
726
+ return pretty(html2);
727
+ }
728
+ return html2;
729
+ });
730
+ export {
731
+ pretty,
732
+ render
733
+ };