@maizzle/framework 6.0.0-rc.17 → 6.0.0-rc.19
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/bin/maizzle.mjs +1 -1
- package/dist/build.d.ts +6 -5
- package/dist/build.d.ts.map +1 -1
- package/dist/{build.mjs → build.js} +23 -15
- package/dist/build.js.map +1 -0
- package/dist/components/Body.vue +10 -0
- package/dist/components/Button.vue +86 -49
- package/dist/components/Column.vue +10 -0
- package/dist/components/Container.vue +35 -7
- package/dist/components/Hr.vue +33 -0
- package/dist/components/Html.vue +29 -1
- package/dist/components/Layout.vue +27 -12
- package/dist/components/MarkdownLayout.vue +39 -0
- package/dist/components/NotPlaintext.vue +14 -0
- package/dist/components/{Vml.vue → OutlookBg.vue} +1 -1
- package/dist/components/Overlap.vue +10 -0
- package/dist/components/Plaintext.vue +14 -0
- package/dist/components/Preheader.vue +3 -8
- package/dist/components/QrCode.vue +157 -0
- package/dist/components/Row.vue +10 -0
- package/dist/components/Section.vue +10 -0
- package/dist/components/Spacer.vue +28 -27
- package/dist/components/{utils.mjs → utils.js} +2 -2
- package/dist/components/utils.js.map +1 -0
- package/dist/composables/{defineConfig.mjs → defineConfig.js} +4 -5
- package/dist/composables/defineConfig.js.map +1 -0
- package/dist/composables/{renderContext.mjs → renderContext.js} +2 -2
- 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.mjs → useConfig.js} +2 -3
- package/dist/composables/useConfig.js.map +1 -0
- package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
- package/dist/composables/useDoctype.js.map +1 -0
- package/dist/composables/{useEvent.mjs → useEvent.js} +3 -4
- package/dist/composables/useEvent.js.map +1 -0
- package/dist/composables/{useFont.mjs → useFont.js} +3 -4
- package/dist/composables/useFont.js.map +1 -0
- package/dist/composables/{useOutlookFallback.mjs → useOutlookFallback.js} +2 -3
- package/dist/composables/useOutlookFallback.js.map +1 -0
- package/dist/composables/usePlaintext.d.ts +2 -0
- package/dist/composables/usePlaintext.d.ts.map +1 -1
- package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
- package/dist/composables/usePlaintext.js.map +1 -0
- package/dist/composables/{usePreheader.mjs → usePreheader.js} +3 -4
- 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.mjs → defaults.js} +9 -3
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/{index.mjs → index.js} +4 -5
- package/dist/config/index.js.map +1 -0
- package/dist/events/index.d.ts +8 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/{index.mjs → index.js} +21 -5
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +12 -9
- package/dist/index.js +36 -0
- package/dist/{plaintext.mjs → plaintext.js} +4 -5
- package/dist/plaintext.js.map +1 -0
- package/dist/{plugin.mjs → plugin.js} +6 -7
- package/dist/plugin.js.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.mjs → pruneVars.js} +2 -2
- package/dist/plugins/postcss/pruneVars.js.map +1 -0
- package/dist/plugins/postcss/{quoteFontFamilies.mjs → quoteFontFamilies.js} +2 -2
- package/dist/plugins/postcss/quoteFontFamilies.js.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.mjs → resolveMaizzleImports.js} +2 -3
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
- package/dist/plugins/postcss/{resolveProps.mjs → resolveProps.js} +2 -2
- package/dist/plugins/postcss/resolveProps.js.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.mjs → tailwindCleanup.js} +2 -2
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
- package/dist/{prepare.mjs → prepare.js} +5 -6
- 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/createRenderer.d.ts.map +1 -1
- package/dist/render/{createRenderer.mjs → createRenderer.js} +24 -19
- package/dist/render/createRenderer.js.map +1 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/{index.mjs → index.js} +18 -11
- package/dist/render/index.js.map +1 -0
- package/dist/render/{injectFonts.mjs → injectFonts.js} +3 -4
- package/dist/render/injectFonts.js.map +1 -0
- package/dist/render/plugins/{codeBlockExtract.mjs → codeBlockExtract.js} +2 -2
- package/dist/render/plugins/codeBlockExtract.js.map +1 -0
- package/dist/render/plugins/{markdownExtract.mjs → markdownExtract.js} +2 -3
- package/dist/render/plugins/markdownExtract.js.map +1 -0
- package/dist/render/plugins/{rawExtract.mjs → rawExtract.js} +2 -2
- package/dist/render/plugins/rawExtract.js.map +1 -0
- package/dist/render/plugins/{rowSourceLocation.mjs → rowSourceLocation.js} +2 -2
- package/dist/render/plugins/rowSourceLocation.js.map +1 -0
- package/dist/serve.d.ts +2 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/{serve.mjs → serve.js} +20 -15
- package/dist/serve.js.map +1 -0
- package/dist/server/{compatibility.mjs → compatibility.js} +5 -6
- package/dist/server/compatibility.js.map +1 -0
- package/dist/server/{email.mjs → email.js} +2 -3
- package/dist/server/email.js.map +1 -0
- package/dist/server/{linter.mjs → linter.js} +3 -4
- package/dist/server/linter.js.map +1 -0
- package/dist/server/{sfc-utils.mjs → sfc-utils.js} +2 -3
- package/dist/server/sfc-utils.js.map +1 -0
- package/dist/server/ui/App.vue +18 -0
- package/dist/server/ui/components/ui/command/Command.vue +4 -1
- 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.mjs → addAttributes.js} +6 -7
- package/dist/transformers/addAttributes.js.map +1 -0
- package/dist/transformers/attributeToStyle.d.ts +27 -14
- package/dist/transformers/attributeToStyle.d.ts.map +1 -1
- package/dist/transformers/attributeToStyle.js +94 -0
- package/dist/transformers/attributeToStyle.js.map +1 -0
- package/dist/transformers/base.d.ts +66 -3
- package/dist/transformers/base.d.ts.map +1 -1
- package/dist/transformers/{base.mjs → base.js} +56 -30
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/{columnWidth.mjs → columnWidth.js} +4 -5
- package/dist/transformers/columnWidth.js.map +1 -0
- package/dist/transformers/entities.d.ts +31 -2
- package/dist/transformers/entities.d.ts.map +1 -1
- package/dist/transformers/entities.js +73 -0
- package/dist/transformers/entities.js.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 +31 -10
- package/dist/transformers/filters/index.d.ts.map +1 -1
- package/dist/transformers/filters/index.js +89 -0
- package/dist/transformers/filters/index.js.map +1 -0
- package/dist/transformers/format.d.ts +14 -7
- package/dist/transformers/format.d.ts.map +1 -1
- package/dist/transformers/format.js +30 -0
- package/dist/transformers/format.js.map +1 -0
- package/dist/transformers/index.js +133 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/inlineCss.d.ts +84 -0
- package/dist/transformers/inlineCss.d.ts.map +1 -0
- package/dist/transformers/{inlineCSS.mjs → inlineCss.js} +28 -18
- package/dist/transformers/inlineCss.js.map +1 -0
- package/dist/transformers/inlineLink.d.ts +26 -5
- package/dist/transformers/inlineLink.d.ts.map +1 -1
- package/dist/transformers/{inlineLink.mjs → inlineLink.js} +34 -10
- package/dist/transformers/inlineLink.js.map +1 -0
- package/dist/transformers/minify.d.ts +13 -9
- package/dist/transformers/minify.d.ts.map +1 -1
- package/dist/transformers/minify.js +25 -0
- package/dist/transformers/minify.js.map +1 -0
- package/dist/transformers/msoPlaceholders.d.ts +28 -0
- package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
- package/dist/transformers/msoPlaceholders.js +88 -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.mjs → purgeCss.js} +36 -29
- package/dist/transformers/purgeCss.js.map +1 -0
- package/dist/transformers/removeAttributes.d.ts +43 -20
- package/dist/transformers/removeAttributes.d.ts.map +1 -1
- package/dist/transformers/removeAttributes.js +70 -0
- package/dist/transformers/removeAttributes.js.map +1 -0
- package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
- package/dist/transformers/replaceStrings.js.map +1 -0
- package/dist/transformers/{safeClassNames.mjs → safeClassNames.js} +4 -5
- package/dist/transformers/safeClassNames.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 +61 -0
- package/dist/transformers/shorthandCss.js.map +1 -0
- package/dist/transformers/sixHex.d.ts +16 -7
- package/dist/transformers/sixHex.d.ts.map +1 -1
- package/dist/transformers/sixHex.js +42 -0
- package/dist/transformers/sixHex.js.map +1 -0
- package/dist/transformers/{tailwindComponent.mjs → tailwindComponent.js} +5 -6
- package/dist/transformers/tailwindComponent.js.map +1 -0
- package/dist/transformers/{tailwindcss.mjs → tailwindcss.js} +6 -7
- package/dist/transformers/tailwindcss.js.map +1 -0
- package/dist/transformers/urlQuery.d.ts +26 -14
- package/dist/transformers/urlQuery.d.ts.map +1 -1
- package/dist/transformers/urlQuery.js +77 -0
- package/dist/transformers/urlQuery.js.map +1 -0
- package/dist/types/config.d.ts +108 -15
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +1 -0
- package/dist/utils/ast/index.js +4 -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.mjs → serializer.js} +3 -4
- package/dist/utils/ast/serializer.js.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/{compileTailwindCss.mjs → compileTailwindCss.js} +8 -9
- package/dist/utils/compileTailwindCss.js.map +1 -0
- package/dist/utils/{decodeStyleEntities.mjs → decodeStyleEntities.js} +2 -2
- package/dist/utils/decodeStyleEntities.js.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.mjs → url.js} +2 -3
- package/dist/utils/url.js.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +8 -0
- package/node_modules/@clack/core/dist/index.d.mts +18 -4
- package/node_modules/@clack/core/dist/index.mjs +16 -10
- package/node_modules/@clack/core/dist/index.mjs.map +1 -1
- package/node_modules/@clack/core/package.json +5 -2
- package/node_modules/@clack/prompts/CHANGELOG.md +15 -0
- package/node_modules/@clack/prompts/README.md +107 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +16 -11
- package/node_modules/@clack/prompts/dist/index.mjs +114 -107
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
- 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 -1
- package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -1
- package/node_modules/fast-wrap-ansi/package.json +2 -2
- 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 +1 -1
- 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 +29 -24
- package/node_modules/maizzle/dist/index.mjs +28 -8
- package/node_modules/maizzle/package.json +1 -1
- package/node_modules/tinyexec/README.md +1 -1
- package/node_modules/tinyexec/dist/main.d.mts +6 -6
- package/node_modules/tinyexec/dist/main.mjs +126 -134
- package/node_modules/tinyexec/package.json +9 -9
- package/package.json +4 -4
- package/dist/build.mjs.map +0 -1
- package/dist/components/Divider.vue +0 -133
- package/dist/components/utils.mjs.map +0 -1
- package/dist/composables/defineConfig.mjs.map +0 -1
- package/dist/composables/renderContext.mjs.map +0 -1
- package/dist/composables/useConfig.mjs.map +0 -1
- package/dist/composables/useDoctype.mjs.map +0 -1
- package/dist/composables/useEvent.mjs.map +0 -1
- package/dist/composables/useFont.mjs.map +0 -1
- package/dist/composables/useOutlookFallback.mjs.map +0 -1
- package/dist/composables/usePlaintext.mjs.map +0 -1
- package/dist/composables/usePreheader.mjs.map +0 -1
- package/dist/config/defaults.mjs.map +0 -1
- package/dist/config/index.mjs.map +0 -1
- package/dist/events/index.mjs.map +0 -1
- package/dist/index.mjs +0 -34
- package/dist/plaintext.mjs.map +0 -1
- package/dist/plugin.mjs.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
- package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
- package/dist/plugins/postcss/quoteFontFamilies.mjs.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
- package/dist/plugins/postcss/resolveMaizzleImports.mjs.map +0 -1
- package/dist/plugins/postcss/resolveProps.mjs.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
- package/dist/prepare.mjs.map +0 -1
- package/dist/render/createRenderer.mjs.map +0 -1
- package/dist/render/index.mjs.map +0 -1
- package/dist/render/injectFonts.mjs.map +0 -1
- package/dist/render/plugins/codeBlockExtract.mjs.map +0 -1
- package/dist/render/plugins/markdownExtract.mjs.map +0 -1
- package/dist/render/plugins/rawExtract.mjs.map +0 -1
- package/dist/render/plugins/rowSourceLocation.mjs.map +0 -1
- package/dist/serve.mjs.map +0 -1
- package/dist/server/compatibility.mjs.map +0 -1
- package/dist/server/email.mjs.map +0 -1
- package/dist/server/linter.mjs.map +0 -1
- package/dist/server/sfc-utils.mjs.map +0 -1
- package/dist/transformers/addAttributes.mjs.map +0 -1
- package/dist/transformers/attributeToStyle.mjs +0 -80
- package/dist/transformers/attributeToStyle.mjs.map +0 -1
- package/dist/transformers/base.mjs.map +0 -1
- package/dist/transformers/columnWidth.mjs.map +0 -1
- package/dist/transformers/entities.mjs +0 -41
- package/dist/transformers/entities.mjs.map +0 -1
- package/dist/transformers/filters/defaults.mjs.map +0 -1
- package/dist/transformers/filters/index.mjs +0 -67
- package/dist/transformers/filters/index.mjs.map +0 -1
- package/dist/transformers/format.mjs +0 -26
- package/dist/transformers/format.mjs.map +0 -1
- package/dist/transformers/index.mjs +0 -87
- package/dist/transformers/index.mjs.map +0 -1
- package/dist/transformers/inlineCSS.d.ts +0 -17
- package/dist/transformers/inlineCSS.d.ts.map +0 -1
- package/dist/transformers/inlineCSS.mjs.map +0 -1
- package/dist/transformers/inlineLink.mjs.map +0 -1
- package/dist/transformers/minify.mjs +0 -24
- package/dist/transformers/minify.mjs.map +0 -1
- package/dist/transformers/msoWidthFromClass.d.ts +0 -19
- package/dist/transformers/msoWidthFromClass.d.ts.map +0 -1
- package/dist/transformers/msoWidthFromClass.mjs +0 -61
- package/dist/transformers/msoWidthFromClass.mjs.map +0 -1
- package/dist/transformers/purgeCSS.d.ts +0 -23
- package/dist/transformers/purgeCSS.d.ts.map +0 -1
- package/dist/transformers/purgeCSS.mjs.map +0 -1
- package/dist/transformers/removeAttributes.mjs +0 -63
- package/dist/transformers/removeAttributes.mjs.map +0 -1
- package/dist/transformers/replaceStrings.mjs.map +0 -1
- package/dist/transformers/safeClassNames.mjs.map +0 -1
- package/dist/transformers/shorthandCSS.d.ts +0 -24
- package/dist/transformers/shorthandCSS.d.ts.map +0 -1
- package/dist/transformers/shorthandCSS.mjs +0 -48
- package/dist/transformers/shorthandCSS.mjs.map +0 -1
- package/dist/transformers/sixHex.mjs +0 -30
- package/dist/transformers/sixHex.mjs.map +0 -1
- package/dist/transformers/tailwindComponent.mjs.map +0 -1
- package/dist/transformers/tailwindcss.mjs.map +0 -1
- package/dist/transformers/urlQuery.mjs +0 -65
- package/dist/transformers/urlQuery.mjs.map +0 -1
- package/dist/types/config.mjs +0 -1
- package/dist/types/index.mjs +0 -1
- package/dist/utils/ast/index.mjs +0 -5
- package/dist/utils/ast/parser.mjs.map +0 -1
- package/dist/utils/ast/serializer.mjs.map +0 -1
- package/dist/utils/ast/walker.mjs.map +0 -1
- package/dist/utils/compileTailwindCss.mjs.map +0 -1
- package/dist/utils/decodeStyleEntities.mjs.map +0 -1
- package/dist/utils/detect.mjs.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
|
@@ -62,6 +62,16 @@ const props = defineProps({
|
|
|
62
62
|
type: String,
|
|
63
63
|
default: '0,-60px,0,0'
|
|
64
64
|
},
|
|
65
|
+
/**
|
|
66
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
67
|
+
* component and all descendants.
|
|
68
|
+
*
|
|
69
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
70
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
71
|
+
* in all built-in components.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
65
75
|
outlookFallback: outlookFallbackProp,
|
|
66
76
|
})
|
|
67
77
|
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
defineProps({
|
|
3
|
-
/** Number of ` ͏` filler
|
|
4
|
-
|
|
5
|
-
type: Number,
|
|
6
|
-
default: 150
|
|
7
|
-
},
|
|
8
|
-
/** Number of `­` entities to render. */
|
|
9
|
-
shyCount: {
|
|
3
|
+
/** Number of ` ͏` filler sequences to render after the preview text. */
|
|
4
|
+
spaces: {
|
|
10
5
|
type: Number,
|
|
11
6
|
default: 150
|
|
12
7
|
}
|
|
@@ -15,6 +10,6 @@ defineProps({
|
|
|
15
10
|
|
|
16
11
|
<template>
|
|
17
12
|
<Teleport to="body:start">
|
|
18
|
-
<div style="display: none"><slot /><template v-for="i in
|
|
13
|
+
<div style="display: none"><slot /><template v-for="i in spaces" :key="i"> ͏ </template> </div>
|
|
19
14
|
</Teleport>
|
|
20
15
|
</template>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createStaticVNode, type PropType } from 'vue'
|
|
3
|
+
import { twMerge } from 'tailwind-merge'
|
|
4
|
+
import { encode } from 'uqr'
|
|
5
|
+
|
|
6
|
+
type Ecc = 'L' | 'M' | 'Q' | 'H'
|
|
7
|
+
|
|
8
|
+
const escapeAttr = (v: string) =>
|
|
9
|
+
v
|
|
10
|
+
.replace(/&/g, '&')
|
|
11
|
+
.replace(/</g, '<')
|
|
12
|
+
.replace(/>/g, '>')
|
|
13
|
+
.replace(/"/g, '"')
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Parse a Tailwind sizing token's pixel equivalent.
|
|
17
|
+
*
|
|
18
|
+
* Assumes the default v4 spacing scale (1 unit = 0.25rem),
|
|
19
|
+
* which resolves to 4px at the standard 16px root font.
|
|
20
|
+
* Arbitrary values accept `px` and `rem`; other units
|
|
21
|
+
* fall through to the caller's default.
|
|
22
|
+
*/
|
|
23
|
+
function tokenToPx(token: string): number {
|
|
24
|
+
const seg = token.split(':').at(-1) ?? ''
|
|
25
|
+
const m = seg.match(/^(?:size|w|h)-(.+)$/)
|
|
26
|
+
if (!m) return 0
|
|
27
|
+
const v = m[1]
|
|
28
|
+
if (v.startsWith('[') && v.endsWith(']')) {
|
|
29
|
+
const um = v.slice(1, -1).match(/^([\d.]+)(px|rem)?$/)
|
|
30
|
+
if (!um) return 0
|
|
31
|
+
const n = Number.parseFloat(um[1])
|
|
32
|
+
return um[2] === 'rem' ? n * 16 : n
|
|
33
|
+
}
|
|
34
|
+
if (/^\d+(?:\.\d+)?$/.test(v)) return Number.parseFloat(v) * 4
|
|
35
|
+
return 0
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Partition a class string into two buckets:
|
|
40
|
+
*
|
|
41
|
+
* - `sizing` — width/height/size utilities used for cell px math.
|
|
42
|
+
* - `neutral` — everything else; lands on the table verbatim.
|
|
43
|
+
*/
|
|
44
|
+
function partition(cls: string): { neutral: string[]; sizing: string[] } {
|
|
45
|
+
const neutral: string[] = []
|
|
46
|
+
const sizing: string[] = []
|
|
47
|
+
for (const t of cls.split(/\s+/).filter(Boolean)) {
|
|
48
|
+
const last = t.split(':').at(-1) ?? ''
|
|
49
|
+
if (/^(?:size|w|h|min-w|min-h|max-w|max-h)-/.test(last)) sizing.push(t)
|
|
50
|
+
else neutral.push(t)
|
|
51
|
+
}
|
|
52
|
+
return { neutral, sizing }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'QrCode',
|
|
57
|
+
inheritAttrs: false,
|
|
58
|
+
props: {
|
|
59
|
+
/** Data to encode (URL or arbitrary text). */
|
|
60
|
+
value: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: true,
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Error correction level: redundancy that keeps the code
|
|
66
|
+
* scannable when partially obscured (e.g. a logo overlay),
|
|
67
|
+
* at the cost of a larger matrix.
|
|
68
|
+
*
|
|
69
|
+
* - `L` ~7% recovery
|
|
70
|
+
* - `M` ~15% recovery (default, fine for on-screen display)
|
|
71
|
+
* - `Q` ~25% recovery
|
|
72
|
+
* - `H` ~30% recovery
|
|
73
|
+
*/
|
|
74
|
+
ecc: {
|
|
75
|
+
type: String as PropType<Ecc>,
|
|
76
|
+
default: 'M',
|
|
77
|
+
validator: (v: string) => ['L', 'M', 'Q', 'H'].includes(v),
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Width of the light "quiet zone" around the code, in modules.
|
|
81
|
+
* Spec recommends ≥ 4; 1 is plenty for on-screen scans.
|
|
82
|
+
*/
|
|
83
|
+
border: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: 1,
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Accessible label exposed via `aria-label` on the table.
|
|
89
|
+
*/
|
|
90
|
+
alt: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: '',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
setup(props, { attrs }) {
|
|
96
|
+
const userClass = String(attrs.class ?? '')
|
|
97
|
+
const { neutral, sizing } = partition(userClass)
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Effective pixel size from the user's sizing token, else
|
|
101
|
+
* 120px (= `size-30` on the default v4 spacing scale).
|
|
102
|
+
*/
|
|
103
|
+
const sizingToken = sizing[0]
|
|
104
|
+
const effectivePx = sizingToken ? (tokenToPx(sizingToken) || 120) : 120
|
|
105
|
+
|
|
106
|
+
const result = encode(props.value, {
|
|
107
|
+
ecc: props.ecc,
|
|
108
|
+
border: props.border,
|
|
109
|
+
boostEcc: true,
|
|
110
|
+
})
|
|
111
|
+
const matrix = result.data
|
|
112
|
+
const dim = matrix.length
|
|
113
|
+
const cellPx = Math.max(1, Math.floor(effectivePx / dim))
|
|
114
|
+
const totalPx = cellPx * dim
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Table base classes:
|
|
118
|
+
*
|
|
119
|
+
* - `size-[Npx]` matches the outer to cell math (no stripe).
|
|
120
|
+
* - `[&_td]:*` sizes each cell and zeroes its font-size.
|
|
121
|
+
* - `bg-*` paints the table; light cells stay transparent.
|
|
122
|
+
* - `qr:*` paints dark cells via the registered variant.
|
|
123
|
+
*
|
|
124
|
+
* Defaults and user tokens share each form, so `twMerge`
|
|
125
|
+
* resolves overrides cleanly.
|
|
126
|
+
*/
|
|
127
|
+
const baseTable = [
|
|
128
|
+
`size-[${totalPx}px]`,
|
|
129
|
+
`[&_td]:w-[${cellPx}px]`,
|
|
130
|
+
`[&_td]:h-[${cellPx}px]`,
|
|
131
|
+
'[&_td]:text-[0px]',
|
|
132
|
+
'bg-white',
|
|
133
|
+
'dark:bg-gray-950',
|
|
134
|
+
'qr:bg-gray-950',
|
|
135
|
+
'dark:qr:bg-white',
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
const merged = twMerge([...baseTable, ...neutral].join(' '))
|
|
139
|
+
|
|
140
|
+
let rows = ''
|
|
141
|
+
for (let y = 0; y < dim; y++) {
|
|
142
|
+
let cells = ''
|
|
143
|
+
const row = matrix[y]
|
|
144
|
+
for (let x = 0; x < dim; x++) {
|
|
145
|
+
cells += row[x] ? '<td class="qd"></td>' : '<td></td>'
|
|
146
|
+
}
|
|
147
|
+
rows += `<tr>${cells}</tr>`
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const altAttr = props.alt ? ` aria-label="${escapeAttr(props.alt)}"` : ''
|
|
151
|
+
const styleAttr = attrs.style ? ` style="${String(attrs.style)}"` : ''
|
|
152
|
+
const html = `<table class="${escapeAttr(merged)}" role="img"${altAttr} cellpadding="0" cellspacing="0" border="0"${styleAttr}>${rows}</table>`
|
|
153
|
+
|
|
154
|
+
return () => createStaticVNode(html, 1)
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
</script>
|
package/dist/components/Row.vue
CHANGED
|
@@ -38,6 +38,16 @@ const props = defineProps({
|
|
|
38
38
|
type: Number,
|
|
39
39
|
default: null
|
|
40
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
43
|
+
* component and all descendants.
|
|
44
|
+
*
|
|
45
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
46
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
47
|
+
* in all built-in components.
|
|
48
|
+
*
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
41
51
|
outlookFallback: outlookFallbackProp,
|
|
42
52
|
})
|
|
43
53
|
|
|
@@ -33,6 +33,16 @@ const props = defineProps({
|
|
|
33
33
|
type: String,
|
|
34
34
|
default: undefined
|
|
35
35
|
},
|
|
36
|
+
/**
|
|
37
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
38
|
+
* component and all descendants.
|
|
39
|
+
*
|
|
40
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
41
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
42
|
+
* in all built-in components.
|
|
43
|
+
*
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
36
46
|
outlookFallback: outlookFallbackProp,
|
|
37
47
|
})
|
|
38
48
|
|
|
@@ -1,53 +1,48 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { computed, h, useAttrs } from 'vue'
|
|
3
3
|
import { normalizeToPixels, outlookFallbackProp } from './utils.ts'
|
|
4
4
|
import { useOutlookFallback } from '../composables/useOutlookFallback'
|
|
5
5
|
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
6
8
|
const props = defineProps({
|
|
7
9
|
/** The type of spacer. */
|
|
8
10
|
type: {
|
|
9
11
|
type: String as () => 'vertical' | 'horizontal',
|
|
10
12
|
default: 'vertical'
|
|
11
13
|
},
|
|
12
|
-
/** The height of the spacer (vertical). */
|
|
13
|
-
height: {
|
|
14
|
-
type: [String, Number],
|
|
15
|
-
default: null
|
|
16
|
-
},
|
|
17
14
|
/** The width of the spacer (horizontal). */
|
|
18
15
|
width: {
|
|
19
16
|
type: [String, Number],
|
|
20
17
|
default: 16
|
|
21
18
|
},
|
|
22
|
-
/** The alternative height to use in Outlook. */
|
|
23
|
-
msoHeight: {
|
|
24
|
-
type: [String, Number],
|
|
25
|
-
default: null
|
|
26
|
-
},
|
|
27
19
|
outlookFallback: outlookFallbackProp,
|
|
28
20
|
})
|
|
29
21
|
|
|
22
|
+
const attrs = useAttrs()
|
|
30
23
|
const outlookFallback = useOutlookFallback(props.outlookFallback)
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return Number.parseFloat(value) || 0
|
|
35
|
-
}
|
|
25
|
+
const HEIGHT_RE = /(?:^|\s)h-([\w./\-[\]%]+)/g
|
|
26
|
+
const LEADING_RE = /(?:^|\s)leading-/
|
|
36
27
|
|
|
37
|
-
const
|
|
38
|
-
const
|
|
28
|
+
const verticalClass = computed(() => {
|
|
29
|
+
const userClass = (attrs.class as string) || ''
|
|
30
|
+
if (!userClass) return ''
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
32
|
+
const heights = [...userClass.matchAll(HEIGHT_RE)]
|
|
33
|
+
const stripped = userClass.replace(HEIGHT_RE, ' ').replace(/\s+/g, ' ').trim()
|
|
43
34
|
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
}
|
|
35
|
+
if (!heights.length) return stripped
|
|
36
|
+
if (LEADING_RE.test(stripped)) return stripped
|
|
47
37
|
|
|
48
|
-
return
|
|
38
|
+
return `${stripped} leading-${heights[heights.length - 1][1]}`.trim()
|
|
49
39
|
})
|
|
50
40
|
|
|
41
|
+
function parsePixelValue(value: string | number): number {
|
|
42
|
+
if (typeof value === 'number') return value
|
|
43
|
+
return Number.parseFloat(value) || 0
|
|
44
|
+
}
|
|
45
|
+
|
|
51
46
|
const horizontalStyles = computed(() => {
|
|
52
47
|
const mso = outlookFallback ? msoFontWidth.value : ''
|
|
53
48
|
return `display:inline-block; width: ${normalizeToPixels(props.width)}; font-size: 16px;${mso}`
|
|
@@ -71,14 +66,20 @@ const emspCount = computed(() => {
|
|
|
71
66
|
})
|
|
72
67
|
|
|
73
68
|
const emsps = computed(() => '\u2003'.repeat(emspCount.value))
|
|
69
|
+
|
|
70
|
+
const HorizontalSpacer = () =>
|
|
71
|
+
h('i', { ...attrs, style: horizontalStyles.value }, emsps.value)
|
|
74
72
|
</script>
|
|
75
73
|
|
|
76
74
|
<template>
|
|
77
75
|
<template v-if="type === 'horizontal'">
|
|
78
|
-
<
|
|
76
|
+
<HorizontalSpacer />
|
|
79
77
|
</template>
|
|
80
78
|
<template v-else>
|
|
81
|
-
<div
|
|
82
|
-
|
|
79
|
+
<div
|
|
80
|
+
role="separator"
|
|
81
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
82
|
+
:class="verticalClass"
|
|
83
|
+
>‍</div>
|
|
83
84
|
</template>
|
|
84
85
|
</template>
|
|
@@ -44,7 +44,7 @@ const outlookFallbackProp = {
|
|
|
44
44
|
type: Boolean,
|
|
45
45
|
default: null
|
|
46
46
|
};
|
|
47
|
-
|
|
48
47
|
//#endregion
|
|
49
48
|
export { hasHeightInStyle, hasHeightUtility, hasWidthInStyle, hasWidthUtility, nextId, normalizeToPixels, outlookFallbackProp };
|
|
50
|
-
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/components/utils.ts"],"sourcesContent":["export function normalizeToPixels(value: string | number): string {\n if (typeof value === 'number' || Number.isFinite(Number(value))) {\n return `${value}px`\n }\n return value\n}\n\nconst counters: Record<string, number> = {}\n\n/**\n * Module-scoped sequential ID generator. Used by components to mint\n * unique marker ids (e.g. `c1`, `c2`) for the post-render transformer.\n *\n * Must live here (not inside `<script setup>`) because Vue compiles\n * `<script setup>` into the component's `setup()` function — any\n * `let counter = 0` there resets per instance, causing id collisions.\n */\nexport function nextId(prefix: string): string {\n counters[prefix] = (counters[prefix] ?? 0) + 1\n return `${prefix}${counters[prefix]}`\n}\n\nexport function hasWidthUtility(classStr: string): boolean {\n return classStr.split(/\\s+/).some((c) => {\n const utility = c.split(':').pop() ?? ''\n const clean = utility.replace(/^!/, '')\n return /^(w-|max-w-|min-w-)/.test(clean)\n })\n}\n\nexport function hasWidthInStyle(styleStr: string): boolean {\n return /(?:^|;\\s*)(?:max-width|width)\\s*:/i.test(styleStr)\n}\n\nexport function hasHeightUtility(classStr: string): boolean {\n return classStr.split(/\\s+/).some((c) => {\n const utility = c.split(':').pop() ?? ''\n const clean = utility.replace(/^!/, '')\n return /^(h-|max-h-|min-h-)/.test(clean)\n })\n}\n\nexport function hasHeightInStyle(styleStr: string): boolean {\n return /(?:^|;\\s*)(?:max-height|height)\\s*:/i.test(styleStr)\n}\n\n/**\n * Shared prop for components that emit MSO/VML fallback markup. The\n * `null` default acts as the \"unset\" sentinel — `useOutlookFallback`\n * treats `null` as inherit-from-ancestor (root default `true`),\n * letting users override per-component without losing inheritance.\n */\nexport const outlookFallbackProp = {\n type: Boolean,\n default: null,\n} as const\n\n"],"mappings":";AAAA,SAAgB,kBAAkB,OAAgC;CAChE,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,OAAO,MAAM,CAAC,EAC7D,OAAO,GAAG,MAAM;CAElB,OAAO;;AAGT,MAAM,WAAmC,EAAE;;;;;;;;;AAU3C,SAAgB,OAAO,QAAwB;CAC7C,SAAS,WAAW,SAAS,WAAW,KAAK;CAC7C,OAAO,GAAG,SAAS,SAAS;;AAG9B,SAAgB,gBAAgB,UAA2B;CACzD,OAAO,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;EAEvC,MAAM,SADU,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,IAChB,QAAQ,MAAM,GAAG;EACvC,OAAO,sBAAsB,KAAK,MAAM;GACxC;;AAGJ,SAAgB,gBAAgB,UAA2B;CACzD,OAAO,qCAAqC,KAAK,SAAS;;AAG5D,SAAgB,iBAAiB,UAA2B;CAC1D,OAAO,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;EAEvC,MAAM,SADU,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,IAChB,QAAQ,MAAM,GAAG;EACvC,OAAO,sBAAsB,KAAK,MAAM;GACxC;;AAGJ,SAAgB,iBAAiB,UAA2B;CAC1D,OAAO,uCAAuC,KAAK,SAAS;;;;;;;;AAS9D,MAAa,sBAAsB;CACjC,MAAM;CACN,SAAS;CACV"}
|
|
@@ -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])) {
|
|
@@ -28,7 +27,7 @@ function defineConfig(data = {}) {
|
|
|
28
27
|
}
|
|
29
28
|
return data;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
31
|
export { defineConfig };
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
//# 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 * Works in both contexts:\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,KAAK,EAAE;EAC3B,IAAI,OAAO;EACX,OAAO;;EAET;;;;;;;;;AAUF,SAAgB,aAAa,OAA+B,EAAE,EAAiB;CAE7E,IAAI,oBAAoB,EAAE;EAExB,MAAM,SAAS,MAAM,MADA,OAAO,kBAAkB,EAAE,CACT,CAAC;EAExC,MAAM,MAAM,OAAO,iBAAiB;EACpC,IAAI,KAAK,IAAI,YAAY;EAEzB,QAAQ,kBAAkB,OAAO;EAEjC,OAAO;;CAIT,OAAO"}
|
|
@@ -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; shyCount: number }\n sfcConfig?: MaizzleConfig\n sfcEventHandlers: Array<{ name: EventName; handler: EventMap[EventName] }>\n plaintext?: UsePlaintextOptions\n fonts?: FontRegistration[]\n tailwindBlocks?: TailwindBlock[]\n}\n\nexport const RenderContextKey: InjectionKey<RenderContext> = Symbol('RenderContext')\n"],"mappings":";AA4BA,MAAa,mBAAgD,OAAO,gBAAgB"}
|
|
@@ -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;;;;;;;;;;iBAAgB,UAAA,CAAW,KAAA,EAAO,SAAA"}
|
|
@@ -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,iBAAiB;CACpC,IAAI,CAAC,KAAK;CACV,IAAI,YAAYA,OAAM,EAAE,KAAK,EAAE,MAAM,OAAO,EAAE,EAAE,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { inject } from "vue";
|
|
2
|
-
|
|
3
2
|
//#region src/composables/useConfig.ts
|
|
4
3
|
const MaizzleConfigKey = Symbol("MaizzleConfig");
|
|
5
4
|
function useConfig() {
|
|
@@ -7,7 +6,7 @@ function useConfig() {
|
|
|
7
6
|
if (!config) throw new Error("useConfig() requires the Maizzle plugin to provide config. Make sure you are using it inside a Maizzle template.");
|
|
8
7
|
return config;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
//#endregion
|
|
12
10
|
export { MaizzleConfigKey, useConfig };
|
|
13
|
-
|
|
11
|
+
|
|
12
|
+
//# 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\nexport const MaizzleConfigKey: InjectionKey<MaizzleConfig> = Symbol('MaizzleConfig')\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":";;AAIA,MAAa,mBAAgD,OAAO,gBAAgB;AAEpF,SAAgB,YAA2B;CACzC,MAAM,SAAS,OAAO,iBAAiB;CAEvC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,mHAAmH;CAGrI,OAAO"}
|
|
@@ -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,iBAAiB;CACpC,IAAI,KAAK,IAAI,UAAU"}
|
|
@@ -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>.
|
|
@@ -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.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,iBAAiB;CACpC,IAAI,KAAK,IAAI,iBAAiB,KAAK;EAAE;EAAM;EAAS,CAAC"}
|
|
@@ -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/useFont.ts
|
|
5
4
|
const FAMILY_CATEGORIES = {
|
|
6
5
|
"Roboto": "sans",
|
|
@@ -87,7 +86,7 @@ function useFont(options) {
|
|
|
87
86
|
url
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
|
-
|
|
91
89
|
//#endregion
|
|
92
90
|
export { useFont };
|
|
93
|
-
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=useFont.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFont.js","names":[],"sources":["../../src/composables/useFont.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\n\ntype FontCategory = 'sans' | 'serif' | 'mono' | 'display' | 'handwriting'\n\nconst FAMILY_CATEGORIES: Record<string, FontCategory> = {\n // Sans-serif\n 'Roboto': 'sans',\n 'Open Sans': 'sans',\n 'Inter': 'sans',\n 'Lato': 'sans',\n 'Montserrat': 'sans',\n // Serif\n 'Merriweather': 'serif',\n 'Playfair Display': 'serif',\n 'Lora': 'serif',\n 'PT Serif': 'serif',\n 'Noto Serif': 'serif',\n // Display\n 'Oswald': 'display',\n 'Bebas Neue': 'display',\n 'Anton': 'display',\n 'Lobster': 'display',\n 'Pacifico': 'display',\n // Handwriting\n 'Dancing Script': 'handwriting',\n 'Caveat': 'handwriting',\n 'Shadows Into Light': 'handwriting',\n 'Satisfy': 'handwriting',\n 'Great Vibes': 'handwriting',\n // Monospace\n 'Roboto Mono': 'mono',\n 'Source Code Pro': 'mono',\n 'JetBrains Mono': 'mono',\n 'Fira Code': 'mono',\n 'Inconsolata': 'mono',\n}\n\nconst DEFAULT_FALLBACKS: Record<FontCategory, string> = {\n sans: 'ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif',\n serif: 'ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif',\n mono: 'ui-monospace, Menlo, Consolas, monospace',\n display: 'Impact, \"Arial Black\", system-ui, sans-serif',\n handwriting: '\"Segoe Script\", \"Brush Script MT\", cursive',\n}\n\nexport type FontProvider = 'google' | 'bunny'\n\nexport interface UseFontOptions {\n /**\n * A single font family name, e.g. `\"Roboto\"` or `\"Open Sans\"`.\n *\n * For fallback fonts, use the `fallback` option instead of a\n * comma-separated list here.\n */\n family: string\n /** CSS fallback list appended to the `font-family` declaration. */\n fallback?: string\n /**\n * Font provider used to build the stylesheet URL when `url` is omitted.\n * Bunny Fonts is a drop-in, privacy-friendly Google Fonts mirror.\n * @default 'google'\n */\n provider?: FontProvider\n /**\n * Stylesheet URL. When provided, used as-is for the `<link href>`.\n * When omitted, a URL is built from `provider`, `family`, `weights`,\n * `display` and `styles`.\n */\n url?: string\n /** Font weights to load. Ignored when `url` is provided. */\n weights?: number[]\n /** `font-display` value. Ignored when `url` is provided. */\n display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional'\n /** Font styles to load. Ignored when `url` is provided. */\n styles?: Array<'normal' | 'italic'>\n}\n\nconst PROVIDER_BASE_URL: Record<FontProvider, string> = {\n google: 'https://fonts.googleapis.com/css2',\n bunny: 'https://fonts.bunny.net/css2',\n}\n\nfunction slugify(family: string): string {\n return family\n .trim()\n .toLowerCase()\n .replace(/\\s+/g, '-')\n .replace(/[^a-z0-9-]/g, '')\n}\n\nfunction buildProviderUrl(opts: Required<Omit<UseFontOptions, 'url' | 'fallback'>>): string {\n const familyParam = opts.family.trim().replace(/\\s+/g, '+')\n const weights = [...opts.weights].sort((a, b) => a - b)\n const hasItalic = opts.styles.includes('italic')\n const hasNormal = opts.styles.includes('normal')\n\n const axis = hasItalic\n ? `:ital,wght@${weights.flatMap(w => [\n ...(hasNormal ? [`0,${w}`] : []),\n `1,${w}`,\n ]).join(';')}`\n : `:wght@${weights.join(';')}`\n\n return `${PROVIDER_BASE_URL[opts.provider]}?family=${familyParam}${axis}&display=${opts.display}`\n}\n\n/**\n * Register a font for the current email template.\n *\n * Builds a Google Fonts stylesheet URL from `family`/`weights`/`display`/`styles`\n * (or uses `url` as-is). The renderer injects a `<link>` tag into `<head>`\n * and merges `--font-{slug}` declarations into the template's existing\n * `@import \"tailwindcss\"` style block so a `font-{slug}` utility class\n * is generated. If no Tailwind import is found, falls back to a `:root`\n * declaration so the CSS variable is still available.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * useFont({ family: 'Roboto', fallback: 'Verdana, sans-serif', weights: [400, 600] })\n * ```\n */\nexport function useFont(options: UseFontOptions): void {\n const ctx = inject(RenderContextKey)\n if (!ctx) return\n\n ctx.fonts = ctx.fonts ?? []\n if (ctx.fonts.some(f => f.family === options.family)) return\n\n const url = options.url ?? buildProviderUrl({\n family: options.family,\n provider: options.provider ?? 'google',\n weights: options.weights ?? [400],\n display: options.display ?? 'swap',\n styles: options.styles ?? ['normal'],\n })\n\n const fallback = options.fallback\n ?? DEFAULT_FALLBACKS[FAMILY_CATEGORIES[options.family] ?? 'sans']\n const quoted = /\\s/.test(options.family) ? `\"${options.family}\"` : options.family\n const declaration = `${quoted}, ${fallback}`\n\n ctx.fonts.push({\n family: options.family,\n slug: slugify(options.family),\n declaration,\n url,\n })\n}\n"],"mappings":";;;AAKA,MAAM,oBAAkD;CAEtD,UAAU;CACV,aAAa;CACb,SAAS;CACT,QAAQ;CACR,cAAc;CAEd,gBAAgB;CAChB,oBAAoB;CACpB,QAAQ;CACR,YAAY;CACZ,cAAc;CAEd,UAAU;CACV,cAAc;CACd,SAAS;CACT,WAAW;CACX,YAAY;CAEZ,kBAAkB;CAClB,UAAU;CACV,sBAAsB;CACtB,WAAW;CACX,eAAe;CAEf,eAAe;CACf,mBAAmB;CACnB,kBAAkB;CAClB,aAAa;CACb,eAAe;CAChB;AAED,MAAM,oBAAkD;CACtD,MAAM;CACN,OAAO;CACP,MAAM;CACN,SAAS;CACT,aAAa;CACd;AAkCD,MAAM,oBAAkD;CACtD,QAAQ;CACR,OAAO;CACR;AAED,SAAS,QAAQ,QAAwB;CACvC,OAAO,OACJ,MAAM,CACN,aAAa,CACb,QAAQ,QAAQ,IAAI,CACpB,QAAQ,eAAe,GAAG;;AAG/B,SAAS,iBAAiB,MAAkE;CAC1F,MAAM,cAAc,KAAK,OAAO,MAAM,CAAC,QAAQ,QAAQ,IAAI;CAC3D,MAAM,UAAU,CAAC,GAAG,KAAK,QAAQ,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE;CACvD,MAAM,YAAY,KAAK,OAAO,SAAS,SAAS;CAChD,MAAM,YAAY,KAAK,OAAO,SAAS,SAAS;CAEhD,MAAM,OAAO,YACT,cAAc,QAAQ,SAAQ,MAAK,CACjC,GAAI,YAAY,CAAC,KAAK,IAAI,GAAG,EAAE,EAC/B,KAAK,IACN,CAAC,CAAC,KAAK,IAAI,KACZ,SAAS,QAAQ,KAAK,IAAI;CAE9B,OAAO,GAAG,kBAAkB,KAAK,UAAU,UAAU,cAAc,KAAK,WAAW,KAAK;;;;;;;;;;;;;;;;;AAkB1F,SAAgB,QAAQ,SAA+B;CACrD,MAAM,MAAM,OAAO,iBAAiB;CACpC,IAAI,CAAC,KAAK;CAEV,IAAI,QAAQ,IAAI,SAAS,EAAE;CAC3B,IAAI,IAAI,MAAM,MAAK,MAAK,EAAE,WAAW,QAAQ,OAAO,EAAE;CAEtD,MAAM,MAAM,QAAQ,OAAO,iBAAiB;EAC1C,QAAQ,QAAQ;EAChB,UAAU,QAAQ,YAAY;EAC9B,SAAS,QAAQ,WAAW,CAAC,IAAI;EACjC,SAAS,QAAQ,WAAW;EAC5B,QAAQ,QAAQ,UAAU,CAAC,SAAS;EACrC,CAAC;CAEF,MAAM,WAAW,QAAQ,YACpB,kBAAkB,kBAAkB,QAAQ,WAAW;CAE5D,MAAM,cAAc,GADL,KAAK,KAAK,QAAQ,OAAO,GAAG,IAAI,QAAQ,OAAO,KAAK,QAAQ,OAC7C,IAAI;CAElC,IAAI,MAAM,KAAK;EACb,QAAQ,QAAQ;EAChB,MAAM,QAAQ,QAAQ,OAAO;EAC7B;EACA;EACD,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { inject, provide } from "vue";
|
|
2
|
-
|
|
3
2
|
//#region src/composables/useOutlookFallback.ts
|
|
4
3
|
const OutlookFallbackKey = Symbol("OutlookFallback");
|
|
5
4
|
/**
|
|
@@ -24,7 +23,7 @@ function useOutlookFallback(value) {
|
|
|
24
23
|
provide(OutlookFallbackKey, enabled);
|
|
25
24
|
return enabled;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
27
|
export { useOutlookFallback };
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=useOutlookFallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOutlookFallback.js","names":[],"sources":["../../src/composables/useOutlookFallback.ts"],"sourcesContent":["import { inject, provide, type InjectionKey } from 'vue'\n\nconst OutlookFallbackKey: InjectionKey<boolean> = Symbol('OutlookFallback')\n\n/**\n * Toggle whether descendants emit Outlook (MSO) and VML fallback markup.\n *\n * Call once in a Layout/template's `<script setup>` to disable for the\n * whole tree:\n * `useOutlookFallback(false)`\n *\n * Components inheriting `false` skip MSO ghost tables, VML rectangles,\n * `xmlns:v`/`xmlns:o`, mso-specific CSS, and Button's `<Outlook>`\n * spacers. Each MSO-aware component still accepts an `outlook-fallback`\n * prop that overrides inheritance for its subtree.\n *\n * @param value Pass `true`/`false` to set; omit to just read the\n * inherited value (defaults to `true` at the root).\n * @returns The resolved boolean for the current component.\n */\nexport function useOutlookFallback(value?: boolean | null): boolean {\n const inherited = inject(OutlookFallbackKey, true)\n const enabled = value == null ? inherited : value\n provide(OutlookFallbackKey, enabled)\n return enabled\n}\n"],"mappings":";;AAEA,MAAM,qBAA4C,OAAO,kBAAkB;;;;;;;;;;;;;;;;;AAkB3E,SAAgB,mBAAmB,OAAiC;CAClE,MAAM,YAAY,OAAO,oBAAoB,KAAK;CAClD,MAAM,UAAU,SAAS,OAAO,YAAY;CAC5C,QAAQ,oBAAoB,QAAQ;CACpC,OAAO"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
interface UsePlaintextOptions {
|
|
3
3
|
extension?: string;
|
|
4
4
|
destination?: string;
|
|
5
|
+
options?: Record<string, unknown>;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Enable plaintext generation for the current email template.
|
|
@@ -11,6 +12,7 @@ interface UsePlaintextOptions {
|
|
|
11
12
|
* usePlaintext()
|
|
12
13
|
* usePlaintext({ extension: 'text' })
|
|
13
14
|
* usePlaintext({ destination: '/custom/path' })
|
|
15
|
+
* usePlaintext({ options: { ignoreTags: ['br'] } })
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
16
18
|
declare function usePlaintext(options?: UsePlaintextOptions): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaintext.d.ts","names":[],"sources":["../../src/composables/usePlaintext.ts"],"mappings":";UAGiB,mBAAA;EACf,SAAA;EACA,WAAA;AAAA
|
|
1
|
+
{"version":3,"file":"usePlaintext.d.ts","names":[],"sources":["../../src/composables/usePlaintext.ts"],"mappings":";UAGiB,mBAAA;EACf,SAAA;EACA,WAAA;EACA,OAAA,GAAU,MAAA;AAAA;;;;;;;AAcZ;;;;;iBAAgB,YAAA,CAAa,OAAA,GAAU,mBAAA"}
|