@maizzle/framework 6.0.0-rc.18 → 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/dist/build.d.ts.map +1 -1
- package/dist/build.js +10 -6
- package/dist/build.js.map +1 -1
- package/dist/components/Button.vue +17 -39
- package/dist/components/Container.vue +6 -6
- package/dist/components/Hr.vue +20 -120
- package/dist/components/Html.vue +19 -1
- package/dist/components/NotPlaintext.vue +14 -0
- package/dist/components/{Vml.vue → OutlookBg.vue} +1 -1
- package/dist/components/Plaintext.vue +14 -0
- package/dist/components/QrCode.vue +157 -0
- package/dist/components/Spacer.vue +28 -27
- package/dist/components/utils.js +1 -1
- package/dist/components/utils.js.map +1 -1
- package/dist/composables/defineConfig.js +1 -2
- package/dist/composables/defineConfig.js.map +1 -1
- package/dist/composables/renderContext.js +1 -1
- package/dist/composables/useBaseUrl.js +3 -4
- package/dist/composables/useBaseUrl.js.map +1 -1
- package/dist/composables/useConfig.js +1 -2
- package/dist/composables/useConfig.js.map +1 -1
- package/dist/composables/useDoctype.js +1 -2
- package/dist/composables/useDoctype.js.map +1 -1
- package/dist/composables/useEvent.js +1 -2
- package/dist/composables/useEvent.js.map +1 -1
- package/dist/composables/useFont.js +1 -2
- package/dist/composables/useFont.js.map +1 -1
- package/dist/composables/useOutlookFallback.js +1 -2
- package/dist/composables/useOutlookFallback.js.map +1 -1
- package/dist/composables/usePlaintext.d.ts +2 -0
- package/dist/composables/usePlaintext.d.ts.map +1 -1
- package/dist/composables/usePlaintext.js +2 -2
- package/dist/composables/usePlaintext.js.map +1 -1
- package/dist/composables/usePreheader.js +1 -2
- package/dist/composables/usePreheader.js.map +1 -1
- package/dist/composables/useTransformers.d.ts +3 -3
- package/dist/composables/useTransformers.js +4 -5
- package/dist/composables/useTransformers.js.map +1 -1
- package/dist/composables/useUrlQuery.js +3 -4
- package/dist/composables/useUrlQuery.js.map +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/index.js +1 -2
- package/dist/config/index.js.map +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/index.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +4 -5
- package/dist/plaintext.js +3 -4
- package/dist/plaintext.js.map +1 -1
- package/dist/plugin.js +1 -2
- package/dist/plugin.js.map +1 -1
- package/dist/plugins/postcss/mergeMediaQueries.js +1 -2
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -1
- package/dist/plugins/postcss/pruneVars.js +1 -1
- package/dist/plugins/postcss/pruneVars.js.map +1 -1
- package/dist/plugins/postcss/quoteFontFamilies.js +1 -1
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -1
- package/dist/plugins/postcss/removeDeclarations.js +1 -1
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -1
- package/dist/plugins/postcss/resolveMaizzleImports.js +1 -2
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -1
- package/dist/plugins/postcss/resolveProps.js +1 -1
- package/dist/plugins/postcss/resolveProps.js.map +1 -1
- package/dist/plugins/postcss/tailwindCleanup.js +1 -1
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -1
- package/dist/prepare.js +1 -2
- package/dist/prepare.js.map +1 -1
- 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.js +6 -9
- package/dist/render/createRenderer.js.map +1 -1
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +13 -6
- package/dist/render/index.js.map +1 -1
- package/dist/render/injectFonts.js +1 -2
- package/dist/render/injectFonts.js.map +1 -1
- package/dist/render/plugins/codeBlockExtract.js +1 -1
- package/dist/render/plugins/codeBlockExtract.js.map +1 -1
- package/dist/render/plugins/markdownExtract.js +1 -2
- package/dist/render/plugins/markdownExtract.js.map +1 -1
- package/dist/render/plugins/rawExtract.js +1 -1
- package/dist/render/plugins/rawExtract.js.map +1 -1
- package/dist/render/plugins/rowSourceLocation.js +1 -1
- package/dist/render/plugins/rowSourceLocation.js.map +1 -1
- package/dist/serve.d.ts +2 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +12 -7
- package/dist/serve.js.map +1 -1
- package/dist/server/compatibility.js +1 -2
- package/dist/server/compatibility.js.map +1 -1
- package/dist/server/email.js +1 -2
- package/dist/server/email.js.map +1 -1
- package/dist/server/linter.js +1 -2
- package/dist/server/linter.js.map +1 -1
- package/dist/server/sfc-utils.js +1 -2
- package/dist/server/sfc-utils.js.map +1 -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.js +3 -4
- package/dist/transformers/addAttributes.js.map +1 -1
- package/dist/transformers/attributeToStyle.d.ts +27 -14
- package/dist/transformers/attributeToStyle.d.ts.map +1 -1
- package/dist/transformers/attributeToStyle.js +34 -20
- package/dist/transformers/attributeToStyle.js.map +1 -1
- package/dist/transformers/base.d.ts +66 -3
- package/dist/transformers/base.d.ts.map +1 -1
- package/dist/transformers/base.js +50 -24
- package/dist/transformers/base.js.map +1 -1
- package/dist/transformers/columnWidth.js +1 -2
- package/dist/transformers/columnWidth.js.map +1 -1
- package/dist/transformers/entities.d.ts +31 -2
- package/dist/transformers/entities.d.ts.map +1 -1
- package/dist/transformers/entities.js +39 -7
- package/dist/transformers/entities.js.map +1 -1
- package/dist/transformers/filters/defaults.js +1 -1
- package/dist/transformers/filters/defaults.js.map +1 -1
- 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 +36 -14
- package/dist/transformers/filters/index.js.map +1 -1
- package/dist/transformers/format.d.ts +14 -7
- package/dist/transformers/format.d.ts.map +1 -1
- package/dist/transformers/format.js +15 -11
- package/dist/transformers/format.js.map +1 -1
- package/dist/transformers/index.js +49 -29
- package/dist/transformers/index.js.map +1 -1
- package/dist/transformers/inlineCss.d.ts +84 -0
- package/dist/transformers/inlineCss.d.ts.map +1 -0
- package/dist/transformers/{inlineCSS.js → inlineCss.js} +24 -14
- 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.js +31 -7
- package/dist/transformers/inlineLink.js.map +1 -1
- package/dist/transformers/minify.d.ts +13 -9
- package/dist/transformers/minify.d.ts.map +1 -1
- package/dist/transformers/minify.js +14 -13
- package/dist/transformers/minify.js.map +1 -1
- package/dist/transformers/msoPlaceholders.js +1 -2
- package/dist/transformers/msoPlaceholders.js.map +1 -1
- package/dist/transformers/purgeCss.d.ts +43 -0
- package/dist/transformers/purgeCss.d.ts.map +1 -0
- package/dist/transformers/{purgeCSS.js → purgeCss.js} +32 -25
- 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 +34 -27
- package/dist/transformers/removeAttributes.js.map +1 -1
- package/dist/transformers/replaceStrings.js +1 -1
- package/dist/transformers/replaceStrings.js.map +1 -1
- package/dist/transformers/safeClassNames.js +1 -2
- package/dist/transformers/safeClassNames.js.map +1 -1
- 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 +21 -9
- package/dist/transformers/sixHex.js.map +1 -1
- package/dist/transformers/tailwindComponent.js +1 -2
- package/dist/transformers/tailwindComponent.js.map +1 -1
- package/dist/transformers/tailwindcss.js +1 -2
- package/dist/transformers/tailwindcss.js.map +1 -1
- package/dist/transformers/urlQuery.d.ts +26 -14
- package/dist/transformers/urlQuery.d.ts.map +1 -1
- package/dist/transformers/urlQuery.js +32 -20
- package/dist/transformers/urlQuery.js.map +1 -1
- package/dist/types/config.d.ts +71 -19
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +1 -1
- package/dist/utils/ast/index.js +1 -2
- package/dist/utils/ast/parser.js +1 -2
- package/dist/utils/ast/parser.js.map +1 -1
- package/dist/utils/ast/serializer.js +1 -2
- package/dist/utils/ast/serializer.js.map +1 -1
- package/dist/utils/ast/walker.js +1 -1
- package/dist/utils/ast/walker.js.map +1 -1
- package/dist/utils/compileTailwindCss.js +1 -2
- package/dist/utils/compileTailwindCss.js.map +1 -1
- package/dist/utils/decodeStyleEntities.js +1 -1
- package/dist/utils/decodeStyleEntities.js.map +1 -1
- package/dist/utils/detect.js +1 -2
- package/dist/utils/detect.js.map +1 -1
- 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.js +1 -2
- package/dist/utils/url.js.map +1 -1
- 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/package.json +2 -2
- package/dist/transformers/inlineCSS.d.ts +0 -17
- package/dist/transformers/inlineCSS.d.ts.map +0 -1
- package/dist/transformers/inlineCSS.js.map +0 -1
- package/dist/transformers/purgeCSS.d.ts +0 -23
- package/dist/transformers/purgeCSS.d.ts.map +0 -1
- package/dist/transformers/purgeCSS.js.map +0 -1
- package/dist/transformers/shorthandCSS.d.ts +0 -24
- package/dist/transformers/shorthandCSS.d.ts.map +0 -1
- package/dist/transformers/shorthandCSS.js +0 -48
- package/dist/transformers/shorthandCSS.js.map +0 -1
- package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
|
@@ -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>
|
package/dist/components/utils.js
CHANGED
|
@@ -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 };
|
|
49
|
+
|
|
50
50
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -2,7 +2,6 @@ import { MaizzleConfigKey } from "./useConfig.js";
|
|
|
2
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 };
|
|
32
|
+
|
|
34
33
|
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -1 +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":"
|
|
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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RenderContextKey } from "./renderContext.js";
|
|
2
|
-
import { defu } from "defu";
|
|
2
|
+
import { defu as defu$1 } from "defu";
|
|
3
3
|
import { inject } from "vue";
|
|
4
|
-
|
|
5
4
|
//#region src/composables/useBaseUrl.ts
|
|
6
5
|
/**
|
|
7
6
|
* Set the base URL for the current email template — same as
|
|
@@ -19,9 +18,9 @@ import { inject } from "vue";
|
|
|
19
18
|
function useBaseUrl(value) {
|
|
20
19
|
const ctx = inject(RenderContextKey);
|
|
21
20
|
if (!ctx) return;
|
|
22
|
-
ctx.sfcConfig = defu({ url: { base: value } }, ctx.sfcConfig ?? {});
|
|
21
|
+
ctx.sfcConfig = defu$1({ url: { base: value } }, ctx.sfcConfig ?? {});
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
//#endregion
|
|
26
24
|
export { useBaseUrl };
|
|
25
|
+
|
|
27
26
|
//# sourceMappingURL=useBaseUrl.js.map
|
|
@@ -1 +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":"
|
|
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 };
|
|
11
|
+
|
|
13
12
|
//# sourceMappingURL=useConfig.js.map
|
|
@@ -1 +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":"
|
|
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
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 };
|
|
18
|
+
|
|
20
19
|
//# sourceMappingURL=useDoctype.js.map
|
|
@@ -1 +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":"
|
|
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
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 };
|
|
23
|
+
|
|
25
24
|
//# sourceMappingURL=useEvent.js.map
|
|
@@ -1 +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":"
|
|
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
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 };
|
|
91
|
+
|
|
93
92
|
//# sourceMappingURL=useFont.js.map
|
|
@@ -1 +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":"
|
|
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 };
|
|
28
|
+
|
|
30
29
|
//# sourceMappingURL=useOutlookFallback.js.map
|
|
@@ -1 +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":"
|
|
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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RenderContextKey } from "./renderContext.js";
|
|
2
2
|
import { inject } from "vue";
|
|
3
|
-
|
|
4
3
|
//#region src/composables/usePlaintext.ts
|
|
5
4
|
/**
|
|
6
5
|
* Enable plaintext generation for the current email template.
|
|
@@ -10,13 +9,14 @@ import { inject } from "vue";
|
|
|
10
9
|
* usePlaintext()
|
|
11
10
|
* usePlaintext({ extension: 'text' })
|
|
12
11
|
* usePlaintext({ destination: '/custom/path' })
|
|
12
|
+
* usePlaintext({ options: { ignoreTags: ['br'] } })
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
function usePlaintext(options) {
|
|
16
16
|
const ctx = inject(RenderContextKey);
|
|
17
17
|
if (ctx) ctx.plaintext = options ?? {};
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
//#endregion
|
|
21
20
|
export { usePlaintext };
|
|
21
|
+
|
|
22
22
|
//# sourceMappingURL=usePlaintext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaintext.js","names":[],"sources":["../../src/composables/usePlaintext.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\n\nexport interface UsePlaintextOptions {\n extension?: string\n destination?: string\n}\n\n/**\n * Enable plaintext generation for the current email template.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * usePlaintext()\n * usePlaintext({ extension: 'text' })\n * usePlaintext({ destination: '/custom/path' })\n * ```\n */\nexport function usePlaintext(options?: UsePlaintextOptions): void {\n const ctx = inject(RenderContextKey)\n if (ctx) ctx.plaintext = options ?? {}\n}\n"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"usePlaintext.js","names":[],"sources":["../../src/composables/usePlaintext.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\n\nexport interface UsePlaintextOptions {\n extension?: string\n destination?: string\n options?: Record<string, unknown>\n}\n\n/**\n * Enable plaintext generation for the current email template.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * usePlaintext()\n * usePlaintext({ extension: 'text' })\n * usePlaintext({ destination: '/custom/path' })\n * usePlaintext({ options: { ignoreTags: ['br'] } })\n * ```\n */\nexport function usePlaintext(options?: UsePlaintextOptions): void {\n const ctx = inject(RenderContextKey)\n if (ctx) ctx.plaintext = options ?? {}\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAgB,aAAa,SAAqC;CAChE,MAAM,MAAM,OAAO,iBAAiB;CACpC,IAAI,KAAK,IAAI,YAAY,WAAW,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RenderContextKey } from "./renderContext.js";
|
|
2
2
|
import { inject } from "vue";
|
|
3
|
-
|
|
4
3
|
//#region src/composables/usePreheader.ts
|
|
5
4
|
/**
|
|
6
5
|
* Set the preheader text for the current email template.
|
|
@@ -23,7 +22,7 @@ function usePreheader(text, options) {
|
|
|
23
22
|
shyCount: options?.shyCount ?? 150
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
export { usePreheader };
|
|
27
|
+
|
|
29
28
|
//# sourceMappingURL=usePreheader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreheader.js","names":[],"sources":["../../src/composables/usePreheader.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\n\nexport interface UsePreheaderOptions {\n /** Number of  ͏ filler pairs to render. @default 150 */\n fillerCount?: number\n /** Number of ­ entities to render. @default 150 */\n shyCount?: number\n}\n\n/**\n * Set the preheader text for the current email template.\n *\n * Injects a hidden `<div>` at the start of `<body>` with the preheader text\n * followed by filler characters that prevent email clients from pulling\n * in body content after the preheader.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * usePreheader('Thanks for signing up!')\n * usePreheader('Welcome!', { fillerCount: 200, shyCount: 200 })\n * ```\n */\nexport function usePreheader(text: string, options?: UsePreheaderOptions): void {\n const ctx = inject(RenderContextKey)\n if (ctx) {\n ctx.preheader = {\n text,\n fillerCount: options?.fillerCount ?? 150,\n shyCount: options?.shyCount ?? 150,\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePreheader.js","names":[],"sources":["../../src/composables/usePreheader.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { RenderContextKey } from './renderContext.ts'\n\nexport interface UsePreheaderOptions {\n /** Number of  ͏ filler pairs to render. @default 150 */\n fillerCount?: number\n /** Number of ­ entities to render. @default 150 */\n shyCount?: number\n}\n\n/**\n * Set the preheader text for the current email template.\n *\n * Injects a hidden `<div>` at the start of `<body>` with the preheader text\n * followed by filler characters that prevent email clients from pulling\n * in body content after the preheader.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * usePreheader('Thanks for signing up!')\n * usePreheader('Welcome!', { fillerCount: 200, shyCount: 200 })\n * ```\n */\nexport function usePreheader(text: string, options?: UsePreheaderOptions): void {\n const ctx = inject(RenderContextKey)\n if (ctx) {\n ctx.preheader = {\n text,\n fillerCount: options?.fillerCount ?? 150,\n shyCount: options?.shyCount ?? 150,\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,SAAgB,aAAa,MAAc,SAAqC;CAC9E,MAAM,MAAM,OAAO,iBAAiB;CACpC,IAAI,KACF,IAAI,YAAY;EACd;EACA,aAAa,SAAS,eAAe;EACrC,UAAU,SAAS,YAAY;EAChC"}
|
|
@@ -6,11 +6,11 @@ import { TransformerToggles } from "../types/config.js";
|
|
|
6
6
|
* - `useTransformers(false)` skips the entire pipeline (CSS inlining,
|
|
7
7
|
* purging, shorthand, etc).
|
|
8
8
|
* - `useTransformers(true)` (or no argument) keeps everything on.
|
|
9
|
-
* - `useTransformers({
|
|
9
|
+
* - `useTransformers({ inlineCss: false, minify: false })` runs the
|
|
10
10
|
* pipeline but skips the listed transformers.
|
|
11
11
|
* - `useTransformers({ prettify: true, minify: true })` *enables*
|
|
12
12
|
* transformers that would otherwise no-op (boolean-driven ones:
|
|
13
|
-
*
|
|
13
|
+
* inlineCss, purgeCss, prettify, minify, shorthandCss, sixHex,
|
|
14
14
|
* safeClassNames, entities). Same effect as setting their config
|
|
15
15
|
* slice directly, scoped to one template.
|
|
16
16
|
*
|
|
@@ -24,7 +24,7 @@ import { TransformerToggles } from "../types/config.js";
|
|
|
24
24
|
* Usage in SFC <script setup>:
|
|
25
25
|
* ```ts
|
|
26
26
|
* useTransformers(false)
|
|
27
|
-
* useTransformers({
|
|
27
|
+
* useTransformers({ inlineCss: false, minify: false })
|
|
28
28
|
* useTransformers({ prettify: true })
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MaizzleConfigKey } from "./useConfig.js";
|
|
2
2
|
import { RenderContextKey } from "./renderContext.js";
|
|
3
3
|
import { getCurrentInstance, inject, provide } from "vue";
|
|
4
|
-
|
|
5
4
|
//#region src/composables/useTransformers.ts
|
|
6
5
|
/**
|
|
7
6
|
* Toggle the transformer pipeline for the current template.
|
|
@@ -9,11 +8,11 @@ import { getCurrentInstance, inject, provide } from "vue";
|
|
|
9
8
|
* - `useTransformers(false)` skips the entire pipeline (CSS inlining,
|
|
10
9
|
* purging, shorthand, etc).
|
|
11
10
|
* - `useTransformers(true)` (or no argument) keeps everything on.
|
|
12
|
-
* - `useTransformers({
|
|
11
|
+
* - `useTransformers({ inlineCss: false, minify: false })` runs the
|
|
13
12
|
* pipeline but skips the listed transformers.
|
|
14
13
|
* - `useTransformers({ prettify: true, minify: true })` *enables*
|
|
15
14
|
* transformers that would otherwise no-op (boolean-driven ones:
|
|
16
|
-
*
|
|
15
|
+
* inlineCss, purgeCss, prettify, minify, shorthandCss, sixHex,
|
|
17
16
|
* safeClassNames, entities). Same effect as setting their config
|
|
18
17
|
* slice directly, scoped to one template.
|
|
19
18
|
*
|
|
@@ -27,7 +26,7 @@ import { getCurrentInstance, inject, provide } from "vue";
|
|
|
27
26
|
* Usage in SFC <script setup>:
|
|
28
27
|
* ```ts
|
|
29
28
|
* useTransformers(false)
|
|
30
|
-
* useTransformers({
|
|
29
|
+
* useTransformers({ inlineCss: false, minify: false })
|
|
31
30
|
* useTransformers({ prettify: true })
|
|
32
31
|
* ```
|
|
33
32
|
*/
|
|
@@ -43,7 +42,7 @@ function useTransformers(value = true) {
|
|
|
43
42
|
ctx.sfcConfig = merged;
|
|
44
43
|
provide(MaizzleConfigKey, merged);
|
|
45
44
|
}
|
|
46
|
-
|
|
47
45
|
//#endregion
|
|
48
46
|
export { useTransformers };
|
|
47
|
+
|
|
49
48
|
//# sourceMappingURL=useTransformers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransformers.js","names":[],"sources":["../../src/composables/useTransformers.ts"],"sourcesContent":["import { getCurrentInstance, inject, provide } from 'vue'\nimport { MaizzleConfigKey } from './useConfig.ts'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { MaizzleConfig, TransformerToggles } from '../types/index.ts'\n\n/**\n * Toggle the transformer pipeline for the current template.\n *\n * - `useTransformers(false)` skips the entire pipeline (CSS inlining,\n * purging, shorthand, etc).\n * - `useTransformers(true)` (or no argument) keeps everything on.\n * - `useTransformers({
|
|
1
|
+
{"version":3,"file":"useTransformers.js","names":[],"sources":["../../src/composables/useTransformers.ts"],"sourcesContent":["import { getCurrentInstance, inject, provide } from 'vue'\nimport { MaizzleConfigKey } from './useConfig.ts'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { MaizzleConfig, TransformerToggles } from '../types/index.ts'\n\n/**\n * Toggle the transformer pipeline for the current template.\n *\n * - `useTransformers(false)` skips the entire pipeline (CSS inlining,\n * purging, shorthand, etc).\n * - `useTransformers(true)` (or no argument) keeps everything on.\n * - `useTransformers({ inlineCss: false, minify: false })` runs the\n * pipeline but skips the listed transformers.\n * - `useTransformers({ prettify: true, minify: true })` *enables*\n * transformers that would otherwise no-op (boolean-driven ones:\n * inlineCss, purgeCss, prettify, minify, shorthandCss, sixHex,\n * safeClassNames, entities). Same effect as setting their config\n * slice directly, scoped to one template.\n *\n * Data-driven transformers (filters, baseURL, urlQuery, addAttributes,\n * removeAttributes, replaceStrings, attributeToStyle) need actual\n * values in config — a bare `true` toggle for them is a no-op.\n *\n * Mirrors the `useTransformers` config flag, scoped to a single template\n * — no need to edit `maizzle.config.ts`.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * useTransformers(false)\n * useTransformers({ inlineCss: false, minify: false })\n * useTransformers({ prettify: true })\n * ```\n */\nexport function useTransformers(value: boolean | TransformerToggles = true): void {\n if (!getCurrentInstance()) return\n\n const ctx = inject(RenderContextKey)\n if (!ctx) return\n\n const globalConfig = inject(MaizzleConfigKey, {} as MaizzleConfig)\n const merged: MaizzleConfig = {\n ...(ctx.sfcConfig ?? globalConfig),\n useTransformers: value,\n }\n\n ctx.sfcConfig = merged\n provide(MaizzleConfigKey, merged)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,SAAgB,gBAAgB,QAAsC,MAAY;CAChF,IAAI,CAAC,oBAAoB,EAAE;CAE3B,MAAM,MAAM,OAAO,iBAAiB;CACpC,IAAI,CAAC,KAAK;CAEV,MAAM,eAAe,OAAO,kBAAkB,EAAE,CAAkB;CAClE,MAAM,SAAwB;EAC5B,GAAI,IAAI,aAAa;EACrB,iBAAiB;EAClB;CAED,IAAI,YAAY;CAChB,QAAQ,kBAAkB,OAAO"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RenderContextKey } from "./renderContext.js";
|
|
2
|
-
import { defu } from "defu";
|
|
2
|
+
import { defu as defu$1 } from "defu";
|
|
3
3
|
import { inject } from "vue";
|
|
4
|
-
|
|
5
4
|
//#region src/composables/useUrlQuery.ts
|
|
6
5
|
/**
|
|
7
6
|
* Append query parameters to URLs in the current email template — same
|
|
@@ -19,9 +18,9 @@ import { inject } from "vue";
|
|
|
19
18
|
function useUrlQuery(value) {
|
|
20
19
|
const ctx = inject(RenderContextKey);
|
|
21
20
|
if (!ctx) return;
|
|
22
|
-
ctx.sfcConfig = defu({ url: { query: value } }, ctx.sfcConfig ?? {});
|
|
21
|
+
ctx.sfcConfig = defu$1({ url: { query: value } }, ctx.sfcConfig ?? {});
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
//#endregion
|
|
26
24
|
export { useUrlQuery };
|
|
25
|
+
|
|
27
26
|
//# sourceMappingURL=useUrlQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUrlQuery.js","names":["merge"],"sources":["../../src/composables/useUrlQuery.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { defu as merge } from 'defu'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { UrlQuery } from '../types/index.ts'\n\n/**\n * Append query parameters to URLs in the current email template — same\n * as `config.url.query`, scoped to one SFC. Common use: per-template\n * UTM parameters or campaign tracking.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * useUrlQuery({ utm_source: 'maizzle', utm_campaign: 'newsletter' })\n * ```\n *\n * Pass `_options` alongside the params to tweak which tags/attributes\n * receive them (see `UrlQueryOptions`).\n */\nexport function useUrlQuery(value: UrlQuery): void {\n const ctx = inject(RenderContextKey)\n if (!ctx) return\n ctx.sfcConfig = merge({ url: { query: value } }, ctx.sfcConfig ?? {})\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useUrlQuery.js","names":["merge"],"sources":["../../src/composables/useUrlQuery.ts"],"sourcesContent":["import { inject } from 'vue'\nimport { defu as merge } from 'defu'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { UrlQuery } from '../types/index.ts'\n\n/**\n * Append query parameters to URLs in the current email template — same\n * as `config.url.query`, scoped to one SFC. Common use: per-template\n * UTM parameters or campaign tracking.\n *\n * Usage in SFC <script setup>:\n * ```ts\n * useUrlQuery({ utm_source: 'maizzle', utm_campaign: 'newsletter' })\n * ```\n *\n * Pass `_options` alongside the params to tweak which tags/attributes\n * receive them (see `UrlQueryOptions`).\n */\nexport function useUrlQuery(value: UrlQuery): void {\n const ctx = inject(RenderContextKey)\n if (!ctx) return\n ctx.sfcConfig = merge({ url: { query: value } }, ctx.sfcConfig ?? {})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAY,OAAuB;CACjD,MAAM,MAAM,OAAO,iBAAiB;CACpC,IAAI,CAAC,KAAK;CACV,IAAI,YAAYA,OAAM,EAAE,KAAK,EAAE,OAAO,OAAO,EAAE,EAAE,IAAI,aAAa,EAAE,CAAC"}
|
package/dist/config/defaults.js
CHANGED
package/dist/config/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { resolve } from "node:path";
|
|
|
5
5
|
import { createJiti } from "jiti";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createDefu } from "defu";
|
|
8
|
-
|
|
9
8
|
//#region src/config/index.ts
|
|
10
9
|
const merge = createDefu((obj, key, value) => {
|
|
11
10
|
if (Array.isArray(obj[key])) {
|
|
@@ -65,7 +64,7 @@ async function loadConfig(configPath, cwd = process.cwd()) {
|
|
|
65
64
|
}
|
|
66
65
|
return {};
|
|
67
66
|
}
|
|
68
|
-
|
|
69
67
|
//#endregion
|
|
70
68
|
export { defaults, defineConfig, resolveConfig };
|
|
69
|
+
|
|
71
70
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/config/index.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { createJiti } from 'jiti'\nimport { fileURLToPath } from 'node:url'\nimport { createDefu } from 'defu'\n\n// defu that replaces arrays: if user provides content: ['x'], it replaces the default, not appends\nconst merge = createDefu((obj, key, value) => {\n if (Array.isArray(obj[key])) {\n obj[key] = value\n return true\n }\n})\nimport { defaults } from './defaults.ts'\nimport type { MaizzleConfig } from '../types/index.ts'\n\nexport { defineConfig } from '../composables/defineConfig.ts'\nexport { defaults } from './defaults.ts'\n\nconst CONFIG_FILES = [\n 'maizzle.config.ts',\n 'maizzle.config.js',\n]\n\n/**\n * Resolve the Maizzle config.\n *\n * Always loads from the config file on disk (maizzle.config.{ts,js}),\n * then merges the programmatic config on top, then fills in defaults.\n */\nexport async function resolveConfig(\n config?: Partial<MaizzleConfig> | string,\n cwd: string = process.cwd(),\n): Promise<MaizzleConfig> {\n // If a string path was provided, load that specific file\n const fileConfig = await loadConfig(\n typeof config === 'string' ? config : undefined,\n cwd,\n )\n\n // Programmatic config (object) overrides file config, which overrides defaults\n const programmaticConfig = typeof config === 'object' && config !== null ? config : {}\n\n const merged = merge(programmaticConfig, fileConfig, defaults) as MaizzleConfig\n\n // Check if root was explicitly provided before resolving\n const hasExplicitRoot = !!(programmaticConfig.root ?? fileConfig.root)\n\n // Resolve root to an absolute path (defaults to cwd)\n const root = resolve(cwd, merged.root ?? '.')\n merged.root = root\n\n // Resolve content patterns relative to root\n if (merged.content) {\n merged.content = merged.content.map(p => {\n // Skip already-absolute or negated patterns\n if (p.startsWith('/') || p.startsWith('!')) return p\n return resolve(root, p).replace(/\\\\/g, '/')\n })\n }\n\n // Resolve static source patterns relative to root\n if (merged.static?.source) {\n merged.static.source = merged.static.source.map(p => {\n if (p.startsWith('/') || p.startsWith('!')) return p\n return resolve(root, p).replace(/\\\\/g, '/')\n })\n }\n\n // Resolve components.source paths relative to cwd (not root),\n // since extra component dirs often live outside the root directory\n if (merged.components?.source) {\n const dirs = Array.isArray(merged.components.source)\n ? merged.components.source\n : [merged.components.source]\n\n merged.components.source = dirs.map(p => {\n if (p.startsWith('/')) return p\n return resolve(cwd, p)\n })\n }\n\n // Default css.base to root when root is explicitly set,\n // so Tailwind resolves @source from the right directory.\n // When root is not set, leave css.base undefined so Tailwind\n // uses its own default (the template file's directory).\n if (hasExplicitRoot && !merged.css?.base) {\n if (!merged.css) merged.css = {}\n merged.css.base = root\n }\n\n return merged\n}\n\nasync function loadConfig(\n configPath?: string,\n cwd: string = process.cwd(),\n): Promise<MaizzleConfig> {\n const jiti = createJiti(fileURLToPath(import.meta.url), { moduleCache: false })\n\n // If an explicit path was provided, use it directly\n if (configPath) {\n const absolutePath = resolve(cwd, configPath)\n\n if (!existsSync(absolutePath)) {\n throw new Error(`Config file not found: ${absolutePath}`)\n }\n\n const mod = await jiti.import(absolutePath) as any\n return mod.default ?? mod\n }\n\n // Otherwise scan cwd for known config file names\n for (const filename of CONFIG_FILES) {\n const filepath = resolve(cwd, filename)\n\n if (existsSync(filepath)) {\n const mod = await jiti.import(filepath) as any\n return mod.default ?? mod\n }\n }\n\n // No config file found, return empty (defaults will be applied by resolveConfig)\n return {}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/config/index.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { createJiti } from 'jiti'\nimport { fileURLToPath } from 'node:url'\nimport { createDefu } from 'defu'\n\n// defu that replaces arrays: if user provides content: ['x'], it replaces the default, not appends\nconst merge = createDefu((obj, key, value) => {\n if (Array.isArray(obj[key])) {\n obj[key] = value\n return true\n }\n})\nimport { defaults } from './defaults.ts'\nimport type { MaizzleConfig } from '../types/index.ts'\n\nexport { defineConfig } from '../composables/defineConfig.ts'\nexport { defaults } from './defaults.ts'\n\nconst CONFIG_FILES = [\n 'maizzle.config.ts',\n 'maizzle.config.js',\n]\n\n/**\n * Resolve the Maizzle config.\n *\n * Always loads from the config file on disk (maizzle.config.{ts,js}),\n * then merges the programmatic config on top, then fills in defaults.\n */\nexport async function resolveConfig(\n config?: Partial<MaizzleConfig> | string,\n cwd: string = process.cwd(),\n): Promise<MaizzleConfig> {\n // If a string path was provided, load that specific file\n const fileConfig = await loadConfig(\n typeof config === 'string' ? config : undefined,\n cwd,\n )\n\n // Programmatic config (object) overrides file config, which overrides defaults\n const programmaticConfig = typeof config === 'object' && config !== null ? config : {}\n\n const merged = merge(programmaticConfig, fileConfig, defaults) as MaizzleConfig\n\n // Check if root was explicitly provided before resolving\n const hasExplicitRoot = !!(programmaticConfig.root ?? fileConfig.root)\n\n // Resolve root to an absolute path (defaults to cwd)\n const root = resolve(cwd, merged.root ?? '.')\n merged.root = root\n\n // Resolve content patterns relative to root\n if (merged.content) {\n merged.content = merged.content.map(p => {\n // Skip already-absolute or negated patterns\n if (p.startsWith('/') || p.startsWith('!')) return p\n return resolve(root, p).replace(/\\\\/g, '/')\n })\n }\n\n // Resolve static source patterns relative to root\n if (merged.static?.source) {\n merged.static.source = merged.static.source.map(p => {\n if (p.startsWith('/') || p.startsWith('!')) return p\n return resolve(root, p).replace(/\\\\/g, '/')\n })\n }\n\n // Resolve components.source paths relative to cwd (not root),\n // since extra component dirs often live outside the root directory\n if (merged.components?.source) {\n const dirs = Array.isArray(merged.components.source)\n ? merged.components.source\n : [merged.components.source]\n\n merged.components.source = dirs.map(p => {\n if (p.startsWith('/')) return p\n return resolve(cwd, p)\n })\n }\n\n // Default css.base to root when root is explicitly set,\n // so Tailwind resolves @source from the right directory.\n // When root is not set, leave css.base undefined so Tailwind\n // uses its own default (the template file's directory).\n if (hasExplicitRoot && !merged.css?.base) {\n if (!merged.css) merged.css = {}\n merged.css.base = root\n }\n\n return merged\n}\n\nasync function loadConfig(\n configPath?: string,\n cwd: string = process.cwd(),\n): Promise<MaizzleConfig> {\n const jiti = createJiti(fileURLToPath(import.meta.url), { moduleCache: false })\n\n // If an explicit path was provided, use it directly\n if (configPath) {\n const absolutePath = resolve(cwd, configPath)\n\n if (!existsSync(absolutePath)) {\n throw new Error(`Config file not found: ${absolutePath}`)\n }\n\n const mod = await jiti.import(absolutePath) as any\n return mod.default ?? mod\n }\n\n // Otherwise scan cwd for known config file names\n for (const filename of CONFIG_FILES) {\n const filepath = resolve(cwd, filename)\n\n if (existsSync(filepath)) {\n const mod = await jiti.import(filepath) as any\n return mod.default ?? mod\n }\n }\n\n // No config file found, return empty (defaults will be applied by resolveConfig)\n return {}\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,QAAQ,YAAY,KAAK,KAAK,UAAU;CAC5C,IAAI,MAAM,QAAQ,IAAI,KAAK,EAAE;EAC3B,IAAI,OAAO;EACX,OAAO;;EAET;AAOF,MAAM,eAAe,CACnB,qBACA,oBACD;;;;;;;AAQD,eAAsB,cACpB,QACA,MAAc,QAAQ,KAAK,EACH;CAExB,MAAM,aAAa,MAAM,WACvB,OAAO,WAAW,WAAW,SAAS,KAAA,GACtC,IACD;CAGD,MAAM,qBAAqB,OAAO,WAAW,YAAY,WAAW,OAAO,SAAS,EAAE;CAEtF,MAAM,SAAS,MAAM,oBAAoB,YAAY,SAAS;CAG9D,MAAM,kBAAkB,CAAC,EAAE,mBAAmB,QAAQ,WAAW;CAGjE,MAAM,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;CAC7C,OAAO,OAAO;CAGd,IAAI,OAAO,SACT,OAAO,UAAU,OAAO,QAAQ,KAAI,MAAK;EAEvC,IAAI,EAAE,WAAW,IAAI,IAAI,EAAE,WAAW,IAAI,EAAE,OAAO;EACnD,OAAO,QAAQ,MAAM,EAAE,CAAC,QAAQ,OAAO,IAAI;GAC3C;CAIJ,IAAI,OAAO,QAAQ,QACjB,OAAO,OAAO,SAAS,OAAO,OAAO,OAAO,KAAI,MAAK;EACnD,IAAI,EAAE,WAAW,IAAI,IAAI,EAAE,WAAW,IAAI,EAAE,OAAO;EACnD,OAAO,QAAQ,MAAM,EAAE,CAAC,QAAQ,OAAO,IAAI;GAC3C;CAKJ,IAAI,OAAO,YAAY,QAAQ;EAC7B,MAAM,OAAO,MAAM,QAAQ,OAAO,WAAW,OAAO,GAChD,OAAO,WAAW,SAClB,CAAC,OAAO,WAAW,OAAO;EAE9B,OAAO,WAAW,SAAS,KAAK,KAAI,MAAK;GACvC,IAAI,EAAE,WAAW,IAAI,EAAE,OAAO;GAC9B,OAAO,QAAQ,KAAK,EAAE;IACtB;;CAOJ,IAAI,mBAAmB,CAAC,OAAO,KAAK,MAAM;EACxC,IAAI,CAAC,OAAO,KAAK,OAAO,MAAM,EAAE;EAChC,OAAO,IAAI,OAAO;;CAGpB,OAAO;;AAGT,eAAe,WACb,YACA,MAAc,QAAQ,KAAK,EACH;CACxB,MAAM,OAAO,WAAW,cAAc,OAAO,KAAK,IAAI,EAAE,EAAE,aAAa,OAAO,CAAC;CAG/E,IAAI,YAAY;EACd,MAAM,eAAe,QAAQ,KAAK,WAAW;EAE7C,IAAI,CAAC,WAAW,aAAa,EAC3B,MAAM,IAAI,MAAM,0BAA0B,eAAe;EAG3D,MAAM,MAAM,MAAM,KAAK,OAAO,aAAa;EAC3C,OAAO,IAAI,WAAW;;CAIxB,KAAK,MAAM,YAAY,cAAc;EACnC,MAAM,WAAW,QAAQ,KAAK,SAAS;EAEvC,IAAI,WAAW,SAAS,EAAE;GACxB,MAAM,MAAM,MAAM,KAAK,OAAO,SAAS;GACvC,OAAO,IAAI,WAAW;;;CAK1B,OAAO,EAAE"}
|