@maizzle/framework 6.0.0-rc.9 → 6.0.1

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 (624) hide show
  1. package/README.md +3 -3
  2. package/bin/maizzle.mjs +1 -1
  3. package/dist/build.d.ts +38 -0
  4. package/dist/build.d.ts.map +1 -0
  5. package/dist/build.js +234 -0
  6. package/dist/build.js.map +1 -0
  7. package/dist/components/Body.vue +32 -3
  8. package/dist/components/Button.vue +91 -62
  9. package/dist/components/CodeBlock.vue +6 -4
  10. package/dist/components/CodeInline.vue +77 -6
  11. package/dist/components/Column.vue +67 -31
  12. package/dist/components/Container.vue +73 -12
  13. package/dist/components/Font.vue +96 -0
  14. package/dist/components/Head.vue +1 -1
  15. package/dist/components/Heading.vue +1 -1
  16. package/dist/components/Hr.vue +33 -0
  17. package/dist/components/Html.vue +36 -3
  18. package/dist/components/Img.vue +332 -0
  19. package/dist/components/Layout.vue +73 -21
  20. package/dist/components/Link.vue +1 -1
  21. package/dist/components/Markdown.vue +51 -24
  22. package/dist/components/MarkdownLayout.vue +39 -0
  23. package/dist/components/NotPlaintext.vue +14 -0
  24. package/dist/components/Outlook.vue +38 -11
  25. package/dist/components/OutlookBg.vue +241 -0
  26. package/dist/components/Plaintext.vue +14 -0
  27. package/dist/components/Preheader.vue +35 -10
  28. package/dist/components/QrCode.vue +157 -0
  29. package/dist/components/Raw.vue +28 -0
  30. package/dist/components/Row.vue +115 -22
  31. package/dist/components/Section.vue +65 -26
  32. package/dist/components/Spacer.vue +35 -29
  33. package/dist/components/Tailwind.vue +45 -0
  34. package/dist/components/Text.vue +3 -3
  35. package/dist/components/Vml.vue +207 -94
  36. package/dist/components/utils.d.ts +53 -0
  37. package/dist/components/utils.d.ts.map +1 -0
  38. package/dist/components/utils.js +80 -0
  39. package/dist/components/utils.js.map +1 -0
  40. package/dist/components/utils.ts +102 -0
  41. package/dist/composables/defineConfig.d.ts +13 -0
  42. package/dist/composables/defineConfig.d.ts.map +1 -0
  43. package/dist/composables/{defineConfig.mjs → defineConfig.js} +7 -9
  44. package/dist/composables/defineConfig.js.map +1 -0
  45. package/dist/composables/renderContext.d.ts +37 -0
  46. package/dist/composables/renderContext.d.ts.map +1 -0
  47. package/dist/composables/renderContext.js +6 -0
  48. package/dist/composables/renderContext.js.map +1 -0
  49. package/dist/composables/useBaseUrl.d.ts +19 -0
  50. package/dist/composables/useBaseUrl.d.ts.map +1 -0
  51. package/dist/composables/useBaseUrl.js +26 -0
  52. package/dist/composables/useBaseUrl.js.map +1 -0
  53. package/dist/composables/useConfig.d.ts +16 -0
  54. package/dist/composables/useConfig.d.ts.map +1 -0
  55. package/dist/composables/useConfig.js +19 -0
  56. package/dist/composables/useConfig.js.map +1 -0
  57. package/dist/composables/useCurrentTemplate.d.ts +31 -0
  58. package/dist/composables/useCurrentTemplate.d.ts.map +1 -0
  59. package/dist/composables/useCurrentTemplate.js +42 -0
  60. package/dist/composables/useCurrentTemplate.js.map +1 -0
  61. package/dist/composables/{useDoctype.d.mts → useDoctype.d.ts} +1 -1
  62. package/dist/composables/useDoctype.d.ts.map +1 -0
  63. package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
  64. package/dist/composables/useDoctype.js.map +1 -0
  65. package/dist/composables/{useEvent.d.mts → useEvent.d.ts} +3 -3
  66. package/dist/composables/useEvent.d.ts.map +1 -0
  67. package/dist/composables/{useEvent.mjs → useEvent.js} +4 -5
  68. package/dist/composables/useEvent.js.map +1 -0
  69. package/dist/composables/useFont.d.ts +50 -0
  70. package/dist/composables/useFont.d.ts.map +1 -0
  71. package/dist/composables/useFont.js +92 -0
  72. package/dist/composables/useFont.js.map +1 -0
  73. package/dist/composables/useOutlookFallback.d.ts +21 -0
  74. package/dist/composables/useOutlookFallback.d.ts.map +1 -0
  75. package/dist/composables/useOutlookFallback.js +29 -0
  76. package/dist/composables/useOutlookFallback.js.map +1 -0
  77. package/dist/composables/useOutputPath.d.ts +17 -0
  78. package/dist/composables/useOutputPath.d.ts.map +1 -0
  79. package/dist/composables/useOutputPath.js +23 -0
  80. package/dist/composables/useOutputPath.js.map +1 -0
  81. package/dist/composables/{usePlaintext.d.mts → usePlaintext.d.ts} +3 -1
  82. package/dist/composables/usePlaintext.d.ts.map +1 -0
  83. package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
  84. package/dist/composables/usePlaintext.js.map +1 -0
  85. package/dist/composables/usePreheader.d.ts +25 -0
  86. package/dist/composables/usePreheader.d.ts.map +1 -0
  87. package/dist/composables/usePreheader.js +28 -0
  88. package/dist/composables/usePreheader.js.map +1 -0
  89. package/dist/composables/useTransformers.d.ts +34 -0
  90. package/dist/composables/useTransformers.d.ts.map +1 -0
  91. package/dist/composables/useTransformers.js +48 -0
  92. package/dist/composables/useTransformers.js.map +1 -0
  93. package/dist/composables/useUrlQuery.d.ts +19 -0
  94. package/dist/composables/useUrlQuery.d.ts.map +1 -0
  95. package/dist/composables/useUrlQuery.js +26 -0
  96. package/dist/composables/useUrlQuery.js.map +1 -0
  97. package/dist/config/{defaults.d.mts → defaults.d.ts} +2 -2
  98. package/dist/config/defaults.d.ts.map +1 -0
  99. package/dist/config/{defaults.mjs → defaults.js} +10 -6
  100. package/dist/config/defaults.js.map +1 -0
  101. package/dist/config/index.d.ts +33 -0
  102. package/dist/config/index.d.ts.map +1 -0
  103. package/dist/config/index.js +136 -0
  104. package/dist/config/index.js.map +1 -0
  105. package/dist/events/{index.d.mts → index.d.ts} +35 -12
  106. package/dist/events/index.d.ts.map +1 -0
  107. package/dist/events/{index.mjs → index.js} +31 -13
  108. package/dist/events/index.js.map +1 -0
  109. package/dist/index.d.ts +41 -0
  110. package/dist/index.js +40 -0
  111. package/dist/{plaintext.d.mts → plaintext.d.ts} +1 -1
  112. package/dist/plaintext.d.ts.map +1 -0
  113. package/dist/{plaintext.mjs → plaintext.js} +4 -5
  114. package/dist/plaintext.js.map +1 -0
  115. package/dist/{plugin.d.mts → plugin.d.ts} +2 -2
  116. package/dist/plugin.d.ts.map +1 -0
  117. package/dist/{plugin.mjs → plugin.js} +8 -9
  118. package/dist/plugin.js.map +1 -0
  119. package/dist/plugins/postcss/{mergeMediaQueries.d.mts → mergeMediaQueries.d.ts} +2 -2
  120. package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -0
  121. package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +2 -3
  122. package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
  123. package/dist/plugins/postcss/{pruneVars.d.mts → pruneVars.d.ts} +1 -1
  124. package/dist/plugins/postcss/pruneVars.d.ts.map +1 -0
  125. package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +2 -2
  126. package/dist/plugins/postcss/pruneVars.js.map +1 -0
  127. package/dist/plugins/postcss/quoteFontFamilies.d.ts +13 -0
  128. package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -0
  129. package/dist/plugins/postcss/quoteFontFamilies.js +84 -0
  130. package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
  131. package/dist/plugins/postcss/{removeDeclarations.d.mts → removeDeclarations.d.ts} +1 -1
  132. package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -0
  133. package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +2 -2
  134. package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
  135. package/dist/plugins/postcss/resolveMaizzleImports.d.ts +16 -0
  136. package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -0
  137. package/dist/plugins/postcss/resolveMaizzleImports.js +39 -0
  138. package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
  139. package/dist/plugins/postcss/resolveProps.d.ts +8 -0
  140. package/dist/plugins/postcss/resolveProps.d.ts.map +1 -0
  141. package/dist/plugins/postcss/resolveProps.js +155 -0
  142. package/dist/plugins/postcss/resolveProps.js.map +1 -0
  143. package/dist/plugins/postcss/{tailwindCleanup.d.mts → tailwindCleanup.d.ts} +2 -2
  144. package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -0
  145. package/dist/plugins/postcss/{tailwindCleanup.mjs → tailwindCleanup.js} +5 -3
  146. package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
  147. package/dist/prepare.d.ts +17 -0
  148. package/dist/prepare.d.ts.map +1 -0
  149. package/dist/prepare.js +44 -0
  150. package/dist/prepare.js.map +1 -0
  151. package/dist/render/active.d.ts +8 -0
  152. package/dist/render/active.d.ts.map +1 -0
  153. package/dist/render/active.js +12 -0
  154. package/dist/render/active.js.map +1 -0
  155. package/dist/render/buildTemplate.d.ts +49 -0
  156. package/dist/render/buildTemplate.d.ts.map +1 -0
  157. package/dist/render/buildTemplate.js +141 -0
  158. package/dist/render/buildTemplate.js.map +1 -0
  159. package/dist/render/{createRenderer.d.mts → createRenderer.d.ts} +14 -6
  160. package/dist/render/createRenderer.d.ts.map +1 -0
  161. package/dist/render/createRenderer.js +468 -0
  162. package/dist/render/createRenderer.js.map +1 -0
  163. package/dist/render/index.d.ts +18 -0
  164. package/dist/render/index.d.ts.map +1 -0
  165. package/dist/render/index.js +59 -0
  166. package/dist/render/index.js.map +1 -0
  167. package/dist/render/injectFonts.d.ts +15 -0
  168. package/dist/render/injectFonts.d.ts.map +1 -0
  169. package/dist/render/injectFonts.js +45 -0
  170. package/dist/render/injectFonts.js.map +1 -0
  171. package/dist/render/parallel/buildWorker.d.ts +31 -0
  172. package/dist/render/parallel/buildWorker.d.ts.map +1 -0
  173. package/dist/render/parallel/buildWorker.js +66 -0
  174. package/dist/render/parallel/buildWorker.js.map +1 -0
  175. package/dist/render/parallel/worker.mjs +28 -0
  176. package/dist/render/plugins/codeBlockExtract.d.ts +14 -0
  177. package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -0
  178. package/dist/render/plugins/codeBlockExtract.js +38 -0
  179. package/dist/render/plugins/codeBlockExtract.js.map +1 -0
  180. package/dist/render/plugins/markdownExtract.d.ts +12 -0
  181. package/dist/render/plugins/markdownExtract.d.ts.map +1 -0
  182. package/dist/render/plugins/markdownExtract.js +49 -0
  183. package/dist/render/plugins/markdownExtract.js.map +1 -0
  184. package/dist/render/plugins/rawExtract.d.ts +14 -0
  185. package/dist/render/plugins/rawExtract.d.ts.map +1 -0
  186. package/dist/render/plugins/rawExtract.js +34 -0
  187. package/dist/render/plugins/rawExtract.js.map +1 -0
  188. package/dist/render/plugins/rowSourceLocation.d.ts +18 -0
  189. package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -0
  190. package/dist/render/plugins/rowSourceLocation.js +45 -0
  191. package/dist/render/plugins/rowSourceLocation.js.map +1 -0
  192. package/dist/{serve.d.mts → serve.d.ts} +5 -3
  193. package/dist/serve.d.ts.map +1 -0
  194. package/dist/{serve.mjs → serve.js} +248 -119
  195. package/dist/serve.js.map +1 -0
  196. package/dist/server/compatibility.d.ts +59 -0
  197. package/dist/server/compatibility.d.ts.map +1 -0
  198. package/dist/server/compatibility.js +959 -0
  199. package/dist/server/compatibility.js.map +1 -0
  200. package/dist/server/{email.d.mts → email.d.ts} +2 -2
  201. package/dist/server/email.d.ts.map +1 -0
  202. package/dist/server/{email.mjs → email.js} +2 -3
  203. package/dist/server/email.js.map +1 -0
  204. package/dist/server/linter.d.ts +20 -0
  205. package/dist/server/linter.d.ts.map +1 -0
  206. package/dist/server/linter.js +345 -0
  207. package/dist/server/linter.js.map +1 -0
  208. package/dist/server/sfc-utils.d.ts +21 -0
  209. package/dist/server/sfc-utils.d.ts.map +1 -0
  210. package/dist/server/sfc-utils.js +198 -0
  211. package/dist/server/sfc-utils.js.map +1 -0
  212. package/dist/server/ui/.vite/deps/@lucide_vue.js +44967 -0
  213. package/dist/server/ui/.vite/deps/@lucide_vue.js.map +1 -0
  214. package/dist/server/ui/.vite/deps/@vueuse_core.js +8155 -0
  215. package/dist/server/ui/.vite/deps/@vueuse_core.js.map +1 -0
  216. package/dist/server/ui/.vite/deps/@vueuse_shared.js +1859 -0
  217. package/dist/server/ui/.vite/deps/@vueuse_shared.js.map +1 -0
  218. package/dist/server/ui/.vite/deps/_metadata.json +78 -0
  219. package/dist/server/ui/.vite/deps/chunk-EAsCxrDo.js +14 -0
  220. package/dist/server/ui/.vite/deps/class-variance-authority.js +57 -0
  221. package/dist/server/ui/.vite/deps/class-variance-authority.js.map +1 -0
  222. package/dist/server/ui/.vite/deps/clsx.js +18 -0
  223. package/dist/server/ui/.vite/deps/clsx.js.map +1 -0
  224. package/dist/server/ui/.vite/deps/culori.js +4312 -0
  225. package/dist/server/ui/.vite/deps/culori.js.map +1 -0
  226. package/dist/server/ui/.vite/deps/package.json +3 -0
  227. package/dist/server/ui/.vite/deps/reka-ui.js +44464 -0
  228. package/dist/server/ui/.vite/deps/reka-ui.js.map +1 -0
  229. package/dist/server/ui/.vite/deps/tailwind-merge.js +3458 -0
  230. package/dist/server/ui/.vite/deps/tailwind-merge.js.map +1 -0
  231. package/dist/server/ui/.vite/deps/vue-router.js +6383 -0
  232. package/dist/server/ui/.vite/deps/vue-router.js.map +1 -0
  233. package/dist/server/ui/.vite/deps/vue.js +2 -0
  234. package/dist/server/ui/.vite/deps/vue.runtime.esm-bundler-N1X0OxKs.js +8800 -0
  235. package/dist/server/ui/.vite/deps/vue.runtime.esm-bundler-N1X0OxKs.js.map +1 -0
  236. package/dist/server/ui/App.vue +106 -66
  237. package/dist/server/ui/components/SidebarClose.vue +12 -0
  238. package/dist/server/ui/components/ui/checkbox/Checkbox.vue +1 -1
  239. package/dist/server/ui/components/ui/command/Command.vue +5 -1
  240. package/dist/server/ui/components/ui/command/CommandInput.vue +2 -2
  241. package/dist/server/ui/components/ui/dialog/DialogContent.vue +1 -1
  242. package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +1 -1
  243. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
  244. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
  245. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  246. package/dist/server/ui/components/ui/input/Input.vue +1 -1
  247. package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
  248. package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +2 -2
  249. package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +1 -1
  250. package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +1 -1
  251. package/dist/server/ui/lib/emulated-dark-mode.ts +146 -0
  252. package/dist/server/ui/main.css +25 -0
  253. package/dist/server/ui/pages/Home.vue +1 -1
  254. package/dist/server/ui/pages/Preview.vue +377 -186
  255. package/dist/server/ui/vite-env.d.ts +1 -0
  256. package/dist/tests/render/_helpers.d.ts +6 -0
  257. package/dist/tests/render/_helpers.d.ts.map +1 -0
  258. package/dist/tests/render/_helpers.js +16 -0
  259. package/dist/tests/render/_helpers.js.map +1 -0
  260. package/dist/transformers/addAttributes.d.ts +42 -0
  261. package/dist/transformers/addAttributes.d.ts.map +1 -0
  262. package/dist/transformers/{addAttributes.mjs → addAttributes.js} +40 -24
  263. package/dist/transformers/addAttributes.js.map +1 -0
  264. package/dist/transformers/attributeToStyle.d.ts +38 -0
  265. package/dist/transformers/attributeToStyle.d.ts.map +1 -0
  266. package/dist/transformers/attributeToStyle.js +94 -0
  267. package/dist/transformers/attributeToStyle.js.map +1 -0
  268. package/dist/transformers/base.d.ts +71 -0
  269. package/dist/transformers/base.d.ts.map +1 -0
  270. package/dist/transformers/{base.mjs → base.js} +65 -40
  271. package/dist/transformers/base.js.map +1 -0
  272. package/dist/transformers/columnWidth.d.ts +31 -0
  273. package/dist/transformers/columnWidth.d.ts.map +1 -0
  274. package/dist/transformers/columnWidth.js +527 -0
  275. package/dist/transformers/columnWidth.js.map +1 -0
  276. package/dist/transformers/entities.d.ts +37 -0
  277. package/dist/transformers/entities.d.ts.map +1 -0
  278. package/dist/transformers/entities.js +74 -0
  279. package/dist/transformers/entities.js.map +1 -0
  280. package/dist/transformers/filters/{defaults.d.mts → defaults.d.ts} +1 -1
  281. package/dist/transformers/filters/defaults.d.ts.map +1 -0
  282. package/dist/transformers/filters/{defaults.mjs → defaults.js} +2 -2
  283. package/dist/transformers/filters/defaults.js.map +1 -0
  284. package/dist/transformers/filters/index.d.ts +43 -0
  285. package/dist/transformers/filters/index.d.ts.map +1 -0
  286. package/dist/transformers/filters/index.js +89 -0
  287. package/dist/transformers/filters/index.js.map +1 -0
  288. package/dist/transformers/format.d.ts +22 -0
  289. package/dist/transformers/format.d.ts.map +1 -0
  290. package/dist/transformers/format.js +30 -0
  291. package/dist/transformers/format.js.map +1 -0
  292. package/dist/transformers/imgWidth.d.ts +20 -0
  293. package/dist/transformers/imgWidth.d.ts.map +1 -0
  294. package/dist/transformers/imgWidth.js +76 -0
  295. package/dist/transformers/imgWidth.js.map +1 -0
  296. package/dist/transformers/{index.d.mts → index.d.ts} +4 -3
  297. package/dist/transformers/index.d.ts.map +1 -0
  298. package/dist/transformers/index.js +163 -0
  299. package/dist/transformers/index.js.map +1 -0
  300. package/dist/transformers/inlineCss.d.ts +85 -0
  301. package/dist/transformers/inlineCss.d.ts.map +1 -0
  302. package/dist/transformers/inlineCss.js +112 -0
  303. package/dist/transformers/inlineCss.js.map +1 -0
  304. package/dist/transformers/inlineLink.d.ts +35 -0
  305. package/dist/transformers/inlineLink.d.ts.map +1 -0
  306. package/dist/transformers/{inlineLink.mjs → inlineLink.js} +35 -11
  307. package/dist/transformers/inlineLink.js.map +1 -0
  308. package/dist/transformers/minify.d.ts +21 -0
  309. package/dist/transformers/minify.d.ts.map +1 -0
  310. package/dist/transformers/minify.js +25 -0
  311. package/dist/transformers/minify.js.map +1 -0
  312. package/dist/transformers/minifyCodeInline.d.ts +29 -0
  313. package/dist/transformers/minifyCodeInline.d.ts.map +1 -0
  314. package/dist/transformers/minifyCodeInline.js +36 -0
  315. package/dist/transformers/minifyCodeInline.js.map +1 -0
  316. package/dist/transformers/msoPlaceholders.d.ts +33 -0
  317. package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
  318. package/dist/transformers/msoPlaceholders.js +114 -0
  319. package/dist/transformers/msoPlaceholders.js.map +1 -0
  320. package/dist/transformers/purgeCss.d.ts +43 -0
  321. package/dist/transformers/purgeCss.d.ts.map +1 -0
  322. package/dist/transformers/purgeCss.js +207 -0
  323. package/dist/transformers/purgeCss.js.map +1 -0
  324. package/dist/transformers/removeAttributes.d.ts +54 -0
  325. package/dist/transformers/removeAttributes.d.ts.map +1 -0
  326. package/dist/transformers/removeAttributes.js +72 -0
  327. package/dist/transformers/removeAttributes.js.map +1 -0
  328. package/dist/transformers/{replaceStrings.d.mts → replaceStrings.d.ts} +2 -2
  329. package/dist/transformers/replaceStrings.d.ts.map +1 -0
  330. package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
  331. package/dist/transformers/replaceStrings.js.map +1 -0
  332. package/dist/transformers/safeSelectors.d.ts +37 -0
  333. package/dist/transformers/safeSelectors.d.ts.map +1 -0
  334. package/dist/transformers/{safeClassNames.mjs → safeSelectors.js} +40 -10
  335. package/dist/transformers/safeSelectors.js.map +1 -0
  336. package/dist/transformers/shorthandCss.d.ts +47 -0
  337. package/dist/transformers/shorthandCss.d.ts.map +1 -0
  338. package/dist/transformers/shorthandCss.js +92 -0
  339. package/dist/transformers/shorthandCss.js.map +1 -0
  340. package/dist/transformers/sixHex.d.ts +25 -0
  341. package/dist/transformers/sixHex.d.ts.map +1 -0
  342. package/dist/transformers/sixHex.js +42 -0
  343. package/dist/transformers/sixHex.js.map +1 -0
  344. package/dist/transformers/tailwindComponent.d.ts +16 -0
  345. package/dist/transformers/tailwindComponent.d.ts.map +1 -0
  346. package/dist/transformers/tailwindComponent.js +101 -0
  347. package/dist/transformers/tailwindComponent.js.map +1 -0
  348. package/dist/transformers/{tailwindcss.d.mts → tailwindcss.d.ts} +2 -2
  349. package/dist/transformers/tailwindcss.d.ts.map +1 -0
  350. package/dist/transformers/{tailwindcss.mjs → tailwindcss.js} +33 -74
  351. package/dist/transformers/tailwindcss.js.map +1 -0
  352. package/dist/transformers/urlQuery.d.ts +36 -0
  353. package/dist/transformers/urlQuery.d.ts.map +1 -0
  354. package/dist/transformers/urlQuery.js +77 -0
  355. package/dist/transformers/urlQuery.js.map +1 -0
  356. package/dist/types/{config.d.mts → config.d.ts} +231 -46
  357. package/dist/types/config.d.ts.map +1 -0
  358. package/dist/types/config.js +1 -0
  359. package/dist/types/index.d.ts +2 -0
  360. package/dist/types/index.js +1 -0
  361. package/dist/utils/ast/index.d.ts +4 -0
  362. package/dist/utils/ast/index.js +4 -0
  363. package/dist/utils/ast/{parser.d.mts → parser.d.ts} +1 -1
  364. package/dist/utils/ast/parser.d.ts.map +1 -0
  365. package/dist/utils/ast/{parser.mjs → parser.js} +2 -3
  366. package/dist/utils/ast/parser.js.map +1 -0
  367. package/dist/utils/ast/{serializer.d.mts → serializer.d.ts} +1 -1
  368. package/dist/utils/ast/serializer.d.ts.map +1 -0
  369. package/dist/utils/ast/serializer.js +46 -0
  370. package/dist/utils/ast/serializer.js.map +1 -0
  371. package/dist/utils/ast/{walker.d.mts → walker.d.ts} +1 -1
  372. package/dist/utils/ast/walker.d.ts.map +1 -0
  373. package/dist/utils/ast/{walker.mjs → walker.js} +2 -2
  374. package/dist/utils/ast/walker.js.map +1 -0
  375. package/dist/utils/cloneConfig.d.ts +13 -0
  376. package/dist/utils/cloneConfig.d.ts.map +1 -0
  377. package/dist/utils/cloneConfig.js +21 -0
  378. package/dist/utils/cloneConfig.js.map +1 -0
  379. package/dist/utils/compileTailwindCss.d.ts +16 -0
  380. package/dist/utils/compileTailwindCss.d.ts.map +1 -0
  381. package/dist/utils/compileTailwindCss.js +55 -0
  382. package/dist/utils/compileTailwindCss.js.map +1 -0
  383. package/dist/utils/componentSources.d.ts +50 -0
  384. package/dist/utils/componentSources.d.ts.map +1 -0
  385. package/dist/utils/componentSources.js +50 -0
  386. package/dist/utils/componentSources.js.map +1 -0
  387. package/dist/utils/cssBox.d.ts +42 -0
  388. package/dist/utils/cssBox.d.ts.map +1 -0
  389. package/dist/utils/cssBox.js +151 -0
  390. package/dist/utils/cssBox.js.map +1 -0
  391. package/dist/utils/decodeStyleEntities.d.ts +15 -0
  392. package/dist/utils/decodeStyleEntities.d.ts.map +1 -0
  393. package/dist/utils/decodeStyleEntities.js +18 -0
  394. package/dist/utils/decodeStyleEntities.js.map +1 -0
  395. package/dist/utils/{detect.d.mts → detect.d.ts} +1 -1
  396. package/dist/utils/detect.d.ts.map +1 -0
  397. package/dist/utils/{detect.mjs → detect.js} +2 -3
  398. package/dist/utils/detect.js.map +1 -0
  399. package/dist/utils/output-markers.d.ts +29 -0
  400. package/dist/utils/output-markers.d.ts.map +1 -0
  401. package/dist/utils/output-markers.js +68 -0
  402. package/dist/utils/output-markers.js.map +1 -0
  403. package/dist/utils/{url.d.mts → url.d.ts} +1 -1
  404. package/dist/utils/url.d.ts.map +1 -0
  405. package/dist/utils/{url.mjs → url.js} +2 -3
  406. package/dist/utils/url.js.map +1 -0
  407. package/dist/utils/watchPaths.d.ts +11 -0
  408. package/dist/utils/watchPaths.d.ts.map +1 -0
  409. package/dist/utils/watchPaths.js +19 -0
  410. package/dist/utils/watchPaths.js.map +1 -0
  411. package/node_modules/@clack/core/CHANGELOG.md +44 -0
  412. package/node_modules/@clack/core/dist/index.d.mts +125 -5
  413. package/node_modules/@clack/core/dist/index.mjs +972 -11
  414. package/node_modules/@clack/core/package.json +6 -2
  415. package/node_modules/@clack/prompts/CHANGELOG.md +70 -0
  416. package/node_modules/@clack/prompts/README.md +129 -3
  417. package/node_modules/@clack/prompts/dist/index.d.mts +567 -33
  418. package/node_modules/@clack/prompts/dist/index.mjs +1378 -133
  419. package/node_modules/@clack/prompts/package.json +7 -4
  420. package/node_modules/fast-string-truncated-width/dist/index.js +36 -96
  421. package/node_modules/fast-string-truncated-width/dist/types.d.ts +0 -3
  422. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +3 -3
  423. package/node_modules/fast-string-truncated-width/dist/utils.js +14 -9
  424. package/node_modules/fast-string-truncated-width/package.json +1 -1
  425. package/node_modules/fast-string-truncated-width/readme.md +2 -3
  426. package/node_modules/fast-string-width/package.json +2 -2
  427. package/node_modules/fast-string-width/readme.md +0 -3
  428. package/node_modules/fast-wrap-ansi/lib/main.js +4 -2
  429. package/node_modules/fast-wrap-ansi/package.json +11 -11
  430. package/node_modules/maizzle/README.md +24 -0
  431. package/node_modules/maizzle/dist/commands/make/component.mjs +1 -1
  432. package/node_modules/maizzle/dist/commands/make/config.mjs +8 -7
  433. package/node_modules/maizzle/dist/commands/make/layout.mjs +3 -3
  434. package/node_modules/maizzle/dist/commands/make/scaffold.mjs +1 -1
  435. package/node_modules/maizzle/dist/commands/make/stubs/Layout.vue +146 -0
  436. package/node_modules/maizzle/dist/commands/make/stubs/component.vue +2 -4
  437. package/node_modules/maizzle/dist/commands/make/stubs/config.ts +1 -5
  438. package/node_modules/maizzle/dist/commands/make/template.mjs +1 -1
  439. package/node_modules/maizzle/dist/commands/new.mjs +46 -135
  440. package/node_modules/maizzle/dist/index.d.mts +1 -0
  441. package/node_modules/maizzle/dist/index.mjs +30 -7
  442. package/node_modules/maizzle/package.json +5 -4
  443. package/node_modules/nypm/dist/cli.mjs +28 -5
  444. package/node_modules/nypm/dist/index.d.mts +0 -8
  445. package/node_modules/nypm/dist/index.mjs +27 -4
  446. package/node_modules/nypm/package.json +12 -12
  447. package/node_modules/tinyexec/README.md +9 -1
  448. package/node_modules/tinyexec/dist/main.d.mts +22 -7
  449. package/node_modules/tinyexec/dist/main.mjs +189 -491
  450. package/node_modules/tinyexec/package.json +14 -16
  451. package/package.json +38 -31
  452. package/dist/_virtual/_rolldown/runtime.mjs +0 -32
  453. package/dist/build.d.mts +0 -19
  454. package/dist/build.d.mts.map +0 -1
  455. package/dist/build.mjs +0 -141
  456. package/dist/build.mjs.map +0 -1
  457. package/dist/components/Divider.vue +0 -133
  458. package/dist/components/Image.vue +0 -70
  459. package/dist/components/Overlap.vue +0 -80
  460. package/dist/components/utils.d.mts +0 -5
  461. package/dist/components/utils.d.mts.map +0 -1
  462. package/dist/components/utils.mjs +0 -9
  463. package/dist/components/utils.mjs.map +0 -1
  464. package/dist/composables/defineConfig.d.mts +0 -14
  465. package/dist/composables/defineConfig.d.mts.map +0 -1
  466. package/dist/composables/defineConfig.mjs.map +0 -1
  467. package/dist/composables/renderContext.d.mts +0 -24
  468. package/dist/composables/renderContext.d.mts.map +0 -1
  469. package/dist/composables/renderContext.mjs +0 -6
  470. package/dist/composables/renderContext.mjs.map +0 -1
  471. package/dist/composables/useConfig.d.mts +0 -9
  472. package/dist/composables/useConfig.d.mts.map +0 -1
  473. package/dist/composables/useConfig.mjs +0 -13
  474. package/dist/composables/useConfig.mjs.map +0 -1
  475. package/dist/composables/useDoctype.d.mts.map +0 -1
  476. package/dist/composables/useDoctype.mjs.map +0 -1
  477. package/dist/composables/useEvent.d.mts.map +0 -1
  478. package/dist/composables/useEvent.mjs.map +0 -1
  479. package/dist/composables/usePlaintext.d.mts.map +0 -1
  480. package/dist/composables/usePlaintext.mjs.map +0 -1
  481. package/dist/composables/usePreviewText.d.mts +0 -24
  482. package/dist/composables/usePreviewText.d.mts.map +0 -1
  483. package/dist/composables/usePreviewText.mjs +0 -29
  484. package/dist/composables/usePreviewText.mjs.map +0 -1
  485. package/dist/config/defaults.d.mts.map +0 -1
  486. package/dist/config/defaults.mjs.map +0 -1
  487. package/dist/config/index.d.mts +0 -15
  488. package/dist/config/index.d.mts.map +0 -1
  489. package/dist/config/index.mjs +0 -71
  490. package/dist/config/index.mjs.map +0 -1
  491. package/dist/events/index.d.mts.map +0 -1
  492. package/dist/events/index.mjs.map +0 -1
  493. package/dist/index.d.mts +0 -31
  494. package/dist/index.mjs +0 -31
  495. package/dist/node_modules/picomatch/index.mjs +0 -13
  496. package/dist/node_modules/picomatch/index.mjs.map +0 -1
  497. package/dist/node_modules/picomatch/lib/constants.mjs +0 -174
  498. package/dist/node_modules/picomatch/lib/constants.mjs.map +0 -1
  499. package/dist/node_modules/picomatch/lib/parse.mjs +0 -1067
  500. package/dist/node_modules/picomatch/lib/parse.mjs.map +0 -1
  501. package/dist/node_modules/picomatch/lib/picomatch.mjs +0 -304
  502. package/dist/node_modules/picomatch/lib/picomatch.mjs.map +0 -1
  503. package/dist/node_modules/picomatch/lib/scan.mjs +0 -296
  504. package/dist/node_modules/picomatch/lib/scan.mjs.map +0 -1
  505. package/dist/node_modules/picomatch/lib/utils.mjs +0 -53
  506. package/dist/node_modules/picomatch/lib/utils.mjs.map +0 -1
  507. package/dist/plaintext.d.mts.map +0 -1
  508. package/dist/plaintext.mjs.map +0 -1
  509. package/dist/plugin.d.mts.map +0 -1
  510. package/dist/plugin.mjs.map +0 -1
  511. package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +0 -1
  512. package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
  513. package/dist/plugins/postcss/pruneVars.d.mts.map +0 -1
  514. package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
  515. package/dist/plugins/postcss/removeDeclarations.d.mts.map +0 -1
  516. package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
  517. package/dist/plugins/postcss/tailwindCleanup.d.mts.map +0 -1
  518. package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
  519. package/dist/render/createRenderer.d.mts.map +0 -1
  520. package/dist/render/createRenderer.mjs +0 -286
  521. package/dist/render/createRenderer.mjs.map +0 -1
  522. package/dist/render/index.d.mts +0 -26
  523. package/dist/render/index.d.mts.map +0 -1
  524. package/dist/render/index.mjs +0 -46
  525. package/dist/render/index.mjs.map +0 -1
  526. package/dist/serve.d.mts.map +0 -1
  527. package/dist/serve.mjs.map +0 -1
  528. package/dist/server/compatibility.d.mts +0 -5
  529. package/dist/server/compatibility.d.mts.map +0 -1
  530. package/dist/server/compatibility.mjs +0 -97
  531. package/dist/server/compatibility.mjs.map +0 -1
  532. package/dist/server/email.d.mts.map +0 -1
  533. package/dist/server/email.mjs.map +0 -1
  534. package/dist/server/linter.d.mts +0 -5
  535. package/dist/server/linter.d.mts.map +0 -1
  536. package/dist/server/linter.mjs +0 -189
  537. package/dist/server/linter.mjs.map +0 -1
  538. package/dist/transformers/addAttributes.d.mts +0 -32
  539. package/dist/transformers/addAttributes.d.mts.map +0 -1
  540. package/dist/transformers/addAttributes.mjs.map +0 -1
  541. package/dist/transformers/attributeToStyle.d.mts +0 -25
  542. package/dist/transformers/attributeToStyle.d.mts.map +0 -1
  543. package/dist/transformers/attributeToStyle.mjs +0 -80
  544. package/dist/transformers/attributeToStyle.mjs.map +0 -1
  545. package/dist/transformers/base.d.mts +0 -8
  546. package/dist/transformers/base.d.mts.map +0 -1
  547. package/dist/transformers/base.mjs.map +0 -1
  548. package/dist/transformers/entities.d.mts +0 -8
  549. package/dist/transformers/entities.d.mts.map +0 -1
  550. package/dist/transformers/entities.mjs +0 -41
  551. package/dist/transformers/entities.mjs.map +0 -1
  552. package/dist/transformers/filters/defaults.d.mts.map +0 -1
  553. package/dist/transformers/filters/defaults.mjs.map +0 -1
  554. package/dist/transformers/filters/index.d.mts +0 -22
  555. package/dist/transformers/filters/index.d.mts.map +0 -1
  556. package/dist/transformers/filters/index.mjs +0 -67
  557. package/dist/transformers/filters/index.mjs.map +0 -1
  558. package/dist/transformers/format.d.mts +0 -15
  559. package/dist/transformers/format.d.mts.map +0 -1
  560. package/dist/transformers/format.mjs +0 -26
  561. package/dist/transformers/format.mjs.map +0 -1
  562. package/dist/transformers/index.d.mts.map +0 -1
  563. package/dist/transformers/index.mjs +0 -81
  564. package/dist/transformers/index.mjs.map +0 -1
  565. package/dist/transformers/inlineCSS.d.mts +0 -17
  566. package/dist/transformers/inlineCSS.d.mts.map +0 -1
  567. package/dist/transformers/inlineCSS.mjs +0 -70
  568. package/dist/transformers/inlineCSS.mjs.map +0 -1
  569. package/dist/transformers/inlineLink.d.mts +0 -14
  570. package/dist/transformers/inlineLink.d.mts.map +0 -1
  571. package/dist/transformers/inlineLink.mjs.map +0 -1
  572. package/dist/transformers/minify.d.mts +0 -17
  573. package/dist/transformers/minify.d.mts.map +0 -1
  574. package/dist/transformers/minify.mjs +0 -24
  575. package/dist/transformers/minify.mjs.map +0 -1
  576. package/dist/transformers/purgeCSS.d.mts +0 -23
  577. package/dist/transformers/purgeCSS.d.mts.map +0 -1
  578. package/dist/transformers/purgeCSS.mjs +0 -132
  579. package/dist/transformers/purgeCSS.mjs.map +0 -1
  580. package/dist/transformers/removeAttributes.d.mts +0 -31
  581. package/dist/transformers/removeAttributes.d.mts.map +0 -1
  582. package/dist/transformers/removeAttributes.mjs +0 -63
  583. package/dist/transformers/removeAttributes.mjs.map +0 -1
  584. package/dist/transformers/replaceStrings.d.mts.map +0 -1
  585. package/dist/transformers/replaceStrings.mjs.map +0 -1
  586. package/dist/transformers/safeClassNames.d.mts +0 -22
  587. package/dist/transformers/safeClassNames.d.mts.map +0 -1
  588. package/dist/transformers/safeClassNames.mjs.map +0 -1
  589. package/dist/transformers/shorthandCSS.d.mts +0 -24
  590. package/dist/transformers/shorthandCSS.d.mts.map +0 -1
  591. package/dist/transformers/shorthandCSS.mjs +0 -48
  592. package/dist/transformers/shorthandCSS.mjs.map +0 -1
  593. package/dist/transformers/sixHex.d.mts +0 -16
  594. package/dist/transformers/sixHex.d.mts.map +0 -1
  595. package/dist/transformers/sixHex.mjs +0 -30
  596. package/dist/transformers/sixHex.mjs.map +0 -1
  597. package/dist/transformers/tailwindcss.d.mts.map +0 -1
  598. package/dist/transformers/tailwindcss.mjs.map +0 -1
  599. package/dist/transformers/urlQuery.d.mts +0 -24
  600. package/dist/transformers/urlQuery.d.mts.map +0 -1
  601. package/dist/transformers/urlQuery.mjs +0 -65
  602. package/dist/transformers/urlQuery.mjs.map +0 -1
  603. package/dist/types/config.d.mts.map +0 -1
  604. package/dist/types/config.mjs +0 -1
  605. package/dist/types/index.d.mts +0 -2
  606. package/dist/types/index.mjs +0 -1
  607. package/dist/utils/ast/index.d.mts +0 -4
  608. package/dist/utils/ast/index.mjs +0 -5
  609. package/dist/utils/ast/parser.d.mts.map +0 -1
  610. package/dist/utils/ast/parser.mjs.map +0 -1
  611. package/dist/utils/ast/serializer.d.mts.map +0 -1
  612. package/dist/utils/ast/serializer.mjs +0 -37
  613. package/dist/utils/ast/serializer.mjs.map +0 -1
  614. package/dist/utils/ast/walker.d.mts.map +0 -1
  615. package/dist/utils/ast/walker.mjs.map +0 -1
  616. package/dist/utils/detect.d.mts.map +0 -1
  617. package/dist/utils/detect.mjs.map +0 -1
  618. package/dist/utils/url.d.mts.map +0 -1
  619. package/dist/utils/url.mjs.map +0 -1
  620. package/node_modules/@clack/core/dist/index.mjs.map +0 -1
  621. package/node_modules/@clack/prompts/dist/index.mjs.map +0 -1
  622. package/node_modules/fast-wrap-ansi/lib/main.js.map +0 -1
  623. package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
  624. package/node_modules/tinyexec/dist/LICENSES.txt +0 -83
@@ -1,9 +1,10 @@
1
- import { walk } from "../utils/ast/walker.mjs";
2
- import "../utils/ast/index.mjs";
1
+ import { parse } from "../utils/ast/parser.js";
2
+ import { walk } from "../utils/ast/walker.js";
3
+ import { serialize } from "../utils/ast/serializer.js";
4
+ import "../utils/ast/index.js";
3
5
  import postcss from "postcss";
4
6
  import safeParser from "postcss-safe-parser";
5
-
6
- //#region src/transformers/safeClassNames.ts
7
+ //#region src/transformers/safeSelectors.ts
7
8
  const DEFAULT_REPLACEMENTS = {
8
9
  ":": "-",
9
10
  "/": "-",
@@ -50,7 +51,19 @@ function processCssSelectors(css, replacements) {
50
51
  const selectorRegex = new RegExp(`\\\\(${Object.keys(replacements).map(escapeForRegex).join("|")})`, "g");
51
52
  return postcss([(root) => {
52
53
  root.walkRules((rule) => {
53
- rule.selector = rule.selector.replace(selectorRegex, (_matched, char) => replacements[char] ?? _matched).replaceAll("\\2c ", "_");
54
+ rule.selector = rule.selector.replace(selectorRegex, (matched, char, offset, str) => {
55
+ /**
56
+ * Yahoo Mail wraps content in a class literally named `&`, so
57
+ * the selector `.\&` must be preserved. Detect it as a
58
+ * `\&` that follows a `.` and ends the class atom
59
+ * (space, combinator, comma, `{`, or end-of-str).
60
+ */
61
+ if (char === "&" && str[offset - 1] === ".") {
62
+ const next = str[offset + 2];
63
+ if (next === void 0 || /[\s,{>~+)]/.test(next)) return matched;
64
+ }
65
+ return replacements[char] ?? matched;
66
+ }).replaceAll("\\2c ", "_");
54
67
  });
55
68
  }]).process(css, { parser: safeParser }).css;
56
69
  }
@@ -67,7 +80,7 @@ function processClassAttr(classStr, replacements) {
67
80
  }).join(" ");
68
81
  }
69
82
  /**
70
- * Safe class names transformer.
83
+ * Safe selectors transformer.
71
84
  *
72
85
  * Replaces unsafe characters (`:`, `/`, `[`, `]`, etc.) in:
73
86
  * - CSS selectors inside `<style>` tags
@@ -79,8 +92,25 @@ function processClassAttr(classStr, replacements) {
79
92
  * Enabled by default. Disable by setting `css.safe` to `false`.
80
93
  * Customize replacements by passing a `Record<string, string>` — user
81
94
  * values are merged on top of the defaults.
95
+ *
96
+ * @param html HTML string to transform.
97
+ * @param config CSS config (see {@link CssConfig}).
98
+ * @returns The transformed HTML string.
99
+ *
100
+ * @example
101
+ * import { safeSelectors } from '@maizzle/framework'
102
+ *
103
+ * const out = safeSelectors('<div class="sm:text-base"></div>')
82
104
  */
83
- function safeClassNames(dom, config = {}) {
105
+ function safeSelectors(html, config = {}) {
106
+ return serialize(safeSelectorsDom(parse(html), config));
107
+ }
108
+ /**
109
+ * DOM-form of {@link safeSelectors} used by the internal transformer pipeline.
110
+ * Takes a parsed DOM, returns a parsed DOM — avoids redundant
111
+ * serialize/parse round-trips when chained with other transformers.
112
+ */
113
+ function safeSelectorsDom(dom, config = {}) {
84
114
  const option = config.safe ?? true;
85
115
  if (!option) return dom;
86
116
  const replacements = option && typeof option === "object" ? {
@@ -97,7 +127,7 @@ function safeClassNames(dom, config = {}) {
97
127
  });
98
128
  return dom;
99
129
  }
100
-
101
130
  //#endregion
102
- export { safeClassNames };
103
- //# sourceMappingURL=safeClassNames.mjs.map
131
+ export { safeSelectors, safeSelectorsDom };
132
+
133
+ //# sourceMappingURL=safeSelectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeSelectors.js","names":[],"sources":["../../src/transformers/safeSelectors.ts"],"sourcesContent":["import postcss from 'postcss'\nimport safeParser from 'postcss-safe-parser'\nimport type { ChildNode, Element } from 'domhandler'\nimport { parse, serialize, walk } from '../utils/ast/index.ts'\nimport type { CssConfig } from '../types/config.ts'\n\nconst DEFAULT_REPLACEMENTS: Record<string, string> = {\n ':': '-',\n '/': '-',\n '%': 'pc',\n '.': '_',\n ',': '_',\n '#': '_',\n '[': '',\n ']': '',\n '(': '',\n ')': '',\n '{': '',\n '}': '',\n '!': '-i',\n '&': 'and-',\n '<': 'lt-',\n '=': 'eq-',\n '>': 'gt-',\n '|': 'or-',\n '@': 'at-',\n '?': 'q-',\n '\\\\': '-',\n '\"': '-',\n \"'\": '-',\n '*': '-',\n '+': '-',\n ';': '-',\n '^': '-',\n '`': '-',\n '~': '-',\n '$': '-',\n}\n\nfunction escapeForRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Replace escaped special characters in CSS selectors.\n *\n * Tailwind generates selectors like `.sm\\:text-base`. This function\n * replaces the `\\:` with `-` (or whatever the configured replacement is)\n * so the selector becomes `.sm-text-base`, which is safe for email clients.\n */\nfunction processCssSelectors(css: string, replacements: Record<string, string>): string {\n // Matches \\<char> in CSS selectors — e.g. \\: \\/ \\. \\[ etc.\n const selectorRegex = new RegExp(\n `\\\\\\\\(${Object.keys(replacements).map(escapeForRegex).join('|')})`,\n 'g',\n )\n\n return postcss([\n (root: postcss.Root) => {\n root.walkRules((rule: postcss.Rule) => {\n rule.selector = rule.selector\n .replace(selectorRegex, (matched, char, offset, str) => {\n /**\n * Yahoo Mail wraps content in a class literally named `&`, so\n * the selector `.\\&` must be preserved. Detect it as a\n * `\\&` that follows a `.` and ends the class atom\n * (space, combinator, comma, `{`, or end-of-str).\n */\n if (char === '&' && str[offset - 1] === '.') {\n const next = str[offset + 2]\n if (next === undefined || /[\\s,{>~+)]/.test(next)) return matched\n }\n return replacements[char] ?? matched\n })\n // Handle CSS unicode escape for comma (\\2c → _)\n .replaceAll('\\\\2c ', '_')\n })\n },\n ]).process(css, { parser: safeParser }).css\n}\n\n/**\n * Replace unsafe special characters in a class attribute value.\n *\n * Splits on whitespace and replaces each char from the replacements map\n * in each class token individually.\n */\nfunction processClassAttr(classStr: string, replacements: Record<string, string>): string {\n return classStr\n .split(/\\s+/)\n .filter(Boolean)\n .map((cls) => {\n for (const [from, to] of Object.entries(replacements)) {\n cls = cls.split(from).join(to)\n }\n return cls\n })\n .join(' ')\n}\n\n/**\n * Safe selectors transformer.\n *\n * Replaces unsafe characters (`:`, `/`, `[`, `]`, etc.) in:\n * - CSS selectors inside `<style>` tags\n * - HTML `class` attributes\n *\n * This makes Tailwind utility classes like `sm:text-base` safe for\n * email clients that cannot handle escaped characters in class names.\n *\n * Enabled by default. Disable by setting `css.safe` to `false`.\n * Customize replacements by passing a `Record<string, string>` — user\n * values are merged on top of the defaults.\n *\n * @param html HTML string to transform.\n * @param config CSS config (see {@link CssConfig}).\n * @returns The transformed HTML string.\n *\n * @example\n * import { safeSelectors } from '@maizzle/framework'\n *\n * const out = safeSelectors('<div class=\"sm:text-base\"></div>')\n */\nexport function safeSelectors(html: string, config: CssConfig = {}): string {\n return serialize(safeSelectorsDom(parse(html), config))\n}\n\n/**\n * DOM-form of {@link safeSelectors} used by the internal transformer pipeline.\n * Takes a parsed DOM, returns a parsed DOM — avoids redundant\n * serialize/parse round-trips when chained with other transformers.\n */\nexport function safeSelectorsDom(dom: ChildNode[], config: CssConfig = {}): ChildNode[] {\n const option = config.safe ?? true\n\n if (!option) return dom\n\n const replacements: Record<string, string> =\n option && typeof option === 'object'\n ? { ...DEFAULT_REPLACEMENTS, ...option }\n : DEFAULT_REPLACEMENTS\n\n walk(dom, (node) => {\n const el = node as Element\n\n // Process CSS selectors inside <style> tags\n if (el.name === 'style' && el.children?.length) {\n const text = el.children.find((c) => c.type === 'text') as any\n if (text?.data?.trim()) {\n text.data = processCssSelectors(text.data, replacements)\n }\n }\n\n // Replace special chars in class attributes\n if ('attribs' in el && el.attribs?.class) {\n el.attribs.class = processClassAttr(el.attribs.class, replacements)\n }\n })\n\n return dom\n}\n"],"mappings":";;;;;;;AAMA,MAAM,uBAA+C;CACnD,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACP;AAEA,SAAS,eAAe,GAAmB;CACzC,OAAO,EAAE,QAAQ,uBAAuB,MAAM;AAChD;;;;;;;;AASA,SAAS,oBAAoB,KAAa,cAA8C;CAEtF,MAAM,gBAAgB,IAAI,OACxB,QAAQ,OAAO,KAAK,YAAY,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,KAAK,GAAG,EAAE,IAChE,GACF;CAEA,OAAO,QAAQ,EACZ,SAAuB;EACtB,KAAK,WAAW,SAAuB;GACrC,KAAK,WAAW,KAAK,SAClB,QAAQ,gBAAgB,SAAS,MAAM,QAAQ,QAAQ;;;;;;;IAOtD,IAAI,SAAS,OAAO,IAAI,SAAS,OAAO,KAAK;KAC3C,MAAM,OAAO,IAAI,SAAS;KAC1B,IAAI,SAAS,KAAA,KAAa,aAAa,KAAK,IAAI,GAAG,OAAO;IAC5D;IACA,OAAO,aAAa,SAAS;GAC/B,CAAC,CAAC,CAED,WAAW,SAAS,GAAG;EAC5B,CAAC;CACH,CACF,CAAC,CAAC,CAAC,QAAQ,KAAK,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC;AAC1C;;;;;;;AAQA,SAAS,iBAAiB,UAAkB,cAA8C;CACxF,OAAO,SACJ,MAAM,KAAK,CAAC,CACZ,OAAO,OAAO,CAAC,CACf,KAAK,QAAQ;EACZ,KAAK,MAAM,CAAC,MAAM,OAAO,OAAO,QAAQ,YAAY,GAClD,MAAM,IAAI,MAAM,IAAI,CAAC,CAAC,KAAK,EAAE;EAE/B,OAAO;CACT,CAAC,CAAC,CACD,KAAK,GAAG;AACb;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,cAAc,MAAc,SAAoB,CAAC,GAAW;CAC1E,OAAO,UAAU,iBAAiB,MAAM,IAAI,GAAG,MAAM,CAAC;AACxD;;;;;;AAOA,SAAgB,iBAAiB,KAAkB,SAAoB,CAAC,GAAgB;CACtF,MAAM,SAAS,OAAO,QAAQ;CAE9B,IAAI,CAAC,QAAQ,OAAO;CAEpB,MAAM,eACJ,UAAU,OAAO,WAAW,WACxB;EAAE,GAAG;EAAsB,GAAG;CAAO,IACrC;CAEN,KAAK,MAAM,SAAS;EAClB,MAAM,KAAK;EAGX,IAAI,GAAG,SAAS,WAAW,GAAG,UAAU,QAAQ;GAC9C,MAAM,OAAO,GAAG,SAAS,MAAM,MAAM,EAAE,SAAS,MAAM;GACtD,IAAI,MAAM,MAAM,KAAK,GACnB,KAAK,OAAO,oBAAoB,KAAK,MAAM,YAAY;EAE3D;EAGA,IAAI,aAAa,MAAM,GAAG,SAAS,OACjC,GAAG,QAAQ,QAAQ,iBAAiB,GAAG,QAAQ,OAAO,YAAY;CAEtE,CAAC;CAED,OAAO;AACT"}
@@ -0,0 +1,47 @@
1
+ import { ChildNode } from "domhandler";
2
+
3
+ //#region src/transformers/shorthandCss.d.ts
4
+ /**
5
+ * Options for the `shorthandCss` transformer.
6
+ */
7
+ interface ShorthandCssOptions {
8
+ /**
9
+ * Restrict the transform to a list of HTML tag names. Omit to apply to
10
+ * every element with a `style` attribute.
11
+ *
12
+ * @example ['td', 'div']
13
+ */
14
+ tags?: string[];
15
+ }
16
+ /**
17
+ * Rewrite longhand CSS inside inline `style` attributes with shorthand
18
+ * syntax. Works with margin, padding, and border when all sides are
19
+ * specified.
20
+ *
21
+ * For example:
22
+ * `margin-left: 2px; margin-right: 2px; margin-top: 4px; margin-bottom: 4px`
23
+ * becomes:
24
+ * `margin: 4px 2px`
25
+ *
26
+ * @param html HTML string to transform.
27
+ * @param options Optional Maizzle options (`tags`).
28
+ * @returns The transformed HTML string.
29
+ *
30
+ * @example
31
+ * import { shorthandCss } from '@maizzle/framework'
32
+ *
33
+ * const out = shorthandCss(
34
+ * '<p style="margin-top: 4px; margin-right: 2px; margin-bottom: 4px; margin-left: 2px;">x</p>',
35
+ * { tags: ['p'] },
36
+ * )
37
+ */
38
+ declare function shorthandCss(html: string, options?: ShorthandCssOptions): string;
39
+ /**
40
+ * DOM-form of {@link shorthandCss} used by the internal transformer
41
+ * pipeline. Takes a parsed DOM, returns a parsed DOM — avoids redundant
42
+ * serialize/parse round-trips when chained with other transformers.
43
+ */
44
+ declare function shorthandCssDom(dom: ChildNode[], options?: ShorthandCssOptions): ChildNode[];
45
+ //#endregion
46
+ export { ShorthandCssOptions, shorthandCss, shorthandCssDom };
47
+ //# sourceMappingURL=shorthandCss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shorthandCss.d.ts","names":[],"sources":["../../src/transformers/shorthandCss.ts"],"mappings":";;;;;AASA;UAAiB,mBAAA;;;AAOX;AAyBN;;;EAzBE,IAAI;AAAA;;;;AAyBsE;AAS5E;;;;;;;;;;;;;;AAA+F;;;;iBAT/E,YAAA,CAAa,IAAA,UAAc,OAAA,GAAS,mBAAwB;;;;;;iBAS5D,eAAA,CAAgB,GAAA,EAAK,SAAA,IAAa,OAAA,GAAS,mBAAA,GAA2B,SAAA"}
@@ -0,0 +1,92 @@
1
+ import { parse } from "../utils/ast/parser.js";
2
+ import { walk } from "../utils/ast/walker.js";
3
+ import { serialize } from "../utils/ast/serializer.js";
4
+ import "../utils/ast/index.js";
5
+ import postcss from "postcss";
6
+ import safeParser from "postcss-safe-parser";
7
+ import mergeLonghand from "postcss-merge-longhand";
8
+ //#region src/transformers/shorthandCss.ts
9
+ /**
10
+ * Rewrite longhand CSS inside inline `style` attributes with shorthand
11
+ * syntax. Works with margin, padding, and border when all sides are
12
+ * specified.
13
+ *
14
+ * For example:
15
+ * `margin-left: 2px; margin-right: 2px; margin-top: 4px; margin-bottom: 4px`
16
+ * becomes:
17
+ * `margin: 4px 2px`
18
+ *
19
+ * @param html HTML string to transform.
20
+ * @param options Optional Maizzle options (`tags`).
21
+ * @returns The transformed HTML string.
22
+ *
23
+ * @example
24
+ * import { shorthandCss } from '@maizzle/framework'
25
+ *
26
+ * const out = shorthandCss(
27
+ * '<p style="margin-top: 4px; margin-right: 2px; margin-bottom: 4px; margin-left: 2px;">x</p>',
28
+ * { tags: ['p'] },
29
+ * )
30
+ */
31
+ function shorthandCss(html, options = {}) {
32
+ return serialize(shorthandCssDom(parse(html), options));
33
+ }
34
+ /**
35
+ * DOM-form of {@link shorthandCss} used by the internal transformer
36
+ * pipeline. Takes a parsed DOM, returns a parsed DOM — avoids redundant
37
+ * serialize/parse round-trips when chained with other transformers.
38
+ */
39
+ function shorthandCssDom(dom, options = {}) {
40
+ const allowedTags = options.tags ?? [];
41
+ const hasTagFilter = allowedTags.length > 0;
42
+ /**
43
+ * Merge longhand within a single inline-style value. Returns the merged
44
+ * string when shorter, otherwise the original. Wraps the value in a
45
+ * dummy selector since postcss-merge-longhand operates on rules.
46
+ */
47
+ const mergeStyleValue = (styleValue) => {
48
+ try {
49
+ const { css } = postcss().use(mergeLonghand).process(`div { ${styleValue} }`, { parser: safeParser });
50
+ const match = css.match(/div\s*\{\s*([^}]+)\s*\}/);
51
+ if (match && match[1]) {
52
+ const merged = match[1].trim();
53
+ if (merged !== styleValue) return merged;
54
+ }
55
+ } catch {}
56
+ return styleValue;
57
+ };
58
+ walk(dom, (node) => {
59
+ /**
60
+ * MSO conditional comments carry their own inline-style attributes
61
+ * (e.g. `<!--[if mso]><td style="…"><![endif]-->`) as opaque text.
62
+ * The element walker can't see them, so without this branch the td/
63
+ * v:rect styles inside comments stay longhand even when the visible
64
+ * div has already been merged. Match each `style="…"` substring,
65
+ * run it through mergeLonghand, splice back.
66
+ *
67
+ * Tag filter intentionally bypassed: the user can't address MSO td
68
+ * elements (they don't parse as elements), and these comments
69
+ * always wrap email-layout primitives anyway.
70
+ */
71
+ if (node.type === "comment") {
72
+ const data = node.data;
73
+ if (!data || !data.includes("style=\"")) return;
74
+ const newData = data.replace(/style="([^"]*)"/g, (full, value) => {
75
+ const merged = mergeStyleValue(value);
76
+ return merged === value ? full : `style="${merged}"`;
77
+ });
78
+ if (newData !== data) node.data = newData;
79
+ return;
80
+ }
81
+ const el = node;
82
+ if (!el.attribs?.style) return;
83
+ if (hasTagFilter && !allowedTags.includes(el.name)) return;
84
+ const merged = mergeStyleValue(el.attribs.style);
85
+ if (merged !== el.attribs.style) el.attribs.style = merged;
86
+ });
87
+ return dom;
88
+ }
89
+ //#endregion
90
+ export { shorthandCss, shorthandCssDom };
91
+
92
+ //# sourceMappingURL=shorthandCss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shorthandCss.js","names":[],"sources":["../../src/transformers/shorthandCss.ts"],"sourcesContent":["import postcss from 'postcss'\nimport safeParser from 'postcss-safe-parser'\nimport mergeLonghand from 'postcss-merge-longhand'\nimport type { ChildNode, Element } from 'domhandler'\nimport { parse, serialize, walk } from '../utils/ast/index.ts'\n\n/**\n * Options for the `shorthandCss` transformer.\n */\nexport interface ShorthandCssOptions {\n /**\n * Restrict the transform to a list of HTML tag names. Omit to apply to\n * every element with a `style` attribute.\n *\n * @example ['td', 'div']\n */\n tags?: string[]\n}\n\n/**\n * Rewrite longhand CSS inside inline `style` attributes with shorthand\n * syntax. Works with margin, padding, and border when all sides are\n * specified.\n *\n * For example:\n * `margin-left: 2px; margin-right: 2px; margin-top: 4px; margin-bottom: 4px`\n * becomes:\n * `margin: 4px 2px`\n *\n * @param html HTML string to transform.\n * @param options Optional Maizzle options (`tags`).\n * @returns The transformed HTML string.\n *\n * @example\n * import { shorthandCss } from '@maizzle/framework'\n *\n * const out = shorthandCss(\n * '<p style=\"margin-top: 4px; margin-right: 2px; margin-bottom: 4px; margin-left: 2px;\">x</p>',\n * { tags: ['p'] },\n * )\n */\nexport function shorthandCss(html: string, options: ShorthandCssOptions = {}): string {\n return serialize(shorthandCssDom(parse(html), options))\n}\n\n/**\n * DOM-form of {@link shorthandCss} used by the internal transformer\n * pipeline. Takes a parsed DOM, returns a parsed DOM — avoids redundant\n * serialize/parse round-trips when chained with other transformers.\n */\nexport function shorthandCssDom(dom: ChildNode[], options: ShorthandCssOptions = {}): ChildNode[] {\n const allowedTags = options.tags ?? []\n const hasTagFilter = allowedTags.length > 0\n\n /**\n * Merge longhand within a single inline-style value. Returns the merged\n * string when shorter, otherwise the original. Wraps the value in a\n * dummy selector since postcss-merge-longhand operates on rules.\n */\n const mergeStyleValue = (styleValue: string): string => {\n try {\n const { css } = postcss()\n .use(mergeLonghand)\n .process(`div { ${styleValue} }`, { parser: safeParser })\n const match = css.match(/div\\s*\\{\\s*([^}]+)\\s*\\}/)\n if (match && match[1]) {\n const merged = match[1].trim()\n if (merged !== styleValue) return merged\n }\n }\n catch {}\n return styleValue\n }\n\n walk(dom, (node) => {\n /**\n * MSO conditional comments carry their own inline-style attributes\n * (e.g. `<!--[if mso]><td style=\"…\"><![endif]-->`) as opaque text.\n * The element walker can't see them, so without this branch the td/\n * v:rect styles inside comments stay longhand even when the visible\n * div has already been merged. Match each `style=\"…\"` substring,\n * run it through mergeLonghand, splice back.\n *\n * Tag filter intentionally bypassed: the user can't address MSO td\n * elements (they don't parse as elements), and these comments\n * always wrap email-layout primitives anyway.\n */\n if (node.type === 'comment') {\n const data = (node as any).data as string\n if (!data || !data.includes('style=\"')) return\n const newData = data.replace(/style=\"([^\"]*)\"/g, (full, value) => {\n const merged = mergeStyleValue(value)\n return merged === value ? full : `style=\"${merged}\"`\n })\n if (newData !== data) (node as any).data = newData\n return\n }\n\n const el = node as Element\n\n if (!el.attribs?.style) return\n if (hasTagFilter && !allowedTags.includes(el.name)) return\n\n const merged = mergeStyleValue(el.attribs.style)\n if (merged !== el.attribs.style) el.attribs.style = merged\n })\n\n return dom\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,aAAa,MAAc,UAA+B,CAAC,GAAW;CACpF,OAAO,UAAU,gBAAgB,MAAM,IAAI,GAAG,OAAO,CAAC;AACxD;;;;;;AAOA,SAAgB,gBAAgB,KAAkB,UAA+B,CAAC,GAAgB;CAChG,MAAM,cAAc,QAAQ,QAAQ,CAAC;CACrC,MAAM,eAAe,YAAY,SAAS;;;;;;CAO1C,MAAM,mBAAmB,eAA+B;EACtD,IAAI;GACF,MAAM,EAAE,QAAQ,QAAQ,CAAC,CACtB,IAAI,aAAa,CAAC,CAClB,QAAQ,SAAS,WAAW,KAAK,EAAE,QAAQ,WAAW,CAAC;GAC1D,MAAM,QAAQ,IAAI,MAAM,yBAAyB;GACjD,IAAI,SAAS,MAAM,IAAI;IACrB,MAAM,SAAS,MAAM,EAAE,CAAC,KAAK;IAC7B,IAAI,WAAW,YAAY,OAAO;GACpC;EACF,QACM,CAAC;EACP,OAAO;CACT;CAEA,KAAK,MAAM,SAAS;;;;;;;;;;;;;EAalB,IAAI,KAAK,SAAS,WAAW;GAC3B,MAAM,OAAQ,KAAa;GAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS,UAAS,GAAG;GACxC,MAAM,UAAU,KAAK,QAAQ,qBAAqB,MAAM,UAAU;IAChE,MAAM,SAAS,gBAAgB,KAAK;IACpC,OAAO,WAAW,QAAQ,OAAO,UAAU,OAAO;GACpD,CAAC;GACD,IAAI,YAAY,MAAM,KAAc,OAAO;GAC3C;EACF;EAEA,MAAM,KAAK;EAEX,IAAI,CAAC,GAAG,SAAS,OAAO;EACxB,IAAI,gBAAgB,CAAC,YAAY,SAAS,GAAG,IAAI,GAAG;EAEpD,MAAM,SAAS,gBAAgB,GAAG,QAAQ,KAAK;EAC/C,IAAI,WAAW,GAAG,QAAQ,OAAO,GAAG,QAAQ,QAAQ;CACtD,CAAC;CAED,OAAO;AACT"}
@@ -0,0 +1,25 @@
1
+ import { ChildNode } from "domhandler";
2
+
3
+ //#region src/transformers/sixHex.d.ts
4
+ /**
5
+ * Convert 3-digit HEX color codes to 6-digit in `bgcolor` and `color`
6
+ * attributes, for better email client compatibility.
7
+ *
8
+ * @param html HTML string to transform.
9
+ * @returns The transformed HTML string.
10
+ *
11
+ * @example
12
+ * import { sixHex } from '@maizzle/framework'
13
+ *
14
+ * const out = sixHex('<font color="#abc">x</font>')
15
+ */
16
+ declare function sixHex(html: string): string;
17
+ /**
18
+ * DOM-form of {@link sixHex} used by the internal transformer pipeline.
19
+ * Takes a parsed DOM, returns a parsed DOM — avoids redundant
20
+ * serialize/parse round-trips when chained with other transformers.
21
+ */
22
+ declare function sixHexDom(dom: ChildNode[]): ChildNode[];
23
+ //#endregion
24
+ export { sixHex, sixHexDom };
25
+ //# sourceMappingURL=sixHex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sixHex.d.ts","names":[],"sources":["../../src/transformers/sixHex.ts"],"mappings":";;;;;AAkBA;;;;AAAmC;AASnC;;;;;iBATgB,MAAA,CAAO,IAAY;;;AASmB;;;iBAAtC,SAAA,CAAU,GAAA,EAAK,SAAA,KAAc,SAAS"}
@@ -0,0 +1,42 @@
1
+ import { parse } from "../utils/ast/parser.js";
2
+ import { walk } from "../utils/ast/walker.js";
3
+ import { serialize } from "../utils/ast/serializer.js";
4
+ import "../utils/ast/index.js";
5
+ import { conv } from "color-shorthand-hex-to-six-digit";
6
+ //#region src/transformers/sixHex.ts
7
+ const targets = new Set(["bgcolor", "color"]);
8
+ /**
9
+ * Convert 3-digit HEX color codes to 6-digit in `bgcolor` and `color`
10
+ * attributes, for better email client compatibility.
11
+ *
12
+ * @param html HTML string to transform.
13
+ * @returns The transformed HTML string.
14
+ *
15
+ * @example
16
+ * import { sixHex } from '@maizzle/framework'
17
+ *
18
+ * const out = sixHex('<font color="#abc">x</font>')
19
+ */
20
+ function sixHex(html) {
21
+ return serialize(sixHexDom(parse(html)));
22
+ }
23
+ /**
24
+ * DOM-form of {@link sixHex} used by the internal transformer pipeline.
25
+ * Takes a parsed DOM, returns a parsed DOM — avoids redundant
26
+ * serialize/parse round-trips when chained with other transformers.
27
+ */
28
+ function sixHexDom(dom) {
29
+ walk(dom, (node) => {
30
+ const el = node;
31
+ if (!el.attribs) return;
32
+ for (const attr of targets) {
33
+ const value = el.attribs[attr];
34
+ if (value) el.attribs[attr] = conv(value);
35
+ }
36
+ });
37
+ return dom;
38
+ }
39
+ //#endregion
40
+ export { sixHex, sixHexDom };
41
+
42
+ //# sourceMappingURL=sixHex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sixHex.js","names":[],"sources":["../../src/transformers/sixHex.ts"],"sourcesContent":["import { conv } from 'color-shorthand-hex-to-six-digit'\nimport type { ChildNode, Element } from 'domhandler'\nimport { parse, serialize, walk } from '../utils/ast/index.ts'\n\nconst targets = new Set(['bgcolor', 'color'])\n\n/**\n * Convert 3-digit HEX color codes to 6-digit in `bgcolor` and `color`\n * attributes, for better email client compatibility.\n *\n * @param html HTML string to transform.\n * @returns The transformed HTML string.\n *\n * @example\n * import { sixHex } from '@maizzle/framework'\n *\n * const out = sixHex('<font color=\"#abc\">x</font>')\n */\nexport function sixHex(html: string): string {\n return serialize(sixHexDom(parse(html)))\n}\n\n/**\n * DOM-form of {@link sixHex} used by the internal transformer pipeline.\n * Takes a parsed DOM, returns a parsed DOM — avoids redundant\n * serialize/parse round-trips when chained with other transformers.\n */\nexport function sixHexDom(dom: ChildNode[]): ChildNode[] {\n walk(dom, (node) => {\n const el = node as Element\n\n if (!el.attribs) {\n return\n }\n\n for (const attr of targets) {\n const value = el.attribs[attr]\n\n if (value) {\n el.attribs[attr] = conv(value)\n }\n }\n })\n\n return dom\n}\n"],"mappings":";;;;;;AAIA,MAAM,UAAU,IAAI,IAAI,CAAC,WAAW,OAAO,CAAC;;;;;;;;;;;;;AAc5C,SAAgB,OAAO,MAAsB;CAC3C,OAAO,UAAU,UAAU,MAAM,IAAI,CAAC,CAAC;AACzC;;;;;;AAOA,SAAgB,UAAU,KAA+B;CACvD,KAAK,MAAM,SAAS;EAClB,MAAM,KAAK;EAEX,IAAI,CAAC,GAAG,SACN;EAGF,KAAK,MAAM,QAAQ,SAAS;GAC1B,MAAM,QAAQ,GAAG,QAAQ;GAEzB,IAAI,OACF,GAAG,QAAQ,QAAQ,KAAK,KAAK;EAEjC;CACF,CAAC;CAED,OAAO;AACT"}
@@ -0,0 +1,16 @@
1
+ import { MaizzleConfig } from "../types/config.js";
2
+ import { TailwindBlock } from "../composables/renderContext.js";
3
+ import { ChildNode } from "domhandler";
4
+
5
+ //#region src/transformers/tailwindComponent.d.ts
6
+ /**
7
+ * Compile Tailwind CSS for each top-level <Tailwind> block in the render
8
+ * context. Nested <Tailwind> instances are flattened: their classes flow
9
+ * up to the outermost block, their `#config` slot (if any) is ignored.
10
+ * One <style> per outermost block is appended to <head>; marker comments
11
+ * are stripped after.
12
+ */
13
+ declare function tailwindComponent(dom: ChildNode[], blocks: TailwindBlock[], config: MaizzleConfig, filePath?: string): Promise<ChildNode[]>;
14
+ //#endregion
15
+ export { tailwindComponent };
16
+ //# sourceMappingURL=tailwindComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwindComponent.d.ts","names":[],"sources":["../../src/transformers/tailwindComponent.ts"],"mappings":";;;;;;;AA0BA;;;;;iBAAsB,iBAAA,CACpB,GAAA,EAAK,SAAA,IACL,MAAA,EAAQ,aAAA,IACR,MAAA,EAAQ,aAAA,EACR,QAAA,YACC,OAAA,CAAQ,SAAA"}
@@ -0,0 +1,101 @@
1
+ import { walk } from "../utils/ast/walker.js";
2
+ import "../utils/ast/index.js";
3
+ import { compileTailwindCss } from "../utils/compileTailwindCss.js";
4
+ import { resolve } from "pathe";
5
+ //#region src/transformers/tailwindComponent.ts
6
+ const DEFAULT_SEED = "@import \"@maizzle/tailwindcss\" source(none);";
7
+ const OPEN_RE = /^mz-tw:(\S+)$/;
8
+ const CLOSE_RE = /^\/mz-tw:(\S+)$/;
9
+ /**
10
+ * Compile Tailwind CSS for each top-level <Tailwind> block in the render
11
+ * context. Nested <Tailwind> instances are flattened: their classes flow
12
+ * up to the outermost block, their `#config` slot (if any) is ignored.
13
+ * One <style> per outermost block is appended to <head>; marker comments
14
+ * are stripped after.
15
+ */
16
+ async function tailwindComponent(dom, blocks, config, filePath) {
17
+ if (!blocks.length) return dom;
18
+ const map = /* @__PURE__ */ new Map();
19
+ for (const b of blocks) map.set(b.id, {
20
+ id: b.id,
21
+ configCss: b.css,
22
+ nested: false,
23
+ classes: /* @__PURE__ */ new Set()
24
+ });
25
+ const stack = [];
26
+ const markers = [];
27
+ walk(dom, (node) => {
28
+ if (node.type === "comment") {
29
+ const data = node.data;
30
+ const open = data.match(OPEN_RE);
31
+ const close = data.match(CLOSE_RE);
32
+ if (open) {
33
+ const id = open[1];
34
+ const meta = map.get(id);
35
+ if (meta && stack.length > 0) meta.nested = true;
36
+ if (meta) stack.push(id);
37
+ markers.push(node);
38
+ } else if (close) {
39
+ const id = close[1];
40
+ if (stack[stack.length - 1] === id) stack.pop();
41
+ markers.push(node);
42
+ }
43
+ return;
44
+ }
45
+ const el = node;
46
+ /**
47
+ * Always assign to the OUTERMOST active marker (stack[0]) so nested
48
+ * <Tailwind> blocks merge their classes into the parent's scope.
49
+ */
50
+ if (el.attribs?.class && stack.length > 0) map.get(stack[0]).classes.add(el.attribs.class);
51
+ });
52
+ const fromPath = filePath ?? resolve(process.cwd(), "template.vue");
53
+ let head;
54
+ walk(dom, (n) => {
55
+ if (!head && n.name === "head") head = n;
56
+ });
57
+ if (!head) throw new Error("`Tailwind` component requires `Head` component to be present in the template.");
58
+ /**
59
+ * Compile + inject one <style raw> per outermost block. `raw` opts
60
+ * the existing tailwindcss transformer out of recompiling
61
+ * already-compiled CSS.
62
+ */
63
+ for (const meta of map.values()) {
64
+ if (meta.nested) continue;
65
+ const css = (await compileTailwindCss(buildCssInput(meta.configCss, meta.classes), config, `${fromPath}?tw=${meta.id}`)).trim();
66
+ if (!css) continue;
67
+ const styleNode = {
68
+ type: "tag",
69
+ name: "style",
70
+ attribs: { raw: "" },
71
+ children: [],
72
+ parent: head,
73
+ prev: null,
74
+ next: null
75
+ };
76
+ styleNode.children = [{
77
+ type: "text",
78
+ data: css,
79
+ parent: styleNode,
80
+ prev: null,
81
+ next: null
82
+ }];
83
+ head.children.push(styleNode);
84
+ }
85
+ for (const c of markers) {
86
+ const parent = c.parent;
87
+ if (!parent?.children) continue;
88
+ const i = parent.children.indexOf(c);
89
+ if (i >= 0) parent.children.splice(i, 1);
90
+ }
91
+ return dom;
92
+ }
93
+ function buildCssInput(configCss, classes) {
94
+ const seed = configCss ?? DEFAULT_SEED;
95
+ if (!classes.size) return seed;
96
+ return `${seed}\n@source inline("${[...classes].join(" ").replace(/"/g, "\\\"")}");`;
97
+ }
98
+ //#endregion
99
+ export { tailwindComponent };
100
+
101
+ //# sourceMappingURL=tailwindComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwindComponent.js","names":[],"sources":["../../src/transformers/tailwindComponent.ts"],"sourcesContent":["import { resolve } from 'pathe'\nimport type { ChildNode, Element, Comment } from 'domhandler'\nimport { walk } from '../utils/ast/index.ts'\nimport { compileTailwindCss } from '../utils/compileTailwindCss.ts'\nimport type { TailwindBlock } from '../composables/renderContext.ts'\nimport type { MaizzleConfig } from '../types/config.ts'\n\nconst DEFAULT_SEED = '@import \"@maizzle/tailwindcss\" source(none);'\n\ninterface BlockMeta {\n id: string\n configCss?: string\n nested: boolean\n classes: Set<string>\n}\n\nconst OPEN_RE = /^mz-tw:(\\S+)$/\nconst CLOSE_RE = /^\\/mz-tw:(\\S+)$/\n\n/**\n * Compile Tailwind CSS for each top-level <Tailwind> block in the render\n * context. Nested <Tailwind> instances are flattened: their classes flow\n * up to the outermost block, their `#config` slot (if any) is ignored.\n * One <style> per outermost block is appended to <head>; marker comments\n * are stripped after.\n */\nexport async function tailwindComponent(\n dom: ChildNode[],\n blocks: TailwindBlock[],\n config: MaizzleConfig,\n filePath?: string,\n): Promise<ChildNode[]> {\n if (!blocks.length) return dom\n\n const map = new Map<string, BlockMeta>()\n for (const b of blocks) {\n map.set(b.id, { id: b.id, configCss: b.css, nested: false, classes: new Set() })\n }\n\n const stack: string[] = []\n const markers: Comment[] = []\n\n walk(dom, (node) => {\n if (node.type === 'comment') {\n const data = (node as Comment).data\n const open = data.match(OPEN_RE)\n const close = data.match(CLOSE_RE)\n if (open) {\n const id = open[1]\n const meta = map.get(id)\n if (meta && stack.length > 0) meta.nested = true\n if (meta) stack.push(id)\n markers.push(node as Comment)\n } else if (close) {\n const id = close[1]\n if (stack[stack.length - 1] === id) stack.pop()\n markers.push(node as Comment)\n }\n return\n }\n\n const el = node as Element\n /**\n * Always assign to the OUTERMOST active marker (stack[0]) so nested\n * <Tailwind> blocks merge their classes into the parent's scope.\n */\n if (el.attribs?.class && stack.length > 0) {\n map.get(stack[0])!.classes.add(el.attribs.class)\n }\n })\n\n const fromPath = filePath ?? resolve(process.cwd(), 'template.vue')\n\n let head: Element | undefined\n walk(dom, (n) => {\n if (!head && (n as Element).name === 'head') head = n as Element\n })\n\n if (!head) {\n throw new Error('`Tailwind` component requires `Head` component to be present in the template.')\n }\n\n /**\n * Compile + inject one <style raw> per outermost block. `raw` opts\n * the existing tailwindcss transformer out of recompiling\n * already-compiled CSS.\n */\n for (const meta of map.values()) {\n if (meta.nested) continue\n\n const cssInput = buildCssInput(meta.configCss, meta.classes)\n const css = (await compileTailwindCss(cssInput, config, `${fromPath}?tw=${meta.id}`)).trim()\n if (!css) continue\n\n const styleNode: Element = {\n type: 'tag',\n name: 'style',\n attribs: { raw: '' },\n children: [],\n parent: head,\n prev: null,\n next: null,\n } as any\n\n const textNode = {\n type: 'text',\n data: css,\n parent: styleNode,\n prev: null,\n next: null,\n } as any\n\n styleNode.children = [textNode]\n head.children.push(styleNode)\n }\n\n // Strip marker comments from their parents\n for (const c of markers) {\n const parent = c.parent as Element | null\n if (!parent?.children) continue\n const i = parent.children.indexOf(c)\n if (i >= 0) parent.children.splice(i, 1)\n }\n\n return dom\n}\n\nfunction buildCssInput(configCss: string | undefined, classes: Set<string>): string {\n const seed = configCss ?? DEFAULT_SEED\n\n if (!classes.size) return seed\n\n const inline = [...classes].join(' ').replace(/\"/g, '\\\\\"')\n return `${seed}\\n@source inline(\"${inline}\");`\n}\n"],"mappings":";;;;;AAOA,MAAM,eAAe;AASrB,MAAM,UAAU;AAChB,MAAM,WAAW;;;;;;;;AASjB,eAAsB,kBACpB,KACA,QACA,QACA,UACsB;CACtB,IAAI,CAAC,OAAO,QAAQ,OAAO;CAE3B,MAAM,sBAAM,IAAI,IAAuB;CACvC,KAAK,MAAM,KAAK,QACd,IAAI,IAAI,EAAE,IAAI;EAAE,IAAI,EAAE;EAAI,WAAW,EAAE;EAAK,QAAQ;EAAO,yBAAS,IAAI,IAAI;CAAE,CAAC;CAGjF,MAAM,QAAkB,CAAC;CACzB,MAAM,UAAqB,CAAC;CAE5B,KAAK,MAAM,SAAS;EAClB,IAAI,KAAK,SAAS,WAAW;GAC3B,MAAM,OAAQ,KAAiB;GAC/B,MAAM,OAAO,KAAK,MAAM,OAAO;GAC/B,MAAM,QAAQ,KAAK,MAAM,QAAQ;GACjC,IAAI,MAAM;IACR,MAAM,KAAK,KAAK;IAChB,MAAM,OAAO,IAAI,IAAI,EAAE;IACvB,IAAI,QAAQ,MAAM,SAAS,GAAG,KAAK,SAAS;IAC5C,IAAI,MAAM,MAAM,KAAK,EAAE;IACvB,QAAQ,KAAK,IAAe;GAC9B,OAAO,IAAI,OAAO;IAChB,MAAM,KAAK,MAAM;IACjB,IAAI,MAAM,MAAM,SAAS,OAAO,IAAI,MAAM,IAAI;IAC9C,QAAQ,KAAK,IAAe;GAC9B;GACA;EACF;EAEA,MAAM,KAAK;;;;;EAKX,IAAI,GAAG,SAAS,SAAS,MAAM,SAAS,GACtC,IAAI,IAAI,MAAM,EAAE,CAAC,CAAE,QAAQ,IAAI,GAAG,QAAQ,KAAK;CAEnD,CAAC;CAED,MAAM,WAAW,YAAY,QAAQ,QAAQ,IAAI,GAAG,cAAc;CAElE,IAAI;CACJ,KAAK,MAAM,MAAM;EACf,IAAI,CAAC,QAAS,EAAc,SAAS,QAAQ,OAAO;CACtD,CAAC;CAED,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,+EAA+E;;;;;;CAQjG,KAAK,MAAM,QAAQ,IAAI,OAAO,GAAG;EAC/B,IAAI,KAAK,QAAQ;EAGjB,MAAM,OAAO,MAAM,mBADF,cAAc,KAAK,WAAW,KAAK,OACP,GAAG,QAAQ,GAAG,SAAS,MAAM,KAAK,IAAI,EAAA,CAAG,KAAK;EAC3F,IAAI,CAAC,KAAK;EAEV,MAAM,YAAqB;GACzB,MAAM;GACN,MAAM;GACN,SAAS,EAAE,KAAK,GAAG;GACnB,UAAU,CAAC;GACX,QAAQ;GACR,MAAM;GACN,MAAM;EACR;EAUA,UAAU,WAAW,CAAC;GAPpB,MAAM;GACN,MAAM;GACN,QAAQ;GACR,MAAM;GACN,MAAM;EAGqB,CAAC;EAC9B,KAAK,SAAS,KAAK,SAAS;CAC9B;CAGA,KAAK,MAAM,KAAK,SAAS;EACvB,MAAM,SAAS,EAAE;EACjB,IAAI,CAAC,QAAQ,UAAU;EACvB,MAAM,IAAI,OAAO,SAAS,QAAQ,CAAC;EACnC,IAAI,KAAK,GAAG,OAAO,SAAS,OAAO,GAAG,CAAC;CACzC;CAEA,OAAO;AACT;AAEA,SAAS,cAAc,WAA+B,SAA8B;CAClF,MAAM,OAAO,aAAa;CAE1B,IAAI,CAAC,QAAQ,MAAM,OAAO;CAG1B,OAAO,GAAG,KAAK,oBADA,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,MAAM,MACZ,EAAE;AAC5C"}
@@ -1,4 +1,4 @@
1
- import { MaizzleConfig } from "../types/config.mjs";
1
+ import { MaizzleConfig } from "../types/config.js";
2
2
  import { ChildNode } from "domhandler";
3
3
 
4
4
  //#region src/transformers/tailwindcss.d.ts
@@ -21,4 +21,4 @@ import { ChildNode } from "domhandler";
21
21
  declare function tailwindcss(dom: ChildNode[], config: MaizzleConfig, filePath?: string): Promise<ChildNode[]>;
22
22
  //#endregion
23
23
  export { tailwindcss };
24
- //# sourceMappingURL=tailwindcss.d.mts.map
24
+ //# sourceMappingURL=tailwindcss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwindcss.d.ts","names":[],"sources":["../../src/transformers/tailwindcss.ts"],"mappings":";;;;;;AA6EA;;;;;;;;;;;;;;iBAAsB,WAAA,CAAY,GAAA,EAAK,SAAA,IAAa,MAAA,EAAQ,aAAA,EAAe,QAAA,YAAoB,OAAA,CAAQ,SAAA"}
@@ -1,39 +1,9 @@
1
- import { walk } from "../utils/ast/walker.mjs";
2
- import "../utils/ast/index.mjs";
3
- import pruneVars_default from "../plugins/postcss/pruneVars.mjs";
4
- import { tailwindCleanup } from "../plugins/postcss/tailwindCleanup.mjs";
5
- import { mergeMediaQueries } from "../plugins/postcss/mergeMediaQueries.mjs";
6
- import { dirname, relative, resolve } from "node:path";
7
- import postcss from "postcss";
8
- import tailwindcssPostcss from "@tailwindcss/postcss";
9
- import customProperties from "postcss-custom-properties";
10
- import postcssCalc from "postcss-calc";
11
- import safeParser from "postcss-safe-parser";
12
- import { transform } from "lightningcss";
13
-
1
+ import { walk } from "../utils/ast/walker.js";
2
+ import "../utils/ast/index.js";
3
+ import { compileTailwindCss } from "../utils/compileTailwindCss.js";
4
+ import { decodeStyleEntities } from "../utils/decodeStyleEntities.js";
5
+ import { dirname, relative, resolve } from "pathe";
14
6
  //#region src/transformers/tailwindcss.ts
15
- function createProcessor(config) {
16
- return postcss([
17
- tailwindcssPostcss({
18
- base: config.css?.base,
19
- transformAssetUrls: false,
20
- optimize: false
21
- }),
22
- customProperties({ preserve: false }),
23
- postcssCalc({}),
24
- pruneVars_default()
25
- ]);
26
- }
27
- /**
28
- * Decode HTML entities that Vue SSR encodes inside <style> tags.
29
- *
30
- * Vue's renderToString HTML-encodes quotes and other characters
31
- * inside <style> tags within templates, breaking CSS like
32
- * `@import "@maizzle/tailwindcss"` → `@import &quot;...&quot;`
33
- */
34
- function decodeEntities(str) {
35
- return str.replace(/&quot;/g, "\"").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&#39;/g, "'").replace(/&apos;/g, "'");
36
- }
37
7
  /**
38
8
  * Check if CSS content uses Tailwind features that require source scanning.
39
9
  *
@@ -42,34 +12,7 @@ function decodeEntities(str) {
42
12
  * and would pass through @source directives unconsumed.
43
13
  */
44
14
  function usesTailwind(css) {
45
- return /(@import\s+["'](tailwindcss|@maizzle\/tailwindcss)|@tailwind\s)/.test(css);
46
- }
47
- /**
48
- * Lower modern CSS syntax using lightningcss.
49
- *
50
- * Targets IE 1 to maximize syntax lowering — converts modern features
51
- * like nesting, oklch(), color-mix(), @property, etc. into simple CSS
52
- * that email clients can understand.
53
- */
54
- function lowerSyntax(css) {
55
- return transform({
56
- filename: "email.css",
57
- code: Buffer.from(css),
58
- minify: false,
59
- targets: { ie: 128 }
60
- }).code.toString();
61
- }
62
- /**
63
- * Run cleanup and media query merging on the compiled CSS.
64
- *
65
- * Removes unwanted selectors (:host, :lang) and at-rules (@layer, @property),
66
- * then sorts and merges media queries.
67
- */
68
- async function optimizeCss(css, config) {
69
- const plugins = [...tailwindCleanup(config)];
70
- const mediaPlugin = mergeMediaQueries(config);
71
- if (mediaPlugin) plugins.push(mediaPlugin);
72
- return (await postcss(plugins).process(css, { from: void 0 })).css;
15
+ return /((@import|@reference)\s+["'](tailwindcss|@maizzle\/tailwindcss)|@tailwind\s)/.test(css);
73
16
  }
74
17
  /**
75
18
  * Build @source directives for Tailwind CSS scanning.
@@ -85,6 +28,13 @@ function buildSourceDirectives(dom, config, fromDir) {
85
28
  const directives = [];
86
29
  const excludePaths = [resolve(config.output?.path ?? "dist"), ...(config.css?.exclude ?? []).map((p) => resolve(p))];
87
30
  for (const p of excludePaths) directives.push(`@source not "${relative(fromDir, resolve(p))}";`);
31
+ /**
32
+ * Inline source: collect all class attribute values from the rendered DOM.
33
+ * After Vue SSR, the DOM contains every class from every component
34
+ * (built-in framework components, user components, dynamic
35
+ * bindings). We pass these raw values to Tailwind's
36
+ * scanner via @source inline().
37
+ */
88
38
  const classes = [];
89
39
  walk(dom, (n) => {
90
40
  const cls = n.attribs?.class;
@@ -114,37 +64,46 @@ async function tailwindcss(dom, config, filePath) {
114
64
  walk(dom, (node) => {
115
65
  if (node.name !== "style") return;
116
66
  const el = node;
117
- const attrs = el.attribs || {};
118
- if ("raw" in attrs) {
67
+ /**
68
+ * `raw` opts out of compilation entirely (marker is consumed here).
69
+ * `embed`/`data-embed` only signal "preserve tag after inlining"
70
+ * — they still need to go through compile so Tailwind/@apply
71
+ * resolves.
72
+ */
73
+ if ("raw" in el.attribs) {
119
74
  delete el.attribs.raw;
120
75
  return;
121
76
  }
122
- if ("embed" in attrs || "data-embed" in attrs) return;
123
77
  const rawContent = el.children.filter((child) => child.type === "text").map((child) => child.data).join("");
124
78
  if (!rawContent.trim()) return;
125
79
  styleTags.push({
126
80
  node: el,
127
- cssContent: decodeEntities(rawContent)
81
+ cssContent: decodeStyleEntities(rawContent)
128
82
  });
129
83
  });
130
84
  if (!styleTags.length) return dom;
131
85
  const fromPath = filePath ?? resolve(process.cwd(), "template.vue");
132
86
  const fromDir = dirname(fromPath);
133
87
  const sourceDirectives = styleTags.some(({ cssContent }) => usesTailwind(cssContent)) ? buildSourceDirectives(dom, config, fromDir) : "";
134
- const processor = createProcessor(config);
135
88
  for (let i = 0; i < styleTags.length; i++) {
136
89
  const { node, cssContent } = styleTags[i];
90
+ /**
91
+ * Only add source directives to style tags that import Tailwind —
92
+ * plain CSS doesn't need them and @tailwindcss/postcss would
93
+ * leave the directives unconsumed in the output.
94
+ */
137
95
  const fullCss = usesTailwind(cssContent) ? `${cssContent}\n${sourceDirectives}` : cssContent;
138
96
  try {
139
97
  node.children = [{
140
98
  type: "text",
141
- data: await optimizeCss(lowerSyntax((await processor.process(fullCss, {
142
- from: `${fromPath}?style=${i}`,
143
- parser: safeParser
144
- })).css), config),
99
+ data: await compileTailwindCss(fullCss, config, `${fromPath}?style=${i}`),
145
100
  parent: node
146
101
  }];
147
102
  } catch {
103
+ /**
104
+ * If CSS processing fails, still replace with decoded content
105
+ * so HTML entities don't break the CSS.
106
+ */
148
107
  node.children = [{
149
108
  type: "text",
150
109
  data: cssContent,
@@ -154,7 +113,7 @@ async function tailwindcss(dom, config, filePath) {
154
113
  }
155
114
  return dom;
156
115
  }
157
-
158
116
  //#endregion
159
117
  export { tailwindcss };
160
- //# sourceMappingURL=tailwindcss.mjs.map
118
+
119
+ //# sourceMappingURL=tailwindcss.js.map