@maizzle/framework 6.0.0-rc.2 → 6.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/maizzle.mjs +1 -1
- package/dist/build.d.ts +20 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +163 -0
- package/dist/build.js.map +1 -0
- package/dist/components/Body.vue +128 -0
- package/dist/components/Button.vue +148 -52
- package/dist/components/CodeBlock.vue +69 -0
- package/dist/components/CodeInline.vue +49 -0
- package/dist/components/Column.vue +108 -0
- package/dist/components/Container.vue +123 -0
- package/dist/components/Font.vue +96 -0
- package/dist/components/Head.vue +30 -0
- package/dist/components/Heading.vue +28 -0
- package/dist/components/Hr.vue +33 -0
- package/dist/components/Html.vue +137 -0
- package/dist/components/Img.vue +70 -0
- package/dist/components/Layout.vue +143 -0
- package/dist/components/Link.vue +26 -0
- package/dist/components/Markdown.vue +89 -0
- package/dist/components/MarkdownLayout.vue +39 -0
- package/dist/components/NotPlaintext.vue +14 -0
- package/dist/components/Outlook.vue +74 -11
- package/dist/components/OutlookBg.vue +241 -0
- package/dist/components/Overlap.vue +156 -0
- package/dist/components/Plaintext.vue +14 -0
- package/dist/components/Preheader.vue +15 -0
- package/dist/components/QrCode.vue +157 -0
- package/dist/components/Raw.vue +28 -0
- package/dist/components/Row.vue +184 -0
- package/dist/components/Section.vue +124 -0
- package/dist/components/Spacer.vue +70 -21
- package/dist/components/Tailwind.vue +43 -0
- package/dist/components/Text.vue +29 -0
- package/dist/components/utils.d.ts +28 -0
- package/dist/components/utils.d.ts.map +1 -0
- package/dist/components/utils.js +50 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/components/utils.ts +51 -0
- package/dist/composables/{defineConfig.d.mts → defineConfig.d.ts} +2 -2
- package/dist/composables/defineConfig.d.ts.map +1 -0
- package/dist/composables/{defineConfig.mjs → defineConfig.js} +4 -5
- package/dist/composables/defineConfig.js.map +1 -0
- package/dist/composables/renderContext.d.ts +37 -0
- package/dist/composables/renderContext.d.ts.map +1 -0
- package/dist/composables/{renderContext.mjs → renderContext.js} +2 -2
- package/dist/composables/renderContext.js.map +1 -0
- package/dist/composables/useBaseUrl.d.ts +19 -0
- package/dist/composables/useBaseUrl.d.ts.map +1 -0
- package/dist/composables/useBaseUrl.js +26 -0
- package/dist/composables/useBaseUrl.js.map +1 -0
- package/dist/composables/{useConfig.d.mts → useConfig.d.ts} +2 -2
- package/dist/composables/useConfig.d.ts.map +1 -0
- package/dist/composables/{useConfig.mjs → useConfig.js} +2 -3
- package/dist/composables/useConfig.js.map +1 -0
- package/dist/composables/useCurrentTemplate.d.ts +31 -0
- package/dist/composables/useCurrentTemplate.d.ts.map +1 -0
- package/dist/composables/useCurrentTemplate.js +35 -0
- package/dist/composables/useCurrentTemplate.js.map +1 -0
- package/dist/composables/{useDoctype.d.mts → useDoctype.d.ts} +1 -1
- package/dist/composables/useDoctype.d.ts.map +1 -0
- package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
- package/dist/composables/useDoctype.js.map +1 -0
- package/dist/composables/{useEvent.d.mts → useEvent.d.ts} +3 -3
- package/dist/composables/useEvent.d.ts.map +1 -0
- package/dist/composables/{useEvent.mjs → useEvent.js} +4 -5
- package/dist/composables/useEvent.js.map +1 -0
- package/dist/composables/useFont.d.ts +50 -0
- package/dist/composables/useFont.d.ts.map +1 -0
- package/dist/composables/useFont.js +92 -0
- package/dist/composables/useFont.js.map +1 -0
- package/dist/composables/useOutlookFallback.d.ts +21 -0
- package/dist/composables/useOutlookFallback.d.ts.map +1 -0
- package/dist/composables/useOutlookFallback.js +29 -0
- package/dist/composables/useOutlookFallback.js.map +1 -0
- package/dist/composables/{usePlaintext.d.mts → usePlaintext.d.ts} +3 -1
- package/dist/composables/usePlaintext.d.ts.map +1 -0
- package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
- package/dist/composables/usePlaintext.js.map +1 -0
- package/dist/composables/usePreheader.d.ts +24 -0
- package/dist/composables/usePreheader.d.ts.map +1 -0
- package/dist/composables/usePreheader.js +28 -0
- package/dist/composables/usePreheader.js.map +1 -0
- package/dist/composables/useTransformers.d.ts +34 -0
- package/dist/composables/useTransformers.d.ts.map +1 -0
- package/dist/composables/useTransformers.js +48 -0
- package/dist/composables/useTransformers.js.map +1 -0
- package/dist/composables/useUrlQuery.d.ts +19 -0
- package/dist/composables/useUrlQuery.d.ts.map +1 -0
- package/dist/composables/useUrlQuery.js +26 -0
- package/dist/composables/useUrlQuery.js.map +1 -0
- package/dist/config/{defaults.d.mts → defaults.d.ts} +2 -2
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/{defaults.mjs → defaults.js} +10 -6
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/{index.d.mts → index.d.ts} +4 -4
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/{index.mjs → index.js} +12 -10
- package/dist/config/index.js.map +1 -0
- package/dist/events/{index.d.mts → index.d.ts} +30 -12
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/{index.mjs → index.js} +26 -13
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +38 -0
- package/dist/{plaintext.d.mts → plaintext.d.ts} +1 -1
- package/dist/plaintext.d.ts.map +1 -0
- package/dist/{plaintext.mjs → plaintext.js} +4 -5
- package/dist/plaintext.js.map +1 -0
- package/dist/{plugin.d.mts → plugin.d.ts} +2 -2
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +57 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.d.mts → mergeMediaQueries.d.ts} +2 -2
- package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +2 -3
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
- package/dist/plugins/postcss/{pruneVars.d.mts → pruneVars.d.ts} +1 -1
- package/dist/plugins/postcss/pruneVars.d.ts.map +1 -0
- package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +2 -2
- package/dist/plugins/postcss/pruneVars.js.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts +13 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.js +84 -0
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.d.mts → removeDeclarations.d.ts} +1 -1
- package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +2 -2
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts +16 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js +39 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
- package/dist/plugins/postcss/resolveProps.d.ts +8 -0
- package/dist/plugins/postcss/resolveProps.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveProps.js +144 -0
- package/dist/plugins/postcss/resolveProps.js.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.d.mts → tailwindCleanup.d.ts} +2 -2
- package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -0
- package/dist/plugins/postcss/tailwindCleanup.js +68 -0
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
- package/dist/prepare.d.ts +17 -0
- package/dist/prepare.d.ts.map +1 -0
- package/dist/prepare.js +44 -0
- package/dist/prepare.js.map +1 -0
- package/dist/render/active.d.ts +8 -0
- package/dist/render/active.d.ts.map +1 -0
- package/dist/render/active.js +12 -0
- package/dist/render/active.js.map +1 -0
- package/dist/render/{createRenderer.d.mts → createRenderer.d.ts} +15 -7
- package/dist/render/createRenderer.d.ts.map +1 -0
- package/dist/render/createRenderer.js +320 -0
- package/dist/render/createRenderer.js.map +1 -0
- package/dist/render/index.d.ts +18 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +53 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/injectFonts.d.ts +15 -0
- package/dist/render/injectFonts.d.ts.map +1 -0
- package/dist/render/injectFonts.js +45 -0
- package/dist/render/injectFonts.js.map +1 -0
- package/dist/render/plugins/codeBlockExtract.d.ts +14 -0
- package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -0
- package/dist/render/plugins/codeBlockExtract.js +34 -0
- package/dist/render/plugins/codeBlockExtract.js.map +1 -0
- package/dist/render/plugins/markdownExtract.d.ts +12 -0
- package/dist/render/plugins/markdownExtract.d.ts.map +1 -0
- package/dist/render/plugins/markdownExtract.js +49 -0
- package/dist/render/plugins/markdownExtract.js.map +1 -0
- package/dist/render/plugins/rawExtract.d.ts +14 -0
- package/dist/render/plugins/rawExtract.d.ts.map +1 -0
- package/dist/render/plugins/rawExtract.js +34 -0
- package/dist/render/plugins/rawExtract.js.map +1 -0
- package/dist/render/plugins/rowSourceLocation.d.ts +18 -0
- package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -0
- package/dist/render/plugins/rowSourceLocation.js +45 -0
- package/dist/render/plugins/rowSourceLocation.js.map +1 -0
- package/dist/{serve.d.mts → serve.d.ts} +4 -2
- package/dist/serve.d.ts.map +1 -0
- package/dist/{serve.mjs → serve.js} +203 -78
- package/dist/serve.js.map +1 -0
- package/dist/server/compatibility.d.ts +59 -0
- package/dist/server/compatibility.d.ts.map +1 -0
- package/dist/server/compatibility.js +911 -0
- package/dist/server/compatibility.js.map +1 -0
- package/dist/server/email.d.ts +17 -0
- package/dist/server/email.d.ts.map +1 -0
- package/dist/server/email.js +40 -0
- package/dist/server/email.js.map +1 -0
- package/dist/server/linter.d.ts +20 -0
- package/dist/server/linter.d.ts.map +1 -0
- package/dist/server/linter.js +339 -0
- package/dist/server/linter.js.map +1 -0
- package/dist/server/sfc-utils.d.ts +21 -0
- package/dist/server/sfc-utils.d.ts.map +1 -0
- package/dist/server/sfc-utils.js +198 -0
- package/dist/server/sfc-utils.js.map +1 -0
- package/dist/server/ui/App.vue +253 -77
- package/dist/server/ui/components/SidebarClose.vue +12 -0
- package/dist/server/ui/components/ui/checkbox/Checkbox.vue +35 -0
- package/dist/server/ui/components/ui/checkbox/index.ts +1 -0
- package/dist/server/ui/components/ui/command/Command.vue +5 -1
- package/dist/server/ui/components/ui/command/CommandDialog.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandInput.vue +19 -1
- package/dist/server/ui/components/ui/command/CommandItem.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandList.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandShortcut.vue +1 -1
- package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +9 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/dist/server/ui/components/ui/input/Input.vue +1 -1
- package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +9 -1
- package/dist/server/ui/components/ui/sidebar/Sidebar.vue +8 -1
- package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +1 -1
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +5 -4
- package/dist/server/ui/components/ui/tags-input/TagsInput.vue +26 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +17 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItem.vue +19 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +22 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItemText.vue +17 -0
- package/dist/server/ui/components/ui/tags-input/index.ts +5 -0
- package/dist/server/ui/components/ui/toggle/index.ts +3 -3
- package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +1 -1
- package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +2 -2
- package/dist/server/ui/lib/emulated-dark-mode.ts +131 -0
- package/dist/server/ui/main.css +20 -20
- package/dist/server/ui/pages/Home.vue +12 -5
- package/dist/server/ui/pages/Preview.vue +716 -276
- package/dist/tests/render/_helpers.d.ts +6 -0
- package/dist/tests/render/_helpers.d.ts.map +1 -0
- package/dist/tests/render/_helpers.js +16 -0
- package/dist/tests/render/_helpers.js.map +1 -0
- package/dist/transformers/{addAttributes.d.mts → addAttributes.d.ts} +2 -2
- package/dist/transformers/addAttributes.d.ts.map +1 -0
- package/dist/transformers/{addAttributes.mjs → addAttributes.js} +16 -13
- package/dist/transformers/addAttributes.js.map +1 -0
- package/dist/transformers/attributeToStyle.d.ts +38 -0
- package/dist/transformers/attributeToStyle.d.ts.map +1 -0
- package/dist/transformers/attributeToStyle.js +94 -0
- package/dist/transformers/attributeToStyle.js.map +1 -0
- package/dist/transformers/base.d.ts +71 -0
- package/dist/transformers/base.d.ts.map +1 -0
- package/dist/transformers/{base.mjs → base.js} +56 -30
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/columnWidth.d.ts +31 -0
- package/dist/transformers/columnWidth.d.ts.map +1 -0
- package/dist/transformers/columnWidth.js +546 -0
- package/dist/transformers/columnWidth.js.map +1 -0
- package/dist/transformers/entities.d.ts +37 -0
- package/dist/transformers/entities.d.ts.map +1 -0
- package/dist/transformers/entities.js +73 -0
- package/dist/transformers/entities.js.map +1 -0
- package/dist/transformers/filters/defaults.d.ts +6 -0
- package/dist/transformers/filters/defaults.d.ts.map +1 -0
- package/dist/transformers/filters/defaults.js +78 -0
- package/dist/transformers/filters/defaults.js.map +1 -0
- package/dist/transformers/filters/index.d.ts +43 -0
- package/dist/transformers/filters/index.d.ts.map +1 -0
- package/dist/transformers/filters/index.js +89 -0
- package/dist/transformers/filters/index.js.map +1 -0
- package/dist/transformers/format.d.ts +22 -0
- package/dist/transformers/format.d.ts.map +1 -0
- package/dist/transformers/format.js +30 -0
- package/dist/transformers/format.js.map +1 -0
- package/dist/transformers/{index.d.mts → index.d.ts} +14 -11
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +133 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/inlineCss.d.ts +84 -0
- package/dist/transformers/inlineCss.d.ts.map +1 -0
- package/dist/transformers/inlineCss.js +91 -0
- package/dist/transformers/inlineCss.js.map +1 -0
- package/dist/transformers/inlineLink.d.ts +35 -0
- package/dist/transformers/inlineLink.d.ts.map +1 -0
- package/dist/transformers/{inlineLink.mjs → inlineLink.js} +34 -10
- package/dist/transformers/inlineLink.js.map +1 -0
- package/dist/transformers/minify.d.ts +21 -0
- package/dist/transformers/minify.d.ts.map +1 -0
- package/dist/transformers/minify.js +25 -0
- package/dist/transformers/minify.js.map +1 -0
- package/dist/transformers/msoPlaceholders.d.ts +28 -0
- package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
- package/dist/transformers/msoPlaceholders.js +88 -0
- package/dist/transformers/msoPlaceholders.js.map +1 -0
- package/dist/transformers/purgeCss.d.ts +43 -0
- package/dist/transformers/purgeCss.d.ts.map +1 -0
- package/dist/transformers/purgeCss.js +181 -0
- package/dist/transformers/purgeCss.js.map +1 -0
- package/dist/transformers/removeAttributes.d.ts +54 -0
- package/dist/transformers/removeAttributes.d.ts.map +1 -0
- package/dist/transformers/removeAttributes.js +70 -0
- package/dist/transformers/removeAttributes.js.map +1 -0
- package/dist/transformers/{replaceStrings.d.mts → replaceStrings.d.ts} +2 -2
- package/dist/transformers/replaceStrings.d.ts.map +1 -0
- package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
- package/dist/transformers/replaceStrings.js.map +1 -0
- package/dist/transformers/{safeClassNames.d.mts → safeClassNames.d.ts} +2 -2
- package/dist/transformers/safeClassNames.d.ts.map +1 -0
- package/dist/transformers/{safeClassNames.mjs → safeClassNames.js} +4 -5
- package/dist/transformers/safeClassNames.js.map +1 -0
- package/dist/transformers/shorthandCss.d.ts +47 -0
- package/dist/transformers/shorthandCss.d.ts.map +1 -0
- package/dist/transformers/shorthandCss.js +61 -0
- package/dist/transformers/shorthandCss.js.map +1 -0
- package/dist/transformers/sixHex.d.ts +25 -0
- package/dist/transformers/sixHex.d.ts.map +1 -0
- package/dist/transformers/sixHex.js +42 -0
- package/dist/transformers/sixHex.js.map +1 -0
- package/dist/transformers/tailwindComponent.d.ts +16 -0
- package/dist/transformers/tailwindComponent.d.ts.map +1 -0
- package/dist/transformers/tailwindComponent.js +92 -0
- package/dist/transformers/tailwindComponent.js.map +1 -0
- package/dist/transformers/{tailwindcss.d.mts → tailwindcss.d.ts} +8 -4
- package/dist/transformers/tailwindcss.d.ts.map +1 -0
- package/dist/transformers/tailwindcss.js +97 -0
- package/dist/transformers/tailwindcss.js.map +1 -0
- package/dist/transformers/urlQuery.d.ts +36 -0
- package/dist/transformers/urlQuery.d.ts.map +1 -0
- package/dist/transformers/urlQuery.js +77 -0
- package/dist/transformers/urlQuery.js.map +1 -0
- package/dist/types/config.d.ts +737 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/ast/index.d.ts +4 -0
- package/dist/utils/ast/index.js +4 -0
- package/dist/utils/ast/{parser.d.mts → parser.d.ts} +1 -1
- package/dist/utils/ast/parser.d.ts.map +1 -0
- package/dist/utils/ast/{parser.mjs → parser.js} +2 -3
- package/dist/utils/ast/parser.js.map +1 -0
- package/dist/utils/ast/serializer.d.ts +8 -0
- package/dist/utils/ast/serializer.d.ts.map +1 -0
- package/dist/utils/ast/serializer.js +36 -0
- package/dist/utils/ast/serializer.js.map +1 -0
- package/dist/utils/ast/{walker.d.mts → walker.d.ts} +1 -1
- package/dist/utils/ast/walker.d.ts.map +1 -0
- package/dist/utils/ast/{walker.mjs → walker.js} +2 -2
- package/dist/utils/ast/walker.js.map +1 -0
- package/dist/utils/compileTailwindCss.d.ts +16 -0
- package/dist/utils/compileTailwindCss.d.ts.map +1 -0
- package/dist/utils/compileTailwindCss.js +54 -0
- package/dist/utils/compileTailwindCss.js.map +1 -0
- package/dist/utils/componentSources.d.ts +50 -0
- package/dist/utils/componentSources.d.ts.map +1 -0
- package/dist/utils/componentSources.js +50 -0
- package/dist/utils/componentSources.js.map +1 -0
- package/dist/utils/decodeStyleEntities.d.ts +15 -0
- package/dist/utils/decodeStyleEntities.d.ts.map +1 -0
- package/dist/utils/decodeStyleEntities.js +18 -0
- package/dist/utils/decodeStyleEntities.js.map +1 -0
- package/dist/utils/detect.d.ts +5 -0
- package/dist/utils/detect.d.ts.map +1 -0
- package/dist/utils/detect.js +10 -0
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/output-markers.d.ts +29 -0
- package/dist/utils/output-markers.d.ts.map +1 -0
- package/dist/utils/output-markers.js +68 -0
- package/dist/utils/output-markers.js.map +1 -0
- package/dist/utils/{url.d.mts → url.d.ts} +1 -1
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/{url.mjs → url.js} +2 -3
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/watchPaths.d.ts +11 -0
- package/dist/utils/watchPaths.d.ts.map +1 -0
- package/dist/utils/watchPaths.js +19 -0
- package/dist/utils/watchPaths.js.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +8 -0
- package/node_modules/@clack/core/dist/index.d.mts +18 -4
- package/node_modules/@clack/core/dist/index.mjs +16 -10
- package/node_modules/@clack/core/dist/index.mjs.map +1 -1
- package/node_modules/@clack/core/package.json +5 -2
- package/node_modules/@clack/prompts/CHANGELOG.md +15 -0
- package/node_modules/@clack/prompts/README.md +107 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +16 -11
- package/node_modules/@clack/prompts/dist/index.mjs +114 -107
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
- package/node_modules/@clack/prompts/package.json +7 -4
- package/node_modules/fast-string-truncated-width/dist/index.js +36 -96
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +0 -3
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +3 -3
- package/node_modules/fast-string-truncated-width/dist/utils.js +14 -9
- package/node_modules/fast-string-truncated-width/package.json +1 -1
- package/node_modules/fast-string-truncated-width/readme.md +2 -3
- package/node_modules/fast-string-width/package.json +2 -2
- package/node_modules/fast-string-width/readme.md +0 -3
- package/node_modules/fast-wrap-ansi/lib/main.js +4 -1
- package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -1
- package/node_modules/fast-wrap-ansi/package.json +2 -2
- package/node_modules/maizzle/README.md +24 -0
- package/node_modules/maizzle/dist/commands/make/component.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/config.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/layout.mjs +3 -3
- package/node_modules/maizzle/dist/commands/make/scaffold.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/stubs/Layout.vue +146 -0
- package/node_modules/maizzle/dist/commands/make/stubs/component.vue +2 -4
- package/node_modules/maizzle/dist/commands/make/stubs/config.ts +1 -5
- package/node_modules/maizzle/dist/commands/make/template.mjs +1 -1
- package/node_modules/maizzle/dist/commands/new.mjs +32 -52
- package/node_modules/maizzle/dist/index.d.mts +1 -0
- package/node_modules/maizzle/dist/index.mjs +30 -7
- package/node_modules/maizzle/package.json +4 -3
- package/node_modules/nypm/dist/cli.mjs +28 -5
- package/node_modules/nypm/dist/index.d.mts +0 -8
- package/node_modules/nypm/dist/index.mjs +27 -4
- package/node_modules/nypm/package.json +12 -12
- package/node_modules/tinyexec/README.md +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 +31 -21
- package/dist/build.d.mts +0 -19
- package/dist/build.d.mts.map +0 -1
- package/dist/build.mjs +0 -139
- package/dist/build.mjs.map +0 -1
- package/dist/components/Divider.vue +0 -105
- package/dist/components/Vml.vue +0 -89
- package/dist/components/utils.d.mts +0 -5
- package/dist/components/utils.d.mts.map +0 -1
- package/dist/components/utils.mjs +0 -9
- package/dist/components/utils.mjs.map +0 -1
- package/dist/composables/defineConfig.d.mts.map +0 -1
- package/dist/composables/defineConfig.mjs.map +0 -1
- package/dist/composables/renderContext.d.mts +0 -19
- package/dist/composables/renderContext.d.mts.map +0 -1
- package/dist/composables/renderContext.mjs.map +0 -1
- package/dist/composables/useConfig.d.mts.map +0 -1
- package/dist/composables/useConfig.mjs.map +0 -1
- package/dist/composables/useDoctype.d.mts.map +0 -1
- package/dist/composables/useDoctype.mjs.map +0 -1
- package/dist/composables/useEvent.d.mts.map +0 -1
- package/dist/composables/useEvent.mjs.map +0 -1
- package/dist/composables/usePlaintext.d.mts.map +0 -1
- package/dist/composables/usePlaintext.mjs.map +0 -1
- package/dist/config/defaults.d.mts.map +0 -1
- package/dist/config/defaults.mjs.map +0 -1
- package/dist/config/index.d.mts.map +0 -1
- package/dist/config/index.mjs.map +0 -1
- package/dist/events/index.d.mts.map +0 -1
- package/dist/events/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -29
- package/dist/index.mjs +0 -29
- package/dist/plaintext.d.mts.map +0 -1
- package/dist/plaintext.mjs.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/plugin.mjs +0 -41
- package/dist/plugin.mjs.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
- package/dist/plugins/postcss/pruneVars.d.mts.map +0 -1
- package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.d.mts.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.mjs +0 -35
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
- package/dist/render/createRenderer.d.mts.map +0 -1
- package/dist/render/createRenderer.mjs +0 -155
- package/dist/render/createRenderer.mjs.map +0 -1
- package/dist/render/index.d.mts +0 -26
- package/dist/render/index.d.mts.map +0 -1
- package/dist/render/index.mjs +0 -44
- package/dist/render/index.mjs.map +0 -1
- package/dist/serve.d.mts.map +0 -1
- package/dist/serve.mjs.map +0 -1
- package/dist/server/compatibility.d.mts +0 -6
- package/dist/server/compatibility.d.mts.map +0 -1
- package/dist/server/compatibility.mjs +0 -83
- package/dist/server/compatibility.mjs.map +0 -1
- package/dist/server/linter.d.mts +0 -6
- package/dist/server/linter.d.mts.map +0 -1
- package/dist/server/linter.mjs +0 -200
- package/dist/server/linter.mjs.map +0 -1
- package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +0 -30
- package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +0 -21
- package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +0 -25
- package/dist/server/ui/components/ui/resizable/index.ts +0 -3
- package/dist/transformers/addAttributes.d.mts.map +0 -1
- package/dist/transformers/addAttributes.mjs.map +0 -1
- package/dist/transformers/attributeToStyle.d.mts +0 -25
- package/dist/transformers/attributeToStyle.d.mts.map +0 -1
- package/dist/transformers/attributeToStyle.mjs +0 -80
- package/dist/transformers/attributeToStyle.mjs.map +0 -1
- package/dist/transformers/base.d.mts +0 -8
- package/dist/transformers/base.d.mts.map +0 -1
- package/dist/transformers/base.mjs.map +0 -1
- package/dist/transformers/entities.d.mts +0 -8
- package/dist/transformers/entities.d.mts.map +0 -1
- package/dist/transformers/entities.mjs +0 -38
- package/dist/transformers/entities.mjs.map +0 -1
- package/dist/transformers/format.d.mts +0 -15
- package/dist/transformers/format.d.mts.map +0 -1
- package/dist/transformers/format.mjs +0 -26
- package/dist/transformers/format.mjs.map +0 -1
- package/dist/transformers/index.d.mts.map +0 -1
- package/dist/transformers/index.mjs +0 -73
- package/dist/transformers/index.mjs.map +0 -1
- package/dist/transformers/inlineCSS.d.mts +0 -30
- package/dist/transformers/inlineCSS.d.mts.map +0 -1
- package/dist/transformers/inlineCSS.mjs +0 -79
- package/dist/transformers/inlineCSS.mjs.map +0 -1
- package/dist/transformers/inlineLink.d.mts +0 -14
- package/dist/transformers/inlineLink.d.mts.map +0 -1
- package/dist/transformers/inlineLink.mjs.map +0 -1
- package/dist/transformers/minify.d.mts +0 -17
- package/dist/transformers/minify.d.mts.map +0 -1
- package/dist/transformers/minify.mjs +0 -24
- package/dist/transformers/minify.mjs.map +0 -1
- package/dist/transformers/purgeCSS.d.mts +0 -23
- package/dist/transformers/purgeCSS.d.mts.map +0 -1
- package/dist/transformers/purgeCSS.mjs +0 -66
- package/dist/transformers/purgeCSS.mjs.map +0 -1
- package/dist/transformers/removeAttributes.d.mts +0 -31
- package/dist/transformers/removeAttributes.d.mts.map +0 -1
- package/dist/transformers/removeAttributes.mjs +0 -63
- package/dist/transformers/removeAttributes.mjs.map +0 -1
- package/dist/transformers/replaceStrings.d.mts.map +0 -1
- package/dist/transformers/replaceStrings.mjs.map +0 -1
- package/dist/transformers/safeClassNames.d.mts.map +0 -1
- package/dist/transformers/safeClassNames.mjs.map +0 -1
- package/dist/transformers/shorthandCSS.d.mts +0 -24
- package/dist/transformers/shorthandCSS.d.mts.map +0 -1
- package/dist/transformers/shorthandCSS.mjs +0 -48
- package/dist/transformers/shorthandCSS.mjs.map +0 -1
- package/dist/transformers/tailwindcss.d.mts.map +0 -1
- package/dist/transformers/tailwindcss.mjs +0 -136
- package/dist/transformers/tailwindcss.mjs.map +0 -1
- package/dist/transformers/urlQuery.d.mts +0 -24
- package/dist/transformers/urlQuery.d.mts.map +0 -1
- package/dist/transformers/urlQuery.mjs +0 -65
- package/dist/transformers/urlQuery.mjs.map +0 -1
- package/dist/types/config.d.mts +0 -149
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs +0 -1
- package/dist/types/index.d.mts +0 -2
- package/dist/types/index.mjs +0 -1
- package/dist/utils/ast/index.d.mts +0 -4
- package/dist/utils/ast/index.mjs +0 -5
- package/dist/utils/ast/parser.d.mts.map +0 -1
- package/dist/utils/ast/parser.mjs.map +0 -1
- package/dist/utils/ast/serializer.d.mts +0 -7
- package/dist/utils/ast/serializer.d.mts.map +0 -1
- package/dist/utils/ast/serializer.mjs +0 -13
- package/dist/utils/ast/serializer.mjs.map +0 -1
- package/dist/utils/ast/walker.d.mts.map +0 -1
- package/dist/utils/ast/walker.mjs.map +0 -1
- package/dist/utils/url.d.mts.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
const warnedLocations = new Set<string>()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { Comment, Text, computed, createStaticVNode, provide, useAttrs, useSlots, Fragment } from 'vue'
|
|
7
|
+
import type { VNode } from 'vue'
|
|
8
|
+
import { twMerge } from 'tailwind-merge'
|
|
9
|
+
import Column from './Column.vue'
|
|
10
|
+
import { hasWidthInStyle, hasWidthUtility, normalizeToPixels, outlookFallbackProp } from './utils.ts'
|
|
11
|
+
import { useOutlookFallback } from '../composables/useOutlookFallback'
|
|
12
|
+
|
|
13
|
+
defineOptions({ inheritAttrs: false })
|
|
14
|
+
|
|
15
|
+
const attrs = useAttrs()
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
/**
|
|
19
|
+
* Explicit row width.
|
|
20
|
+
*
|
|
21
|
+
* Used as the width source for column min-width calculation.
|
|
22
|
+
* When not set, the nearest sized ancestor (`Container`, `Section`,
|
|
23
|
+
* outer `Column`, or this row's own width class/inline style) is
|
|
24
|
+
* used instead.
|
|
25
|
+
*/
|
|
26
|
+
width: {
|
|
27
|
+
type: [String, Number],
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Override the auto-detected column count.
|
|
32
|
+
*
|
|
33
|
+
* By default, the number of direct child elements is used.
|
|
34
|
+
* Set this when the auto-detection doesn't match your layout
|
|
35
|
+
* (e.g. when using `v-if` or `v-for`).
|
|
36
|
+
*/
|
|
37
|
+
cols: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: null
|
|
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
|
+
*/
|
|
51
|
+
outlookFallback: outlookFallbackProp,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const outlookFallback = useOutlookFallback(props.outlookFallback)
|
|
55
|
+
|
|
56
|
+
const slots = useSlots()
|
|
57
|
+
|
|
58
|
+
function countChildren(vnodes: VNode[]): number {
|
|
59
|
+
let count = 0
|
|
60
|
+
|
|
61
|
+
for (const vnode of vnodes) {
|
|
62
|
+
if (vnode.type === Fragment && Array.isArray(vnode.children)) {
|
|
63
|
+
count += countChildren(vnode.children as VNode[])
|
|
64
|
+
} else if (vnode.type !== Comment && typeof vnode.type !== 'symbol') {
|
|
65
|
+
count++
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return count
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function hasColumnChild(vnodes: VNode[]): boolean {
|
|
73
|
+
for (const vnode of vnodes) {
|
|
74
|
+
if (vnode.type === Fragment && Array.isArray(vnode.children)) {
|
|
75
|
+
if (hasColumnChild(vnode.children as VNode[])) return true
|
|
76
|
+
} else if (vnode.type === Column) {
|
|
77
|
+
return true
|
|
78
|
+
} else if (
|
|
79
|
+
typeof vnode.type === 'object'
|
|
80
|
+
&& vnode.type !== null
|
|
81
|
+
&& '__name' in vnode.type
|
|
82
|
+
&& (vnode.type as { __name?: string }).__name === 'Column'
|
|
83
|
+
) {
|
|
84
|
+
return true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function hasMeaningfulContent(vnodes: VNode[]): boolean {
|
|
91
|
+
for (const vnode of vnodes) {
|
|
92
|
+
if (vnode.type === Comment) continue
|
|
93
|
+
if (vnode.type === Fragment && Array.isArray(vnode.children)) {
|
|
94
|
+
if (hasMeaningfulContent(vnode.children as VNode[])) return true
|
|
95
|
+
continue
|
|
96
|
+
}
|
|
97
|
+
if (vnode.type === Text) {
|
|
98
|
+
if (typeof vnode.children === 'string' && vnode.children.trim()) return true
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
101
|
+
if (typeof vnode.type === 'symbol') continue
|
|
102
|
+
return true
|
|
103
|
+
}
|
|
104
|
+
return false
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const columnCount = computed(() => {
|
|
108
|
+
if (props.cols) return props.cols
|
|
109
|
+
|
|
110
|
+
const children = slots.default?.() ?? []
|
|
111
|
+
return countChildren(children) || 1
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
provide('columnCount', columnCount)
|
|
115
|
+
|
|
116
|
+
const userStyle = computed(() => {
|
|
117
|
+
const s = attrs.style
|
|
118
|
+
if (!s) return ''
|
|
119
|
+
return typeof s === 'object'
|
|
120
|
+
? Object.entries(s).map(([k, v]) => `${k.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${v}`).join('; ')
|
|
121
|
+
: String(s)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const userHasWidth = computed(() => {
|
|
125
|
+
const cls = (attrs.class as string) ?? ''
|
|
126
|
+
return hasWidthUtility(cls) || hasWidthInStyle(userStyle.value)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const colWidthSource = computed(() => {
|
|
130
|
+
if (props.width != null) return normalizeToPixels(props.width)
|
|
131
|
+
if (userHasWidth.value) return ''
|
|
132
|
+
return null
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const restAttrs = computed(() => {
|
|
136
|
+
const { style: _, class: __, 'data-maizzle-loc': ___, ...rest } = attrs
|
|
137
|
+
return rest
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* `font-size: 0;` removes the whitespace gap between inline-block
|
|
142
|
+
* children. Lives in a class so users can override (e.g. via a custom
|
|
143
|
+
* `text-*`) and twMerge resolves the conflict cleanly instead of the
|
|
144
|
+
* inline declaration silently shadowing the user's class.
|
|
145
|
+
*/
|
|
146
|
+
const baseClass = 'text-0'
|
|
147
|
+
const mergedClass = computed(() => twMerge(baseClass, (attrs.class as string) ?? ''))
|
|
148
|
+
|
|
149
|
+
const divStyle = computed(() => userStyle.value || undefined)
|
|
150
|
+
|
|
151
|
+
const MsoBefore = () => createStaticVNode(
|
|
152
|
+
'<!--[if mso]><table role="none" cellpadding="0" cellspacing="0" style="width: 100%"><tr><![endif]-->',
|
|
153
|
+
1
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
const MsoAfter = () => createStaticVNode(
|
|
157
|
+
'<!--[if mso]></tr></table><![endif]-->',
|
|
158
|
+
1
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
const initialChildren = slots.default?.() ?? []
|
|
162
|
+
if (hasMeaningfulContent(initialChildren) && !hasColumnChild(initialChildren)) {
|
|
163
|
+
const loc = (attrs['data-maizzle-loc'] as string | undefined) ?? '<unknown location>'
|
|
164
|
+
if (!warnedLocations.has(loc)) {
|
|
165
|
+
warnedLocations.add(loc)
|
|
166
|
+
const display = loc.split('/').pop() ?? loc
|
|
167
|
+
const suffix = outlookFallback ? ' Layout will break in Outlook.' : ''
|
|
168
|
+
console.warn(`[maizzle] <Row> in ${display} has no <Column> inside it.${suffix}`)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<template>
|
|
174
|
+
<MsoBefore v-if="outlookFallback" />
|
|
175
|
+
<div
|
|
176
|
+
v-bind="restAttrs"
|
|
177
|
+
:class="mergedClass"
|
|
178
|
+
:style="divStyle"
|
|
179
|
+
:data-maizzle-cw="colWidthSource"
|
|
180
|
+
>
|
|
181
|
+
<slot />
|
|
182
|
+
</div>
|
|
183
|
+
<MsoAfter v-if="outlookFallback" />
|
|
184
|
+
</template>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, createStaticVNode, useAttrs } from 'vue'
|
|
3
|
+
import { hasWidthInStyle, hasWidthUtility, nextId, normalizeToPixels, outlookFallbackProp } from './utils.ts'
|
|
4
|
+
import { useOutlookFallback } from '../composables/useOutlookFallback'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
8
|
+
const attrs = useAttrs()
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
/**
|
|
12
|
+
* Width of the section.
|
|
13
|
+
*
|
|
14
|
+
* Applied as `max-width` on the div and as `width` on the MSO table.
|
|
15
|
+
*
|
|
16
|
+
* When not set, the MSO table width is auto-derived from a width
|
|
17
|
+
* utility class (e.g. `max-w-md`) or inline style (`max-width`/
|
|
18
|
+
* `width`) on the component, after CSS inlining. Falls back to
|
|
19
|
+
* `100%` when no width source is provided.
|
|
20
|
+
*/
|
|
21
|
+
width: {
|
|
22
|
+
type: [String, Number],
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Inline CSS applied only to the MSO `<td>` element.
|
|
27
|
+
*
|
|
28
|
+
* Use for Outlook-specific styling that shouldn't affect other clients.
|
|
29
|
+
*
|
|
30
|
+
* @example 'padding: 10px 20px'
|
|
31
|
+
*/
|
|
32
|
+
msoStyle: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: undefined
|
|
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
|
+
*/
|
|
46
|
+
outlookFallback: outlookFallbackProp,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const outlookFallback = useOutlookFallback(props.outlookFallback)
|
|
50
|
+
|
|
51
|
+
const userStyle = computed(() => {
|
|
52
|
+
const s = attrs.style
|
|
53
|
+
if (!s) return ''
|
|
54
|
+
return typeof s === 'object'
|
|
55
|
+
? Object.entries(s).map(([k, v]) => `${k.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${v}`).join('; ')
|
|
56
|
+
: String(s)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const userHasWidth = computed(() => {
|
|
60
|
+
const cls = (attrs.class as string) ?? ''
|
|
61
|
+
return hasWidthUtility(cls) || hasWidthInStyle(userStyle.value)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const useMarker = outlookFallback && props.width == null && userHasWidth.value
|
|
65
|
+
const msoId = useMarker ? nextId('s') : null
|
|
66
|
+
|
|
67
|
+
const divStyle = computed(() => {
|
|
68
|
+
const parts: string[] = []
|
|
69
|
+
if (props.width != null) parts.push(`max-width: ${normalizeToPixels(props.width)}`)
|
|
70
|
+
if (userStyle.value) parts.push(userStyle.value)
|
|
71
|
+
return parts.length ? parts.join('; ') : undefined
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const restAttrs = computed(() => {
|
|
75
|
+
const { style: _, ...rest } = attrs
|
|
76
|
+
return rest
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const tdStyles = computed(() => {
|
|
80
|
+
const parts: string[] = []
|
|
81
|
+
if (userStyle.value) parts.push(userStyle.value)
|
|
82
|
+
if (props.msoStyle) parts.push(props.msoStyle)
|
|
83
|
+
return parts.length ? parts.join('; ') : ''
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const msoWidth = computed(() => {
|
|
87
|
+
if (props.width != null) return normalizeToPixels(props.width)
|
|
88
|
+
if (useMarker) return `__MAIZZLE_MSOW_${msoId}__`
|
|
89
|
+
return '100%'
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const colWidthSource = computed(() => {
|
|
93
|
+
if (props.width != null) return normalizeToPixels(props.width)
|
|
94
|
+
if (userHasWidth.value) return ''
|
|
95
|
+
return null
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const MsoBefore = () => {
|
|
99
|
+
const tdStyle = tdStyles.value ? ` style="${tdStyles.value}"` : ''
|
|
100
|
+
return createStaticVNode(
|
|
101
|
+
`<!--[if mso]><table role="none" cellpadding="0" cellspacing="0" style="width: ${msoWidth.value}"><tr><td${tdStyle}><![endif]-->`,
|
|
102
|
+
1
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const MsoAfter = () => createStaticVNode(
|
|
107
|
+
'<!--[if mso]></td></tr></table><![endif]-->',
|
|
108
|
+
1
|
|
109
|
+
)
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<template>
|
|
113
|
+
<MsoBefore v-if="outlookFallback" />
|
|
114
|
+
<div
|
|
115
|
+
v-bind="restAttrs"
|
|
116
|
+
:style="divStyle"
|
|
117
|
+
:data-maizzle-msow-id="msoId"
|
|
118
|
+
:data-maizzle-msow-fallback="useMarker ? '100%' : null"
|
|
119
|
+
:data-maizzle-cw="colWidthSource"
|
|
120
|
+
>
|
|
121
|
+
<slot />
|
|
122
|
+
</div>
|
|
123
|
+
<MsoAfter v-if="outlookFallback" />
|
|
124
|
+
</template>
|
|
@@ -1,36 +1,85 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { normalizeToPixels } from './utils.ts'
|
|
2
|
+
import { computed, h, useAttrs } from 'vue'
|
|
3
|
+
import { normalizeToPixels, outlookFallbackProp } from './utils.ts'
|
|
4
|
+
import { useOutlookFallback } from '../composables/useOutlookFallback'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
4
7
|
|
|
5
8
|
const props = defineProps({
|
|
6
|
-
/** The
|
|
7
|
-
|
|
8
|
-
type:
|
|
9
|
-
default:
|
|
9
|
+
/** The type of spacer. */
|
|
10
|
+
type: {
|
|
11
|
+
type: String as () => 'vertical' | 'horizontal',
|
|
12
|
+
default: 'vertical'
|
|
10
13
|
},
|
|
11
|
-
/** The
|
|
12
|
-
|
|
14
|
+
/** The width of the spacer (horizontal). */
|
|
15
|
+
width: {
|
|
13
16
|
type: [String, Number],
|
|
14
|
-
default:
|
|
15
|
-
}
|
|
17
|
+
default: 16
|
|
18
|
+
},
|
|
19
|
+
outlookFallback: outlookFallbackProp,
|
|
16
20
|
})
|
|
17
21
|
|
|
18
|
-
const
|
|
19
|
-
|
|
22
|
+
const attrs = useAttrs()
|
|
23
|
+
const outlookFallback = useOutlookFallback(props.outlookFallback)
|
|
24
|
+
|
|
25
|
+
const HEIGHT_RE = /(?:^|\s)h-([\w./\-[\]%]+)/g
|
|
26
|
+
const LEADING_RE = /(?:^|\s)leading-/
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
const verticalClass = computed(() => {
|
|
29
|
+
const userClass = (attrs.class as string) || ''
|
|
30
|
+
if (!userClass) return ''
|
|
31
|
+
|
|
32
|
+
const heights = [...userClass.matchAll(HEIGHT_RE)]
|
|
33
|
+
const stripped = userClass.replace(HEIGHT_RE, ' ').replace(/\s+/g, ' ').trim()
|
|
34
|
+
|
|
35
|
+
if (!heights.length) return stripped
|
|
36
|
+
if (LEADING_RE.test(stripped)) return stripped
|
|
37
|
+
|
|
38
|
+
return `${stripped} leading-${heights[heights.length - 1][1]}`.trim()
|
|
39
|
+
})
|
|
24
40
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
function parsePixelValue(value: string | number): number {
|
|
42
|
+
if (typeof value === 'number') return value
|
|
43
|
+
return Number.parseFloat(value) || 0
|
|
44
|
+
}
|
|
28
45
|
|
|
29
|
-
|
|
46
|
+
const horizontalStyles = computed(() => {
|
|
47
|
+
const mso = outlookFallback ? msoFontWidth.value : ''
|
|
48
|
+
return `display:inline-block; width: ${normalizeToPixels(props.width)}; font-size: 16px;${mso}`
|
|
30
49
|
})
|
|
50
|
+
|
|
51
|
+
const msoFontWidth = computed(() => {
|
|
52
|
+
const widthPx = parsePixelValue(props.width)
|
|
53
|
+
const emspBase = 16
|
|
54
|
+
const maxPercent = 500
|
|
55
|
+
const maxPerEmsp = emspBase * (maxPercent / 100)
|
|
56
|
+
const numEmsps = Math.ceil(widthPx / maxPerEmsp)
|
|
57
|
+
const percent = Math.round((widthPx / (numEmsps * emspBase)) * 100)
|
|
58
|
+
|
|
59
|
+
return ` mso-font-width:${percent}%;`
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const emspCount = computed(() => {
|
|
63
|
+
const widthPx = parsePixelValue(props.width)
|
|
64
|
+
const maxPerEmsp = 16 * 5
|
|
65
|
+
return Math.ceil(widthPx / maxPerEmsp)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const emsps = computed(() => '\u2003'.repeat(emspCount.value))
|
|
69
|
+
|
|
70
|
+
const HorizontalSpacer = () =>
|
|
71
|
+
h('i', { ...attrs, style: horizontalStyles.value }, emsps.value)
|
|
31
72
|
</script>
|
|
32
73
|
|
|
33
74
|
<template>
|
|
34
|
-
<
|
|
35
|
-
|
|
75
|
+
<template v-if="type === 'horizontal'">
|
|
76
|
+
<HorizontalSpacer />
|
|
77
|
+
</template>
|
|
78
|
+
<template v-else>
|
|
79
|
+
<div
|
|
80
|
+
role="separator"
|
|
81
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
82
|
+
:class="verticalClass"
|
|
83
|
+
>‍</div>
|
|
84
|
+
</template>
|
|
36
85
|
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, createCommentVNode, inject, h, Fragment, type VNode } from 'vue'
|
|
3
|
+
import { RenderContextKey } from '../composables/renderContext'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Walk a slot's vnode tree and concatenate its text content.
|
|
7
|
+
* Handles plain text children, arrays, and Comment vnodes.
|
|
8
|
+
* Static text in <template #config>...</template> compiles into
|
|
9
|
+
* text vnodes whose `children` is a string — that's our path.
|
|
10
|
+
*/
|
|
11
|
+
function vnodeText(input: unknown): string {
|
|
12
|
+
if (input == null || input === false) return ''
|
|
13
|
+
if (typeof input === 'string') return input
|
|
14
|
+
if (typeof input === 'number') return String(input)
|
|
15
|
+
if (Array.isArray(input)) return input.map(vnodeText).join('')
|
|
16
|
+
|
|
17
|
+
const v = input as VNode
|
|
18
|
+
if (typeof v.children === 'string') return v.children
|
|
19
|
+
if (Array.isArray(v.children)) return vnodeText(v.children)
|
|
20
|
+
return ''
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default defineComponent({
|
|
24
|
+
name: 'Tailwind',
|
|
25
|
+
setup(_, { slots }) {
|
|
26
|
+
const ctx = inject(RenderContextKey)!
|
|
27
|
+
if (!ctx.tailwindBlocks) ctx.tailwindBlocks = []
|
|
28
|
+
const id = `tw${ctx.tailwindBlocks.length}`
|
|
29
|
+
|
|
30
|
+
// Extract optional `#config` slot content as raw CSS. Evaluated at
|
|
31
|
+
// setup time; the slot is NOT rendered into the document.
|
|
32
|
+
const css = slots.config ? vnodeText(slots.config()).trim() : undefined
|
|
33
|
+
|
|
34
|
+
ctx.tailwindBlocks.push({ id, css: css || undefined })
|
|
35
|
+
|
|
36
|
+
return () => h(Fragment, null, [
|
|
37
|
+
createCommentVNode(`mz-tw:${id}`),
|
|
38
|
+
slots.default?.(),
|
|
39
|
+
createCommentVNode(`/mz-tw:${id}`),
|
|
40
|
+
])
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type PropType, computed, useAttrs } from 'vue'
|
|
3
|
+
import { twMerge } from 'tailwind-merge'
|
|
4
|
+
|
|
5
|
+
defineOptions({ inheritAttrs: false })
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
/**
|
|
9
|
+
* The HTML element to render.
|
|
10
|
+
* @default 'p'
|
|
11
|
+
*/
|
|
12
|
+
as: {
|
|
13
|
+
type: String as PropType<'p' | 'span'>,
|
|
14
|
+
default: 'p',
|
|
15
|
+
validator: (v: string) => ['p', 'span'].includes(v),
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const attrs = useAttrs()
|
|
20
|
+
|
|
21
|
+
const defaultClass = computed(() => props.as === 'span' ? 'text-base' : 'm-0 my-4 text-base')
|
|
22
|
+
const mergedClass = computed(() => twMerge(defaultClass.value, attrs.class as string))
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<component :is="props.as" v-bind="$attrs" :class="mergedClass">
|
|
27
|
+
<slot />
|
|
28
|
+
</component>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/components/utils.d.ts
|
|
2
|
+
declare function normalizeToPixels(value: string | number): string;
|
|
3
|
+
/**
|
|
4
|
+
* Module-scoped sequential ID generator. Used by components to mint
|
|
5
|
+
* unique marker ids (e.g. `c1`, `c2`) for the post-render transformer.
|
|
6
|
+
*
|
|
7
|
+
* Must live here (not inside `<script setup>`) because Vue compiles
|
|
8
|
+
* `<script setup>` into the component's `setup()` function — any
|
|
9
|
+
* `let counter = 0` there resets per instance, causing id collisions.
|
|
10
|
+
*/
|
|
11
|
+
declare function nextId(prefix: string): string;
|
|
12
|
+
declare function hasWidthUtility(classStr: string): boolean;
|
|
13
|
+
declare function hasWidthInStyle(styleStr: string): boolean;
|
|
14
|
+
declare function hasHeightUtility(classStr: string): boolean;
|
|
15
|
+
declare function hasHeightInStyle(styleStr: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Shared prop for components that emit MSO/VML fallback markup. The
|
|
18
|
+
* `null` default acts as the "unset" sentinel — `useOutlookFallback`
|
|
19
|
+
* treats `null` as inherit-from-ancestor (root default `true`),
|
|
20
|
+
* letting users override per-component without losing inheritance.
|
|
21
|
+
*/
|
|
22
|
+
declare const outlookFallbackProp: {
|
|
23
|
+
readonly type: BooleanConstructor;
|
|
24
|
+
readonly default: null;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { hasHeightInStyle, hasHeightUtility, hasWidthInStyle, hasWidthUtility, nextId, normalizeToPixels, outlookFallbackProp };
|
|
28
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/components/utils.ts"],"mappings":";iBAAgB,iBAAA,CAAkB,KAAA;AAAlC;;;;;AAiBA;;;AAjBA,iBAiBgB,MAAA,CAAO,MAAA;AAAA,iBAKP,eAAA,CAAgB,QAAA;AAAA,iBAQhB,eAAA,CAAgB,QAAA;AAAA,iBAIhB,gBAAA,CAAiB,QAAA;AAAA,iBAQjB,gBAAA,CAAiB,QAAA;;;AAZjC;;;;cAsBa,mBAAA;EAAA,eAGH,kBAAA;EAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/components/utils.ts
|
|
2
|
+
function normalizeToPixels(value) {
|
|
3
|
+
if (typeof value === "number" || Number.isFinite(Number(value))) return `${value}px`;
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
const counters = {};
|
|
7
|
+
/**
|
|
8
|
+
* Module-scoped sequential ID generator. Used by components to mint
|
|
9
|
+
* unique marker ids (e.g. `c1`, `c2`) for the post-render transformer.
|
|
10
|
+
*
|
|
11
|
+
* Must live here (not inside `<script setup>`) because Vue compiles
|
|
12
|
+
* `<script setup>` into the component's `setup()` function — any
|
|
13
|
+
* `let counter = 0` there resets per instance, causing id collisions.
|
|
14
|
+
*/
|
|
15
|
+
function nextId(prefix) {
|
|
16
|
+
counters[prefix] = (counters[prefix] ?? 0) + 1;
|
|
17
|
+
return `${prefix}${counters[prefix]}`;
|
|
18
|
+
}
|
|
19
|
+
function hasWidthUtility(classStr) {
|
|
20
|
+
return classStr.split(/\s+/).some((c) => {
|
|
21
|
+
const clean = (c.split(":").pop() ?? "").replace(/^!/, "");
|
|
22
|
+
return /^(w-|max-w-|min-w-)/.test(clean);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function hasWidthInStyle(styleStr) {
|
|
26
|
+
return /(?:^|;\s*)(?:max-width|width)\s*:/i.test(styleStr);
|
|
27
|
+
}
|
|
28
|
+
function hasHeightUtility(classStr) {
|
|
29
|
+
return classStr.split(/\s+/).some((c) => {
|
|
30
|
+
const clean = (c.split(":").pop() ?? "").replace(/^!/, "");
|
|
31
|
+
return /^(h-|max-h-|min-h-)/.test(clean);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function hasHeightInStyle(styleStr) {
|
|
35
|
+
return /(?:^|;\s*)(?:max-height|height)\s*:/i.test(styleStr);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Shared prop for components that emit MSO/VML fallback markup. The
|
|
39
|
+
* `null` default acts as the "unset" sentinel — `useOutlookFallback`
|
|
40
|
+
* treats `null` as inherit-from-ancestor (root default `true`),
|
|
41
|
+
* letting users override per-component without losing inheritance.
|
|
42
|
+
*/
|
|
43
|
+
const outlookFallbackProp = {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: null
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { hasHeightInStyle, hasHeightUtility, hasWidthInStyle, hasWidthUtility, nextId, normalizeToPixels, outlookFallbackProp };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/components/utils.ts"],"sourcesContent":["export function normalizeToPixels(value: string | number): string {\n if (typeof value === 'number' || Number.isFinite(Number(value))) {\n return `${value}px`\n }\n return value\n}\n\nconst counters: Record<string, number> = {}\n\n/**\n * Module-scoped sequential ID generator. Used by components to mint\n * unique marker ids (e.g. `c1`, `c2`) for the post-render transformer.\n *\n * Must live here (not inside `<script setup>`) because Vue compiles\n * `<script setup>` into the component's `setup()` function — any\n * `let counter = 0` there resets per instance, causing id collisions.\n */\nexport function nextId(prefix: string): string {\n counters[prefix] = (counters[prefix] ?? 0) + 1\n return `${prefix}${counters[prefix]}`\n}\n\nexport function hasWidthUtility(classStr: string): boolean {\n return classStr.split(/\\s+/).some((c) => {\n const utility = c.split(':').pop() ?? ''\n const clean = utility.replace(/^!/, '')\n return /^(w-|max-w-|min-w-)/.test(clean)\n })\n}\n\nexport function hasWidthInStyle(styleStr: string): boolean {\n return /(?:^|;\\s*)(?:max-width|width)\\s*:/i.test(styleStr)\n}\n\nexport function hasHeightUtility(classStr: string): boolean {\n return classStr.split(/\\s+/).some((c) => {\n const utility = c.split(':').pop() ?? ''\n const clean = utility.replace(/^!/, '')\n return /^(h-|max-h-|min-h-)/.test(clean)\n })\n}\n\nexport function hasHeightInStyle(styleStr: string): boolean {\n return /(?:^|;\\s*)(?:max-height|height)\\s*:/i.test(styleStr)\n}\n\n/**\n * Shared prop for components that emit MSO/VML fallback markup. The\n * `null` default acts as the \"unset\" sentinel — `useOutlookFallback`\n * treats `null` as inherit-from-ancestor (root default `true`),\n * letting users override per-component without losing inheritance.\n */\nexport const outlookFallbackProp = {\n type: Boolean,\n default: null,\n} as const\n\n"],"mappings":";AAAA,SAAgB,kBAAkB,OAAgC;CAChE,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,OAAO,MAAM,CAAC,EAC7D,OAAO,GAAG,MAAM;CAElB,OAAO;;AAGT,MAAM,WAAmC,EAAE;;;;;;;;;AAU3C,SAAgB,OAAO,QAAwB;CAC7C,SAAS,WAAW,SAAS,WAAW,KAAK;CAC7C,OAAO,GAAG,SAAS,SAAS;;AAG9B,SAAgB,gBAAgB,UAA2B;CACzD,OAAO,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;EAEvC,MAAM,SADU,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,IAChB,QAAQ,MAAM,GAAG;EACvC,OAAO,sBAAsB,KAAK,MAAM;GACxC;;AAGJ,SAAgB,gBAAgB,UAA2B;CACzD,OAAO,qCAAqC,KAAK,SAAS;;AAG5D,SAAgB,iBAAiB,UAA2B;CAC1D,OAAO,SAAS,MAAM,MAAM,CAAC,MAAM,MAAM;EAEvC,MAAM,SADU,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,IAChB,QAAQ,MAAM,GAAG;EACvC,OAAO,sBAAsB,KAAK,MAAM;GACxC;;AAGJ,SAAgB,iBAAiB,UAA2B;CAC1D,OAAO,uCAAuC,KAAK,SAAS;;;;;;;;AAS9D,MAAa,sBAAsB;CACjC,MAAM;CACN,SAAS;CACV"}
|
package/dist/components/utils.ts
CHANGED
|
@@ -4,3 +4,54 @@ export function normalizeToPixels(value: string | number): string {
|
|
|
4
4
|
}
|
|
5
5
|
return value
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
const counters: Record<string, number> = {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Module-scoped sequential ID generator. Used by components to mint
|
|
12
|
+
* unique marker ids (e.g. `c1`, `c2`) for the post-render transformer.
|
|
13
|
+
*
|
|
14
|
+
* Must live here (not inside `<script setup>`) because Vue compiles
|
|
15
|
+
* `<script setup>` into the component's `setup()` function — any
|
|
16
|
+
* `let counter = 0` there resets per instance, causing id collisions.
|
|
17
|
+
*/
|
|
18
|
+
export function nextId(prefix: string): string {
|
|
19
|
+
counters[prefix] = (counters[prefix] ?? 0) + 1
|
|
20
|
+
return `${prefix}${counters[prefix]}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function hasWidthUtility(classStr: string): boolean {
|
|
24
|
+
return classStr.split(/\s+/).some((c) => {
|
|
25
|
+
const utility = c.split(':').pop() ?? ''
|
|
26
|
+
const clean = utility.replace(/^!/, '')
|
|
27
|
+
return /^(w-|max-w-|min-w-)/.test(clean)
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function hasWidthInStyle(styleStr: string): boolean {
|
|
32
|
+
return /(?:^|;\s*)(?:max-width|width)\s*:/i.test(styleStr)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function hasHeightUtility(classStr: string): boolean {
|
|
36
|
+
return classStr.split(/\s+/).some((c) => {
|
|
37
|
+
const utility = c.split(':').pop() ?? ''
|
|
38
|
+
const clean = utility.replace(/^!/, '')
|
|
39
|
+
return /^(h-|max-h-|min-h-)/.test(clean)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function hasHeightInStyle(styleStr: string): boolean {
|
|
44
|
+
return /(?:^|;\s*)(?:max-height|height)\s*:/i.test(styleStr)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Shared prop for components that emit MSO/VML fallback markup. The
|
|
49
|
+
* `null` default acts as the "unset" sentinel — `useOutlookFallback`
|
|
50
|
+
* treats `null` as inherit-from-ancestor (root default `true`),
|
|
51
|
+
* letting users override per-component without losing inheritance.
|
|
52
|
+
*/
|
|
53
|
+
export const outlookFallbackProp = {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: null,
|
|
56
|
+
} as const
|
|
57
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaizzleConfig } from "../types/config.
|
|
1
|
+
import { MaizzleConfig } from "../types/config.js";
|
|
2
2
|
//#region src/composables/defineConfig.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Define Maizzle config.
|
|
@@ -11,4 +11,4 @@ import { MaizzleConfig } from "../types/config.mjs";
|
|
|
11
11
|
declare function defineConfig(data?: Partial<MaizzleConfig>): MaizzleConfig;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { defineConfig };
|
|
14
|
-
//# sourceMappingURL=defineConfig.d.
|
|
14
|
+
//# sourceMappingURL=defineConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.d.ts","names":[],"sources":["../../src/composables/defineConfig.ts"],"mappings":";;;;;AAqBA;;;;;iBAAgB,YAAA,CAAa,IAAA,GAAM,OAAA,CAAQ,aAAA,IAAsB,aAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { MaizzleConfigKey } from "./useConfig.
|
|
2
|
-
import { RenderContextKey } from "./renderContext.
|
|
1
|
+
import { MaizzleConfigKey } from "./useConfig.js";
|
|
2
|
+
import { RenderContextKey } from "./renderContext.js";
|
|
3
3
|
import { createDefu } from "defu";
|
|
4
4
|
import { getCurrentInstance, inject, provide } from "vue";
|
|
5
|
-
|
|
6
5
|
//#region src/composables/defineConfig.ts
|
|
7
6
|
const merge = createDefu((obj, key, value) => {
|
|
8
7
|
if (Array.isArray(obj[key])) {
|
|
@@ -28,7 +27,7 @@ function defineConfig(data = {}) {
|
|
|
28
27
|
}
|
|
29
28
|
return data;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
31
|
export { defineConfig };
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.js","names":[],"sources":["../../src/composables/defineConfig.ts"],"sourcesContent":["import { getCurrentInstance, inject, provide } from 'vue'\nimport { createDefu } from 'defu'\nimport { MaizzleConfigKey } from './useConfig.ts'\nimport { RenderContextKey } from './renderContext.ts'\nimport type { MaizzleConfig } from '../types/index.ts'\n\nconst merge = createDefu((obj, key, value) => {\n if (Array.isArray(obj[key])) {\n obj[key] = value\n return true\n }\n})\n\n/**\n * Define Maizzle config.\n *\n * Works in both contexts:\n * - In maizzle.config.ts: typed identity function, returns the config as-is\n * - In Vue SFC <script setup>: merges with the global config and provides\n * the result to child components via useConfig()\n */\nexport function defineConfig(data: Partial<MaizzleConfig> = {}): MaizzleConfig {\n // Inside a Vue SFC — merge with global config and provide to children\n if (getCurrentInstance()) {\n const globalConfig = inject(MaizzleConfigKey, {} as MaizzleConfig)\n const merged = merge(data, globalConfig) as MaizzleConfig\n\n const ctx = inject(RenderContextKey)\n if (ctx) ctx.sfcConfig = merged\n\n provide(MaizzleConfigKey, merged)\n\n return merged\n }\n\n // Outside Vue (maizzle.config.ts) — just return the config\n return data as MaizzleConfig\n}\n"],"mappings":";;;;;AAMA,MAAM,QAAQ,YAAY,KAAK,KAAK,UAAU;CAC5C,IAAI,MAAM,QAAQ,IAAI,KAAK,EAAE;EAC3B,IAAI,OAAO;EACX,OAAO;;EAET;;;;;;;;;AAUF,SAAgB,aAAa,OAA+B,EAAE,EAAiB;CAE7E,IAAI,oBAAoB,EAAE;EAExB,MAAM,SAAS,MAAM,MADA,OAAO,kBAAkB,EAAE,CACT,CAAC;EAExC,MAAM,MAAM,OAAO,iBAAiB;EACpC,IAAI,KAAK,IAAI,YAAY;EAEzB,QAAQ,kBAAkB,OAAO;EAEjC,OAAO;;CAIT,OAAO"}
|