@maizzle/framework 6.0.0-9 → 6.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/maizzle.mjs +10 -0
- package/dist/build.d.mts +19 -0
- package/dist/build.d.mts.map +1 -0
- package/dist/build.mjs +121 -0
- package/dist/build.mjs.map +1 -0
- package/dist/components/Button.vue +141 -0
- package/dist/components/Divider.vue +105 -0
- package/dist/components/NoWidows.vue +123 -0
- package/dist/components/NotOutlook.vue +17 -0
- package/dist/components/Outlook.vue +74 -0
- package/dist/components/Spacer.vue +36 -0
- package/dist/components/Vml.vue +89 -0
- package/dist/components/WithUrl.vue +190 -0
- package/dist/components/utils.d.mts +5 -0
- package/dist/components/utils.d.mts.map +1 -0
- package/dist/components/utils.mjs +9 -0
- package/dist/components/utils.mjs.map +1 -0
- package/dist/components/utils.ts +6 -0
- package/dist/composables/defineConfig.d.mts +14 -0
- package/dist/composables/defineConfig.d.mts.map +1 -0
- package/dist/composables/defineConfig.mjs +34 -0
- package/dist/composables/defineConfig.mjs.map +1 -0
- package/dist/composables/renderContext.d.mts +19 -0
- package/dist/composables/renderContext.d.mts.map +1 -0
- package/dist/composables/renderContext.mjs +6 -0
- package/dist/composables/renderContext.mjs.map +1 -0
- package/dist/composables/useConfig.d.mts +9 -0
- package/dist/composables/useConfig.d.mts.map +1 -0
- package/dist/composables/useConfig.mjs +13 -0
- package/dist/composables/useConfig.mjs.map +1 -0
- package/dist/composables/useDoctype.d.mts +13 -0
- package/dist/composables/useDoctype.d.mts.map +1 -0
- package/dist/composables/useDoctype.mjs +20 -0
- package/dist/composables/useDoctype.mjs.map +1 -0
- package/dist/composables/useEvent.d.mts +17 -0
- package/dist/composables/useEvent.d.mts.map +1 -0
- package/dist/composables/useEvent.mjs +25 -0
- package/dist/composables/useEvent.mjs.map +1 -0
- package/dist/composables/usePlaintext.d.mts +19 -0
- package/dist/composables/usePlaintext.d.mts.map +1 -0
- package/dist/composables/usePlaintext.mjs +22 -0
- package/dist/composables/usePlaintext.mjs.map +1 -0
- package/dist/config/defaults.d.mts +6 -0
- package/dist/config/defaults.d.mts.map +1 -0
- package/dist/config/defaults.mjs +28 -0
- package/dist/config/defaults.mjs.map +1 -0
- package/dist/config/index.d.mts +15 -0
- package/dist/config/index.d.mts.map +1 -0
- package/dist/config/index.mjs +47 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/events/index.d.mts +91 -0
- package/dist/events/index.d.mts.map +1 -0
- package/dist/events/index.mjs +110 -0
- package/dist/events/index.mjs.map +1 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +29 -0
- package/dist/plaintext.d.mts +5 -0
- package/dist/plaintext.d.mts.map +1 -0
- package/dist/plaintext.mjs +15 -0
- package/dist/plaintext.mjs.map +1 -0
- package/dist/plugin.d.mts +17 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +41 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/plugins/postcss/mergeMediaQueries.d.mts +18 -0
- package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +1 -0
- package/dist/plugins/postcss/mergeMediaQueries.mjs +22 -0
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +1 -0
- package/dist/plugins/postcss/pruneVars.d.mts +8 -0
- package/dist/plugins/postcss/pruneVars.d.mts.map +1 -0
- package/dist/plugins/postcss/pruneVars.mjs +49 -0
- package/dist/plugins/postcss/pruneVars.mjs.map +1 -0
- package/dist/plugins/postcss/removeDeclarations.d.mts +12 -0
- package/dist/plugins/postcss/removeDeclarations.d.mts.map +1 -0
- package/dist/plugins/postcss/removeDeclarations.mjs +45 -0
- package/dist/plugins/postcss/removeDeclarations.mjs.map +1 -0
- package/dist/plugins/postcss/tailwindCleanup.d.mts +18 -0
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +1 -0
- package/dist/plugins/postcss/tailwindCleanup.mjs +35 -0
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +1 -0
- package/dist/render/createRenderer.d.mts +34 -0
- package/dist/render/createRenderer.d.mts.map +1 -0
- package/dist/render/createRenderer.mjs +149 -0
- package/dist/render/createRenderer.mjs.map +1 -0
- package/dist/render/index.d.mts +26 -0
- package/dist/render/index.d.mts.map +1 -0
- package/dist/render/index.mjs +40 -0
- package/dist/render/index.mjs.map +1 -0
- package/dist/serve.d.mts +25 -0
- package/dist/serve.d.mts.map +1 -0
- package/dist/serve.mjs +402 -0
- package/dist/serve.mjs.map +1 -0
- package/dist/server/compatibility.d.mts +6 -0
- package/dist/server/compatibility.d.mts.map +1 -0
- package/dist/server/compatibility.mjs +83 -0
- package/dist/server/compatibility.mjs.map +1 -0
- package/dist/server/linter.d.mts +6 -0
- package/dist/server/linter.d.mts.map +1 -0
- package/dist/server/linter.mjs +200 -0
- package/dist/server/linter.mjs.map +1 -0
- package/dist/server/ui/App.vue +360 -0
- package/dist/server/ui/components/ui/button/Button.vue +31 -0
- package/dist/server/ui/components/ui/button/index.ts +38 -0
- package/dist/server/ui/components/ui/command/Command.vue +87 -0
- package/dist/server/ui/components/ui/command/CommandDialog.vue +31 -0
- package/dist/server/ui/components/ui/command/CommandEmpty.vue +27 -0
- package/dist/server/ui/components/ui/command/CommandGroup.vue +45 -0
- package/dist/server/ui/components/ui/command/CommandInput.vue +39 -0
- package/dist/server/ui/components/ui/command/CommandItem.vue +76 -0
- package/dist/server/ui/components/ui/command/CommandList.vue +25 -0
- package/dist/server/ui/components/ui/command/CommandSeparator.vue +21 -0
- package/dist/server/ui/components/ui/command/CommandShortcut.vue +17 -0
- package/dist/server/ui/components/ui/command/index.ts +25 -0
- package/dist/server/ui/components/ui/dialog/Dialog.vue +19 -0
- package/dist/server/ui/components/ui/dialog/DialogClose.vue +15 -0
- package/dist/server/ui/components/ui/dialog/DialogContent.vue +53 -0
- package/dist/server/ui/components/ui/dialog/DialogDescription.vue +23 -0
- package/dist/server/ui/components/ui/dialog/DialogFooter.vue +27 -0
- package/dist/server/ui/components/ui/dialog/DialogHeader.vue +17 -0
- package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +21 -0
- package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +59 -0
- package/dist/server/ui/components/ui/dialog/DialogTitle.vue +23 -0
- package/dist/server/ui/components/ui/dialog/DialogTrigger.vue +15 -0
- package/dist/server/ui/components/ui/dialog/index.ts +10 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuContent.vue +39 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuGroup.vue +15 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +31 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuLabel.vue +23 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/dist/server/ui/components/ui/dropdown-menu/index.ts +16 -0
- package/dist/server/ui/components/ui/empty/Empty.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyContent.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyDescription.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyHeader.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyMedia.vue +21 -0
- package/dist/server/ui/components/ui/empty/EmptyTitle.vue +17 -0
- package/dist/server/ui/components/ui/empty/index.ts +26 -0
- package/dist/server/ui/components/ui/input/Input.vue +33 -0
- package/dist/server/ui/components/ui/input/index.ts +1 -0
- package/dist/server/ui/components/ui/kbd/Kbd.vue +20 -0
- package/dist/server/ui/components/ui/kbd/KbdGroup.vue +17 -0
- package/dist/server/ui/components/ui/kbd/index.ts +2 -0
- package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +30 -0
- package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +21 -0
- package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +25 -0
- package/dist/server/ui/components/ui/resizable/index.ts +3 -0
- package/dist/server/ui/components/ui/scroll-area/ScrollArea.vue +33 -0
- package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +32 -0
- package/dist/server/ui/components/ui/scroll-area/index.ts +2 -0
- package/dist/server/ui/components/ui/separator/Separator.vue +29 -0
- package/dist/server/ui/components/ui/separator/index.ts +1 -0
- package/dist/server/ui/components/ui/sheet/Sheet.vue +19 -0
- package/dist/server/ui/components/ui/sheet/SheetClose.vue +15 -0
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +62 -0
- package/dist/server/ui/components/ui/sheet/SheetDescription.vue +21 -0
- package/dist/server/ui/components/ui/sheet/SheetFooter.vue +16 -0
- package/dist/server/ui/components/ui/sheet/SheetHeader.vue +15 -0
- package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +21 -0
- package/dist/server/ui/components/ui/sheet/SheetTitle.vue +21 -0
- package/dist/server/ui/components/ui/sheet/SheetTrigger.vue +15 -0
- package/dist/server/ui/components/ui/sheet/index.ts +8 -0
- package/dist/server/ui/components/ui/sidebar/Sidebar.vue +96 -0
- package/dist/server/ui/components/ui/sidebar/SidebarContent.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarFooter.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroup.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroupAction.vue +27 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroupContent.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroupLabel.vue +25 -0
- package/dist/server/ui/components/ui/sidebar/SidebarHeader.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarInput.vue +31 -0
- package/dist/server/ui/components/ui/sidebar/SidebarInset.vue +21 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenu.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuAction.vue +35 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuBadge.vue +26 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuButton.vue +48 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuButtonChild.vue +36 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuItem.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSkeleton.vue +35 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSub.vue +22 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSubButton.vue +36 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSubItem.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +82 -0
- package/dist/server/ui/components/ui/sidebar/SidebarRail.vue +33 -0
- package/dist/server/ui/components/ui/sidebar/SidebarSeparator.vue +19 -0
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +28 -0
- package/dist/server/ui/components/ui/sidebar/index.ts +60 -0
- package/dist/server/ui/components/ui/sidebar/utils.ts +19 -0
- package/dist/server/ui/components/ui/skeleton/Skeleton.vue +17 -0
- package/dist/server/ui/components/ui/skeleton/index.ts +1 -0
- package/dist/server/ui/components/ui/tabs/Tabs.vue +24 -0
- package/dist/server/ui/components/ui/tabs/TabsContent.vue +21 -0
- package/dist/server/ui/components/ui/tabs/TabsList.vue +24 -0
- package/dist/server/ui/components/ui/tabs/TabsTrigger.vue +26 -0
- package/dist/server/ui/components/ui/tabs/index.ts +4 -0
- package/dist/server/ui/components/ui/toggle/Toggle.vue +35 -0
- package/dist/server/ui/components/ui/toggle/index.ts +28 -0
- package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +49 -0
- package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +46 -0
- package/dist/server/ui/components/ui/toggle-group/index.ts +2 -0
- package/dist/server/ui/components/ui/tooltip/Tooltip.vue +19 -0
- package/dist/server/ui/components/ui/tooltip/TooltipContent.vue +34 -0
- package/dist/server/ui/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/dist/server/ui/components/ui/tooltip/TooltipTrigger.vue +15 -0
- package/dist/server/ui/components/ui/tooltip/index.ts +4 -0
- package/dist/server/ui/favicon.svg +1 -0
- package/dist/server/ui/index.html +13 -0
- package/dist/server/ui/lib/utils.ts +7 -0
- package/dist/server/ui/logo-gradient.svg +1 -0
- package/dist/server/ui/logo.svg +1 -0
- package/dist/server/ui/main.css +129 -0
- package/dist/server/ui/main.ts +16 -0
- package/dist/server/ui/mark-gradient.svg +1 -0
- package/dist/server/ui/mark.svg +1 -0
- package/dist/server/ui/pages/Home.vue +39 -0
- package/dist/server/ui/pages/Preview.vue +609 -0
- package/dist/server/ui/stripes.svg +174 -0
- package/dist/transformers/addAttributes.d.mts +32 -0
- package/dist/transformers/addAttributes.d.mts.map +1 -0
- package/dist/transformers/addAttributes.mjs +101 -0
- package/dist/transformers/addAttributes.mjs.map +1 -0
- package/dist/transformers/attributeToStyle.d.mts +25 -0
- package/dist/transformers/attributeToStyle.d.mts.map +1 -0
- package/dist/transformers/attributeToStyle.mjs +80 -0
- package/dist/transformers/attributeToStyle.mjs.map +1 -0
- package/dist/transformers/base.d.mts +8 -0
- package/dist/transformers/base.d.mts.map +1 -0
- package/dist/transformers/base.mjs +160 -0
- package/dist/transformers/base.mjs.map +1 -0
- package/dist/transformers/entities.d.mts +8 -0
- package/dist/transformers/entities.d.mts.map +1 -0
- package/dist/transformers/entities.mjs +38 -0
- package/dist/transformers/entities.mjs.map +1 -0
- package/dist/transformers/format.d.mts +15 -0
- package/dist/transformers/format.d.mts.map +1 -0
- package/dist/transformers/format.mjs +26 -0
- package/dist/transformers/format.mjs.map +1 -0
- package/dist/transformers/index.d.mts +35 -0
- package/dist/transformers/index.d.mts.map +1 -0
- package/dist/transformers/index.mjs +73 -0
- package/dist/transformers/index.mjs.map +1 -0
- package/dist/transformers/inlineCSS.d.mts +30 -0
- package/dist/transformers/inlineCSS.d.mts.map +1 -0
- package/dist/transformers/inlineCSS.mjs +79 -0
- package/dist/transformers/inlineCSS.mjs.map +1 -0
- package/dist/transformers/inlineLink.d.mts +14 -0
- package/dist/transformers/inlineLink.d.mts.map +1 -0
- package/dist/transformers/inlineLink.mjs +76 -0
- package/dist/transformers/inlineLink.mjs.map +1 -0
- package/dist/transformers/minify.d.mts +17 -0
- package/dist/transformers/minify.d.mts.map +1 -0
- package/dist/transformers/minify.mjs +24 -0
- package/dist/transformers/minify.mjs.map +1 -0
- package/dist/transformers/purgeCSS.d.mts +23 -0
- package/dist/transformers/purgeCSS.d.mts.map +1 -0
- package/dist/transformers/purgeCSS.mjs +66 -0
- package/dist/transformers/purgeCSS.mjs.map +1 -0
- package/dist/transformers/removeAttributes.d.mts +31 -0
- package/dist/transformers/removeAttributes.d.mts.map +1 -0
- package/dist/transformers/removeAttributes.mjs +63 -0
- package/dist/transformers/removeAttributes.mjs.map +1 -0
- package/dist/transformers/replaceStrings.d.mts +16 -0
- package/dist/transformers/replaceStrings.d.mts.map +1 -0
- package/dist/transformers/replaceStrings.mjs +19 -0
- package/dist/transformers/replaceStrings.mjs.map +1 -0
- package/dist/transformers/safeClassNames.d.mts +22 -0
- package/dist/transformers/safeClassNames.d.mts.map +1 -0
- package/dist/transformers/safeClassNames.mjs +103 -0
- package/dist/transformers/safeClassNames.mjs.map +1 -0
- package/dist/transformers/shorthandCSS.d.mts +24 -0
- package/dist/transformers/shorthandCSS.d.mts.map +1 -0
- package/dist/transformers/shorthandCSS.mjs +48 -0
- package/dist/transformers/shorthandCSS.mjs.map +1 -0
- package/dist/transformers/tailwindcss.d.mts +20 -0
- package/dist/transformers/tailwindcss.d.mts.map +1 -0
- package/dist/transformers/tailwindcss.mjs +136 -0
- package/dist/transformers/tailwindcss.mjs.map +1 -0
- package/dist/transformers/urlQuery.d.mts +24 -0
- package/dist/transformers/urlQuery.d.mts.map +1 -0
- package/dist/transformers/urlQuery.mjs +65 -0
- package/dist/transformers/urlQuery.mjs.map +1 -0
- package/dist/types/config.d.mts +129 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/dist/utils/ast/index.d.mts +4 -0
- package/dist/utils/ast/index.mjs +5 -0
- package/dist/utils/ast/parser.d.mts +7 -0
- package/dist/utils/ast/parser.d.mts.map +1 -0
- package/dist/utils/ast/parser.mjs +15 -0
- package/dist/utils/ast/parser.mjs.map +1 -0
- package/dist/utils/ast/serializer.d.mts +7 -0
- package/dist/utils/ast/serializer.d.mts.map +1 -0
- package/dist/utils/ast/serializer.mjs +13 -0
- package/dist/utils/ast/serializer.mjs.map +1 -0
- package/dist/utils/ast/walker.d.mts +7 -0
- package/dist/utils/ast/walker.d.mts.map +1 -0
- package/dist/utils/ast/walker.mjs +12 -0
- package/dist/utils/ast/walker.mjs.map +1 -0
- package/dist/utils/url.d.mts +8 -0
- package/dist/utils/url.d.mts.map +1 -0
- package/dist/utils/url.mjs +32 -0
- package/dist/utils/url.mjs.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +257 -0
- package/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/@clack/core/README.md +22 -0
- package/node_modules/@clack/core/dist/index.cjs +15 -0
- package/node_modules/@clack/core/dist/index.cjs.map +1 -0
- package/node_modules/@clack/core/dist/index.d.cts +211 -0
- package/node_modules/@clack/core/dist/index.d.mts +211 -0
- package/node_modules/@clack/core/dist/index.d.ts +211 -0
- package/node_modules/@clack/core/dist/index.mjs +15 -0
- package/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/node_modules/@clack/core/package.json +62 -0
- package/node_modules/@clack/prompts/CHANGELOG.md +412 -0
- package/node_modules/@clack/prompts/LICENSE +9 -0
- package/node_modules/@clack/prompts/README.md +207 -0
- package/node_modules/@clack/prompts/dist/index.cjs +87 -0
- package/node_modules/@clack/prompts/dist/index.cjs.map +1 -0
- package/node_modules/@clack/prompts/dist/index.d.cts +165 -0
- package/node_modules/@clack/prompts/dist/index.d.mts +165 -0
- package/node_modules/@clack/prompts/dist/index.d.ts +165 -0
- package/node_modules/@clack/prompts/dist/index.mjs +87 -0
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/node_modules/@clack/prompts/package.json +61 -0
- package/node_modules/@maizzle/cli/LICENSE +21 -0
- package/node_modules/@maizzle/cli/README.md +58 -0
- package/node_modules/@maizzle/cli/dist/commands/make/component.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/component.mjs +31 -0
- package/node_modules/@maizzle/cli/dist/commands/make/config.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/config.mjs +21 -0
- package/node_modules/@maizzle/cli/dist/commands/make/layout.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/layout.mjs +31 -0
- package/node_modules/@maizzle/cli/dist/commands/make/scaffold.d.mts +5 -0
- package/node_modules/@maizzle/cli/dist/commands/make/scaffold.mjs +28 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/component.vue +9 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/config.ts +9 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/layout.vue +39 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/template.vue +8 -0
- package/node_modules/@maizzle/cli/dist/commands/make/template.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/template.mjs +31 -0
- package/node_modules/@maizzle/cli/dist/index.d.mts +8 -0
- package/node_modules/@maizzle/cli/dist/index.mjs +42 -0
- package/node_modules/@maizzle/cli/package.json +59 -0
- package/node_modules/citty/LICENSE +36 -0
- package/node_modules/citty/README.md +134 -0
- package/node_modules/citty/dist/index.cjs +475 -0
- package/node_modules/citty/dist/index.d.cts +80 -0
- package/node_modules/citty/dist/index.d.mts +80 -0
- package/node_modules/citty/dist/index.d.ts +80 -0
- package/node_modules/citty/dist/index.mjs +463 -0
- package/node_modules/citty/package.json +49 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1149 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2662 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +709 -0
- package/node_modules/commander/lib/option.js +367 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +82 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +1045 -0
- package/node_modules/consola/LICENSE +47 -0
- package/node_modules/consola/README.md +352 -0
- package/node_modules/consola/basic.d.ts +1 -0
- package/node_modules/consola/browser.d.ts +1 -0
- package/node_modules/consola/core.d.ts +1 -0
- package/node_modules/consola/dist/basic.cjs +32 -0
- package/node_modules/consola/dist/basic.d.cts +23 -0
- package/node_modules/consola/dist/basic.d.mts +21 -0
- package/node_modules/consola/dist/basic.d.ts +23 -0
- package/node_modules/consola/dist/basic.mjs +24 -0
- package/node_modules/consola/dist/browser.cjs +84 -0
- package/node_modules/consola/dist/browser.d.cts +23 -0
- package/node_modules/consola/dist/browser.d.mts +21 -0
- package/node_modules/consola/dist/browser.d.ts +23 -0
- package/node_modules/consola/dist/browser.mjs +76 -0
- package/node_modules/consola/dist/chunks/prompt.cjs +288 -0
- package/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/node_modules/consola/dist/core.cjs +517 -0
- package/node_modules/consola/dist/core.d.cts +459 -0
- package/node_modules/consola/dist/core.d.mts +459 -0
- package/node_modules/consola/dist/core.d.ts +459 -0
- package/node_modules/consola/dist/core.mjs +512 -0
- package/node_modules/consola/dist/index.cjs +663 -0
- package/node_modules/consola/dist/index.d.cts +24 -0
- package/node_modules/consola/dist/index.d.mts +22 -0
- package/node_modules/consola/dist/index.d.ts +24 -0
- package/node_modules/consola/dist/index.mjs +651 -0
- package/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +75 -0
- package/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/node_modules/consola/dist/shared/consola.DwRq1yyg.cjs +312 -0
- package/node_modules/consola/dist/utils.cjs +64 -0
- package/node_modules/consola/dist/utils.d.cts +286 -0
- package/node_modules/consola/dist/utils.d.mts +286 -0
- package/node_modules/consola/dist/utils.d.ts +286 -0
- package/node_modules/consola/dist/utils.mjs +54 -0
- package/node_modules/consola/lib/index.cjs +10 -0
- package/node_modules/consola/package.json +136 -0
- package/node_modules/consola/utils.d.ts +1 -0
- package/node_modules/create-maizzle/README.md +86 -0
- package/node_modules/create-maizzle/bin/create-maizzle.mjs +4 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/CHANGELOG.md +340 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/README.md +22 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.d.mts +349 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs +11 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/package.json +60 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/CHANGELOG.md +576 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/LICENSE +9 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/README.md +270 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.d.mts +391 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs +137 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/package.json +65 -0
- package/node_modules/create-maizzle/package.json +47 -0
- package/node_modules/create-maizzle/src/index.js +242 -0
- package/node_modules/defu/LICENSE +21 -0
- package/node_modules/defu/README.md +171 -0
- package/node_modules/defu/dist/defu.cjs +77 -0
- package/node_modules/defu/dist/defu.d.cts +31 -0
- package/node_modules/defu/dist/defu.d.mts +29 -0
- package/node_modules/defu/dist/defu.d.ts +31 -0
- package/node_modules/defu/dist/defu.mjs +69 -0
- package/node_modules/defu/lib/defu.cjs +10 -0
- package/node_modules/defu/lib/defu.d.cts +12 -0
- package/node_modules/defu/package.json +48 -0
- package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/index.js +171 -0
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +22 -0
- package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
- package/node_modules/fast-string-truncated-width/license +21 -0
- package/node_modules/fast-string-truncated-width/package.json +35 -0
- package/node_modules/fast-string-truncated-width/readme.md +60 -0
- package/node_modules/fast-string-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-width/dist/index.js +14 -0
- package/node_modules/fast-string-width/license +21 -0
- package/node_modules/fast-string-width/package.json +34 -0
- package/node_modules/fast-string-width/readme.md +45 -0
- package/node_modules/fast-wrap-ansi/LICENSE +23 -0
- package/node_modules/fast-wrap-ansi/README.md +26 -0
- package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
- package/node_modules/fast-wrap-ansi/lib/main.js +216 -0
- package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
- package/node_modules/fast-wrap-ansi/package.json +51 -0
- package/node_modules/giget/LICENSE +184 -0
- package/node_modules/giget/README.md +248 -0
- package/node_modules/giget/dist/cli.mjs +112 -0
- package/node_modules/giget/dist/index.d.mts +49 -0
- package/node_modules/giget/dist/index.mjs +22 -0
- package/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +468 -0
- package/node_modules/giget/package.json +62 -0
- package/node_modules/node-fetch-native/LICENSE +114 -0
- package/node_modules/node-fetch-native/README.md +225 -0
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +2 -0
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -0
- package/node_modules/node-fetch-native/dist/index.cjs +1 -0
- package/node_modules/node-fetch-native/dist/index.mjs +1 -0
- package/node_modules/node-fetch-native/dist/native.cjs +1 -0
- package/node_modules/node-fetch-native/dist/native.mjs +1 -0
- package/node_modules/node-fetch-native/dist/node.cjs +19 -0
- package/node_modules/node-fetch-native/dist/node.mjs +19 -0
- package/node_modules/node-fetch-native/dist/polyfill.cjs +1 -0
- package/node_modules/node-fetch-native/dist/polyfill.mjs +1 -0
- package/node_modules/node-fetch-native/dist/proxy-stub.cjs +1 -0
- package/node_modules/node-fetch-native/dist/proxy-stub.mjs +1 -0
- package/node_modules/node-fetch-native/dist/proxy.cjs +58 -0
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +1 -0
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +1 -0
- package/node_modules/node-fetch-native/index.d.ts +1 -0
- package/node_modules/node-fetch-native/lib/empty.cjs +0 -0
- package/node_modules/node-fetch-native/lib/empty.mjs +0 -0
- package/node_modules/node-fetch-native/lib/index.cjs +11 -0
- package/node_modules/node-fetch-native/lib/index.d.cts +10 -0
- package/node_modules/node-fetch-native/lib/index.d.mts +10 -0
- package/node_modules/node-fetch-native/lib/index.d.ts +10 -0
- package/node_modules/node-fetch-native/lib/native.cjs +11 -0
- package/node_modules/node-fetch-native/lib/polyfill.d.cts +1 -0
- package/node_modules/node-fetch-native/lib/polyfill.d.mts +1 -0
- package/node_modules/node-fetch-native/lib/polyfill.d.ts +1 -0
- package/node_modules/node-fetch-native/lib/proxy.d.ts +32 -0
- package/node_modules/node-fetch-native/node.d.ts +1 -0
- package/node_modules/node-fetch-native/package.json +138 -0
- package/node_modules/node-fetch-native/polyfill.d.ts +1 -0
- package/node_modules/node-fetch-native/proxy.d.ts +1 -0
- package/node_modules/nypm/LICENSE +21 -0
- package/node_modules/nypm/README.md +152 -0
- package/node_modules/nypm/dist/cli.d.mts +1 -0
- package/node_modules/nypm/dist/cli.mjs +460 -0
- package/node_modules/nypm/dist/index.d.mts +209 -0
- package/node_modules/nypm/dist/index.mjs +423 -0
- package/node_modules/nypm/node_modules/citty/LICENSE +21 -0
- package/node_modules/nypm/node_modules/citty/README.md +231 -0
- package/node_modules/nypm/node_modules/citty/dist/THIRD-PARTY-LICENSES.md +33 -0
- package/node_modules/nypm/node_modules/citty/dist/_chunks/libs/scule.mjs +70 -0
- package/node_modules/nypm/node_modules/citty/dist/index.d.mts +112 -0
- package/node_modules/nypm/node_modules/citty/dist/index.mjs +425 -0
- package/node_modules/nypm/node_modules/citty/package.json +42 -0
- package/node_modules/nypm/package.json +54 -0
- package/node_modules/pathe/LICENSE +70 -0
- package/node_modules/pathe/README.md +73 -0
- package/node_modules/pathe/dist/index.cjs +39 -0
- package/node_modules/pathe/dist/index.d.cts +47 -0
- package/node_modules/pathe/dist/index.d.mts +47 -0
- package/node_modules/pathe/dist/index.d.ts +47 -0
- package/node_modules/pathe/dist/index.mjs +19 -0
- package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +266 -0
- package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +249 -0
- package/node_modules/pathe/dist/utils.cjs +82 -0
- package/node_modules/pathe/dist/utils.d.cts +32 -0
- package/node_modules/pathe/dist/utils.d.mts +32 -0
- package/node_modules/pathe/dist/utils.d.ts +32 -0
- package/node_modules/pathe/dist/utils.mjs +77 -0
- package/node_modules/pathe/package.json +61 -0
- package/node_modules/pathe/utils.d.ts +1 -0
- package/node_modules/picocolors/LICENSE +15 -0
- package/node_modules/picocolors/README.md +21 -0
- package/node_modules/picocolors/package.json +25 -0
- package/node_modules/picocolors/picocolors.browser.js +4 -0
- package/node_modules/picocolors/picocolors.d.ts +5 -0
- package/node_modules/picocolors/picocolors.js +75 -0
- package/node_modules/picocolors/types.d.ts +51 -0
- package/node_modules/sisteransi/license +21 -0
- package/node_modules/sisteransi/package.json +34 -0
- package/node_modules/sisteransi/readme.md +113 -0
- package/node_modules/sisteransi/src/index.js +58 -0
- package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/node_modules/tinyexec/LICENSE +21 -0
- package/node_modules/tinyexec/README.md +269 -0
- package/node_modules/tinyexec/dist/LICENSES.txt +83 -0
- package/node_modules/tinyexec/dist/main.d.mts +71 -0
- package/node_modules/tinyexec/dist/main.mjs +642 -0
- package/node_modules/tinyexec/package.json +62 -0
- package/package.json +74 -73
- package/CHANGELOG.md +0 -770
- package/bin/maizzle +0 -5
- package/src/commands/build.js +0 -348
- package/src/commands/serve.js +0 -3
- package/src/generators/plaintext.js +0 -222
- package/src/generators/render.js +0 -129
- package/src/index.js +0 -49
- package/src/posthtml/defaultComponentsConfig.js +0 -19
- package/src/posthtml/defaultConfig.js +0 -14
- package/src/posthtml/index.js +0 -102
- package/src/posthtml/plugins/combineMediaQueries.js +0 -42
- package/src/posthtml/plugins/envAttributes.js +0 -32
- package/src/posthtml/plugins/envTags.js +0 -33
- package/src/posthtml/plugins/expandLinkTag.js +0 -59
- package/src/posthtml/plugins/postcss/compileCss.js +0 -125
- package/src/posthtml/plugins/removeRawStyleAttributes.js +0 -30
- package/src/server/client.js +0 -182
- package/src/server/index.js +0 -464
- package/src/server/routes/hmr.js +0 -26
- package/src/server/routes/index.js +0 -77
- package/src/server/views/404.html +0 -59
- package/src/server/views/error.html +0 -83
- package/src/server/views/index.html +0 -172
- package/src/server/websockets.js +0 -27
- package/src/transformers/addAttributes.js +0 -29
- package/src/transformers/attributeToStyle.js +0 -90
- package/src/transformers/baseUrl.js +0 -154
- package/src/transformers/core.js +0 -32
- package/src/transformers/filters/defaultFilters.js +0 -146
- package/src/transformers/filters/index.js +0 -18
- package/src/transformers/index.js +0 -259
- package/src/transformers/inline.js +0 -306
- package/src/transformers/markdown.js +0 -26
- package/src/transformers/minify.js +0 -27
- package/src/transformers/posthtmlMso.js +0 -14
- package/src/transformers/prettify.js +0 -29
- package/src/transformers/preventWidows.js +0 -37
- package/src/transformers/purge.js +0 -56
- package/src/transformers/removeAttributes.js +0 -55
- package/src/transformers/replaceStrings.js +0 -37
- package/src/transformers/safeClassNames.js +0 -29
- package/src/transformers/shorthandCss.js +0 -20
- package/src/transformers/sixHex.js +0 -30
- package/src/transformers/template.js +0 -26
- package/src/transformers/urlParameters.js +0 -20
- package/src/transformers/useAttributeSizes.js +0 -63
- package/src/utils/getConfigByFilePath.js +0 -143
- package/src/utils/node.js +0 -68
- package/src/utils/string.js +0 -186
- package/types/build.d.ts +0 -166
- package/types/config.d.ts +0 -638
- package/types/css/combineMediaQueries.d.ts +0 -90
- package/types/css/inline.d.ts +0 -218
- package/types/css/purge.d.ts +0 -125
- package/types/events.d.ts +0 -153
- package/types/index.d.ts +0 -232
- package/types/markdown.d.ts +0 -33
- package/types/minify.d.ts +0 -138
- package/types/plaintext.d.ts +0 -56
- package/types/posthtml.d.ts +0 -162
- package/types/render.d.ts +0 -13
- package/types/urlParameters.d.ts +0 -40
- package/types/widowWords.d.ts +0 -38
package/bin/maizzle.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createJiti } from 'jiti'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
const jiti = createJiti(fileURLToPath(import.meta.url), { interopDefault: true })
|
|
7
|
+
const { default: bootstrap } = await jiti.import('@maizzle/cli')
|
|
8
|
+
const framework = await jiti.import('../dist/index.mjs')
|
|
9
|
+
|
|
10
|
+
await bootstrap(framework)
|
package/dist/build.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MaizzleConfig } from "./types/config.mjs";
|
|
2
|
+
//#region src/build.d.ts
|
|
3
|
+
interface BuildOptions {
|
|
4
|
+
config?: Partial<MaizzleConfig> | string;
|
|
5
|
+
}
|
|
6
|
+
interface BuildResult {
|
|
7
|
+
files: string[];
|
|
8
|
+
config: MaizzleConfig;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build all SFC email templates to HTML files.
|
|
12
|
+
*
|
|
13
|
+
* Creates a single Renderer instance, then loops through each template
|
|
14
|
+
* calling render → transformers → write to disk.
|
|
15
|
+
*/
|
|
16
|
+
declare function build(options?: BuildOptions): Promise<BuildResult>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { BuildOptions, BuildResult, build };
|
|
19
|
+
//# sourceMappingURL=build.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.mts","names":[],"sources":["../src/build.ts"],"mappings":";;UAWiB,YAAA;EACf,MAAA,GAAS,OAAA,CAAQ,aAAA;AAAA;AAAA,UAGF,WAAA;EACf,KAAA;EACA,MAAA,EAAQ,aAAA;AAAA;;;;;;AAFV;iBAWsB,KAAA,CAAM,OAAA,GAAS,YAAA,GAAoB,OAAA,CAAQ,WAAA"}
|
package/dist/build.mjs
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { resolveConfig } from "./config/index.mjs";
|
|
2
|
+
import { EventManager } from "./events/index.mjs";
|
|
3
|
+
import { runTransformers } from "./transformers/index.mjs";
|
|
4
|
+
import { createRenderer } from "./render/createRenderer.mjs";
|
|
5
|
+
import { createPlaintext } from "./plaintext.mjs";
|
|
6
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
8
|
+
import { glob } from "tinyglobby";
|
|
9
|
+
import ora from "ora";
|
|
10
|
+
|
|
11
|
+
//#region src/build.ts
|
|
12
|
+
/**
|
|
13
|
+
* Build all SFC email templates to HTML files.
|
|
14
|
+
*
|
|
15
|
+
* Creates a single Renderer instance, then loops through each template
|
|
16
|
+
* calling render → transformers → write to disk.
|
|
17
|
+
*/
|
|
18
|
+
async function build(options = {}) {
|
|
19
|
+
const start = Date.now();
|
|
20
|
+
const spinner = ora("Building templates...").start();
|
|
21
|
+
const config = await resolveConfig(options.config);
|
|
22
|
+
const events = new EventManager();
|
|
23
|
+
events.registerConfig(config);
|
|
24
|
+
await events.fireBeforeCreate({ config });
|
|
25
|
+
const outputPath = resolve(config.output?.path ?? "dist");
|
|
26
|
+
const outputExtension = config.output?.extension ?? "html";
|
|
27
|
+
const templateFiles = await glob(config.content ?? ["emails/**/*.vue"]);
|
|
28
|
+
if (templateFiles.length === 0) {
|
|
29
|
+
spinner.succeed("No templates found");
|
|
30
|
+
return {
|
|
31
|
+
files: [],
|
|
32
|
+
config
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (existsSync(outputPath)) rmSync(outputPath, {
|
|
36
|
+
recursive: true,
|
|
37
|
+
force: true
|
|
38
|
+
});
|
|
39
|
+
const renderer = await createRenderer({ markdown: config.markdown });
|
|
40
|
+
const outputFiles = [];
|
|
41
|
+
try {
|
|
42
|
+
for (const templatePath of templateFiles) {
|
|
43
|
+
const absolutePath = resolve(templatePath);
|
|
44
|
+
let template = readFileSync(absolutePath, "utf-8");
|
|
45
|
+
template = await events.fireBeforeRender({
|
|
46
|
+
config,
|
|
47
|
+
template
|
|
48
|
+
});
|
|
49
|
+
const rendered = await renderer.render(absolutePath, config);
|
|
50
|
+
let html = await events.fireAfterRender({
|
|
51
|
+
config,
|
|
52
|
+
template,
|
|
53
|
+
html: rendered.html
|
|
54
|
+
});
|
|
55
|
+
const templateConfig = rendered.templateConfig;
|
|
56
|
+
if (templateConfig.useTransformers !== false) html = await runTransformers(html, templateConfig, absolutePath);
|
|
57
|
+
html = await events.fireAfterTransform({
|
|
58
|
+
config,
|
|
59
|
+
template,
|
|
60
|
+
html
|
|
61
|
+
});
|
|
62
|
+
html = `${rendered.doctype ?? templateConfig.doctype ?? "<!DOCTYPE html>"}\n${html}`;
|
|
63
|
+
const outputFilePath = resolveOutputPath(templatePath, outputPath, outputExtension);
|
|
64
|
+
mkdirSync(dirname(outputFilePath), { recursive: true });
|
|
65
|
+
writeFileSync(outputFilePath, html);
|
|
66
|
+
outputFiles.push(outputFilePath);
|
|
67
|
+
const globalPlaintext = templateConfig.plaintext;
|
|
68
|
+
const sfcPlaintext = rendered.plaintext;
|
|
69
|
+
if (globalPlaintext || sfcPlaintext) {
|
|
70
|
+
const plaintext = createPlaintext(html, typeof globalPlaintext === "object" ? globalPlaintext : {});
|
|
71
|
+
const ptExtension = sfcPlaintext?.extension ?? "txt";
|
|
72
|
+
let ptOutputPath;
|
|
73
|
+
if (sfcPlaintext?.destination) {
|
|
74
|
+
const name = basename(templatePath).replace(/\.(vue|md)$/, "");
|
|
75
|
+
ptOutputPath = join(resolve(sfcPlaintext.destination), `${name}.${ptExtension}`);
|
|
76
|
+
} else if (typeof globalPlaintext === "string") ptOutputPath = resolveOutputPath(templatePath, resolve(globalPlaintext), ptExtension);
|
|
77
|
+
else ptOutputPath = resolveOutputPath(templatePath, outputPath, ptExtension);
|
|
78
|
+
mkdirSync(dirname(ptOutputPath), { recursive: true });
|
|
79
|
+
writeFileSync(ptOutputPath, plaintext);
|
|
80
|
+
}
|
|
81
|
+
for (const { name, handler } of rendered.sfcEventHandlers) events.on(name, handler);
|
|
82
|
+
events.clearSfcHandlers();
|
|
83
|
+
}
|
|
84
|
+
await copyStatic(config, outputPath);
|
|
85
|
+
await events.fireAfterBuild({
|
|
86
|
+
files: outputFiles,
|
|
87
|
+
config
|
|
88
|
+
});
|
|
89
|
+
} finally {
|
|
90
|
+
await renderer.close();
|
|
91
|
+
}
|
|
92
|
+
const duration = ((Date.now() - start) / 1e3).toFixed(2);
|
|
93
|
+
const count = outputFiles.length;
|
|
94
|
+
spinner.stopAndPersist({
|
|
95
|
+
symbol: "✅",
|
|
96
|
+
text: `Built ${count} template${count !== 1 ? "s" : ""} in ${duration}s`
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
files: outputFiles,
|
|
100
|
+
config
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function resolveOutputPath(templatePath, outputDir, extension) {
|
|
104
|
+
const name = basename(templatePath).replace(/\.(vue|md)$/, "");
|
|
105
|
+
return join(outputDir, dirname(templatePath).split("/").slice(1).join("/"), `${name}.${extension}`);
|
|
106
|
+
}
|
|
107
|
+
async function copyStatic(config, outputPath) {
|
|
108
|
+
const sources = config.static?.source ?? ["public/**/*.*"];
|
|
109
|
+
const destination = config.static?.destination ?? "public";
|
|
110
|
+
const files = await glob(sources);
|
|
111
|
+
for (const file of files) {
|
|
112
|
+
const destPath = join(outputPath, destination, relative(dirname(sources[0]).replace(/\*.*$/, ""), file));
|
|
113
|
+
const destDir = dirname(destPath);
|
|
114
|
+
if (!existsSync(destDir)) mkdirSync(destDir, { recursive: true });
|
|
115
|
+
cpSync(file, destPath);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
export { build };
|
|
121
|
+
//# sourceMappingURL=build.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.mjs","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 BuildOptions {\n config?: Partial<MaizzleConfig> | string\n}\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 */\nexport async function build(options: BuildOptions = {}): Promise<BuildResult> {\n const start = Date.now()\n const spinner = ora('Building templates...').start()\n\n const config = await resolveConfig(options.config)\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 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 })\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 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 if (templateConfig.useTransformers !== false) {\n html = await runTransformers(html, templateConfig, absolutePath)\n }\n\n html = await events.fireAfterTransform({ config, template, html })\n\n const doctype = rendered.doctype ?? templateConfig.doctype ?? '<!DOCTYPE html>'\n html = `${doctype}\\n${html}`\n\n const outputFilePath = resolveOutputPath(templatePath, outputPath, outputExtension)\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)\n } else {\n ptOutputPath = resolveOutputPath(templatePath, outputPath, ptExtension)\n }\n\n mkdirSync(dirname(ptOutputPath), { recursive: true })\n writeFileSync(ptOutputPath, plaintext)\n }\n\n // Register SFC event handlers that were collected during render\n for (const { name, handler } of rendered.sfcEventHandlers) {\n events.on(name, handler)\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\nfunction resolveOutputPath(templatePath: string, outputDir: string, extension: string): string {\n const name = basename(templatePath).replace(/\\.(vue|md)$/, '')\n const relDir = dirname(templatePath).split('/').slice(1).join('/')\n\n return join(outputDir, relDir, `${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":";;;;;;;;;;;;;;;;;AA0BA,eAAsB,MAAM,UAAwB,EAAE,EAAwB;CAC5E,MAAM,QAAQ,KAAK,KAAK;CACxB,MAAM,UAAU,IAAI,wBAAwB,CAAC,OAAO;CAEpD,MAAM,SAAS,MAAM,cAAc,QAAQ,OAAO;CAElD,MAAM,SAAS,IAAI,cAAc;AACjC,QAAO,eAAe,OAAO;AAC7B,OAAM,OAAO,iBAAiB,EAAE,QAAQ,CAAC;CAEzC,MAAM,aAAa,QAAQ,OAAO,QAAQ,QAAQ,OAAO;CACzD,MAAM,kBAAkB,OAAO,QAAQ,aAAa;CAGpD,MAAM,gBAAgB,MAAM,KADJ,OAAO,WAAW,CAAC,kBAAkB,CACZ;AAEjD,KAAI,cAAc,WAAW,GAAG;AAC9B,UAAQ,QAAQ,qBAAqB;AACrC,SAAO;GAAE,OAAO,EAAE;GAAE;GAAQ;;AAI9B,KAAI,WAAW,WAAW,CACxB,QAAO,YAAY;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;CAGtD,MAAM,WAAW,MAAM,eAAe,EAAE,UAAU,OAAO,UAAU,CAAC;CACpE,MAAM,cAAwB,EAAE;AAEhC,KAAI;AACF,OAAK,MAAM,gBAAgB,eAAe;GACxC,MAAM,eAAe,QAAQ,aAAa;GAC1C,IAAI,WAAW,aAAa,cAAc,QAAQ;AAElD,cAAW,MAAM,OAAO,iBAAiB;IAAE;IAAQ;IAAU,CAAC;GAE9D,MAAM,WAAW,MAAM,SAAS,OAAO,cAAc,OAAO;GAE5D,IAAI,OAAO,MAAM,OAAO,gBAAgB;IAAE;IAAQ;IAAU,MAAM,SAAS;IAAM,CAAC;GAIlF,MAAM,iBAAiB,SAAS;AAEhC,OAAI,eAAe,oBAAoB,MACrC,QAAO,MAAM,gBAAgB,MAAM,gBAAgB,aAAa;AAGlE,UAAO,MAAM,OAAO,mBAAmB;IAAE;IAAQ;IAAU;IAAM,CAAC;AAGlE,UAAO,GADS,SAAS,WAAW,eAAe,WAAW,kBAC5C,IAAI;GAEtB,MAAM,iBAAiB,kBAAkB,cAAc,YAAY,gBAAgB;AACnF,aAAU,QAAQ,eAAe,EAAE,EAAE,WAAW,MAAM,CAAC;AACvD,iBAAc,gBAAgB,KAAK;AACnC,eAAY,KAAK,eAAe;GAGhC,MAAM,kBAAkB,eAAe;GACvC,MAAM,eAAe,SAAS;AAE9B,OAAI,mBAAmB,cAAc;IAEnC,MAAM,YAAY,gBAAgB,MADb,OAAO,oBAAoB,WAAW,kBAAkB,EAAE,CAC1B;IACrD,MAAM,cAAc,cAAc,aAAa;IAE/C,IAAI;AAEJ,QAAI,cAAc,aAAa;KAC7B,MAAM,OAAO,SAAS,aAAa,CAAC,QAAQ,eAAe,GAAG;AAC9D,oBAAe,KAAK,QAAQ,aAAa,YAAY,EAAE,GAAG,KAAK,GAAG,cAAc;eACvE,OAAO,oBAAoB,SACpC,gBAAe,kBAAkB,cAAc,QAAQ,gBAAgB,EAAE,YAAY;QAErF,gBAAe,kBAAkB,cAAc,YAAY,YAAY;AAGzE,cAAU,QAAQ,aAAa,EAAE,EAAE,WAAW,MAAM,CAAC;AACrD,kBAAc,cAAc,UAAU;;AAIxC,QAAK,MAAM,EAAE,MAAM,aAAa,SAAS,iBACvC,QAAO,GAAG,MAAM,QAAQ;AAG1B,UAAO,kBAAkB;;AAG3B,QAAM,WAAW,QAAQ,WAAW;AACpC,QAAM,OAAO,eAAe;GAAE,OAAO;GAAa;GAAQ,CAAC;WACnD;AACR,QAAM,SAAS,OAAO;;CAGxB,MAAM,aAAa,KAAK,KAAK,GAAG,SAAS,KAAM,QAAQ,EAAE;CACzD,MAAM,QAAQ,YAAY;AAC1B,SAAQ,eAAe;EACrB,QAAQ;EACR,MAAM,SAAS,MAAM,WAAW,UAAU,IAAI,MAAM,GAAG,MAAM,SAAS;EACvE,CAAC;AAEF,QAAO;EAAE,OAAO;EAAa;EAAQ;;AAGvC,SAAS,kBAAkB,cAAsB,WAAmB,WAA2B;CAC7F,MAAM,OAAO,SAAS,aAAa,CAAC,QAAQ,eAAe,GAAG;AAG9D,QAAO,KAAK,WAFG,QAAQ,aAAa,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,EAEnC,GAAG,KAAK,GAAG,YAAY;;AAGxD,eAAe,WAAW,QAAuB,YAAmC;CAClF,MAAM,UAAU,OAAO,QAAQ,UAAU,CAAC,gBAAgB;CAC1D,MAAM,cAAc,OAAO,QAAQ,eAAe;CAElD,MAAM,QAAQ,MAAM,KAAK,QAAQ;AAEjC,MAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,WAAW,KAAK,YAAY,aAAa,SAAS,QAAQ,QAAQ,GAAG,CAAC,QAAQ,SAAS,GAAG,EAAE,KAAK,CAAC;EACxG,MAAM,UAAU,QAAQ,SAAS;AAEjC,MAAI,CAAC,WAAW,QAAQ,CACtB,WAAU,SAAS,EAAE,WAAW,MAAM,CAAC;AAGzC,SAAO,MAAM,SAAS"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useAttrs } from 'vue'
|
|
3
|
+
import { twMerge } from 'tailwind-merge'
|
|
4
|
+
import Outlook from './Outlook.vue'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
8
|
+
const attrs = useAttrs()
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
/** The URL the button links to. */
|
|
12
|
+
href: String,
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'solid'
|
|
16
|
+
},
|
|
17
|
+
align: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
bgColor: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '#4338ca'
|
|
24
|
+
},
|
|
25
|
+
color: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: null
|
|
28
|
+
},
|
|
29
|
+
msoPt: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '16px'
|
|
32
|
+
},
|
|
33
|
+
msoPb: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '31px'
|
|
36
|
+
},
|
|
37
|
+
icon: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: null
|
|
40
|
+
},
|
|
41
|
+
iconWidth: {
|
|
42
|
+
type: [String, Number],
|
|
43
|
+
default: 12
|
|
44
|
+
},
|
|
45
|
+
iconPosition: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'right'
|
|
48
|
+
},
|
|
49
|
+
iconClass: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: ''
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const parsedIconWidth = computed(() => parseInt(String(props.iconWidth), 10))
|
|
56
|
+
|
|
57
|
+
const alignClass = computed(() => ({
|
|
58
|
+
left: 'text-left',
|
|
59
|
+
center: 'text-center',
|
|
60
|
+
right: 'text-right',
|
|
61
|
+
})[props.align] || '')
|
|
62
|
+
|
|
63
|
+
const textColor = computed(() => {
|
|
64
|
+
if (props.color) return props.color
|
|
65
|
+
|
|
66
|
+
return props.type === 'solid' ? '#fffffe' : props.bgColor
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const styles = computed(() => {
|
|
70
|
+
if (props.type === 'link') {
|
|
71
|
+
return [
|
|
72
|
+
'text-decoration: none;',
|
|
73
|
+
`color: ${textColor.value};`,
|
|
74
|
+
].join('')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const base = [
|
|
78
|
+
'display: inline-block;',
|
|
79
|
+
'text-decoration: none;',
|
|
80
|
+
'padding: 16px 24px;',
|
|
81
|
+
'font-size: 16px;',
|
|
82
|
+
'line-height: 1;',
|
|
83
|
+
'border-radius: 4px;',
|
|
84
|
+
`color: ${textColor.value};`,
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
if (props.type === 'outline') {
|
|
88
|
+
base.push(
|
|
89
|
+
'background-color: transparent;',
|
|
90
|
+
`border: 1px solid ${props.bgColor};`,
|
|
91
|
+
)
|
|
92
|
+
} else if (props.type === 'ghost') {
|
|
93
|
+
base.push('background-color: transparent;')
|
|
94
|
+
} else {
|
|
95
|
+
base.push(`background-color: ${props.bgColor};`)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return base.join('')
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const isLink = computed(() => props.type === 'link')
|
|
102
|
+
|
|
103
|
+
const defaultClasses = computed(() => {
|
|
104
|
+
if (props.type === 'ghost') return 'hover:bg-indigo-50'
|
|
105
|
+
return ''
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
const mergedClass = computed(() => twMerge(defaultClasses.value, attrs.class as string))
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<template>
|
|
112
|
+
<div :class="alignClass">
|
|
113
|
+
<a
|
|
114
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
115
|
+
:href="href"
|
|
116
|
+
:style="styles"
|
|
117
|
+
:class="mergedClass"
|
|
118
|
+
>
|
|
119
|
+
<template v-if="!isLink">
|
|
120
|
+
<Outlook><i class="mso-font-width-[150%]" :style="`mso-text-raise: ${msoPb};`" hidden> </i></Outlook>
|
|
121
|
+
<template v-if="icon && iconPosition === 'left'">
|
|
122
|
+
<span :style="`mso-text-raise: ${msoPt}`">
|
|
123
|
+
<img :src="icon" :width="parsedIconWidth" :class="`align-baseline max-w-full ${iconClass}`">
|
|
124
|
+
</span>
|
|
125
|
+
<Outlook><i class="mso-font-width-[30%]" hidden> ​</i></Outlook>
|
|
126
|
+
</template>
|
|
127
|
+
<span :class="icon ? (iconPosition === 'right' ? 'mr-2' : 'ml-2') : ''" :style="`mso-text-raise: ${msoPt}`"><slot /></span>
|
|
128
|
+
<template v-if="icon && iconPosition === 'right'">
|
|
129
|
+
<Outlook><i class="mso-font-width-[30%]" hidden> ​</i></Outlook>
|
|
130
|
+
<span :style="`mso-text-raise: ${msoPt}`">
|
|
131
|
+
<img :src="icon" :width="parsedIconWidth" :class="`align-baseline max-w-full ${iconClass}`">
|
|
132
|
+
</span>
|
|
133
|
+
</template>
|
|
134
|
+
<Outlook><i class="mso-font-width-[150%]" hidden> ​</i></Outlook>
|
|
135
|
+
</template>
|
|
136
|
+
<template v-else>
|
|
137
|
+
<slot />
|
|
138
|
+
</template>
|
|
139
|
+
</a>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useAttrs } from 'vue'
|
|
3
|
+
import { normalizeToPixels } from './utils.ts'
|
|
4
|
+
|
|
5
|
+
const attrs = useAttrs()
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
height: {
|
|
9
|
+
type: [String, Number],
|
|
10
|
+
default: '1px'
|
|
11
|
+
},
|
|
12
|
+
color: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: null
|
|
15
|
+
},
|
|
16
|
+
spaceY: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: '24px'
|
|
19
|
+
},
|
|
20
|
+
spaceX: {
|
|
21
|
+
type: [String, Number],
|
|
22
|
+
default: null
|
|
23
|
+
},
|
|
24
|
+
top: {
|
|
25
|
+
type: [String, Number],
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
bottom: {
|
|
29
|
+
type: [String, Number],
|
|
30
|
+
default: null
|
|
31
|
+
},
|
|
32
|
+
left: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
right: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: null
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const hasBgClass = computed(() =>
|
|
43
|
+
typeof attrs.class === 'string' &&
|
|
44
|
+
attrs.class.split(' ').some(c => c.startsWith('bg-'))
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
const styles = computed(() => {
|
|
48
|
+
const s = []
|
|
49
|
+
const height = normalizeToPixels(props.height || '1px')
|
|
50
|
+
|
|
51
|
+
s.push(`height: ${height};`)
|
|
52
|
+
s.push(`line-height: ${height};`)
|
|
53
|
+
|
|
54
|
+
// Color
|
|
55
|
+
if (props.color) {
|
|
56
|
+
s.push(`background-color: ${props.color};`)
|
|
57
|
+
} else if (!hasBgClass.value) {
|
|
58
|
+
s.push('background-color: #cbd5e1;')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Margins reset
|
|
62
|
+
if (
|
|
63
|
+
props.top != null ||
|
|
64
|
+
props.bottom != null ||
|
|
65
|
+
props.left != null ||
|
|
66
|
+
props.right != null ||
|
|
67
|
+
props.spaceY != null ||
|
|
68
|
+
props.spaceX != null
|
|
69
|
+
) {
|
|
70
|
+
s.push('margin: 0;')
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// space-y
|
|
74
|
+
if (props.spaceY != null) {
|
|
75
|
+
const v = props.spaceY === 0 ? '0px' : normalizeToPixels(props.spaceY)
|
|
76
|
+
s.push(`margin-top: ${v}; margin-bottom: ${v};`)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// space-x
|
|
80
|
+
if (props.spaceX != null) {
|
|
81
|
+
const v = props.spaceX === 0 ? '0px' : normalizeToPixels(props.spaceX)
|
|
82
|
+
s.push(`margin-left: ${v}; margin-right: ${v};`)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// individual margins
|
|
86
|
+
if (props.top != null) {
|
|
87
|
+
s.push(`margin-top: ${normalizeToPixels(props.top)};`)
|
|
88
|
+
}
|
|
89
|
+
if (props.bottom != null) {
|
|
90
|
+
s.push(`margin-bottom: ${normalizeToPixels(props.bottom)};`)
|
|
91
|
+
}
|
|
92
|
+
if (props.left != null) {
|
|
93
|
+
s.push(`margin-left: ${normalizeToPixels(props.left)};`)
|
|
94
|
+
}
|
|
95
|
+
if (props.right != null) {
|
|
96
|
+
s.push(`margin-right: ${normalizeToPixels(props.right)};`)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return s.join('')
|
|
100
|
+
})
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<div role="separator" :style="styles">‍</div>
|
|
105
|
+
</template>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, h, Fragment, createTextVNode, Text as TextVNode } from 'vue'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Template syntax patterns whose content must never have widow
|
|
6
|
+
* prevention applied (the expression should stay untouched).
|
|
7
|
+
*/
|
|
8
|
+
const IGNORED_PATTERNS = [
|
|
9
|
+
{ start: '{{', end: '}}' }, // Handlebars / Liquid / Nunjucks / Mustache
|
|
10
|
+
{ start: '{%', end: '%}' }, // Liquid / Nunjucks / Twig / Jinja2
|
|
11
|
+
{ start: '<%=', end: '%>' }, // EJS / ERB
|
|
12
|
+
{ start: '<%', end: '%>' }, // EJS / ERB
|
|
13
|
+
{ start: '{$', end: '}' }, // Smarty
|
|
14
|
+
{ start: '<\\?', end: '\\?>' }, // PHP
|
|
15
|
+
{ start: '#{', end: '}' }, // Pug
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Replace the space before the last word in a text string with a
|
|
20
|
+
* non-breaking space (U+00A0), but only when the string has at
|
|
21
|
+
* least `minWords` words. Template expressions are skipped.
|
|
22
|
+
*/
|
|
23
|
+
function processText(text: string, minWords: number): string {
|
|
24
|
+
// Split around ignored template expressions so they are never touched
|
|
25
|
+
let parts: string[] = [text]
|
|
26
|
+
|
|
27
|
+
for (const { start, end } of IGNORED_PATTERNS) {
|
|
28
|
+
const regex = new RegExp(`(${start}.*?${end})`, 'g')
|
|
29
|
+
parts = parts.flatMap(part => part.split(regex))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return parts
|
|
33
|
+
.map((part) => {
|
|
34
|
+
// Pass template expressions through unchanged
|
|
35
|
+
for (const { start, end } of IGNORED_PATTERNS) {
|
|
36
|
+
if (new RegExp(`^${start}.*?${end}$`).test(part)) return part
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const trimmedPart = part.trimEnd()
|
|
40
|
+
const wordCount = trimmedPart.trim().split(/\s+/).filter(Boolean).length
|
|
41
|
+
|
|
42
|
+
return wordCount >= minWords
|
|
43
|
+
? trimmedPart.replace(/ ([^ ]+)$/gm, '\u00A0$1') + part.slice(trimmedPart.length)
|
|
44
|
+
: part
|
|
45
|
+
})
|
|
46
|
+
.join('')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function processChildren(children: any[], minWords: number): any[] {
|
|
50
|
+
return children.map((child) => {
|
|
51
|
+
if (child == null) return child
|
|
52
|
+
if (typeof child === 'string') {
|
|
53
|
+
return processText(child, minWords)
|
|
54
|
+
}
|
|
55
|
+
return processVNode(child, minWords)
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Recursively walk a VNode tree and apply widow prevention to
|
|
61
|
+
* every text node. Component VNodes are left untouched.
|
|
62
|
+
*/
|
|
63
|
+
function processVNode(vnode: any, minWords: number): any {
|
|
64
|
+
if (vnode == null || typeof vnode !== 'object') return vnode
|
|
65
|
+
|
|
66
|
+
// Text VNode — process the string content
|
|
67
|
+
if (vnode.type === TextVNode) {
|
|
68
|
+
return createTextVNode(processText(vnode.children as string, minWords))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Fragment — recurse into children array
|
|
72
|
+
if (vnode.type === Fragment) {
|
|
73
|
+
return h(
|
|
74
|
+
Fragment,
|
|
75
|
+
null,
|
|
76
|
+
Array.isArray(vnode.children)
|
|
77
|
+
? processChildren(vnode.children, minWords)
|
|
78
|
+
: vnode.children,
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// DOM element — recurse into children, preserve props/attrs
|
|
83
|
+
if (typeof vnode.type === 'string' && vnode.children != null) {
|
|
84
|
+
if (Array.isArray(vnode.children)) {
|
|
85
|
+
return h(vnode.type, vnode.props, processChildren(vnode.children, minWords))
|
|
86
|
+
}
|
|
87
|
+
if (typeof vnode.children === 'string') {
|
|
88
|
+
return h(vnode.type, vnode.props, processText(vnode.children, minWords))
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Component VNode or anything else — leave untouched
|
|
93
|
+
return vnode
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default defineComponent({
|
|
97
|
+
name: 'NoWidows',
|
|
98
|
+
|
|
99
|
+
props: {
|
|
100
|
+
/**
|
|
101
|
+
* Minimum number of words required for widow words
|
|
102
|
+
* prevention to apply. Strings with fewer words
|
|
103
|
+
* are ignored.
|
|
104
|
+
* @default 4
|
|
105
|
+
*/
|
|
106
|
+
minWords: {
|
|
107
|
+
type: [String, Number],
|
|
108
|
+
default: 4,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
setup(props, { slots }) {
|
|
113
|
+
return () => {
|
|
114
|
+
const minWords = typeof props.minWords === 'string'
|
|
115
|
+
? parseInt(props.minWords, 10)
|
|
116
|
+
: props.minWords
|
|
117
|
+
return (slots.default?.() ?? []).map((vnode) =>
|
|
118
|
+
processVNode(vnode, minWords),
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createStaticVNode } from 'vue'
|
|
3
|
+
|
|
4
|
+
const START = '<!--[if !mso]><!-->'
|
|
5
|
+
const END = '<!--<![endif]-->'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
name: 'NotOutlook',
|
|
9
|
+
setup(_, { slots }) {
|
|
10
|
+
return () => [
|
|
11
|
+
createStaticVNode(START, 1),
|
|
12
|
+
slots.default?.(),
|
|
13
|
+
createStaticVNode(END, 1),
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, createStaticVNode } from 'vue'
|
|
3
|
+
|
|
4
|
+
const VERSION_MAP = {
|
|
5
|
+
2003: 11,
|
|
6
|
+
2007: 12,
|
|
7
|
+
2010: 14,
|
|
8
|
+
2013: 15,
|
|
9
|
+
2016: 16,
|
|
10
|
+
2019: 16
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const toMso = (v: string) => VERSION_MAP[v]
|
|
14
|
+
|
|
15
|
+
const parseList = (value: string) =>
|
|
16
|
+
value
|
|
17
|
+
.split(',')
|
|
18
|
+
.map(v => v.trim())
|
|
19
|
+
.map(toMso)
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
name: 'Outlook',
|
|
24
|
+
props: {
|
|
25
|
+
only: String,
|
|
26
|
+
not: String,
|
|
27
|
+
lt: String,
|
|
28
|
+
lte: String,
|
|
29
|
+
gt: String,
|
|
30
|
+
gte: String
|
|
31
|
+
},
|
|
32
|
+
setup(props, { slots }) {
|
|
33
|
+
const condition = computed(() => {
|
|
34
|
+
if (props.only) {
|
|
35
|
+
const versions = parseList(props.only)
|
|
36
|
+
if (versions.length === 1) {
|
|
37
|
+
return `mso ${versions[0]}`
|
|
38
|
+
}
|
|
39
|
+
return versions.map(v => `(mso ${v})`).join('|')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (props.not) {
|
|
43
|
+
const versions = parseList(props.not)
|
|
44
|
+
if (versions.length === 1) {
|
|
45
|
+
return `!mso ${versions[0]}`
|
|
46
|
+
}
|
|
47
|
+
return `!(${versions.map(v => `mso ${v}`).join('|')})`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const parts = []
|
|
51
|
+
|
|
52
|
+
if (props.lt) parts.push(`lt mso ${toMso(props.lt)}`)
|
|
53
|
+
if (props.lte) parts.push(`lte mso ${toMso(props.lte)}`)
|
|
54
|
+
if (props.gt) parts.push(`gt mso ${toMso(props.gt)}`)
|
|
55
|
+
if (props.gte) parts.push(`gte mso ${toMso(props.gte)}`)
|
|
56
|
+
|
|
57
|
+
if (parts.length) {
|
|
58
|
+
return parts.map(p => `(${p})`).join('&')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return 'mso'
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const start = computed(() => `<!--[if ${condition.value}]>`)
|
|
65
|
+
const end = `<![endif]-->`
|
|
66
|
+
|
|
67
|
+
return () => [
|
|
68
|
+
createStaticVNode(start.value, 1),
|
|
69
|
+
slots.default?.(),
|
|
70
|
+
createStaticVNode(end, 1),
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { normalizeToPixels } from './utils.ts'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
/** The height of the spacer. */
|
|
7
|
+
size: {
|
|
8
|
+
type: [String, Number],
|
|
9
|
+
default: null
|
|
10
|
+
},
|
|
11
|
+
/** The alternative height to use in Outlook. */
|
|
12
|
+
msoHeight: {
|
|
13
|
+
type: [String, Number],
|
|
14
|
+
default: null
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const styles = computed(() => {
|
|
19
|
+
const s = []
|
|
20
|
+
|
|
21
|
+
if (props.size) {
|
|
22
|
+
s.push(`line-height: ${normalizeToPixels(props.size)};`)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (props.msoHeight) {
|
|
26
|
+
s.push(`mso-line-height-alt: ${normalizeToPixels(props.msoHeight)};`)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return s.join('')
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div v-if="size" role="separator" :style="styles">‍</div>
|
|
35
|
+
<div v-else role="separator">‍</div>
|
|
36
|
+
</template>
|