@maizzle/framework 6.0.0-rc.8 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/maizzle.mjs +1 -1
- package/dist/build.d.ts +38 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +234 -0
- package/dist/build.js.map +1 -0
- package/dist/components/Body.vue +32 -3
- package/dist/components/Button.vue +91 -62
- package/dist/components/CodeBlock.vue +6 -4
- package/dist/components/CodeInline.vue +77 -6
- package/dist/components/Column.vue +67 -31
- package/dist/components/Container.vue +73 -12
- package/dist/components/Font.vue +96 -0
- package/dist/components/Head.vue +1 -1
- package/dist/components/Heading.vue +1 -1
- package/dist/components/Hr.vue +33 -0
- package/dist/components/Html.vue +36 -3
- package/dist/components/Img.vue +332 -0
- package/dist/components/Layout.vue +71 -21
- package/dist/components/Link.vue +1 -1
- package/dist/components/Markdown.vue +56 -23
- package/dist/components/MarkdownLayout.vue +39 -0
- package/dist/components/NotPlaintext.vue +14 -0
- package/dist/components/Outlook.vue +38 -11
- package/dist/components/OutlookBg.vue +241 -0
- package/dist/components/Plaintext.vue +14 -0
- package/dist/components/Preheader.vue +35 -10
- package/dist/components/QrCode.vue +157 -0
- package/dist/components/Raw.vue +28 -0
- package/dist/components/Row.vue +115 -22
- package/dist/components/Section.vue +65 -26
- package/dist/components/Spacer.vue +35 -29
- package/dist/components/Tailwind.vue +45 -0
- package/dist/components/Text.vue +3 -3
- package/dist/components/Vml.vue +207 -94
- package/dist/components/utils.d.ts +53 -0
- package/dist/components/utils.d.ts.map +1 -0
- package/dist/components/utils.js +80 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/components/utils.ts +102 -0
- package/dist/composables/defineConfig.d.ts +13 -0
- package/dist/composables/defineConfig.d.ts.map +1 -0
- package/dist/composables/{defineConfig.mjs → defineConfig.js} +7 -9
- package/dist/composables/defineConfig.js.map +1 -0
- package/dist/composables/renderContext.d.ts +37 -0
- package/dist/composables/renderContext.d.ts.map +1 -0
- package/dist/composables/renderContext.js +6 -0
- package/dist/composables/renderContext.js.map +1 -0
- package/dist/composables/useBaseUrl.d.ts +19 -0
- package/dist/composables/useBaseUrl.d.ts.map +1 -0
- package/dist/composables/useBaseUrl.js +26 -0
- package/dist/composables/useBaseUrl.js.map +1 -0
- package/dist/composables/useConfig.d.ts +16 -0
- package/dist/composables/useConfig.d.ts.map +1 -0
- package/dist/composables/useConfig.js +19 -0
- package/dist/composables/useConfig.js.map +1 -0
- package/dist/composables/useCurrentTemplate.d.ts +31 -0
- package/dist/composables/useCurrentTemplate.d.ts.map +1 -0
- package/dist/composables/useCurrentTemplate.js +42 -0
- package/dist/composables/useCurrentTemplate.js.map +1 -0
- package/dist/composables/{useDoctype.d.mts → useDoctype.d.ts} +1 -1
- package/dist/composables/useDoctype.d.ts.map +1 -0
- package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
- package/dist/composables/useDoctype.js.map +1 -0
- package/dist/composables/{useEvent.d.mts → useEvent.d.ts} +3 -3
- package/dist/composables/useEvent.d.ts.map +1 -0
- package/dist/composables/{useEvent.mjs → useEvent.js} +4 -5
- package/dist/composables/useEvent.js.map +1 -0
- package/dist/composables/useFont.d.ts +50 -0
- package/dist/composables/useFont.d.ts.map +1 -0
- package/dist/composables/useFont.js +92 -0
- package/dist/composables/useFont.js.map +1 -0
- package/dist/composables/useOutlookFallback.d.ts +21 -0
- package/dist/composables/useOutlookFallback.d.ts.map +1 -0
- package/dist/composables/useOutlookFallback.js +29 -0
- package/dist/composables/useOutlookFallback.js.map +1 -0
- package/dist/composables/useOutputPath.d.ts +17 -0
- package/dist/composables/useOutputPath.d.ts.map +1 -0
- package/dist/composables/useOutputPath.js +23 -0
- package/dist/composables/useOutputPath.js.map +1 -0
- package/dist/composables/{usePlaintext.d.mts → usePlaintext.d.ts} +3 -1
- package/dist/composables/usePlaintext.d.ts.map +1 -0
- package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
- package/dist/composables/usePlaintext.js.map +1 -0
- package/dist/composables/usePreheader.d.ts +25 -0
- package/dist/composables/usePreheader.d.ts.map +1 -0
- package/dist/composables/usePreheader.js +28 -0
- package/dist/composables/usePreheader.js.map +1 -0
- package/dist/composables/useTransformers.d.ts +34 -0
- package/dist/composables/useTransformers.d.ts.map +1 -0
- package/dist/composables/useTransformers.js +48 -0
- package/dist/composables/useTransformers.js.map +1 -0
- package/dist/composables/useUrlQuery.d.ts +19 -0
- package/dist/composables/useUrlQuery.d.ts.map +1 -0
- package/dist/composables/useUrlQuery.js +26 -0
- package/dist/composables/useUrlQuery.js.map +1 -0
- package/dist/config/{defaults.d.mts → defaults.d.ts} +2 -2
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/{defaults.mjs → defaults.js} +10 -6
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +24 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/{index.mjs → index.js} +45 -14
- package/dist/config/index.js.map +1 -0
- package/dist/events/{index.d.mts → index.d.ts} +35 -12
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/{index.mjs → index.js} +31 -13
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +40 -0
- package/dist/{plaintext.d.mts → plaintext.d.ts} +1 -1
- package/dist/plaintext.d.ts.map +1 -0
- package/dist/{plaintext.mjs → plaintext.js} +4 -5
- package/dist/plaintext.js.map +1 -0
- package/dist/{plugin.d.mts → plugin.d.ts} +2 -2
- package/dist/plugin.d.ts.map +1 -0
- package/dist/{plugin.mjs → plugin.js} +16 -13
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.d.mts → mergeMediaQueries.d.ts} +2 -2
- package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +2 -3
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
- package/dist/plugins/postcss/{pruneVars.d.mts → pruneVars.d.ts} +1 -1
- package/dist/plugins/postcss/pruneVars.d.ts.map +1 -0
- package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +2 -2
- package/dist/plugins/postcss/pruneVars.js.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts +13 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.js +84 -0
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.d.mts → removeDeclarations.d.ts} +1 -1
- package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +2 -2
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts +16 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js +39 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
- package/dist/plugins/postcss/resolveProps.d.ts +8 -0
- package/dist/plugins/postcss/resolveProps.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveProps.js +155 -0
- package/dist/plugins/postcss/resolveProps.js.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.d.mts → tailwindCleanup.d.ts} +2 -2
- package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.mjs → tailwindCleanup.js} +29 -5
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
- package/dist/prepare.d.ts +17 -0
- package/dist/prepare.d.ts.map +1 -0
- package/dist/prepare.js +44 -0
- package/dist/prepare.js.map +1 -0
- package/dist/render/active.d.ts +8 -0
- package/dist/render/active.d.ts.map +1 -0
- package/dist/render/active.js +12 -0
- package/dist/render/active.js.map +1 -0
- package/dist/render/buildTemplate.d.ts +49 -0
- package/dist/render/buildTemplate.d.ts.map +1 -0
- package/dist/render/buildTemplate.js +141 -0
- package/dist/render/buildTemplate.js.map +1 -0
- package/dist/render/{createRenderer.d.mts → createRenderer.d.ts} +17 -6
- package/dist/render/createRenderer.d.ts.map +1 -0
- package/dist/render/createRenderer.js +468 -0
- package/dist/render/createRenderer.js.map +1 -0
- package/dist/render/index.d.ts +18 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +59 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/injectFonts.d.ts +15 -0
- package/dist/render/injectFonts.d.ts.map +1 -0
- package/dist/render/injectFonts.js +45 -0
- package/dist/render/injectFonts.js.map +1 -0
- package/dist/render/parallel/buildWorker.d.ts +31 -0
- package/dist/render/parallel/buildWorker.d.ts.map +1 -0
- package/dist/render/parallel/buildWorker.js +66 -0
- package/dist/render/parallel/buildWorker.js.map +1 -0
- package/dist/render/parallel/worker.mjs +28 -0
- package/dist/render/plugins/codeBlockExtract.d.ts +14 -0
- package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -0
- package/dist/render/plugins/codeBlockExtract.js +38 -0
- package/dist/render/plugins/codeBlockExtract.js.map +1 -0
- package/dist/render/plugins/markdownExtract.d.ts +12 -0
- package/dist/render/plugins/markdownExtract.d.ts.map +1 -0
- package/dist/render/plugins/markdownExtract.js +49 -0
- package/dist/render/plugins/markdownExtract.js.map +1 -0
- package/dist/render/plugins/rawExtract.d.ts +14 -0
- package/dist/render/plugins/rawExtract.d.ts.map +1 -0
- package/dist/render/plugins/rawExtract.js +34 -0
- package/dist/render/plugins/rawExtract.js.map +1 -0
- package/dist/render/plugins/rowSourceLocation.d.ts +18 -0
- package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -0
- package/dist/render/plugins/rowSourceLocation.js +45 -0
- package/dist/render/plugins/rowSourceLocation.js.map +1 -0
- package/dist/{serve.d.mts → serve.d.ts} +5 -3
- package/dist/serve.d.ts.map +1 -0
- package/dist/{serve.mjs → serve.js} +207 -106
- package/dist/serve.js.map +1 -0
- package/dist/server/compatibility.d.ts +59 -0
- package/dist/server/compatibility.d.ts.map +1 -0
- package/dist/server/compatibility.js +959 -0
- package/dist/server/compatibility.js.map +1 -0
- package/dist/server/{email.d.mts → email.d.ts} +2 -2
- package/dist/server/email.d.ts.map +1 -0
- package/dist/server/{email.mjs → email.js} +2 -3
- package/dist/server/email.js.map +1 -0
- package/dist/server/linter.d.ts +20 -0
- package/dist/server/linter.d.ts.map +1 -0
- package/dist/server/linter.js +345 -0
- package/dist/server/linter.js.map +1 -0
- package/dist/server/sfc-utils.d.ts +21 -0
- package/dist/server/sfc-utils.d.ts.map +1 -0
- package/dist/server/sfc-utils.js +198 -0
- package/dist/server/sfc-utils.js.map +1 -0
- package/dist/server/ui/.vite/deps/@lucide_vue.js +44967 -0
- package/dist/server/ui/.vite/deps/@lucide_vue.js.map +1 -0
- package/dist/server/ui/.vite/deps/@vueuse_core.js +8155 -0
- package/dist/server/ui/.vite/deps/@vueuse_core.js.map +1 -0
- package/dist/server/ui/.vite/deps/@vueuse_shared.js +1859 -0
- package/dist/server/ui/.vite/deps/@vueuse_shared.js.map +1 -0
- package/dist/server/ui/.vite/deps/_metadata.json +78 -0
- package/dist/server/ui/.vite/deps/chunk-EAsCxrDo.js +14 -0
- package/dist/server/ui/.vite/deps/class-variance-authority.js +57 -0
- package/dist/server/ui/.vite/deps/class-variance-authority.js.map +1 -0
- package/dist/server/ui/.vite/deps/clsx.js +18 -0
- package/dist/server/ui/.vite/deps/clsx.js.map +1 -0
- package/dist/server/ui/.vite/deps/culori.js +4312 -0
- package/dist/server/ui/.vite/deps/culori.js.map +1 -0
- package/dist/server/ui/.vite/deps/package.json +3 -0
- package/dist/server/ui/.vite/deps/reka-ui.js +44464 -0
- package/dist/server/ui/.vite/deps/reka-ui.js.map +1 -0
- package/dist/server/ui/.vite/deps/tailwind-merge.js +3458 -0
- package/dist/server/ui/.vite/deps/tailwind-merge.js.map +1 -0
- package/dist/server/ui/.vite/deps/vue-router.js +6383 -0
- package/dist/server/ui/.vite/deps/vue-router.js.map +1 -0
- package/dist/server/ui/.vite/deps/vue.js +2 -0
- package/dist/server/ui/.vite/deps/vue.runtime.esm-bundler-DaqjATE_.js +8785 -0
- package/dist/server/ui/.vite/deps/vue.runtime.esm-bundler-DaqjATE_.js.map +1 -0
- package/dist/server/ui/App.vue +106 -66
- package/dist/server/ui/components/SidebarClose.vue +12 -0
- package/dist/server/ui/components/ui/checkbox/Checkbox.vue +1 -1
- package/dist/server/ui/components/ui/command/Command.vue +5 -1
- package/dist/server/ui/components/ui/command/CommandInput.vue +2 -2
- package/dist/server/ui/components/ui/dialog/DialogContent.vue +1 -1
- package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +1 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/dist/server/ui/components/ui/input/Input.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +2 -2
- package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +1 -1
- package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +1 -1
- package/dist/server/ui/lib/emulated-dark-mode.ts +146 -0
- package/dist/server/ui/main.css +25 -0
- package/dist/server/ui/pages/Home.vue +1 -1
- package/dist/server/ui/pages/Preview.vue +377 -186
- package/dist/server/ui/vite-env.d.ts +1 -0
- package/dist/tests/render/_helpers.d.ts +6 -0
- package/dist/tests/render/_helpers.d.ts.map +1 -0
- package/dist/tests/render/_helpers.js +16 -0
- package/dist/tests/render/_helpers.js.map +1 -0
- package/dist/transformers/addAttributes.d.ts +42 -0
- package/dist/transformers/addAttributes.d.ts.map +1 -0
- package/dist/transformers/{addAttributes.mjs → addAttributes.js} +40 -24
- package/dist/transformers/addAttributes.js.map +1 -0
- package/dist/transformers/attributeToStyle.d.ts +38 -0
- package/dist/transformers/attributeToStyle.d.ts.map +1 -0
- package/dist/transformers/attributeToStyle.js +94 -0
- package/dist/transformers/attributeToStyle.js.map +1 -0
- package/dist/transformers/base.d.ts +71 -0
- package/dist/transformers/base.d.ts.map +1 -0
- package/dist/transformers/{base.mjs → base.js} +65 -40
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/columnWidth.d.ts +31 -0
- package/dist/transformers/columnWidth.d.ts.map +1 -0
- package/dist/transformers/columnWidth.js +527 -0
- package/dist/transformers/columnWidth.js.map +1 -0
- package/dist/transformers/entities.d.ts +37 -0
- package/dist/transformers/entities.d.ts.map +1 -0
- package/dist/transformers/entities.js +74 -0
- package/dist/transformers/entities.js.map +1 -0
- package/dist/transformers/filters/{defaults.d.mts → defaults.d.ts} +1 -1
- package/dist/transformers/filters/defaults.d.ts.map +1 -0
- package/dist/transformers/filters/{defaults.mjs → defaults.js} +2 -2
- package/dist/transformers/filters/defaults.js.map +1 -0
- package/dist/transformers/filters/index.d.ts +43 -0
- package/dist/transformers/filters/index.d.ts.map +1 -0
- package/dist/transformers/filters/index.js +89 -0
- package/dist/transformers/filters/index.js.map +1 -0
- package/dist/transformers/format.d.ts +22 -0
- package/dist/transformers/format.d.ts.map +1 -0
- package/dist/transformers/format.js +30 -0
- package/dist/transformers/format.js.map +1 -0
- package/dist/transformers/imgWidth.d.ts +20 -0
- package/dist/transformers/imgWidth.d.ts.map +1 -0
- package/dist/transformers/imgWidth.js +76 -0
- package/dist/transformers/imgWidth.js.map +1 -0
- package/dist/transformers/{index.d.mts → index.d.ts} +14 -12
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +163 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/inlineCss.d.ts +85 -0
- package/dist/transformers/inlineCss.d.ts.map +1 -0
- package/dist/transformers/inlineCss.js +112 -0
- package/dist/transformers/inlineCss.js.map +1 -0
- package/dist/transformers/inlineLink.d.ts +35 -0
- package/dist/transformers/inlineLink.d.ts.map +1 -0
- package/dist/transformers/{inlineLink.mjs → inlineLink.js} +35 -11
- package/dist/transformers/inlineLink.js.map +1 -0
- package/dist/transformers/minify.d.ts +21 -0
- package/dist/transformers/minify.d.ts.map +1 -0
- package/dist/transformers/minify.js +25 -0
- package/dist/transformers/minify.js.map +1 -0
- package/dist/transformers/minifyCodeInline.d.ts +29 -0
- package/dist/transformers/minifyCodeInline.d.ts.map +1 -0
- package/dist/transformers/minifyCodeInline.js +36 -0
- package/dist/transformers/minifyCodeInline.js.map +1 -0
- package/dist/transformers/msoPlaceholders.d.ts +33 -0
- package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
- package/dist/transformers/msoPlaceholders.js +114 -0
- package/dist/transformers/msoPlaceholders.js.map +1 -0
- package/dist/transformers/purgeCss.d.ts +43 -0
- package/dist/transformers/purgeCss.d.ts.map +1 -0
- package/dist/transformers/purgeCss.js +207 -0
- package/dist/transformers/purgeCss.js.map +1 -0
- package/dist/transformers/removeAttributes.d.ts +54 -0
- package/dist/transformers/removeAttributes.d.ts.map +1 -0
- package/dist/transformers/removeAttributes.js +72 -0
- package/dist/transformers/removeAttributes.js.map +1 -0
- package/dist/transformers/{replaceStrings.d.mts → replaceStrings.d.ts} +2 -2
- package/dist/transformers/replaceStrings.d.ts.map +1 -0
- package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
- package/dist/transformers/replaceStrings.js.map +1 -0
- package/dist/transformers/safeSelectors.d.ts +37 -0
- package/dist/transformers/safeSelectors.d.ts.map +1 -0
- package/dist/transformers/{safeClassNames.mjs → safeSelectors.js} +40 -10
- package/dist/transformers/safeSelectors.js.map +1 -0
- package/dist/transformers/shorthandCss.d.ts +47 -0
- package/dist/transformers/shorthandCss.d.ts.map +1 -0
- package/dist/transformers/shorthandCss.js +92 -0
- package/dist/transformers/shorthandCss.js.map +1 -0
- package/dist/transformers/sixHex.d.ts +25 -0
- package/dist/transformers/sixHex.d.ts.map +1 -0
- package/dist/transformers/sixHex.js +42 -0
- package/dist/transformers/sixHex.js.map +1 -0
- package/dist/transformers/tailwindComponent.d.ts +16 -0
- package/dist/transformers/tailwindComponent.d.ts.map +1 -0
- package/dist/transformers/tailwindComponent.js +101 -0
- package/dist/transformers/tailwindComponent.js.map +1 -0
- package/dist/transformers/{tailwindcss.d.mts → tailwindcss.d.ts} +2 -2
- package/dist/transformers/tailwindcss.d.ts.map +1 -0
- package/dist/transformers/{tailwindcss.mjs → tailwindcss.js} +33 -74
- package/dist/transformers/tailwindcss.js.map +1 -0
- package/dist/transformers/urlQuery.d.ts +36 -0
- package/dist/transformers/urlQuery.d.ts.map +1 -0
- package/dist/transformers/urlQuery.js +77 -0
- package/dist/transformers/urlQuery.js.map +1 -0
- package/dist/types/{config.d.mts → config.d.ts} +270 -40
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/ast/index.d.ts +4 -0
- package/dist/utils/ast/index.js +4 -0
- package/dist/utils/ast/{parser.d.mts → parser.d.ts} +1 -1
- package/dist/utils/ast/parser.d.ts.map +1 -0
- package/dist/utils/ast/{parser.mjs → parser.js} +2 -3
- package/dist/utils/ast/parser.js.map +1 -0
- package/dist/utils/ast/{serializer.d.mts → serializer.d.ts} +1 -1
- package/dist/utils/ast/serializer.d.ts.map +1 -0
- package/dist/utils/ast/serializer.js +46 -0
- package/dist/utils/ast/serializer.js.map +1 -0
- package/dist/utils/ast/{walker.d.mts → walker.d.ts} +1 -1
- package/dist/utils/ast/walker.d.ts.map +1 -0
- package/dist/utils/ast/{walker.mjs → walker.js} +2 -2
- package/dist/utils/ast/walker.js.map +1 -0
- package/dist/utils/cloneConfig.d.ts +13 -0
- package/dist/utils/cloneConfig.d.ts.map +1 -0
- package/dist/utils/cloneConfig.js +21 -0
- package/dist/utils/cloneConfig.js.map +1 -0
- package/dist/utils/compileTailwindCss.d.ts +16 -0
- package/dist/utils/compileTailwindCss.d.ts.map +1 -0
- package/dist/utils/compileTailwindCss.js +55 -0
- package/dist/utils/compileTailwindCss.js.map +1 -0
- package/dist/utils/componentSources.d.ts +50 -0
- package/dist/utils/componentSources.d.ts.map +1 -0
- package/dist/utils/componentSources.js +50 -0
- package/dist/utils/componentSources.js.map +1 -0
- package/dist/utils/cssBox.d.ts +42 -0
- package/dist/utils/cssBox.d.ts.map +1 -0
- package/dist/utils/cssBox.js +151 -0
- package/dist/utils/cssBox.js.map +1 -0
- package/dist/utils/decodeStyleEntities.d.ts +15 -0
- package/dist/utils/decodeStyleEntities.d.ts.map +1 -0
- package/dist/utils/decodeStyleEntities.js +18 -0
- package/dist/utils/decodeStyleEntities.js.map +1 -0
- package/dist/utils/{detect.d.mts → detect.d.ts} +1 -1
- package/dist/utils/detect.d.ts.map +1 -0
- package/dist/utils/{detect.mjs → detect.js} +2 -3
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/output-markers.d.ts +29 -0
- package/dist/utils/output-markers.d.ts.map +1 -0
- package/dist/utils/output-markers.js +68 -0
- package/dist/utils/output-markers.js.map +1 -0
- package/dist/utils/{url.d.mts → url.d.ts} +1 -1
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/{url.mjs → url.js} +2 -3
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/watchPaths.d.ts +11 -0
- package/dist/utils/watchPaths.d.ts.map +1 -0
- package/dist/utils/watchPaths.js +19 -0
- package/dist/utils/watchPaths.js.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +44 -0
- package/node_modules/@clack/core/dist/index.d.mts +125 -5
- package/node_modules/@clack/core/dist/index.mjs +972 -11
- package/node_modules/@clack/core/package.json +6 -2
- package/node_modules/@clack/prompts/CHANGELOG.md +70 -0
- package/node_modules/@clack/prompts/README.md +129 -3
- package/node_modules/@clack/prompts/dist/index.d.mts +567 -33
- package/node_modules/@clack/prompts/dist/index.mjs +1378 -133
- package/node_modules/@clack/prompts/package.json +7 -4
- package/node_modules/fast-string-truncated-width/dist/index.js +36 -96
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +0 -3
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +3 -3
- package/node_modules/fast-string-truncated-width/dist/utils.js +14 -9
- package/node_modules/fast-string-truncated-width/package.json +1 -1
- package/node_modules/fast-string-truncated-width/readme.md +2 -3
- package/node_modules/fast-string-width/package.json +2 -2
- package/node_modules/fast-string-width/readme.md +0 -3
- package/node_modules/fast-wrap-ansi/lib/main.js +4 -2
- package/node_modules/fast-wrap-ansi/package.json +11 -11
- package/node_modules/maizzle/README.md +24 -0
- package/node_modules/maizzle/dist/commands/make/component.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/config.mjs +8 -7
- package/node_modules/maizzle/dist/commands/make/layout.mjs +3 -3
- package/node_modules/maizzle/dist/commands/make/scaffold.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/stubs/Layout.vue +146 -0
- package/node_modules/maizzle/dist/commands/make/stubs/component.vue +2 -4
- package/node_modules/maizzle/dist/commands/make/stubs/config.ts +1 -5
- package/node_modules/maizzle/dist/commands/make/template.mjs +1 -1
- package/node_modules/maizzle/dist/commands/new.mjs +46 -135
- package/node_modules/maizzle/dist/index.d.mts +1 -0
- package/node_modules/maizzle/dist/index.mjs +30 -7
- package/node_modules/maizzle/package.json +5 -4
- package/node_modules/nypm/dist/cli.mjs +28 -5
- package/node_modules/nypm/dist/index.d.mts +0 -8
- package/node_modules/nypm/dist/index.mjs +27 -4
- package/node_modules/nypm/package.json +12 -12
- package/node_modules/tinyexec/README.md +9 -1
- package/node_modules/tinyexec/dist/main.d.mts +22 -7
- package/node_modules/tinyexec/dist/main.mjs +189 -491
- package/node_modules/tinyexec/package.json +14 -16
- package/package.json +38 -30
- package/dist/build.d.mts +0 -19
- package/dist/build.d.mts.map +0 -1
- package/dist/build.mjs +0 -140
- package/dist/build.mjs.map +0 -1
- package/dist/components/Divider.vue +0 -133
- package/dist/components/Image.vue +0 -70
- package/dist/components/Overlap.vue +0 -80
- package/dist/components/utils.d.mts +0 -5
- package/dist/components/utils.d.mts.map +0 -1
- package/dist/components/utils.mjs +0 -9
- package/dist/components/utils.mjs.map +0 -1
- package/dist/composables/defineConfig.d.mts +0 -14
- package/dist/composables/defineConfig.d.mts.map +0 -1
- package/dist/composables/defineConfig.mjs.map +0 -1
- package/dist/composables/renderContext.d.mts +0 -24
- package/dist/composables/renderContext.d.mts.map +0 -1
- package/dist/composables/renderContext.mjs +0 -6
- package/dist/composables/renderContext.mjs.map +0 -1
- package/dist/composables/useConfig.d.mts +0 -9
- package/dist/composables/useConfig.d.mts.map +0 -1
- package/dist/composables/useConfig.mjs +0 -13
- package/dist/composables/useConfig.mjs.map +0 -1
- package/dist/composables/useDoctype.d.mts.map +0 -1
- package/dist/composables/useDoctype.mjs.map +0 -1
- package/dist/composables/useEvent.d.mts.map +0 -1
- package/dist/composables/useEvent.mjs.map +0 -1
- package/dist/composables/usePlaintext.d.mts.map +0 -1
- package/dist/composables/usePlaintext.mjs.map +0 -1
- package/dist/composables/usePreviewText.d.mts +0 -24
- package/dist/composables/usePreviewText.d.mts.map +0 -1
- package/dist/composables/usePreviewText.mjs +0 -29
- package/dist/composables/usePreviewText.mjs.map +0 -1
- package/dist/config/defaults.d.mts.map +0 -1
- package/dist/config/defaults.mjs.map +0 -1
- package/dist/config/index.d.mts +0 -15
- package/dist/config/index.d.mts.map +0 -1
- package/dist/config/index.mjs.map +0 -1
- package/dist/events/index.d.mts.map +0 -1
- package/dist/events/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -30
- package/dist/index.mjs +0 -30
- package/dist/plaintext.d.mts.map +0 -1
- package/dist/plaintext.mjs.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/plugin.mjs.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
- package/dist/plugins/postcss/pruneVars.d.mts.map +0 -1
- package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.d.mts.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
- package/dist/render/createRenderer.d.mts.map +0 -1
- package/dist/render/createRenderer.mjs +0 -279
- package/dist/render/createRenderer.mjs.map +0 -1
- package/dist/render/index.d.mts +0 -26
- package/dist/render/index.d.mts.map +0 -1
- package/dist/render/index.mjs +0 -45
- package/dist/render/index.mjs.map +0 -1
- package/dist/serve.d.mts.map +0 -1
- package/dist/serve.mjs.map +0 -1
- package/dist/server/compatibility.d.mts +0 -5
- package/dist/server/compatibility.d.mts.map +0 -1
- package/dist/server/compatibility.mjs +0 -97
- package/dist/server/compatibility.mjs.map +0 -1
- package/dist/server/email.d.mts.map +0 -1
- package/dist/server/email.mjs.map +0 -1
- package/dist/server/linter.d.mts +0 -5
- package/dist/server/linter.d.mts.map +0 -1
- package/dist/server/linter.mjs +0 -189
- package/dist/server/linter.mjs.map +0 -1
- package/dist/transformers/addAttributes.d.mts +0 -32
- package/dist/transformers/addAttributes.d.mts.map +0 -1
- package/dist/transformers/addAttributes.mjs.map +0 -1
- package/dist/transformers/attributeToStyle.d.mts +0 -25
- package/dist/transformers/attributeToStyle.d.mts.map +0 -1
- package/dist/transformers/attributeToStyle.mjs +0 -80
- package/dist/transformers/attributeToStyle.mjs.map +0 -1
- package/dist/transformers/base.d.mts +0 -8
- package/dist/transformers/base.d.mts.map +0 -1
- package/dist/transformers/base.mjs.map +0 -1
- package/dist/transformers/entities.d.mts +0 -8
- package/dist/transformers/entities.d.mts.map +0 -1
- package/dist/transformers/entities.mjs +0 -41
- package/dist/transformers/entities.mjs.map +0 -1
- package/dist/transformers/filters/defaults.d.mts.map +0 -1
- package/dist/transformers/filters/defaults.mjs.map +0 -1
- package/dist/transformers/filters/index.d.mts +0 -22
- package/dist/transformers/filters/index.d.mts.map +0 -1
- package/dist/transformers/filters/index.mjs +0 -67
- package/dist/transformers/filters/index.mjs.map +0 -1
- package/dist/transformers/format.d.mts +0 -15
- package/dist/transformers/format.d.mts.map +0 -1
- package/dist/transformers/format.mjs +0 -26
- package/dist/transformers/format.mjs.map +0 -1
- package/dist/transformers/index.d.mts.map +0 -1
- package/dist/transformers/index.mjs +0 -78
- package/dist/transformers/index.mjs.map +0 -1
- package/dist/transformers/inlineCSS.d.mts +0 -17
- package/dist/transformers/inlineCSS.d.mts.map +0 -1
- package/dist/transformers/inlineCSS.mjs +0 -70
- package/dist/transformers/inlineCSS.mjs.map +0 -1
- package/dist/transformers/inlineLink.d.mts +0 -14
- package/dist/transformers/inlineLink.d.mts.map +0 -1
- package/dist/transformers/inlineLink.mjs.map +0 -1
- package/dist/transformers/minify.d.mts +0 -17
- package/dist/transformers/minify.d.mts.map +0 -1
- package/dist/transformers/minify.mjs +0 -24
- package/dist/transformers/minify.mjs.map +0 -1
- package/dist/transformers/purgeCSS.d.mts +0 -23
- package/dist/transformers/purgeCSS.d.mts.map +0 -1
- package/dist/transformers/purgeCSS.mjs +0 -132
- package/dist/transformers/purgeCSS.mjs.map +0 -1
- package/dist/transformers/removeAttributes.d.mts +0 -31
- package/dist/transformers/removeAttributes.d.mts.map +0 -1
- package/dist/transformers/removeAttributes.mjs +0 -63
- package/dist/transformers/removeAttributes.mjs.map +0 -1
- package/dist/transformers/replaceStrings.d.mts.map +0 -1
- package/dist/transformers/replaceStrings.mjs.map +0 -1
- package/dist/transformers/safeClassNames.d.mts +0 -22
- package/dist/transformers/safeClassNames.d.mts.map +0 -1
- package/dist/transformers/safeClassNames.mjs.map +0 -1
- package/dist/transformers/shorthandCSS.d.mts +0 -24
- package/dist/transformers/shorthandCSS.d.mts.map +0 -1
- package/dist/transformers/shorthandCSS.mjs +0 -48
- package/dist/transformers/shorthandCSS.mjs.map +0 -1
- package/dist/transformers/tailwindcss.d.mts.map +0 -1
- package/dist/transformers/tailwindcss.mjs.map +0 -1
- package/dist/transformers/urlQuery.d.mts +0 -24
- package/dist/transformers/urlQuery.d.mts.map +0 -1
- package/dist/transformers/urlQuery.mjs +0 -65
- package/dist/transformers/urlQuery.mjs.map +0 -1
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs +0 -1
- package/dist/types/index.d.mts +0 -2
- package/dist/types/index.mjs +0 -1
- package/dist/utils/ast/index.d.mts +0 -4
- package/dist/utils/ast/index.mjs +0 -5
- package/dist/utils/ast/parser.d.mts.map +0 -1
- package/dist/utils/ast/parser.mjs.map +0 -1
- package/dist/utils/ast/serializer.d.mts.map +0 -1
- package/dist/utils/ast/serializer.mjs +0 -37
- package/dist/utils/ast/serializer.mjs.map +0 -1
- package/dist/utils/ast/walker.d.mts.map +0 -1
- package/dist/utils/ast/walker.mjs.map +0 -1
- package/dist/utils/detect.d.mts.map +0 -1
- package/dist/utils/detect.mjs.map +0 -1
- package/dist/utils/url.d.mts.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/node_modules/@clack/core/dist/index.mjs.map +0 -1
- package/node_modules/@clack/prompts/dist/index.mjs.map +0 -1
- package/node_modules/fast-wrap-ansi/lib/main.js.map +0 -1
- package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
- package/node_modules/tinyexec/dist/LICENSES.txt +0 -83
package/dist/components/utils.ts
CHANGED
|
@@ -4,3 +4,105 @@ export function normalizeToPixels(value: string | number): string {
|
|
|
4
4
|
}
|
|
5
5
|
return value
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
const counters: Record<string, number> = {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Module-scoped sequential ID generator. Used by components to mint
|
|
12
|
+
* unique marker ids (e.g. `c1`, `c2`) for the post-render transformer.
|
|
13
|
+
*
|
|
14
|
+
* Must live here (not inside `<script setup>`) because Vue compiles
|
|
15
|
+
* `<script setup>` into the component's `setup()` function — any
|
|
16
|
+
* `let counter = 0` there resets per instance, causing id collisions.
|
|
17
|
+
*/
|
|
18
|
+
export function nextId(prefix: string): string {
|
|
19
|
+
counters[prefix] = (counters[prefix] ?? 0) + 1
|
|
20
|
+
return `${prefix}${counters[prefix]}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function hasWidthUtility(classStr: string): boolean {
|
|
24
|
+
return classStr.split(/\s+/).some((c) => {
|
|
25
|
+
const utility = c.split(':').pop() ?? ''
|
|
26
|
+
const clean = utility.replace(/^!/, '')
|
|
27
|
+
return /^(w-|max-w-|min-w-)/.test(clean)
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function hasWidthInStyle(styleStr: string): boolean {
|
|
32
|
+
return /(?:^|;\s*)(?:max-width|width)\s*:/i.test(styleStr)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function hasHeightUtility(classStr: string): boolean {
|
|
36
|
+
return classStr.split(/\s+/).some((c) => {
|
|
37
|
+
const utility = c.split(':').pop() ?? ''
|
|
38
|
+
const clean = utility.replace(/^!/, '')
|
|
39
|
+
return /^(h-|max-h-|min-h-)/.test(clean)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function hasHeightInStyle(styleStr: string): boolean {
|
|
44
|
+
return /(?:^|;\s*)(?:max-height|height)\s*:/i.test(styleStr)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Shared prop for components that emit MSO/VML fallback markup. The
|
|
49
|
+
* `null` default acts as the "unset" sentinel — `useOutlookFallback`
|
|
50
|
+
* treats `null` as inherit-from-ancestor (root default `true`),
|
|
51
|
+
* letting users override per-component without losing inheritance.
|
|
52
|
+
*/
|
|
53
|
+
export const outlookFallbackProp = {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: null,
|
|
56
|
+
} as const
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Default utility classes for a code-block `<pre>`. `whitespace-pre!` is
|
|
60
|
+
* forced important so Gmail's stylesheet can't reset it to `normal`, and
|
|
61
|
+
* `m-0` strips the browser's default `<pre>` margins so it isn't spaced
|
|
62
|
+
* away from its wrapper.
|
|
63
|
+
*/
|
|
64
|
+
export function codeBlockPreClass(bg: string): string {
|
|
65
|
+
return `font-mono bg-[${bg}] p-4 m-0 overflow-auto whitespace-pre! [word-wrap:normal] [word-break:normal] [word-spacing:normal]`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Build the email-safe table wrapper around highlighted code. Shared by the
|
|
70
|
+
* `<CodeBlock>` component and the Markdown fenced/indented code-block
|
|
71
|
+
* rules so both render identical markup: a full-width table whose
|
|
72
|
+
* cell carries the theme background, wrapping a `<pre>` styled
|
|
73
|
+
* with utility classes (not Shiki's raw inline styles).
|
|
74
|
+
*/
|
|
75
|
+
export function buildCodeBlock(
|
|
76
|
+
codeContent: string,
|
|
77
|
+
bg: string,
|
|
78
|
+
options: { preClass?: string; tdClass?: string; styleAttr?: string } = {},
|
|
79
|
+
): string {
|
|
80
|
+
const preClass = options.preClass ?? codeBlockPreClass(bg)
|
|
81
|
+
const tdClass = options.tdClass ?? `bg-[${bg}] max-w-0 mso-padding-alt-4`
|
|
82
|
+
const styleAttr = options.styleAttr ?? ''
|
|
83
|
+
|
|
84
|
+
// `data-juice-important` tells the CSS inliner to keep `!important` on this
|
|
85
|
+
// element's inlined declarations (e.g. `white-space: pre !important`), which
|
|
86
|
+
// it strips by default. Juice removes the attribute from the output.
|
|
87
|
+
return `<table class="w-full"><tr><td class="${tdClass}"><pre class="${preClass}"${styleAttr} data-juice-important><code>${codeContent}</code></pre></td></tr></table>`
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Re-wrap a Shiki (or plain markdown-it) `<pre><code>` block as a CodeBlock,
|
|
92
|
+
* pulling the inner code and the theme background out of the highlighted
|
|
93
|
+
* HTML. Falls back to a white background for unhighlighted blocks.
|
|
94
|
+
*/
|
|
95
|
+
export function shikiToCodeBlock(highlighted: string): string {
|
|
96
|
+
const trimmed = highlighted.trim()
|
|
97
|
+
// Read the background only from the opening <pre> tag's style, never from
|
|
98
|
+
// the code body — otherwise a `background-color:` inside the snippet (e.g. a
|
|
99
|
+
// CSS example, or any unhighlighted block) would hijack the wrapper color.
|
|
100
|
+
const preTag = trimmed.match(/^<pre[^>]*>/)?.[0] ?? ''
|
|
101
|
+
const bg = preTag.match(/background-color:\s*(#[0-9a-fA-F]+)/)?.[1] ?? '#fff'
|
|
102
|
+
const codeContent = trimmed
|
|
103
|
+
.replace(/^<pre[^>]*><code[^>]*>/, '')
|
|
104
|
+
.replace(/<\/code><\/pre>$/, '')
|
|
105
|
+
|
|
106
|
+
return buildCodeBlock(codeContent, bg)
|
|
107
|
+
}
|
|
108
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MaizzleConfig } from "../types/config.js";
|
|
2
|
+
//#region src/composables/defineConfig.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Define Maizzle config.
|
|
5
|
+
*
|
|
6
|
+
* In maizzle.config.ts: typed identity function, returns the config as-is
|
|
7
|
+
* In Vue SFC `<script setup>`: merges with the global config and provides
|
|
8
|
+
* the result to child components via `useConfig()`
|
|
9
|
+
*/
|
|
10
|
+
declare function defineConfig(data?: Partial<MaizzleConfig>): MaizzleConfig;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { defineConfig };
|
|
13
|
+
//# sourceMappingURL=defineConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.d.ts","names":[],"sources":["../../src/composables/defineConfig.ts"],"mappings":";;;;;AAoBA;;;;iBAAgB,YAAA,CAAa,IAAA,GAAM,OAAA,CAAQ,aAAA,IAAsB,aAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { MaizzleConfigKey } from "./useConfig.
|
|
2
|
-
import { RenderContextKey } from "./renderContext.
|
|
1
|
+
import { MaizzleConfigKey } from "./useConfig.js";
|
|
2
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
3
3
|
import { createDefu } from "defu";
|
|
4
4
|
import { getCurrentInstance, inject, provide } from "vue";
|
|
5
|
-
|
|
6
5
|
//#region src/composables/defineConfig.ts
|
|
7
6
|
const merge = createDefu((obj, key, value) => {
|
|
8
7
|
if (Array.isArray(obj[key])) {
|
|
@@ -13,10 +12,9 @@ const merge = createDefu((obj, key, value) => {
|
|
|
13
12
|
/**
|
|
14
13
|
* Define Maizzle config.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* the result to child components via useConfig()
|
|
15
|
+
* In maizzle.config.ts: typed identity function, returns the config as-is
|
|
16
|
+
* In Vue SFC `<script setup>`: merges with the global config and provides
|
|
17
|
+
* the result to child components via `useConfig()`
|
|
20
18
|
*/
|
|
21
19
|
function defineConfig(data = {}) {
|
|
22
20
|
if (getCurrentInstance()) {
|
|
@@ -28,7 +26,7 @@ function defineConfig(data = {}) {
|
|
|
28
26
|
}
|
|
29
27
|
return data;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
//#endregion
|
|
33
30
|
export { defineConfig };
|
|
34
|
-
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.js","names":[],"sources":["../../src/composables/defineConfig.ts"],"sourcesContent":["import { getCurrentInstance, inject, provide } from 'vue'\nimport { createDefu } from 'defu'\nimport { MaizzleConfigKey } from './useConfig.ts'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { MaizzleConfig } from '../types/index.ts'\n\nconst merge = createDefu((obj, key, value) => {\n if (Array.isArray(obj[key])) {\n obj[key] = value\n return true\n }\n})\n\n/**\n * Define Maizzle config.\n *\n * In maizzle.config.ts: typed identity function, returns the config as-is\n * In Vue SFC `<script setup>`: merges with the global config and provides\n * the result to child components via `useConfig()`\n */\nexport function defineConfig(data: Partial<MaizzleConfig> = {}): MaizzleConfig {\n // Inside a Vue SFC — merge with global config and provide to children\n if (getCurrentInstance()) {\n const globalConfig = inject(MaizzleConfigKey, {} as MaizzleConfig)\n const merged = merge(data, globalConfig) as MaizzleConfig\n\n const ctx = inject(RenderContextKey)\n if (ctx) ctx.sfcConfig = merged\n\n provide(MaizzleConfigKey, merged)\n\n return merged\n }\n\n // Outside Vue (maizzle.config.ts) — just return the config\n return data as MaizzleConfig\n}\n"],"mappings":";;;;;AAMA,MAAM,QAAQ,YAAY,KAAK,KAAK,UAAU;CAC5C,IAAI,MAAM,QAAQ,IAAI,IAAI,GAAG;EAC3B,IAAI,OAAO;EACX,OAAO;CACT;AACF,CAAC;;;;;;;;AASD,SAAgB,aAAa,OAA+B,CAAC,GAAkB;CAE7E,IAAI,mBAAmB,GAAG;EAExB,MAAM,SAAS,MAAM,MADA,OAAO,kBAAkB,CAAC,CACT,CAAC;EAEvC,MAAM,MAAM,OAAO,gBAAgB;EACnC,IAAI,KAAK,IAAI,YAAY;EAEzB,QAAQ,kBAAkB,MAAM;EAEhC,OAAO;CACT;CAGA,OAAO;AACT"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EventMap, EventName } from "../events/index.js";
|
|
2
|
+
import { MaizzleConfig } from "../types/config.js";
|
|
3
|
+
import { UsePlaintextOptions } from "./usePlaintext.js";
|
|
4
|
+
import { InjectionKey } from "vue";
|
|
5
|
+
|
|
6
|
+
//#region src/composables/renderContext.d.ts
|
|
7
|
+
interface FontRegistration {
|
|
8
|
+
family: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
declaration: string;
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
interface TailwindBlock {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Optional raw CSS from the component's `#config` slot. */
|
|
16
|
+
css?: string;
|
|
17
|
+
}
|
|
18
|
+
interface RenderContext {
|
|
19
|
+
doctype?: string;
|
|
20
|
+
preheader?: {
|
|
21
|
+
text: string;
|
|
22
|
+
fillerCount: number;
|
|
23
|
+
};
|
|
24
|
+
sfcConfig?: MaizzleConfig;
|
|
25
|
+
sfcEventHandlers: Array<{
|
|
26
|
+
name: EventName;
|
|
27
|
+
handler: EventMap[EventName];
|
|
28
|
+
}>;
|
|
29
|
+
plaintext?: UsePlaintextOptions;
|
|
30
|
+
outputPath?: string;
|
|
31
|
+
fonts?: FontRegistration[];
|
|
32
|
+
tailwindBlocks?: TailwindBlock[];
|
|
33
|
+
}
|
|
34
|
+
declare const RenderContextKey: InjectionKey<RenderContext>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { FontRegistration, RenderContext, RenderContextKey, TailwindBlock };
|
|
37
|
+
//# sourceMappingURL=renderContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderContext.d.ts","names":[],"sources":["../../src/composables/renderContext.ts"],"mappings":";;;;;;UAKiB,gBAAA;EACf,MAAA;EACA,IAAA;EACA,WAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,EAAA;EANA;EAQA,GAAG;AAAA;AAAA,UAGY,aAAA;EACf,OAAA;EACA,SAAA;IAAc,IAAA;IAAc,WAAA;EAAA;EAC5B,SAAA,GAAY,aAAA;EACZ,gBAAA,EAAkB,KAAA;IAAQ,IAAA,EAAM,SAAA;IAAW,OAAA,EAAS,QAAA,CAAS,SAAA;EAAA;EAC7D,SAAA,GAAY,mBAAA;EACZ,UAAA;EACA,KAAA,GAAQ,gBAAA;EACR,cAAA,GAAiB,aAAA;AAAA;AAAA,cAIN,gBAAA,EAAkB,YAAY,CAAC,aAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderContext.js","names":[],"sources":["../../src/composables/renderContext.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\nimport type { MaizzleConfig } from '../types/index.ts'\nimport type { EventName, EventMap } from '../events/index.ts'\nimport type { UsePlaintextOptions } from './usePlaintext.ts'\n\nexport interface FontRegistration {\n family: string\n slug: string\n declaration: string\n url: string\n}\n\nexport interface TailwindBlock {\n id: string\n /** Optional raw CSS from the component's `#config` slot. */\n css?: string\n}\n\nexport interface RenderContext {\n doctype?: string\n preheader?: { text: string; fillerCount: number }\n sfcConfig?: MaizzleConfig\n sfcEventHandlers: Array<{ name: EventName; handler: EventMap[EventName] }>\n plaintext?: UsePlaintextOptions\n outputPath?: string\n fonts?: FontRegistration[]\n tailwindBlocks?: TailwindBlock[]\n}\n\n// Global symbol registry — same rationale as MaizzleConfigKey in useConfig.ts.\nexport const RenderContextKey: InjectionKey<RenderContext> = Symbol.for('maizzle.renderContext')\n"],"mappings":";AA8BA,MAAa,mBAAgD,OAAO,IAAI,uBAAuB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UrlConfig } from "../types/config.js";
|
|
2
|
+
//#region src/composables/useBaseUrl.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Set the base URL for the current email template — same as
|
|
5
|
+
* `config.url.base`, scoped to one SFC.
|
|
6
|
+
*
|
|
7
|
+
* Pass a string to prepend to all default tags/attributes, or an object
|
|
8
|
+
* for fine-grained control (which tags/attributes, style tags, etc.).
|
|
9
|
+
*
|
|
10
|
+
* Usage in SFC <script setup>:
|
|
11
|
+
* ```ts
|
|
12
|
+
* useBaseUrl('https://cdn.example.com/emails/')
|
|
13
|
+
* useBaseUrl({ url: 'https://cdn.example.com/', styleTag: true })
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare function useBaseUrl(value: UrlConfig['base']): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { useBaseUrl };
|
|
19
|
+
//# sourceMappingURL=useBaseUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseUrl.d.ts","names":[],"sources":["../../src/composables/useBaseUrl.ts"],"mappings":";;;;;AAkBA;;;;AAAmD;;;;;;iBAAnC,UAAA,CAAW,KAAwB,EAAjB,SAAS"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
2
|
+
import { defu as defu$1 } from "defu";
|
|
3
|
+
import { inject } from "vue";
|
|
4
|
+
//#region src/composables/useBaseUrl.ts
|
|
5
|
+
/**
|
|
6
|
+
* Set the base URL for the current email template — same as
|
|
7
|
+
* `config.url.base`, scoped to one SFC.
|
|
8
|
+
*
|
|
9
|
+
* Pass a string to prepend to all default tags/attributes, or an object
|
|
10
|
+
* for fine-grained control (which tags/attributes, style tags, etc.).
|
|
11
|
+
*
|
|
12
|
+
* Usage in SFC <script setup>:
|
|
13
|
+
* ```ts
|
|
14
|
+
* useBaseUrl('https://cdn.example.com/emails/')
|
|
15
|
+
* useBaseUrl({ url: 'https://cdn.example.com/', styleTag: true })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function useBaseUrl(value) {
|
|
19
|
+
const ctx = inject(RenderContextKey);
|
|
20
|
+
if (!ctx) return;
|
|
21
|
+
ctx.sfcConfig = defu$1({ url: { base: value } }, ctx.sfcConfig ?? {});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useBaseUrl };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=useBaseUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseUrl.js","names":["merge"],"sources":["../../src/composables/useBaseUrl.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { defu as merge } from 'defu'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { UrlConfig } from '../types/index.ts'\n\n/**\n * Set the base URL for the current email template — same as\n * `config.url.base`, scoped to one SFC.\n *\n * Pass a string to prepend to all default tags/attributes, or an object\n * for fine-grained control (which tags/attributes, style tags, etc.).\n *\n * Usage in SFC <script setup>:\n * ```ts\n * useBaseUrl('https://cdn.example.com/emails/')\n * useBaseUrl({ url: 'https://cdn.example.com/', styleTag: true })\n * ```\n */\nexport function useBaseUrl(value: UrlConfig['base']): void {\n const ctx = inject(RenderContextKey)\n if (!ctx) return\n ctx.sfcConfig = merge({ url: { base: value } }, ctx.sfcConfig ?? {})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAAgB,WAAW,OAAgC;CACzD,MAAM,MAAM,OAAO,gBAAgB;CACnC,IAAI,CAAC,KAAK;CACV,IAAI,YAAYA,OAAM,EAAE,KAAK,EAAE,MAAM,MAAM,EAAE,GAAG,IAAI,aAAa,CAAC,CAAC;AACrE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MaizzleConfig } from "../types/config.js";
|
|
2
|
+
import { InjectionKey } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/composables/useConfig.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Use the global symbol registry so the key is identical across every
|
|
7
|
+
* module instance. In dev, `render()` (Node) and the SFC's auto-imported
|
|
8
|
+
* composables can resolve to two separate instances of this module; a plain
|
|
9
|
+
* `Symbol()` would differ between them, so `app.provide()` and the SFC's
|
|
10
|
+
* `inject()` would miss each other and `useConfig()` would throw.
|
|
11
|
+
*/
|
|
12
|
+
declare const MaizzleConfigKey: InjectionKey<MaizzleConfig>;
|
|
13
|
+
declare function useConfig(): MaizzleConfig;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { MaizzleConfigKey, useConfig };
|
|
16
|
+
//# sourceMappingURL=useConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfig.d.ts","names":[],"sources":["../../src/composables/useConfig.ts"],"mappings":";;;;;;;AAWA;;;;cAAa,gBAAA,EAAkB,YAAY,CAAC,aAAA;AAAA,iBAE5B,SAAA,IAAa,aAAa"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
//#region src/composables/useConfig.ts
|
|
3
|
+
/**
|
|
4
|
+
* Use the global symbol registry so the key is identical across every
|
|
5
|
+
* module instance. In dev, `render()` (Node) and the SFC's auto-imported
|
|
6
|
+
* composables can resolve to two separate instances of this module; a plain
|
|
7
|
+
* `Symbol()` would differ between them, so `app.provide()` and the SFC's
|
|
8
|
+
* `inject()` would miss each other and `useConfig()` would throw.
|
|
9
|
+
*/
|
|
10
|
+
const MaizzleConfigKey = Symbol.for("maizzle.config");
|
|
11
|
+
function useConfig() {
|
|
12
|
+
const config = inject(MaizzleConfigKey);
|
|
13
|
+
if (!config) throw new Error("useConfig() requires the Maizzle plugin to provide config. Make sure you are using it inside a Maizzle template.");
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { MaizzleConfigKey, useConfig };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=useConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfig.js","names":[],"sources":["../../src/composables/useConfig.ts"],"sourcesContent":["import { inject } from 'vue'\nimport type { InjectionKey } from 'vue'\nimport type { MaizzleConfig } from '../types/index.ts'\n\n/**\n * Use the global symbol registry so the key is identical across every\n * module instance. In dev, `render()` (Node) and the SFC's auto-imported\n * composables can resolve to two separate instances of this module; a plain\n * `Symbol()` would differ between them, so `app.provide()` and the SFC's\n * `inject()` would miss each other and `useConfig()` would throw.\n */\nexport const MaizzleConfigKey: InjectionKey<MaizzleConfig> = Symbol.for('maizzle.config')\n\nexport function useConfig(): MaizzleConfig {\n const config = inject(MaizzleConfigKey)\n\n if (!config) {\n throw new Error('useConfig() requires the Maizzle plugin to provide config. Make sure you are using it inside a Maizzle template.')\n }\n\n return config\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,mBAAgD,OAAO,IAAI,gBAAgB;AAExF,SAAgB,YAA2B;CACzC,MAAM,SAAS,OAAO,gBAAgB;CAEtC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,kHAAkH;CAGpI,OAAO;AACT"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ParsedPath } from "node:path";
|
|
2
|
+
|
|
3
|
+
//#region src/composables/useCurrentTemplate.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Internal — set by the build loop before each template iteration and
|
|
6
|
+
* cleared in `finally`. Not exported from the package entrypoint.
|
|
7
|
+
*/
|
|
8
|
+
declare function _setCurrentTemplate(parsed: ParsedPath | undefined): void;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the parsed path of the template currently being processed,
|
|
11
|
+
* or `undefined` when called outside the per-template scope (e.g. from
|
|
12
|
+
* `beforeCreate` / `afterBuild`, or outside a build entirely).
|
|
13
|
+
*
|
|
14
|
+
* Usage in an SFC `<script setup>`:
|
|
15
|
+
* ```ts
|
|
16
|
+
* const file = useCurrentTemplate()
|
|
17
|
+
* console.log(file?.name) // 'welcome'
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Usage in an event handler:
|
|
21
|
+
* ```ts
|
|
22
|
+
* beforeRender() {
|
|
23
|
+
* const file = useCurrentTemplate()
|
|
24
|
+
* // file?.dir, file?.name, file?.ext, file?.base, file?.root
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function useCurrentTemplate(): ParsedPath | undefined;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { _setCurrentTemplate, useCurrentTemplate };
|
|
31
|
+
//# sourceMappingURL=useCurrentTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrentTemplate.d.ts","names":[],"sources":["../../src/composables/useCurrentTemplate.ts"],"mappings":";;;;;AAmBA;;iBAAgB,mBAAA,CAAoB,MAA8B,EAAtB,UAAU;;AAAY;AAuBlE;;;;AAAgD;;;;;;;;;;;;;iBAAhC,kBAAA,IAAsB,UAAU"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/composables/useCurrentTemplate.ts
|
|
2
|
+
/**
|
|
3
|
+
* Stored on globalThis so the Vite SSR module graph (which loads this file
|
|
4
|
+
* when a user SFC auto-imports useCurrentTemplate) and the Node import
|
|
5
|
+
* graph (used by build.ts / serve.ts) share the same value. Two
|
|
6
|
+
* module instances would otherwise hold independent `let`
|
|
7
|
+
* bindings.
|
|
8
|
+
*/
|
|
9
|
+
const KEY = Symbol.for("maizzle.currentTemplate");
|
|
10
|
+
/**
|
|
11
|
+
* Internal — set by the build loop before each template iteration and
|
|
12
|
+
* cleared in `finally`. Not exported from the package entrypoint.
|
|
13
|
+
*/
|
|
14
|
+
function _setCurrentTemplate(parsed) {
|
|
15
|
+
globalThis[KEY] = parsed;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the parsed path of the template currently being processed,
|
|
19
|
+
* or `undefined` when called outside the per-template scope (e.g. from
|
|
20
|
+
* `beforeCreate` / `afterBuild`, or outside a build entirely).
|
|
21
|
+
*
|
|
22
|
+
* Usage in an SFC `<script setup>`:
|
|
23
|
+
* ```ts
|
|
24
|
+
* const file = useCurrentTemplate()
|
|
25
|
+
* console.log(file?.name) // 'welcome'
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Usage in an event handler:
|
|
29
|
+
* ```ts
|
|
30
|
+
* beforeRender() {
|
|
31
|
+
* const file = useCurrentTemplate()
|
|
32
|
+
* // file?.dir, file?.name, file?.ext, file?.base, file?.root
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
function useCurrentTemplate() {
|
|
37
|
+
return globalThis[KEY];
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { _setCurrentTemplate, useCurrentTemplate };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=useCurrentTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrentTemplate.js","names":[],"sources":["../../src/composables/useCurrentTemplate.ts"],"sourcesContent":["import type { ParsedPath } from 'node:path'\n\n/**\n * Stored on globalThis so the Vite SSR module graph (which loads this file\n * when a user SFC auto-imports useCurrentTemplate) and the Node import\n * graph (used by build.ts / serve.ts) share the same value. Two\n * module instances would otherwise hold independent `let`\n * bindings.\n */\nconst KEY = Symbol.for('maizzle.currentTemplate')\n\ninterface GlobalWithCurrentTemplate {\n [KEY]?: ParsedPath\n}\n\n/**\n * Internal — set by the build loop before each template iteration and\n * cleared in `finally`. Not exported from the package entrypoint.\n */\nexport function _setCurrentTemplate(parsed: ParsedPath | undefined): void {\n (globalThis as GlobalWithCurrentTemplate)[KEY] = parsed\n}\n\n/**\n * Returns the parsed path of the template currently being processed,\n * or `undefined` when called outside the per-template scope (e.g. from\n * `beforeCreate` / `afterBuild`, or outside a build entirely).\n *\n * Usage in an SFC `<script setup>`:\n * ```ts\n * const file = useCurrentTemplate()\n * console.log(file?.name) // 'welcome'\n * ```\n *\n * Usage in an event handler:\n * ```ts\n * beforeRender() {\n * const file = useCurrentTemplate()\n * // file?.dir, file?.name, file?.ext, file?.base, file?.root\n * }\n * ```\n */\nexport function useCurrentTemplate(): ParsedPath | undefined {\n return (globalThis as GlobalWithCurrentTemplate)[KEY]\n}\n"],"mappings":";;;;;;;;AASA,MAAM,MAAM,OAAO,IAAI,yBAAyB;;;;;AAUhD,SAAgB,oBAAoB,QAAsC;CACxE,WAA0C,OAAO;AACnD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,qBAA6C;CAC3D,OAAQ,WAAyC;AACnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDoctype.d.ts","names":[],"sources":["../../src/composables/useDoctype.ts"],"mappings":";;AAWA;;;;AAA0C;;;iBAA1B,UAAA,CAAW,OAAe"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RenderContextKey } from "./renderContext.
|
|
1
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
2
2
|
import { inject } from "vue";
|
|
3
|
-
|
|
4
3
|
//#region src/composables/useDoctype.ts
|
|
5
4
|
/**
|
|
6
5
|
* Set the doctype for the current email template.
|
|
@@ -14,7 +13,7 @@ function useDoctype(doctype) {
|
|
|
14
13
|
const ctx = inject(RenderContextKey);
|
|
15
14
|
if (ctx) ctx.doctype = doctype;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
17
|
export { useDoctype };
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=useDoctype.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDoctype.js","names":[],"sources":["../../src/composables/useDoctype.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\n\n/**\n * Set the doctype for the current email template.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * useDoctype('<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">')\n * ```\n */\nexport function useDoctype(doctype: string): void {\n const ctx = inject(RenderContextKey)\n if (ctx) ctx.doctype = doctype\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,WAAW,SAAuB;CAChD,MAAM,MAAM,OAAO,gBAAgB;CACnC,IAAI,KAAK,IAAI,UAAU;AACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventMap, EventName } from "../events/index.
|
|
1
|
+
import { EventMap, EventName } from "../events/index.js";
|
|
2
2
|
|
|
3
3
|
//#region src/composables/useEvent.d.ts
|
|
4
4
|
/**
|
|
@@ -7,11 +7,11 @@ import { EventMap, EventName } from "../events/index.mjs";
|
|
|
7
7
|
* Usage:
|
|
8
8
|
* ```ts
|
|
9
9
|
* useEvent('beforeRender', ({ config, template }) => {
|
|
10
|
-
* return template.replace('foo', 'bar')
|
|
10
|
+
* return template.source.replace('foo', 'bar')
|
|
11
11
|
* })
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
declare function useEvent<K extends EventName>(name: K, handler: EventMap[K]): void;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { useEvent };
|
|
17
|
-
//# sourceMappingURL=useEvent.d.
|
|
17
|
+
//# sourceMappingURL=useEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvent.d.ts","names":[],"sources":["../../src/composables/useEvent.ts"],"mappings":";;;;;AAcA;;;;;;;;iBAAgB,QAAA,WAAmB,SAAA,EAAW,IAAA,EAAM,CAAA,EAAG,OAAA,EAAS,QAAA,CAAS,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RenderContextKey } from "./renderContext.
|
|
1
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
2
2
|
import { inject } from "vue";
|
|
3
|
-
|
|
4
3
|
//#region src/composables/useEvent.ts
|
|
5
4
|
/**
|
|
6
5
|
* Register an event handler from within an SFC's <script setup>.
|
|
@@ -8,7 +7,7 @@ import { inject } from "vue";
|
|
|
8
7
|
* Usage:
|
|
9
8
|
* ```ts
|
|
10
9
|
* useEvent('beforeRender', ({ config, template }) => {
|
|
11
|
-
* return template.replace('foo', 'bar')
|
|
10
|
+
* return template.source.replace('foo', 'bar')
|
|
12
11
|
* })
|
|
13
12
|
* ```
|
|
14
13
|
*/
|
|
@@ -19,7 +18,7 @@ function useEvent(name, handler) {
|
|
|
19
18
|
handler
|
|
20
19
|
});
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
//#endregion
|
|
24
22
|
export { useEvent };
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=useEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvent.js","names":[],"sources":["../../src/composables/useEvent.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { EventName, EventMap } from '../events/index.ts'\n\n/**\n * Register an event handler from within an SFC's <script setup>.\n *\n * Usage:\n * ```ts\n * useEvent('beforeRender', ({ config, template }) => {\n * return template.source.replace('foo', 'bar')\n * })\n * ```\n */\nexport function useEvent<K extends EventName>(name: K, handler: EventMap[K]) {\n const ctx = inject(RenderContextKey)\n if (ctx) ctx.sfcEventHandlers.push({ name, handler })\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,SAA8B,MAAS,SAAsB;CAC3E,MAAM,MAAM,OAAO,gBAAgB;CACnC,IAAI,KAAK,IAAI,iBAAiB,KAAK;EAAE;EAAM;CAAQ,CAAC;AACtD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/composables/useFont.d.ts
|
|
2
|
+
type FontProvider = 'google' | 'bunny';
|
|
3
|
+
interface UseFontOptions {
|
|
4
|
+
/**
|
|
5
|
+
* A single font family name, e.g. `"Roboto"` or `"Open Sans"`.
|
|
6
|
+
*
|
|
7
|
+
* For fallback fonts, use the `fallback` option instead of a
|
|
8
|
+
* comma-separated list here.
|
|
9
|
+
*/
|
|
10
|
+
family: string;
|
|
11
|
+
/** CSS fallback list appended to the `font-family` declaration. */
|
|
12
|
+
fallback?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Font provider used to build the stylesheet URL when `url` is omitted.
|
|
15
|
+
* Bunny Fonts is a drop-in, privacy-friendly Google Fonts mirror.
|
|
16
|
+
* @default 'google'
|
|
17
|
+
*/
|
|
18
|
+
provider?: FontProvider;
|
|
19
|
+
/**
|
|
20
|
+
* Stylesheet URL. When provided, used as-is for the `<link href>`.
|
|
21
|
+
* When omitted, a URL is built from `provider`, `family`, `weights`,
|
|
22
|
+
* `display` and `styles`.
|
|
23
|
+
*/
|
|
24
|
+
url?: string;
|
|
25
|
+
/** Font weights to load. Ignored when `url` is provided. */
|
|
26
|
+
weights?: number[];
|
|
27
|
+
/** `font-display` value. Ignored when `url` is provided. */
|
|
28
|
+
display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
29
|
+
/** Font styles to load. Ignored when `url` is provided. */
|
|
30
|
+
styles?: Array<'normal' | 'italic'>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Register a font for the current email template.
|
|
34
|
+
*
|
|
35
|
+
* Builds a Google Fonts stylesheet URL from `family`/`weights`/`display`/`styles`
|
|
36
|
+
* (or uses `url` as-is). The renderer injects a `<link>` tag into `<head>`
|
|
37
|
+
* and merges `--font-{slug}` declarations into the template's existing
|
|
38
|
+
* `@import "tailwindcss"` style block so a `font-{slug}` utility class
|
|
39
|
+
* is generated. If no Tailwind import is found, falls back to a `:root`
|
|
40
|
+
* declaration so the CSS variable is still available.
|
|
41
|
+
*
|
|
42
|
+
* Usage in SFC <script setup>:
|
|
43
|
+
* ```ts
|
|
44
|
+
* useFont({ family: 'Roboto', fallback: 'Verdana, sans-serif', weights: [400, 600] })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function useFont(options: UseFontOptions): void;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { FontProvider, UseFontOptions, useFont };
|
|
50
|
+
//# sourceMappingURL=useFont.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFont.d.ts","names":[],"sources":["../../src/composables/useFont.ts"],"mappings":";KA8CY,YAAA;AAAA,UAEK,cAAA;EAFO;;;AAAA;AAExB;;EAOE,MAAA;EAoBc;EAlBd,QAAA;EAAA;;;;;EAMA,QAAA,GAAW,YAAA;EAYX;;;AAAc;AA+ChB;EArDE,GAAA;;EAEA,OAAA;EAmD6C;EAjD7C,OAAA;;EAEA,MAAA,GAAS,KAAK;AAAA;;;;;;;;;;;;;;;;iBA+CA,OAAA,CAAQ,OAAuB,EAAd,cAAc"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
2
|
+
import { inject } from "vue";
|
|
3
|
+
//#region src/composables/useFont.ts
|
|
4
|
+
const FAMILY_CATEGORIES = {
|
|
5
|
+
"Roboto": "sans",
|
|
6
|
+
"Open Sans": "sans",
|
|
7
|
+
"Inter": "sans",
|
|
8
|
+
"Lato": "sans",
|
|
9
|
+
"Montserrat": "sans",
|
|
10
|
+
"Merriweather": "serif",
|
|
11
|
+
"Playfair Display": "serif",
|
|
12
|
+
"Lora": "serif",
|
|
13
|
+
"PT Serif": "serif",
|
|
14
|
+
"Noto Serif": "serif",
|
|
15
|
+
"Oswald": "display",
|
|
16
|
+
"Bebas Neue": "display",
|
|
17
|
+
"Anton": "display",
|
|
18
|
+
"Lobster": "display",
|
|
19
|
+
"Pacifico": "display",
|
|
20
|
+
"Dancing Script": "handwriting",
|
|
21
|
+
"Caveat": "handwriting",
|
|
22
|
+
"Shadows Into Light": "handwriting",
|
|
23
|
+
"Satisfy": "handwriting",
|
|
24
|
+
"Great Vibes": "handwriting",
|
|
25
|
+
"Roboto Mono": "mono",
|
|
26
|
+
"Source Code Pro": "mono",
|
|
27
|
+
"JetBrains Mono": "mono",
|
|
28
|
+
"Fira Code": "mono",
|
|
29
|
+
"Inconsolata": "mono"
|
|
30
|
+
};
|
|
31
|
+
const DEFAULT_FALLBACKS = {
|
|
32
|
+
sans: "ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif",
|
|
33
|
+
serif: "ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif",
|
|
34
|
+
mono: "ui-monospace, Menlo, Consolas, monospace",
|
|
35
|
+
display: "Impact, \"Arial Black\", system-ui, sans-serif",
|
|
36
|
+
handwriting: "\"Segoe Script\", \"Brush Script MT\", cursive"
|
|
37
|
+
};
|
|
38
|
+
const PROVIDER_BASE_URL = {
|
|
39
|
+
google: "https://fonts.googleapis.com/css2",
|
|
40
|
+
bunny: "https://fonts.bunny.net/css2"
|
|
41
|
+
};
|
|
42
|
+
function slugify(family) {
|
|
43
|
+
return family.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
44
|
+
}
|
|
45
|
+
function buildProviderUrl(opts) {
|
|
46
|
+
const familyParam = opts.family.trim().replace(/\s+/g, "+");
|
|
47
|
+
const weights = [...opts.weights].sort((a, b) => a - b);
|
|
48
|
+
const hasItalic = opts.styles.includes("italic");
|
|
49
|
+
const hasNormal = opts.styles.includes("normal");
|
|
50
|
+
const axis = hasItalic ? `:ital,wght@${weights.flatMap((w) => [...hasNormal ? [`0,${w}`] : [], `1,${w}`]).join(";")}` : `:wght@${weights.join(";")}`;
|
|
51
|
+
return `${PROVIDER_BASE_URL[opts.provider]}?family=${familyParam}${axis}&display=${opts.display}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Register a font for the current email template.
|
|
55
|
+
*
|
|
56
|
+
* Builds a Google Fonts stylesheet URL from `family`/`weights`/`display`/`styles`
|
|
57
|
+
* (or uses `url` as-is). The renderer injects a `<link>` tag into `<head>`
|
|
58
|
+
* and merges `--font-{slug}` declarations into the template's existing
|
|
59
|
+
* `@import "tailwindcss"` style block so a `font-{slug}` utility class
|
|
60
|
+
* is generated. If no Tailwind import is found, falls back to a `:root`
|
|
61
|
+
* declaration so the CSS variable is still available.
|
|
62
|
+
*
|
|
63
|
+
* Usage in SFC <script setup>:
|
|
64
|
+
* ```ts
|
|
65
|
+
* useFont({ family: 'Roboto', fallback: 'Verdana, sans-serif', weights: [400, 600] })
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function useFont(options) {
|
|
69
|
+
const ctx = inject(RenderContextKey);
|
|
70
|
+
if (!ctx) return;
|
|
71
|
+
ctx.fonts = ctx.fonts ?? [];
|
|
72
|
+
if (ctx.fonts.some((f) => f.family === options.family)) return;
|
|
73
|
+
const url = options.url ?? buildProviderUrl({
|
|
74
|
+
family: options.family,
|
|
75
|
+
provider: options.provider ?? "google",
|
|
76
|
+
weights: options.weights ?? [400],
|
|
77
|
+
display: options.display ?? "swap",
|
|
78
|
+
styles: options.styles ?? ["normal"]
|
|
79
|
+
});
|
|
80
|
+
const fallback = options.fallback ?? DEFAULT_FALLBACKS[FAMILY_CATEGORIES[options.family] ?? "sans"];
|
|
81
|
+
const declaration = `${/\s/.test(options.family) ? `"${options.family}"` : options.family}, ${fallback}`;
|
|
82
|
+
ctx.fonts.push({
|
|
83
|
+
family: options.family,
|
|
84
|
+
slug: slugify(options.family),
|
|
85
|
+
declaration,
|
|
86
|
+
url
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { useFont };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=useFont.js.map
|