@maizzle/framework 6.0.0-rc.17 → 6.0.0-rc.18
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} +13 -9
- package/dist/build.js.map +1 -0
- package/dist/components/Body.vue +10 -0
- package/dist/components/Button.vue +70 -11
- package/dist/components/Column.vue +10 -0
- package/dist/components/Container.vue +29 -1
- package/dist/components/Html.vue +10 -0
- package/dist/components/Layout.vue +27 -12
- package/dist/components/MarkdownLayout.vue +39 -0
- package/dist/components/Overlap.vue +10 -0
- package/dist/components/Preheader.vue +3 -8
- package/dist/components/Row.vue +10 -0
- package/dist/components/Section.vue +10 -0
- package/dist/components/{utils.mjs → utils.js} +1 -1
- package/dist/components/utils.js.map +1 -0
- package/dist/composables/{defineConfig.mjs → defineConfig.js} +3 -3
- package/dist/composables/defineConfig.js.map +1 -0
- package/dist/composables/{renderContext.mjs → renderContext.js} +1 -1
- 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 +27 -0
- package/dist/composables/useBaseUrl.js.map +1 -0
- package/dist/composables/{useConfig.mjs → useConfig.js} +1 -1
- package/dist/composables/useConfig.js.map +1 -0
- package/dist/composables/{useDoctype.mjs → useDoctype.js} +2 -2
- package/dist/composables/useDoctype.js.map +1 -0
- package/dist/composables/{useEvent.mjs → useEvent.js} +2 -2
- package/dist/composables/useEvent.js.map +1 -0
- package/dist/composables/{useFont.mjs → useFont.js} +2 -2
- package/dist/composables/useFont.js.map +1 -0
- package/dist/composables/{useOutlookFallback.mjs → useOutlookFallback.js} +1 -1
- package/dist/composables/useOutlookFallback.js.map +1 -0
- package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +2 -2
- package/dist/composables/usePlaintext.js.map +1 -0
- package/dist/composables/{usePreheader.mjs → usePreheader.js} +2 -2
- 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 +49 -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 +27 -0
- package/dist/composables/useUrlQuery.js.map +1 -0
- package/dist/config/{defaults.mjs → defaults.js} +8 -2
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/{index.mjs → index.js} +3 -3
- 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} +20 -4
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +37 -0
- package/dist/{plaintext.mjs → plaintext.js} +1 -1
- package/dist/plaintext.js.map +1 -0
- package/dist/{plugin.mjs → plugin.js} +5 -5
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +1 -1
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
- package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +1 -1
- package/dist/plugins/postcss/pruneVars.js.map +1 -0
- package/dist/plugins/postcss/{quoteFontFamilies.mjs → quoteFontFamilies.js} +1 -1
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +1 -1
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
- package/dist/plugins/postcss/{resolveMaizzleImports.mjs → resolveMaizzleImports.js} +1 -1
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
- package/dist/plugins/postcss/{resolveProps.mjs → resolveProps.js} +1 -1
- package/dist/plugins/postcss/resolveProps.js.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.mjs → tailwindCleanup.js} +1 -1
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
- package/dist/{prepare.mjs → prepare.js} +4 -4
- package/dist/prepare.js.map +1 -0
- package/dist/render/{createRenderer.mjs → createRenderer.js} +19 -11
- package/dist/render/createRenderer.js.map +1 -0
- package/dist/render/{index.mjs → index.js} +5 -5
- package/dist/render/index.js.map +1 -0
- package/dist/render/{injectFonts.mjs → injectFonts.js} +2 -2
- package/dist/render/injectFonts.js.map +1 -0
- package/dist/render/plugins/{codeBlockExtract.mjs → codeBlockExtract.js} +1 -1
- package/dist/render/plugins/codeBlockExtract.js.map +1 -0
- package/dist/render/plugins/{markdownExtract.mjs → markdownExtract.js} +1 -1
- package/dist/render/plugins/markdownExtract.js.map +1 -0
- package/dist/render/plugins/{rawExtract.mjs → rawExtract.js} +1 -1
- package/dist/render/plugins/rawExtract.js.map +1 -0
- package/dist/render/plugins/{rowSourceLocation.mjs → rowSourceLocation.js} +1 -1
- package/dist/render/plugins/rowSourceLocation.js.map +1 -0
- package/dist/{serve.mjs → serve.js} +8 -8
- package/dist/serve.js.map +1 -0
- package/dist/server/{compatibility.mjs → compatibility.js} +4 -4
- package/dist/server/compatibility.js.map +1 -0
- package/dist/server/{email.mjs → email.js} +1 -1
- package/dist/server/email.js.map +1 -0
- package/dist/server/{linter.mjs → linter.js} +2 -2
- package/dist/server/linter.js.map +1 -0
- package/dist/server/{sfc-utils.mjs → sfc-utils.js} +1 -1
- 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/transformers/{addAttributes.mjs → addAttributes.js} +3 -3
- package/dist/transformers/addAttributes.js.map +1 -0
- package/dist/transformers/{attributeToStyle.mjs → attributeToStyle.js} +3 -3
- package/dist/transformers/attributeToStyle.js.map +1 -0
- package/dist/transformers/{base.mjs → base.js} +6 -6
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/{columnWidth.mjs → columnWidth.js} +3 -3
- package/dist/transformers/columnWidth.js.map +1 -0
- package/dist/transformers/{entities.mjs → entities.js} +3 -3
- package/dist/transformers/entities.js.map +1 -0
- package/dist/transformers/filters/{defaults.mjs → defaults.js} +1 -1
- package/dist/transformers/filters/defaults.js.map +1 -0
- package/dist/transformers/filters/{index.mjs → index.js} +5 -5
- package/dist/transformers/filters/index.js.map +1 -0
- package/dist/transformers/{format.mjs → format.js} +1 -1
- package/dist/transformers/format.js.map +1 -0
- package/dist/transformers/index.js +113 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/{inlineCSS.mjs → inlineCSS.js} +5 -5
- package/dist/transformers/inlineCSS.js.map +1 -0
- package/dist/transformers/{inlineLink.mjs → inlineLink.js} +3 -3
- package/dist/transformers/inlineLink.js.map +1 -0
- package/dist/transformers/{minify.mjs → minify.js} +1 -1
- 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 +89 -0
- package/dist/transformers/msoPlaceholders.js.map +1 -0
- package/dist/transformers/{purgeCSS.mjs → purgeCSS.js} +5 -5
- package/dist/transformers/purgeCSS.js.map +1 -0
- package/dist/transformers/{removeAttributes.mjs → removeAttributes.js} +3 -3
- package/dist/transformers/removeAttributes.js.map +1 -0
- package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +1 -1
- package/dist/transformers/replaceStrings.js.map +1 -0
- package/dist/transformers/{safeClassNames.mjs → safeClassNames.js} +3 -3
- package/dist/transformers/safeClassNames.js.map +1 -0
- package/dist/transformers/{shorthandCSS.mjs → shorthandCSS.js} +3 -3
- package/dist/transformers/shorthandCSS.js.map +1 -0
- package/dist/transformers/{sixHex.mjs → sixHex.js} +3 -3
- package/dist/transformers/sixHex.js.map +1 -0
- package/dist/transformers/{tailwindComponent.mjs → tailwindComponent.js} +4 -4
- package/dist/transformers/tailwindComponent.js.map +1 -0
- package/dist/transformers/{tailwindcss.mjs → tailwindcss.js} +5 -5
- package/dist/transformers/tailwindcss.js.map +1 -0
- package/dist/transformers/{urlQuery.mjs → urlQuery.js} +2 -2
- package/dist/transformers/urlQuery.js.map +1 -0
- package/dist/types/config.d.ts +43 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/ast/index.js +5 -0
- package/dist/utils/ast/{parser.mjs → parser.js} +1 -1
- package/dist/utils/ast/parser.js.map +1 -0
- package/dist/utils/ast/{serializer.mjs → serializer.js} +2 -2
- package/dist/utils/ast/serializer.js.map +1 -0
- package/dist/utils/ast/{walker.mjs → walker.js} +1 -1
- package/dist/utils/ast/walker.js.map +1 -0
- package/dist/utils/{compileTailwindCss.mjs → compileTailwindCss.js} +7 -7
- package/dist/utils/compileTailwindCss.js.map +1 -0
- package/dist/utils/{decodeStyleEntities.mjs → decodeStyleEntities.js} +1 -1
- package/dist/utils/decodeStyleEntities.js.map +1 -0
- package/dist/utils/{detect.mjs → detect.js} +1 -1
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/{url.mjs → url.js} +1 -1
- 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/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 +3 -3
- package/dist/build.mjs.map +0 -1
- 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.map +0 -1
- package/dist/transformers/base.mjs.map +0 -1
- package/dist/transformers/columnWidth.mjs.map +0 -1
- package/dist/transformers/entities.mjs.map +0 -1
- package/dist/transformers/filters/defaults.mjs.map +0 -1
- package/dist/transformers/filters/index.mjs.map +0 -1
- 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.mjs.map +0 -1
- package/dist/transformers/inlineLink.mjs.map +0 -1
- 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.mjs.map +0 -1
- 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.mjs.map +0 -1
- 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.map +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/dist/components/{Divider.vue → Hr.vue} +0 -0
- /package/dist/types/{config.mjs → config.js} +0 -0
- /package/dist/types/{index.mjs → index.js} +0 -0
package/bin/maizzle.mjs
CHANGED
|
@@ -5,6 +5,6 @@ import { fileURLToPath } from 'node:url'
|
|
|
5
5
|
|
|
6
6
|
const jiti = createJiti(fileURLToPath(import.meta.url), { interopDefault: true })
|
|
7
7
|
const { default: bootstrap } = await jiti.import('maizzle')
|
|
8
|
-
const framework = await jiti.import('../dist/index.
|
|
8
|
+
const framework = await jiti.import('../dist/index.js')
|
|
9
9
|
|
|
10
10
|
await bootstrap(framework)
|
package/dist/build.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { MaizzleConfig } from "./types/config.js";
|
|
2
2
|
//#region src/build.d.ts
|
|
3
|
-
interface BuildOptions {
|
|
4
|
-
config?: Partial<MaizzleConfig> | string;
|
|
5
|
-
}
|
|
6
3
|
interface BuildResult {
|
|
7
4
|
files: string[];
|
|
8
5
|
config: MaizzleConfig;
|
|
@@ -12,8 +9,12 @@ interface BuildResult {
|
|
|
12
9
|
*
|
|
13
10
|
* Creates a single Renderer instance, then loops through each template
|
|
14
11
|
* calling render → transformers → write to disk.
|
|
12
|
+
*
|
|
13
|
+
* Pass a `Partial<MaizzleConfig>` to override config inline, or a string
|
|
14
|
+
* to load config from a specific file path. Omit to load `maizzle.config`
|
|
15
|
+
* from the working directory.
|
|
15
16
|
*/
|
|
16
|
-
declare function build(
|
|
17
|
+
declare function build(configInput?: Partial<MaizzleConfig> | string): Promise<BuildResult>;
|
|
17
18
|
//#endregion
|
|
18
|
-
export {
|
|
19
|
+
export { BuildResult, build };
|
|
19
20
|
//# sourceMappingURL=build.d.ts.map
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","names":[],"sources":["../src/build.ts"],"mappings":";;UAWiB,
|
|
1
|
+
{"version":3,"file":"build.d.ts","names":[],"sources":["../src/build.ts"],"mappings":";;UAWiB,WAAA;EACf,KAAA;EACA,MAAA,EAAQ,aAAA;AAAA;;;;;;;;;AAaV;;iBAAsB,KAAA,CAAM,WAAA,GAAc,OAAA,CAAQ,aAAA,aAA0B,OAAA,CAAQ,WAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolveConfig } from "./config/index.
|
|
2
|
-
import { EventManager } from "./events/index.
|
|
3
|
-
import { runTransformers } from "./transformers/index.
|
|
4
|
-
import { createRenderer } from "./render/createRenderer.
|
|
5
|
-
import { createPlaintext } from "./plaintext.
|
|
1
|
+
import { resolveConfig } from "./config/index.js";
|
|
2
|
+
import { EventManager } from "./events/index.js";
|
|
3
|
+
import { runTransformers } from "./transformers/index.js";
|
|
4
|
+
import { createRenderer } from "./render/createRenderer.js";
|
|
5
|
+
import { createPlaintext } from "./plaintext.js";
|
|
6
6
|
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
8
8
|
import { glob } from "tinyglobby";
|
|
@@ -14,14 +14,18 @@ import ora from "ora";
|
|
|
14
14
|
*
|
|
15
15
|
* Creates a single Renderer instance, then loops through each template
|
|
16
16
|
* calling render → transformers → write to disk.
|
|
17
|
+
*
|
|
18
|
+
* Pass a `Partial<MaizzleConfig>` to override config inline, or a string
|
|
19
|
+
* to load config from a specific file path. Omit to load `maizzle.config`
|
|
20
|
+
* from the working directory.
|
|
17
21
|
*/
|
|
18
|
-
async function build(
|
|
22
|
+
async function build(configInput) {
|
|
19
23
|
const start = Date.now();
|
|
20
24
|
const spinner = ora({
|
|
21
25
|
text: "Building templates...",
|
|
22
26
|
spinner: "circleHalves"
|
|
23
27
|
}).start();
|
|
24
|
-
const config = await resolveConfig(
|
|
28
|
+
const config = await resolveConfig(configInput);
|
|
25
29
|
const events = new EventManager();
|
|
26
30
|
events.registerConfig(config);
|
|
27
31
|
await events.fireBeforeCreate({ config });
|
|
@@ -57,6 +61,7 @@ async function build(options = {}) {
|
|
|
57
61
|
template
|
|
58
62
|
});
|
|
59
63
|
const rendered = await renderer.render(absolutePath, config);
|
|
64
|
+
for (const { name, handler } of rendered.sfcEventHandlers) events.on(name, handler);
|
|
60
65
|
let html = await events.fireAfterRender({
|
|
61
66
|
config,
|
|
62
67
|
template,
|
|
@@ -89,7 +94,6 @@ async function build(options = {}) {
|
|
|
89
94
|
mkdirSync(dirname(ptOutputPath), { recursive: true });
|
|
90
95
|
writeFileSync(ptOutputPath, plaintext);
|
|
91
96
|
}
|
|
92
|
-
for (const { name, handler } of rendered.sfcEventHandlers) events.on(name, handler);
|
|
93
97
|
events.clearSfcHandlers();
|
|
94
98
|
}
|
|
95
99
|
await copyStatic(config, outputPath);
|
|
@@ -141,4 +145,4 @@ async function copyStatic(config, outputPath) {
|
|
|
141
145
|
|
|
142
146
|
//#endregion
|
|
143
147
|
export { build };
|
|
144
|
-
//# sourceMappingURL=build.
|
|
148
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","names":[],"sources":["../src/build.ts"],"sourcesContent":["import { readFileSync, writeFileSync, mkdirSync, cpSync, existsSync, rmSync } from 'node:fs'\nimport { resolve, dirname, basename, relative, join } from 'node:path'\nimport { glob } from 'tinyglobby'\nimport ora from 'ora'\nimport { resolveConfig } from './config/index.ts'\nimport { EventManager } from './events/index.ts'\nimport { runTransformers } from './transformers/index.ts'\nimport { createRenderer } from './render/createRenderer.ts'\nimport { createPlaintext } from './plaintext.ts'\nimport type { MaizzleConfig } from './types/index.ts'\n\nexport interface BuildResult {\n files: string[]\n config: MaizzleConfig\n}\n\n/**\n * Build all SFC email templates to HTML files.\n *\n * Creates a single Renderer instance, then loops through each template\n * calling render → transformers → write to disk.\n *\n * Pass a `Partial<MaizzleConfig>` to override config inline, or a string\n * to load config from a specific file path. Omit to load `maizzle.config`\n * from the working directory.\n */\nexport async function build(configInput?: Partial<MaizzleConfig> | string): Promise<BuildResult> {\n const start = Date.now()\n const spinner = ora({ text: 'Building templates...', spinner: 'circleHalves' }).start()\n\n const config = await resolveConfig(configInput)\n\n const events = new EventManager()\n events.registerConfig(config)\n await events.fireBeforeCreate({ config })\n\n const outputPath = resolve(config.output?.path ?? 'dist')\n const outputExtension = config.output?.extension ?? 'html'\n\n const contentPatterns = config.content ?? ['emails/**/*.vue']\n const contentBase = computeContentBase(contentPatterns)\n const templateFiles = await glob(contentPatterns)\n\n if (templateFiles.length === 0) {\n spinner.succeed('No templates found')\n return { files: [], config }\n }\n\n // Clear the output directory before writing fresh output\n if (existsSync(outputPath)) {\n rmSync(outputPath, { recursive: true, force: true })\n }\n\n const renderer = await createRenderer({ markdown: config.markdown, root: config.root, componentDirs: [config.components?.source ?? []].flat(), vite: config.vite })\n const outputFiles: string[] = []\n\n try {\n for (const templatePath of templateFiles) {\n const absolutePath = resolve(templatePath)\n let template = readFileSync(absolutePath, 'utf-8')\n\n template = await events.fireBeforeRender({ config, template })\n\n const rendered = await renderer.render(absolutePath, config)\n\n // Register SFC event handlers collected during render so they participate\n // in the post-render events (afterRender / afterTransform). They're cleared\n // at the end of the iteration so they don't leak into the next template.\n for (const { name, handler } of rendered.sfcEventHandlers) {\n events.on(name, handler)\n }\n\n let html = await events.fireAfterRender({ config, template, html: rendered.html })\n\n // Use the per-template merged config (from defineConfig() in the SFC) so that\n // template-level overrides like css.safe: false are respected by transformers.\n const templateConfig = rendered.templateConfig\n\n const doctype = rendered.doctype ?? templateConfig.doctype ?? '<!DOCTYPE html>'\n\n if (templateConfig.useTransformers !== false) {\n html = await runTransformers(html, templateConfig, absolutePath, doctype, rendered.tailwindBlocks)\n }\n\n html = await events.fireAfterTransform({ config, template, html })\n html = `${doctype}\\n${html}`\n\n const outputFilePath = resolveOutputPath(templatePath, outputPath, outputExtension, contentBase)\n mkdirSync(dirname(outputFilePath), { recursive: true })\n writeFileSync(outputFilePath, html)\n outputFiles.push(outputFilePath)\n\n // Generate plaintext version if configured\n const globalPlaintext = templateConfig.plaintext\n const sfcPlaintext = rendered.plaintext\n\n if (globalPlaintext || sfcPlaintext) {\n const stripOptions = typeof globalPlaintext === 'object' ? globalPlaintext : {}\n const plaintext = createPlaintext(html, stripOptions)\n const ptExtension = sfcPlaintext?.extension ?? 'txt'\n\n let ptOutputPath: string\n\n if (sfcPlaintext?.destination) {\n const name = basename(templatePath).replace(/\\.(vue|md)$/, '')\n ptOutputPath = join(resolve(sfcPlaintext.destination), `${name}.${ptExtension}`)\n } else if (typeof globalPlaintext === 'string') {\n ptOutputPath = resolveOutputPath(templatePath, resolve(globalPlaintext), ptExtension, contentBase)\n } else {\n ptOutputPath = resolveOutputPath(templatePath, outputPath, ptExtension, contentBase)\n }\n\n mkdirSync(dirname(ptOutputPath), { recursive: true })\n writeFileSync(ptOutputPath, plaintext)\n }\n\n events.clearSfcHandlers()\n }\n\n await copyStatic(config, outputPath)\n await events.fireAfterBuild({ files: outputFiles, config })\n } finally {\n await renderer.close()\n }\n\n const duration = ((Date.now() - start) / 1000).toFixed(2)\n const count = outputFiles.length\n spinner.stopAndPersist({\n symbol: '✅',\n text: `Built ${count} template${count !== 1 ? 's' : ''} in ${duration}s`,\n })\n\n return { files: outputFiles, config }\n}\n\n/**\n * Extract the static (non-glob) prefix from content patterns.\n *\n * For example, `['/abs/path/emails/**\\/*.vue']` → `'/abs/path/emails'`\n *\n * This is used to strip the content base from template paths\n * so the output preserves only the subdirectory structure.\n */\nfunction computeContentBase(patterns: string[]): string {\n // Use the first non-negated pattern\n const pattern = patterns.find(p => !p.startsWith('!')) ?? patterns[0]\n\n // Split on first glob character (* { ? [) and take the directory part\n const staticPart = pattern.split(/[*{?[]/)[0]\n\n // Ensure we have a clean directory path (not a partial segment)\n return resolve(staticPart.endsWith('/') ? staticPart : dirname(staticPart))\n}\n\nfunction resolveOutputPath(templatePath: string, outputDir: string, extension: string, contentBase: string): string {\n const name = basename(templatePath).replace(/\\.(vue|md)$/, '')\n const absTemplate = resolve(templatePath)\n const rel = relative(contentBase, dirname(absTemplate))\n\n return join(outputDir, rel, `${name}.${extension}`)\n}\n\nasync function copyStatic(config: MaizzleConfig, outputPath: string): Promise<void> {\n const sources = config.static?.source ?? ['public/**/*.*']\n const destination = config.static?.destination ?? 'public'\n\n const files = await glob(sources)\n\n for (const file of files) {\n const destPath = join(outputPath, destination, relative(dirname(sources[0]).replace(/\\*.*$/, ''), file))\n const destDir = dirname(destPath)\n\n if (!existsSync(destDir)) {\n mkdirSync(destDir, { recursive: true })\n }\n\n cpSync(file, destPath)\n }\n}\n"],"mappings":"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"}
|
package/dist/components/Body.vue
CHANGED
|
@@ -68,6 +68,16 @@ const props = defineProps({
|
|
|
68
68
|
type: String,
|
|
69
69
|
default: undefined
|
|
70
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
73
|
+
* component and all descendants.
|
|
74
|
+
*
|
|
75
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
76
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
77
|
+
* in all built-in components.
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
71
81
|
outlookFallback: outlookFallbackProp,
|
|
72
82
|
})
|
|
73
83
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useAttrs } from 'vue'
|
|
2
|
+
import { computed, useAttrs, createStaticVNode } from 'vue'
|
|
3
3
|
import type { PropType } from 'vue'
|
|
4
4
|
import { twMerge } from 'tailwind-merge'
|
|
5
|
-
import Outlook from './Outlook.vue'
|
|
6
5
|
import { outlookFallbackProp } from './utils.ts'
|
|
7
6
|
import { useOutlookFallback } from '../composables/useOutlookFallback'
|
|
8
7
|
|
|
@@ -106,6 +105,35 @@ const props = defineProps({
|
|
|
106
105
|
type: String,
|
|
107
106
|
default: ''
|
|
108
107
|
},
|
|
108
|
+
/**
|
|
109
|
+
* Alt text for the icon image.
|
|
110
|
+
* @default ''
|
|
111
|
+
*/
|
|
112
|
+
iconAlt: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: ''
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* Horizontal padding in old Outlook, applied as `mso-font-width` on the
|
|
118
|
+
* outer spacer `<i>` elements. Accepts a number, a numeric string, or a
|
|
119
|
+
* string with `%`. Bare numbers are treated as percentages. Effective
|
|
120
|
+
* range up to 500%.
|
|
121
|
+
* @default 150
|
|
122
|
+
*/
|
|
123
|
+
msoPx: {
|
|
124
|
+
type: [String, Number],
|
|
125
|
+
default: 150
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
129
|
+
* component and all descendants.
|
|
130
|
+
*
|
|
131
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
132
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
133
|
+
* in all built-in components.
|
|
134
|
+
*
|
|
135
|
+
* @default true
|
|
136
|
+
*/
|
|
109
137
|
outlookFallback: outlookFallbackProp,
|
|
110
138
|
})
|
|
111
139
|
|
|
@@ -165,6 +193,37 @@ const defaultClasses = computed(() => {
|
|
|
165
193
|
})
|
|
166
194
|
|
|
167
195
|
const mergedClass = computed(() => twMerge(defaultClasses.value, attrs.class as string))
|
|
196
|
+
|
|
197
|
+
const textSpanStyle = computed(() =>
|
|
198
|
+
outlookFallback ? `mso-text-raise: ${props.msoPt};` : undefined,
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
const msoPx = computed(() => {
|
|
202
|
+
const v = String(props.msoPx).trim()
|
|
203
|
+
// Bare number → percentage. Anything with a unit passes through.
|
|
204
|
+
return /^\d+(\.\d+)?$/.test(v) ? `${v}%` : v
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Outlook spacer `<i>` elements rendered as raw HTML inside MSO conditional
|
|
209
|
+
* comments. JS strings keep ` ` / `​` from being decoded by
|
|
210
|
+
* Vue's template parser; htmlparser2 then preserves the comment
|
|
211
|
+
* data verbatim because conditional comments are opaque.
|
|
212
|
+
*/
|
|
213
|
+
const MsoSpacerLeft = () => createStaticVNode(
|
|
214
|
+
`<!--[if mso]><i style="mso-font-width: ${msoPx.value}; mso-text-raise: ${props.msoPb};" hidden> </i><![endif]-->`,
|
|
215
|
+
1,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
const MsoSpacerRight = () => createStaticVNode(
|
|
219
|
+
`<!--[if mso]><i style="mso-font-width: ${msoPx.value};" hidden> ​</i><![endif]-->`,
|
|
220
|
+
1,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
const MsoIconGap = () => createStaticVNode(
|
|
224
|
+
`<!--[if mso]><i style="mso-font-width: 30%;" hidden> ​</i><![endif]-->`,
|
|
225
|
+
1,
|
|
226
|
+
)
|
|
168
227
|
</script>
|
|
169
228
|
|
|
170
229
|
<template>
|
|
@@ -176,21 +235,21 @@ const mergedClass = computed(() => twMerge(defaultClasses.value, attrs.class as
|
|
|
176
235
|
:class="mergedClass"
|
|
177
236
|
>
|
|
178
237
|
<template v-if="!isLink">
|
|
179
|
-
<
|
|
238
|
+
<MsoSpacerLeft v-if="outlookFallback" />
|
|
180
239
|
<template v-if="icon && iconPosition === 'left'">
|
|
181
|
-
<span :style="
|
|
182
|
-
<img :src="icon" :width="parsedIconWidth" :
|
|
240
|
+
<span :style="textSpanStyle">
|
|
241
|
+
<img :src="icon" :width="parsedIconWidth" :alt="iconAlt" style="vertical-align: baseline; max-width: 100%;" :class="iconClass">
|
|
183
242
|
</span>
|
|
184
|
-
<
|
|
243
|
+
<MsoIconGap v-if="outlookFallback" />
|
|
185
244
|
</template>
|
|
186
|
-
<span :
|
|
245
|
+
<span :style="textSpanStyle"><slot /></span>
|
|
187
246
|
<template v-if="icon && iconPosition === 'right'">
|
|
188
|
-
<
|
|
189
|
-
<span :style="
|
|
190
|
-
<img :src="icon" :width="parsedIconWidth" :
|
|
247
|
+
<MsoIconGap v-if="outlookFallback" />
|
|
248
|
+
<span :style="textSpanStyle">
|
|
249
|
+
<img :src="icon" :width="parsedIconWidth" :alt="iconAlt" style="vertical-align: baseline; max-width: 100%;" :class="iconClass">
|
|
191
250
|
</span>
|
|
192
251
|
</template>
|
|
193
|
-
<
|
|
252
|
+
<MsoSpacerRight v-if="outlookFallback" />
|
|
194
253
|
</template>
|
|
195
254
|
<template v-else>
|
|
196
255
|
<slot />
|
|
@@ -32,6 +32,16 @@ const props = defineProps({
|
|
|
32
32
|
type: String,
|
|
33
33
|
default: undefined
|
|
34
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
37
|
+
* component and all descendants.
|
|
38
|
+
*
|
|
39
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
40
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
41
|
+
* in all built-in components.
|
|
42
|
+
*
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
35
45
|
outlookFallback: outlookFallbackProp,
|
|
36
46
|
})
|
|
37
47
|
|
|
@@ -35,6 +35,29 @@ const props = defineProps({
|
|
|
35
35
|
type: [String, Number],
|
|
36
36
|
default: null
|
|
37
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Inline CSS applied only to the MSO `<td>` element.
|
|
40
|
+
*
|
|
41
|
+
* Use for Outlook-specific styling that shouldn't affect other clients.
|
|
42
|
+
* Appended after any padding propagated from the outer div's
|
|
43
|
+
* inlined style, so msoStyle wins on duplicate properties.
|
|
44
|
+
*
|
|
45
|
+
* @example 'padding: 10px 20px'
|
|
46
|
+
*/
|
|
47
|
+
msoStyle: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: undefined
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
53
|
+
* component and all descendants.
|
|
54
|
+
*
|
|
55
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
56
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
57
|
+
* in all built-in components.
|
|
58
|
+
*
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
38
61
|
outlookFallback: outlookFallbackProp,
|
|
39
62
|
})
|
|
40
63
|
|
|
@@ -44,6 +67,7 @@ provide('containerWidth', computed(() => props.width))
|
|
|
44
67
|
|
|
45
68
|
const useMarker = outlookFallback && props.width == null && props.msoWidth == null
|
|
46
69
|
const msoId = useMarker ? nextId('c') : null
|
|
70
|
+
const tdId = outlookFallback ? nextId('ct') : null
|
|
47
71
|
|
|
48
72
|
const styles = computed(() => {
|
|
49
73
|
if (props.width == null) return undefined
|
|
@@ -69,8 +93,10 @@ const colWidthSource = computed(() =>
|
|
|
69
93
|
props.width != null ? normalizeToPixels(props.width) : ''
|
|
70
94
|
)
|
|
71
95
|
|
|
96
|
+
const tdMarker = tdId ? `__MAIZZLE_MSOTDSTYLE_${tdId}__` : ''
|
|
97
|
+
|
|
72
98
|
const MsoBefore = () => createStaticVNode(
|
|
73
|
-
`<!--[if mso]><table role="none" cellpadding="0" cellspacing="0" style="width: ${msoWidth.value}" align="center"><tr><td><![endif]-->`,
|
|
99
|
+
`<!--[if mso]><table role="none" cellpadding="0" cellspacing="0" style="width: ${msoWidth.value}" align="center"><tr><td${tdMarker}><![endif]-->`,
|
|
74
100
|
1
|
|
75
101
|
)
|
|
76
102
|
|
|
@@ -88,6 +114,8 @@ const MsoAfter = () => createStaticVNode(
|
|
|
88
114
|
:style="styles"
|
|
89
115
|
:data-maizzle-msow-id="msoId"
|
|
90
116
|
:data-maizzle-cw="colWidthSource"
|
|
117
|
+
:data-maizzle-mso-td-id="tdId"
|
|
118
|
+
:data-maizzle-mso-style="tdId && props.msoStyle ? props.msoStyle : null"
|
|
91
119
|
>
|
|
92
120
|
<slot />
|
|
93
121
|
</div>
|
package/dist/components/Html.vue
CHANGED
|
@@ -68,6 +68,16 @@ const props = defineProps({
|
|
|
68
68
|
type: [Boolean, String],
|
|
69
69
|
default: true
|
|
70
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
73
|
+
* component and all descendants.
|
|
74
|
+
*
|
|
75
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
76
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
77
|
+
* in all built-in components.
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
71
81
|
outlookFallback: outlookFallbackProp,
|
|
72
82
|
})
|
|
73
83
|
|
|
@@ -55,6 +55,16 @@ const props = defineProps({
|
|
|
55
55
|
type: String,
|
|
56
56
|
default: undefined
|
|
57
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Toggle Outlook (MSO) and VML fallback markup for this
|
|
60
|
+
* component and all descendants.
|
|
61
|
+
*
|
|
62
|
+
* When `false`, skips MSO ghost tables, VML shapes,
|
|
63
|
+
* `xmlns:v`/`xmlns:o` attributes, and mso-specific CSS
|
|
64
|
+
* in all built-in components.
|
|
65
|
+
*
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
58
68
|
outlookFallback: outlookFallbackProp,
|
|
59
69
|
})
|
|
60
70
|
|
|
@@ -68,21 +78,25 @@ const EmptyHead = () => createStaticVNode('<head></head>', 1)
|
|
|
68
78
|
|
|
69
79
|
const MsoHead = () => createStaticVNode(
|
|
70
80
|
`<!--[if mso]>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</xml>
|
|
77
|
-
</noscript>
|
|
78
|
-
<style>
|
|
79
|
-
td,th,div,p,a,h1,h2,h3,h4,h5,h6 {font-family: "Segoe UI", sans-serif; mso-line-height-rule: exactly;}
|
|
80
|
-
.mso-break-all {word-break: break-all;}
|
|
81
|
-
</style>
|
|
82
|
-
<![endif]-->`,
|
|
81
|
+
<style>
|
|
82
|
+
td,th,div,p,a,h1,h2,h3,h4,h5,h6 {font-family: "Segoe UI", sans-serif; mso-line-height-rule: exactly;}
|
|
83
|
+
.mso-break-all {word-break: break-all;}
|
|
84
|
+
</style>
|
|
85
|
+
<![endif]-->`,
|
|
83
86
|
1
|
|
84
87
|
)
|
|
85
88
|
|
|
89
|
+
const msoBody = `<!--[if mso]>
|
|
90
|
+
<xml>
|
|
91
|
+
<o:OfficeDocumentSettings>
|
|
92
|
+
<o:PixelsPerInch>96</o:PixelsPerInch>
|
|
93
|
+
</o:OfficeDocumentSettings>
|
|
94
|
+
<w:WordDocument>
|
|
95
|
+
<w:DontUseAdvancedTypographyReadingMail />
|
|
96
|
+
</w:WordDocument>
|
|
97
|
+
</xml>
|
|
98
|
+
<![endif]-->`
|
|
99
|
+
|
|
86
100
|
const htmlXmlns = computed(() => outlookFallback ? {
|
|
87
101
|
'xmlns:v': 'urn:schemas-microsoft-com:vml',
|
|
88
102
|
'xmlns:o': 'urn:schemas-microsoft-com:office:office',
|
|
@@ -112,6 +126,7 @@ const htmlXmlns = computed(() => outlookFallback ? {
|
|
|
112
126
|
</style>
|
|
113
127
|
</head>
|
|
114
128
|
<body :xml:lang="outlookFallback ? lang : null" :class="bodyMergedClass">
|
|
129
|
+
<span v-if="outlookFallback" style="display: none" v-html="msoBody"></span>
|
|
115
130
|
<div
|
|
116
131
|
role="article"
|
|
117
132
|
aria-roledescription="email"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
import Layout from './Layout.vue'
|
|
4
|
+
import Container from './Container.vue'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
/**
|
|
10
|
+
* Frontmatter object — wired in automatically when this layout
|
|
11
|
+
* wraps a `.md` template (the default behavior, or via the
|
|
12
|
+
* `layout: MarkdownLayout` frontmatter key).
|
|
13
|
+
*
|
|
14
|
+
* Keys matching `Layout`'s props (`lang`, `dir`, `bodyClass`,
|
|
15
|
+
* `doubleHead`, `ariaLabel`, `outlookFallback`) flow through to
|
|
16
|
+
* the wrapped `Layout`. Missing keys fall back to `Layout`'s
|
|
17
|
+
* own defaults.
|
|
18
|
+
*/
|
|
19
|
+
frontmatter: {
|
|
20
|
+
type: Object as PropType<Record<string, unknown>>,
|
|
21
|
+
default: () => ({})
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<Layout
|
|
28
|
+
:lang="props.frontmatter.lang as string | undefined"
|
|
29
|
+
:dir="props.frontmatter.dir as 'ltr' | 'rtl' | undefined"
|
|
30
|
+
:body-class="props.frontmatter.bodyClass as string | undefined"
|
|
31
|
+
:double-head="props.frontmatter.doubleHead as boolean | string | undefined"
|
|
32
|
+
:aria-label="props.frontmatter.ariaLabel as string | undefined"
|
|
33
|
+
:outlook-fallback="props.frontmatter.outlookFallback as boolean | undefined"
|
|
34
|
+
>
|
|
35
|
+
<Container class="max-w-xl">
|
|
36
|
+
<slot />
|
|
37
|
+
</Container>
|
|
38
|
+
</Layout>
|
|
39
|
+
</template>
|
|
@@ -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>
|
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
|
|
|
@@ -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;AAChE,KAAI,OAAO,UAAU,YAAY,OAAO,SAAS,OAAO,MAAM,CAAC,CAC7D,QAAO,GAAG,MAAM;AAElB,QAAO;;AAGT,MAAM,WAAmC,EAAE;;;;;;;;;AAU3C,SAAgB,OAAO,QAAwB;AAC7C,UAAS,WAAW,SAAS,WAAW,KAAK;AAC7C,QAAO,GAAG,SAAS,SAAS;;AAG9B,SAAgB,gBAAgB,UAA2B;AACzD,QAAO,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;EAEvC,MAAM,SADU,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,IAChB,QAAQ,MAAM,GAAG;AACvC,SAAO,sBAAsB,KAAK,MAAM;GACxC;;AAGJ,SAAgB,gBAAgB,UAA2B;AACzD,QAAO,qCAAqC,KAAK,SAAS;;AAG5D,SAAgB,iBAAiB,UAA2B;AAC1D,QAAO,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;EAEvC,MAAM,SADU,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,IAChB,QAAQ,MAAM,GAAG;AACvC,SAAO,sBAAsB,KAAK,MAAM;GACxC;;AAGJ,SAAgB,iBAAiB,UAA2B;AAC1D,QAAO,uCAAuC,KAAK,SAAS;;;;;;;;AAS9D,MAAa,sBAAsB;CACjC,MAAM;CACN,SAAS;CACV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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
5
|
|
|
@@ -31,4 +31,4 @@ function defineConfig(data = {}) {
|
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { defineConfig };
|
|
34
|
-
//# sourceMappingURL=defineConfig.
|
|
34
|
+
//# 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;AAC5C,KAAI,MAAM,QAAQ,IAAI,KAAK,EAAE;AAC3B,MAAI,OAAO;AACX,SAAO;;EAET;;;;;;;;;AAUF,SAAgB,aAAa,OAA+B,EAAE,EAAiB;AAE7E,KAAI,oBAAoB,EAAE;EAExB,MAAM,SAAS,MAAM,MADA,OAAO,kBAAkB,EAAE,CAAkB,CAC1B;EAExC,MAAM,MAAM,OAAO,iBAAiB;AACpC,MAAI,IAAK,KAAI,YAAY;AAEzB,UAAQ,kBAAkB,OAAO;AAEjC,SAAO;;AAIT,QAAO"}
|
|
@@ -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,27 @@
|
|
|
1
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
import { inject } from "vue";
|
|
4
|
+
|
|
5
|
+
//#region src/composables/useBaseUrl.ts
|
|
6
|
+
/**
|
|
7
|
+
* Set the base URL for the current email template — same as
|
|
8
|
+
* `config.url.base`, scoped to one SFC.
|
|
9
|
+
*
|
|
10
|
+
* Pass a string to prepend to all default tags/attributes, or an object
|
|
11
|
+
* for fine-grained control (which tags/attributes, style tags, etc.).
|
|
12
|
+
*
|
|
13
|
+
* Usage in SFC <script setup>:
|
|
14
|
+
* ```ts
|
|
15
|
+
* useBaseUrl('https://cdn.example.com/emails/')
|
|
16
|
+
* useBaseUrl({ url: 'https://cdn.example.com/', styleTag: true })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function useBaseUrl(value) {
|
|
20
|
+
const ctx = inject(RenderContextKey);
|
|
21
|
+
if (!ctx) return;
|
|
22
|
+
ctx.sfcConfig = defu({ url: { base: value } }, ctx.sfcConfig ?? {});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useBaseUrl };
|
|
27
|
+
//# 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;AACpC,KAAI,CAAC,IAAK;AACV,KAAI,YAAYA,KAAM,EAAE,KAAK,EAAE,MAAM,OAAO,EAAE,EAAE,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -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;AAEvC,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,mHAAmH;AAGrI,QAAO"}
|