@maizzle/framework 6.0.0-rc.22 → 6.0.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +11 -0
- package/dist/build.js.map +1 -1
- package/dist/components/Heading.vue +1 -1
- package/dist/components/Img.vue +60 -10
- package/dist/components/Link.vue +1 -1
- package/dist/components/Preheader.vue +4 -2
- package/dist/components/Tailwind.vue +4 -2
- package/dist/components/Text.vue +1 -1
- package/dist/components/Vml.vue +354 -0
- package/dist/components/utils.d.ts.map +1 -1
- package/dist/components/utils.js.map +1 -1
- package/dist/composables/defineConfig.js.map +1 -1
- package/dist/composables/renderContext.d.ts.map +1 -1
- package/dist/composables/renderContext.js.map +1 -1
- package/dist/composables/useBaseUrl.d.ts.map +1 -1
- package/dist/composables/useBaseUrl.js.map +1 -1
- package/dist/composables/useConfig.d.ts.map +1 -1
- package/dist/composables/useConfig.js.map +1 -1
- package/dist/composables/useCurrentTemplate.d.ts.map +1 -1
- package/dist/composables/useCurrentTemplate.js +10 -3
- package/dist/composables/useCurrentTemplate.js.map +1 -1
- package/dist/composables/useDoctype.d.ts.map +1 -1
- package/dist/composables/useDoctype.js.map +1 -1
- package/dist/composables/useEvent.js.map +1 -1
- package/dist/composables/useFont.d.ts.map +1 -1
- package/dist/composables/useFont.js.map +1 -1
- package/dist/composables/useOutlookFallback.d.ts.map +1 -1
- package/dist/composables/useOutlookFallback.js.map +1 -1
- package/dist/composables/usePlaintext.d.ts.map +1 -1
- package/dist/composables/usePlaintext.js.map +1 -1
- package/dist/composables/usePreheader.d.ts.map +1 -1
- package/dist/composables/usePreheader.js.map +1 -1
- package/dist/composables/useTransformers.d.ts.map +1 -1
- package/dist/composables/useTransformers.js.map +1 -1
- package/dist/composables/useUrlQuery.d.ts.map +1 -1
- package/dist/composables/useUrlQuery.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.js +12 -0
- package/dist/config/index.js.map +1 -1
- package/dist/events/index.d.ts +5 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -1
- package/dist/plaintext.d.ts.map +1 -1
- package/dist/plaintext.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -1
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -1
- package/dist/plugins/postcss/pruneVars.d.ts.map +1 -1
- package/dist/plugins/postcss/pruneVars.js.map +1 -1
- package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -1
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -1
- package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -1
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -1
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -1
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -1
- package/dist/plugins/postcss/resolveProps.d.ts.map +1 -1
- package/dist/plugins/postcss/resolveProps.js +14 -0
- package/dist/plugins/postcss/resolveProps.js.map +1 -1
- package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -1
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -1
- package/dist/prepare.d.ts.map +1 -1
- package/dist/prepare.js.map +1 -1
- package/dist/render/active.d.ts.map +1 -1
- package/dist/render/active.js.map +1 -1
- package/dist/render/createRenderer.d.ts.map +1 -1
- package/dist/render/createRenderer.js +89 -1
- package/dist/render/createRenderer.js.map +1 -1
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +6 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/injectFonts.js.map +1 -1
- package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -1
- package/dist/render/plugins/codeBlockExtract.js +4 -0
- package/dist/render/plugins/codeBlockExtract.js.map +1 -1
- package/dist/render/plugins/markdownExtract.d.ts.map +1 -1
- package/dist/render/plugins/markdownExtract.js.map +1 -1
- package/dist/render/plugins/rawExtract.d.ts.map +1 -1
- package/dist/render/plugins/rawExtract.js.map +1 -1
- package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -1
- package/dist/render/plugins/rowSourceLocation.js.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +48 -15
- package/dist/serve.js.map +1 -1
- package/dist/server/compatibility.d.ts.map +1 -1
- package/dist/server/compatibility.js +48 -0
- package/dist/server/compatibility.js.map +1 -1
- package/dist/server/email.js.map +1 -1
- package/dist/server/linter.js +6 -0
- package/dist/server/linter.js.map +1 -1
- package/dist/server/sfc-utils.d.ts.map +1 -1
- package/dist/server/sfc-utils.js.map +1 -1
- package/dist/server/ui/App.vue +17 -16
- package/dist/server/ui/components/Markdown.vue +17 -0
- package/dist/server/ui/components/SidebarClose.vue +1 -1
- package/dist/server/ui/components/ui/checkbox/Checkbox.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandInput.vue +2 -2
- package/dist/server/ui/components/ui/dialog/DialogContent.vue +1 -1
- package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +1 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +1 -1
- package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +1 -1
- package/dist/server/ui/lib/emulated-dark-mode.ts +25 -10
- package/dist/server/ui/pages/Home.vue +1 -1
- package/dist/server/ui/pages/Preview.vue +32 -18
- package/dist/tests/render/_helpers.js.map +1 -1
- package/dist/transformers/addAttributes.d.ts.map +1 -1
- package/dist/transformers/addAttributes.js.map +1 -1
- package/dist/transformers/attributeToStyle.d.ts.map +1 -1
- package/dist/transformers/attributeToStyle.js.map +1 -1
- package/dist/transformers/base.d.ts.map +1 -1
- package/dist/transformers/base.js +4 -0
- package/dist/transformers/base.js.map +1 -1
- package/dist/transformers/columnWidth.d.ts.map +1 -1
- package/dist/transformers/columnWidth.js.map +1 -1
- package/dist/transformers/entities.d.ts.map +1 -1
- package/dist/transformers/entities.js.map +1 -1
- package/dist/transformers/filters/defaults.d.ts.map +1 -1
- package/dist/transformers/filters/defaults.js.map +1 -1
- package/dist/transformers/filters/index.d.ts.map +1 -1
- package/dist/transformers/filters/index.js.map +1 -1
- package/dist/transformers/format.d.ts.map +1 -1
- package/dist/transformers/format.js.map +1 -1
- package/dist/transformers/index.d.ts.map +1 -1
- package/dist/transformers/index.js +26 -0
- package/dist/transformers/index.js.map +1 -1
- package/dist/transformers/inlineCss.d.ts.map +1 -1
- package/dist/transformers/inlineCss.js +25 -2
- package/dist/transformers/inlineCss.js.map +1 -1
- package/dist/transformers/inlineLink.d.ts.map +1 -1
- package/dist/transformers/inlineLink.js.map +1 -1
- package/dist/transformers/minify.d.ts.map +1 -1
- package/dist/transformers/minify.js.map +1 -1
- package/dist/transformers/minifyCodeInline.d.ts.map +1 -1
- package/dist/transformers/minifyCodeInline.js.map +1 -1
- package/dist/transformers/msoPlaceholders.d.ts.map +1 -1
- package/dist/transformers/msoPlaceholders.js.map +1 -1
- package/dist/transformers/purgeCss.d.ts.map +1 -1
- package/dist/transformers/purgeCss.js +29 -3
- package/dist/transformers/purgeCss.js.map +1 -1
- package/dist/transformers/removeAttributes.d.ts.map +1 -1
- package/dist/transformers/removeAttributes.js.map +1 -1
- package/dist/transformers/replaceStrings.d.ts.map +1 -1
- package/dist/transformers/replaceStrings.js.map +1 -1
- package/dist/transformers/safeSelectors.d.ts.map +1 -1
- package/dist/transformers/safeSelectors.js +13 -1
- package/dist/transformers/safeSelectors.js.map +1 -1
- package/dist/transformers/shorthandCss.d.ts.map +1 -1
- package/dist/transformers/shorthandCss.js.map +1 -1
- package/dist/transformers/sixHex.d.ts.map +1 -1
- package/dist/transformers/sixHex.js.map +1 -1
- package/dist/transformers/tailwindComponent.js +9 -0
- package/dist/transformers/tailwindComponent.js.map +1 -1
- package/dist/transformers/tailwindcss.d.ts.map +1 -1
- package/dist/transformers/tailwindcss.js +22 -0
- package/dist/transformers/tailwindcss.js.map +1 -1
- package/dist/transformers/urlQuery.d.ts.map +1 -1
- package/dist/transformers/urlQuery.js.map +1 -1
- package/dist/types/config.d.ts +4 -8
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/ast/parser.d.ts.map +1 -1
- package/dist/utils/ast/parser.js.map +1 -1
- package/dist/utils/ast/serializer.d.ts.map +1 -1
- package/dist/utils/ast/serializer.js.map +1 -1
- package/dist/utils/ast/walker.d.ts.map +1 -1
- package/dist/utils/ast/walker.js.map +1 -1
- package/dist/utils/compileTailwindCss.d.ts.map +1 -1
- package/dist/utils/compileTailwindCss.js.map +1 -1
- package/dist/utils/componentSources.d.ts.map +1 -1
- package/dist/utils/componentSources.js.map +1 -1
- package/dist/utils/cssBox.d.ts.map +1 -1
- package/dist/utils/cssBox.js.map +1 -1
- package/dist/utils/decodeStyleEntities.d.ts.map +1 -1
- package/dist/utils/decodeStyleEntities.js.map +1 -1
- package/dist/utils/detect.d.ts.map +1 -1
- package/dist/utils/detect.js.map +1 -1
- package/dist/utils/output-markers.d.ts.map +1 -1
- package/dist/utils/output-markers.js.map +1 -1
- package/dist/utils/url.d.ts.map +1 -1
- package/dist/utils/url.js.map +1 -1
- package/dist/utils/watchPaths.js.map +1 -1
- package/node_modules/@clack/core/CHANGELOG.md +6 -0
- package/node_modules/@clack/core/dist/index.d.mts +1 -1
- package/node_modules/@clack/core/dist/index.mjs +8 -8
- package/node_modules/@clack/core/dist/index.mjs.map +1 -1
- package/node_modules/@clack/core/package.json +1 -1
- package/node_modules/@clack/prompts/CHANGELOG.md +13 -0
- package/node_modules/@clack/prompts/README.md +2 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +98 -0
- package/node_modules/@clack/prompts/dist/index.mjs +122 -121
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
- package/node_modules/@clack/prompts/package.json +2 -2
- package/node_modules/fast-wrap-ansi/lib/main.js +0 -1
- package/node_modules/fast-wrap-ansi/package.json +10 -10
- package/node_modules/maizzle/dist/commands/make/config.mjs +7 -6
- package/node_modules/maizzle/dist/commands/new.mjs +15 -84
- package/node_modules/maizzle/package.json +2 -2
- package/node_modules/tinyexec/README.md +8 -0
- package/node_modules/tinyexec/dist/main.d.mts +16 -1
- package/node_modules/tinyexec/dist/main.mjs +163 -457
- package/node_modules/tinyexec/package.json +12 -14
- package/package.json +3 -4
- package/node_modules/fast-wrap-ansi/lib/main.js.map +0 -1
- package/node_modules/tinyexec/dist/LICENSES.txt +0 -83
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/types/config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/types/config.ts"],"mappings":"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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AttributesConfig, CaniemailClient, ChecksConfig, ComponentSource, CssConfig, EntitiesConfig, FilterFunction, FiltersConfig, HtmlConfig, MaizzleConfig, MarkdownConfig, PlaintextConfig, PostcssConfig, TransformerToggles, UrlConfig, UrlQuery, UrlQueryOptions } from "./config.js";
|
|
2
|
-
export {
|
|
2
|
+
export type { AttributesConfig, CaniemailClient, ChecksConfig, ComponentSource, CssConfig, EntitiesConfig, FilterFunction, FiltersConfig, HtmlConfig, MaizzleConfig, MarkdownConfig, PlaintextConfig, PostcssConfig, TransformerToggles, UrlConfig, UrlQuery, UrlQueryOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","names":[],"sources":["../../../src/utils/ast/parser.ts"],"mappings":";;;iBAIgB,KAAA,CAAM,IAAA,UAAc,OAAA,GAAS,iBAAA,GAAyB,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","names":[],"sources":["../../../src/utils/ast/parser.ts"],"mappings":";;;iBAIgB,KAAA,CAAM,IAAA,UAAc,OAAA,GAAS,iBAAA,GAAyB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","names":[],"sources":["../../../src/utils/ast/parser.ts"],"sourcesContent":["import { Parser } from 'htmlparser2'\nimport { DomHandler } from 'domhandler'\nimport type { ChildNode, DomHandlerOptions } from 'domhandler'\n\nexport function parse(html: string, options: DomHandlerOptions = {}): ChildNode[] {\n const handler = new DomHandler()\n const parser = new Parser(handler, options)\n parser.write(html)\n parser.end()\n return handler.dom\n}\n"],"mappings":";;;AAIA,SAAgB,MAAM,MAAc,UAA6B,
|
|
1
|
+
{"version":3,"file":"parser.js","names":[],"sources":["../../../src/utils/ast/parser.ts"],"sourcesContent":["import { Parser } from 'htmlparser2'\nimport { DomHandler } from 'domhandler'\nimport type { ChildNode, DomHandlerOptions } from 'domhandler'\n\nexport function parse(html: string, options: DomHandlerOptions = {}): ChildNode[] {\n const handler = new DomHandler()\n const parser = new Parser(handler, options)\n parser.write(html)\n parser.end()\n return handler.dom\n}\n"],"mappings":";;;AAIA,SAAgB,MAAM,MAAc,UAA6B,CAAC,GAAgB;CAChF,MAAM,UAAU,IAAI,WAAW;CAC/B,MAAM,SAAS,IAAI,OAAO,SAAS,OAAO;CAC1C,OAAO,MAAM,IAAI;CACjB,OAAO,IAAI;CACX,OAAO,QAAQ;AACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"mappings":";;;;iBA0CgB,SAAA,CAAU,GAAA,EAAK,SAAA,IAAa,OAAA,GAAU,
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"mappings":";;;;iBA0CgB,SAAA,CAAU,GAAA,EAAK,SAAA,IAAa,OAAA,GAAU,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"sourcesContent":["import render from 'dom-serializer'\nimport type { ChildNode, Element, Text } from 'domhandler'\nimport type { DomSerializerOptions } from 'dom-serializer'\n\nconst RAW_TEXT_ELEMENTS = new Set(['script', 'style'])\n\n/**\n * Re-encode `<` and `>` in text nodes before serialization.\n *\n * The parser decodes entities like `<` into raw `<` in text nodes. With\n * `encodeEntities: false` (needed so other transformers can emit entity\n * strings such as ` ` verbatim), the serializer would write those raw\n * `<` characters as-is, turning escaped text (e.g. a Vue `{{ html }}`\n * interpolation containing `<p>...</p>`) into real DOM downstream.\n *\n * `&` is intentionally not re-encoded: the `entities` transformer writes\n * literal entity strings (` `, `—`) directly into text-node data\n * and relies on the serializer leaving them alone.\n *\n * Skip `<script>` / `<style>` — their children are raw-text containers, and\n * CSS/JS legitimately contains `<` and `>`.\n */\nfunction encodeTextNodes(dom: ChildNode[], inRawText = false): void {\n for (const node of dom) {\n if (node.type === 'text') {\n if (!inRawText) {\n const text = node as Text\n text.data = text.data\n .replace(/</g, '<')\n .replace(/>/g, '>')\n }\n continue\n }\n\n if ('children' in node && (node as Element).children?.length) {\n const el = node as Element\n const nextRaw = inRawText || RAW_TEXT_ELEMENTS.has(el.name)\n encodeTextNodes(el.children as ChildNode[], nextRaw)\n }\n }\n}\n\nexport function serialize(dom: ChildNode[], options?: DomSerializerOptions): string {\n encodeTextNodes(dom)\n return render(dom, { encodeEntities: false, ...options })\n}\n"],"mappings":";;AAIA,MAAM,oBAAoB,IAAI,IAAI,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"serializer.js","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"sourcesContent":["import render from 'dom-serializer'\nimport type { ChildNode, Element, Text } from 'domhandler'\nimport type { DomSerializerOptions } from 'dom-serializer'\n\nconst RAW_TEXT_ELEMENTS = new Set(['script', 'style'])\n\n/**\n * Re-encode `<` and `>` in text nodes before serialization.\n *\n * The parser decodes entities like `<` into raw `<` in text nodes. With\n * `encodeEntities: false` (needed so other transformers can emit entity\n * strings such as ` ` verbatim), the serializer would write those raw\n * `<` characters as-is, turning escaped text (e.g. a Vue `{{ html }}`\n * interpolation containing `<p>...</p>`) into real DOM downstream.\n *\n * `&` is intentionally not re-encoded: the `entities` transformer writes\n * literal entity strings (` `, `—`) directly into text-node data\n * and relies on the serializer leaving them alone.\n *\n * Skip `<script>` / `<style>` — their children are raw-text containers, and\n * CSS/JS legitimately contains `<` and `>`.\n */\nfunction encodeTextNodes(dom: ChildNode[], inRawText = false): void {\n for (const node of dom) {\n if (node.type === 'text') {\n if (!inRawText) {\n const text = node as Text\n text.data = text.data\n .replace(/</g, '<')\n .replace(/>/g, '>')\n }\n continue\n }\n\n if ('children' in node && (node as Element).children?.length) {\n const el = node as Element\n const nextRaw = inRawText || RAW_TEXT_ELEMENTS.has(el.name)\n encodeTextNodes(el.children as ChildNode[], nextRaw)\n }\n }\n}\n\nexport function serialize(dom: ChildNode[], options?: DomSerializerOptions): string {\n encodeTextNodes(dom)\n return render(dom, { encodeEntities: false, ...options })\n}\n"],"mappings":";;AAIA,MAAM,oBAAoB,IAAI,IAAI,CAAC,UAAU,OAAO,CAAC;;;;;;;;;;;;;;;;;AAkBrD,SAAS,gBAAgB,KAAkB,YAAY,OAAa;CAClE,KAAK,MAAM,QAAQ,KAAK;EACtB,IAAI,KAAK,SAAS,QAAQ;GACxB,IAAI,CAAC,WAAW;IACd,MAAM,OAAO;IACb,KAAK,OAAO,KAAK,KACd,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM;GACzB;GACA;EACF;EAEA,IAAI,cAAc,QAAS,KAAiB,UAAU,QAAQ;GAC5D,MAAM,KAAK;GACX,MAAM,UAAU,aAAa,kBAAkB,IAAI,GAAG,IAAI;GAC1D,gBAAgB,GAAG,UAAyB,OAAO;EACrD;CACF;AACF;AAEA,SAAgB,UAAU,KAAkB,SAAwC;CAClF,gBAAgB,GAAG;CACnB,OAAO,OAAO,KAAK;EAAE,gBAAgB;EAAO,GAAG;CAAQ,CAAC;AAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walker.d.ts","names":[],"sources":["../../../src/utils/ast/walker.ts"],"mappings":";;;iBAEgB,IAAA,CAAK,GAAA,EAAK,SAAA,IAAa,QAAA,GAAW,IAAA,EAAM,
|
|
1
|
+
{"version":3,"file":"walker.d.ts","names":[],"sources":["../../../src/utils/ast/walker.ts"],"mappings":";;;iBAEgB,IAAA,CAAK,GAAA,EAAK,SAAA,IAAa,QAAA,GAAW,IAAA,EAAM,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walker.js","names":[],"sources":["../../../src/utils/ast/walker.ts"],"sourcesContent":["import type { ChildNode } from 'domhandler'\n\nexport function walk(ast: ChildNode[], callback: (node: ChildNode) => void): void {\n function traverse(node: ChildNode) {\n callback(node)\n\n if ('children' in node && node.children && node.children.length > 0) {\n for (const child of node.children) {\n traverse(child)\n }\n }\n }\n\n for (const node of ast) {\n traverse(node)\n }\n}\n"],"mappings":";AAEA,SAAgB,KAAK,KAAkB,UAA2C;CAChF,SAAS,SAAS,MAAiB;EACjC,SAAS,
|
|
1
|
+
{"version":3,"file":"walker.js","names":[],"sources":["../../../src/utils/ast/walker.ts"],"sourcesContent":["import type { ChildNode } from 'domhandler'\n\nexport function walk(ast: ChildNode[], callback: (node: ChildNode) => void): void {\n function traverse(node: ChildNode) {\n callback(node)\n\n if ('children' in node && node.children && node.children.length > 0) {\n for (const child of node.children) {\n traverse(child)\n }\n }\n }\n\n for (const node of ast) {\n traverse(node)\n }\n}\n"],"mappings":";AAEA,SAAgB,KAAK,KAAkB,UAA2C;CAChF,SAAS,SAAS,MAAiB;EACjC,SAAS,IAAI;EAEb,IAAI,cAAc,QAAQ,KAAK,YAAY,KAAK,SAAS,SAAS,GAChE,KAAK,MAAM,SAAS,KAAK,UACvB,SAAS,KAAK;CAGpB;CAEA,KAAK,MAAM,QAAQ,KACjB,SAAS,IAAI;AAEjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileTailwindCss.d.ts","names":[],"sources":["../../src/utils/compileTailwindCss.ts"],"mappings":";;;;iBAagB,uBAAA,CAAwB,MAAA,EAAQ,aAAA,GAAa,OAAA,CAAA,SAAA;AAAA,iBAe7C,cAAA,CAAe,
|
|
1
|
+
{"version":3,"file":"compileTailwindCss.d.ts","names":[],"sources":["../../src/utils/compileTailwindCss.ts"],"mappings":";;;;iBAagB,uBAAA,CAAwB,MAAA,EAAQ,aAAA,GAAa,OAAA,CAAA,SAAA;AAAA,iBAe7C,cAAA,CAAe,GAAW;AAAA,iBAWpB,mBAAA,CAAoB,GAAA,UAAa,MAAA,EAAQ,aAAA,GAAgB,OAAO;;;;;;iBAgBhE,kBAAA,CACpB,QAAA,UACA,MAAA,EAAQ,aAAA,EACR,IAAA,WACC,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileTailwindCss.js","names":["resolveProps","pruneVars"],"sources":["../../src/utils/compileTailwindCss.ts"],"sourcesContent":["import postcss from 'postcss'\nimport tailwindcssPostcss from '@tailwindcss/postcss'\nimport postcssCalc from 'postcss-calc'\nimport safeParser from 'postcss-safe-parser'\nimport { transform } from 'lightningcss'\nimport resolveProps from '../plugins/postcss/resolveProps.ts'\nimport pruneVars from '../plugins/postcss/pruneVars.ts'\nimport { tailwindCleanup } from '../plugins/postcss/tailwindCleanup.ts'\nimport { mergeMediaQueries } from '../plugins/postcss/mergeMediaQueries.ts'\nimport { quoteFontFamilies } from '../plugins/postcss/quoteFontFamilies.ts'\nimport { resolveMaizzleImports } from '../plugins/postcss/resolveMaizzleImports.ts'\nimport type { MaizzleConfig } from '../types/config.ts'\n\nexport function createTailwindProcessor(config: MaizzleConfig) {\n return postcss([\n // Must run before @tailwindcss/postcss so it sees absolute import paths\n resolveMaizzleImports(),\n tailwindcssPostcss({\n base: config.css?.base,\n transformAssetUrls: false,\n optimize: false,\n }),\n resolveProps(),\n postcssCalc({}),\n pruneVars(),\n ])\n}\n\nexport function lowerCssSyntax(css: string): string {\n const result = transform({\n filename: 'email.css',\n code: Buffer.from(css),\n minify: false,\n targets: { ie: 4 << 5 },\n })\n\n return result.code.toString()\n}\n\nexport async function optimizeTailwindCss(css: string, config: MaizzleConfig): Promise<string> {\n const plugins: postcss.Plugin[] = [...tailwindCleanup(config), quoteFontFamilies()]\n\n const mediaPlugin = mergeMediaQueries(config)\n if (mediaPlugin) plugins.push(mediaPlugin)\n\n const result = await postcss(plugins).process(css, { from: undefined })\n\n return result.css\n}\n\n/**\n * Compile a Tailwind CSS source string into final email-safe CSS:\n * runs @tailwindcss/postcss, lowers modern syntax via lightningcss,\n * then applies cleanup + media-query merging.\n */\nexport async function compileTailwindCss(\n cssInput: string,\n config: MaizzleConfig,\n from: string,\n): Promise<string> {\n const processor = createTailwindProcessor(config)\n const result = await processor.process(cssInput, { from, parser: safeParser })\n const lowered = lowerCssSyntax(result.css)\n return optimizeTailwindCss(lowered, config)\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,wBAAwB,QAAuB;CAC7D,OAAO,QAAQ;EAEb,
|
|
1
|
+
{"version":3,"file":"compileTailwindCss.js","names":["resolveProps","pruneVars"],"sources":["../../src/utils/compileTailwindCss.ts"],"sourcesContent":["import postcss from 'postcss'\nimport tailwindcssPostcss from '@tailwindcss/postcss'\nimport postcssCalc from 'postcss-calc'\nimport safeParser from 'postcss-safe-parser'\nimport { transform } from 'lightningcss'\nimport resolveProps from '../plugins/postcss/resolveProps.ts'\nimport pruneVars from '../plugins/postcss/pruneVars.ts'\nimport { tailwindCleanup } from '../plugins/postcss/tailwindCleanup.ts'\nimport { mergeMediaQueries } from '../plugins/postcss/mergeMediaQueries.ts'\nimport { quoteFontFamilies } from '../plugins/postcss/quoteFontFamilies.ts'\nimport { resolveMaizzleImports } from '../plugins/postcss/resolveMaizzleImports.ts'\nimport type { MaizzleConfig } from '../types/config.ts'\n\nexport function createTailwindProcessor(config: MaizzleConfig) {\n return postcss([\n // Must run before @tailwindcss/postcss so it sees absolute import paths\n resolveMaizzleImports(),\n tailwindcssPostcss({\n base: config.css?.base,\n transformAssetUrls: false,\n optimize: false,\n }),\n resolveProps(),\n postcssCalc({}),\n pruneVars(),\n ])\n}\n\nexport function lowerCssSyntax(css: string): string {\n const result = transform({\n filename: 'email.css',\n code: Buffer.from(css),\n minify: false,\n targets: { ie: 4 << 5 },\n })\n\n return result.code.toString()\n}\n\nexport async function optimizeTailwindCss(css: string, config: MaizzleConfig): Promise<string> {\n const plugins: postcss.Plugin[] = [...tailwindCleanup(config), quoteFontFamilies()]\n\n const mediaPlugin = mergeMediaQueries(config)\n if (mediaPlugin) plugins.push(mediaPlugin)\n\n const result = await postcss(plugins).process(css, { from: undefined })\n\n return result.css\n}\n\n/**\n * Compile a Tailwind CSS source string into final email-safe CSS:\n * runs @tailwindcss/postcss, lowers modern syntax via lightningcss,\n * then applies cleanup + media-query merging.\n */\nexport async function compileTailwindCss(\n cssInput: string,\n config: MaizzleConfig,\n from: string,\n): Promise<string> {\n const processor = createTailwindProcessor(config)\n const result = await processor.process(cssInput, { from, parser: safeParser })\n const lowered = lowerCssSyntax(result.css)\n return optimizeTailwindCss(lowered, config)\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,wBAAwB,QAAuB;CAC7D,OAAO,QAAQ;EAEb,sBAAsB;EACtB,mBAAmB;GACjB,MAAM,OAAO,KAAK;GAClB,oBAAoB;GACpB,UAAU;EACZ,CAAC;EACDA,qBAAa;EACb,YAAY,CAAC,CAAC;EACdC,kBAAU;CACZ,CAAC;AACH;AAEA,SAAgB,eAAe,KAAqB;CAQlD,OAPe,UAAU;EACvB,UAAU;EACV,MAAM,OAAO,KAAK,GAAG;EACrB,QAAQ;EACR,SAAS,EAAE,IAAI,IAAO;CACxB,CAEY,EAAE,KAAK,SAAS;AAC9B;AAEA,eAAsB,oBAAoB,KAAa,QAAwC;CAC7F,MAAM,UAA4B,CAAC,GAAG,gBAAgB,MAAM,GAAG,kBAAkB,CAAC;CAElF,MAAM,cAAc,kBAAkB,MAAM;CAC5C,IAAI,aAAa,QAAQ,KAAK,WAAW;CAIzC,QAAO,MAFc,QAAQ,OAAO,EAAE,QAAQ,KAAK,EAAE,MAAM,KAAA,EAAU,CAAC,GAExD;AAChB;;;;;;AAOA,eAAsB,mBACpB,UACA,QACA,MACiB;CAIjB,OAAO,oBADS,gBAAe,MAFb,wBAAwB,MACb,EAAE,QAAQ,UAAU;EAAE;EAAM,QAAQ;CAAW,CAAC,GACvC,GACL,GAAG,MAAM;AAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentSources.d.ts","names":[],"sources":["../../src/utils/componentSources.ts"],"mappings":";;;;;AAQA;;;UAAiB,yBAAA;EAEf;EAAA,IAAA;EAUA
|
|
1
|
+
{"version":3,"file":"componentSources.d.ts","names":[],"sources":["../../src/utils/componentSources.ts"],"mappings":";;;;;AAQA;;;UAAiB,yBAAA;EAEf;EAAA,IAAA;EAUA;;AAAU;AAOZ;;;;EATE,MAAA;EAYC;EAVD,UAAA;AAAA;;;;;iBAOc,yBAAA,CACd,OAAA,EAAS,eAAA,GAAkB,eAAA,gBAC3B,GAAA,WACC,yBAAA;AAAA,UAqBc,oBAAA;EArBW;EAuB1B,QAAA;EAFmC;EAInC,OAAA;EAJmC;EAMnC,MAAA;EAFA;EAIA,UAAA;AAAA;;AAAU;AAYZ;;;;AAAgE;;;iBAAhD,qBAAA,CAAsB,IAA0B,EAApB,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentSources.js","names":[],"sources":["../../src/utils/componentSources.ts"],"sourcesContent":["import { resolve, relative } from 'node:path'\nimport type { ComponentSource } from '../types/config.ts'\n\n/**\n * Internal representation of a component source after defaults are\n * resolved and `path` is made absolute. Always carries the same shape\n * regardless of which user-facing form produced it.\n */\nexport interface NormalizedComponentSource {\n /** Absolute directory path. */\n path: string\n /**\n * Custom prefix prepended to resolved component names.\n * - `undefined` → use folder-name namespace (the `directoryAsNamespace`\n * behavior of unplugin-vue-components).\n * - `''` (empty string) → no prefix at all; use the bare filename.\n * - any other string → exact prefix.\n */\n prefix?: string\n /** Include intermediate subfolder names in the resolved name. */\n pathPrefix: boolean\n}\n\n/**\n * Normalize a user-supplied `components.source` value into an array\n * of absolute, fully-defaulted entries.\n */\nexport function normalizeComponentSources(\n sources: ComponentSource | ComponentSource[] | undefined,\n cwd: string,\n): NormalizedComponentSource[] {\n if (!sources) return []\n const list = Array.isArray(sources) ? sources : [sources]\n return list.map((s) => {\n if (typeof s === 'string') {\n return { path: resolve(cwd, s), prefix: undefined, pathPrefix: true }\n }\n return {\n path: resolve(cwd, s.path),\n prefix: s.prefix,\n pathPrefix: s.pathPrefix ?? true,\n }\n })\n}\n\nfunction pascalCase(s: string): string {\n return s\n .replace(/[-_\\s]+(.)/g, (_, c) => c.toUpperCase())\n .replace(/^(.)/, c => c.toUpperCase())\n}\n\nexport interface ComponentNameOptions {\n /** Absolute path to the component file. */\n filePath: string\n /** Absolute path to the dir root the component was discovered under. */\n dirRoot: string\n /** See {@link NormalizedComponentSource.prefix}. */\n prefix?: string\n /** See {@link NormalizedComponentSource.pathPrefix}. */\n pathPrefix: boolean\n}\n\n/**\n * Compute the component name unplugin-vue-components would assign for a\n * given file under a given dir, mirroring the plugin's\n * `directoryAsNamespace: true` + `collapseSamePrefixes: true` behavior\n * and layering custom-prefix sources on top.\n *\n * Used both at render time (to register a custom resolver) and at lint\n * time (so the linter can follow component graph correctly).\n */\nexport function componentNameFromPath(opts: ComponentNameOptions): string {\n const { filePath, dirRoot, prefix, pathPrefix } = opts\n\n const rel = relative(dirRoot, filePath).replace(/\\\\/g, '/')\n const noExt = rel.replace(/\\.(vue|md)$/, '')\n const segments = noExt.split('/').map(pascalCase)\n const fileName = segments.pop() ?? ''\n\n if (prefix !== undefined) {\n const folderPart = pathPrefix ? segments.join('') : ''\n const stripped = prefix && fileName.startsWith(prefix)\n ? fileName.slice(prefix.length)\n : fileName\n return prefix + folderPart + stripped\n }\n\n const folderPart = segments.join('')\n if (folderPart && fileName.startsWith(folderPart)) {\n return fileName\n }\n return folderPart + fileName\n}\n"],"mappings":";;;;;;AA2BA,SAAgB,0BACd,SACA,KAC6B;CAC7B,IAAI,CAAC,SAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"componentSources.js","names":[],"sources":["../../src/utils/componentSources.ts"],"sourcesContent":["import { resolve, relative } from 'node:path'\nimport type { ComponentSource } from '../types/config.ts'\n\n/**\n * Internal representation of a component source after defaults are\n * resolved and `path` is made absolute. Always carries the same shape\n * regardless of which user-facing form produced it.\n */\nexport interface NormalizedComponentSource {\n /** Absolute directory path. */\n path: string\n /**\n * Custom prefix prepended to resolved component names.\n * - `undefined` → use folder-name namespace (the `directoryAsNamespace`\n * behavior of unplugin-vue-components).\n * - `''` (empty string) → no prefix at all; use the bare filename.\n * - any other string → exact prefix.\n */\n prefix?: string\n /** Include intermediate subfolder names in the resolved name. */\n pathPrefix: boolean\n}\n\n/**\n * Normalize a user-supplied `components.source` value into an array\n * of absolute, fully-defaulted entries.\n */\nexport function normalizeComponentSources(\n sources: ComponentSource | ComponentSource[] | undefined,\n cwd: string,\n): NormalizedComponentSource[] {\n if (!sources) return []\n const list = Array.isArray(sources) ? sources : [sources]\n return list.map((s) => {\n if (typeof s === 'string') {\n return { path: resolve(cwd, s), prefix: undefined, pathPrefix: true }\n }\n return {\n path: resolve(cwd, s.path),\n prefix: s.prefix,\n pathPrefix: s.pathPrefix ?? true,\n }\n })\n}\n\nfunction pascalCase(s: string): string {\n return s\n .replace(/[-_\\s]+(.)/g, (_, c) => c.toUpperCase())\n .replace(/^(.)/, c => c.toUpperCase())\n}\n\nexport interface ComponentNameOptions {\n /** Absolute path to the component file. */\n filePath: string\n /** Absolute path to the dir root the component was discovered under. */\n dirRoot: string\n /** See {@link NormalizedComponentSource.prefix}. */\n prefix?: string\n /** See {@link NormalizedComponentSource.pathPrefix}. */\n pathPrefix: boolean\n}\n\n/**\n * Compute the component name unplugin-vue-components would assign for a\n * given file under a given dir, mirroring the plugin's\n * `directoryAsNamespace: true` + `collapseSamePrefixes: true` behavior\n * and layering custom-prefix sources on top.\n *\n * Used both at render time (to register a custom resolver) and at lint\n * time (so the linter can follow component graph correctly).\n */\nexport function componentNameFromPath(opts: ComponentNameOptions): string {\n const { filePath, dirRoot, prefix, pathPrefix } = opts\n\n const rel = relative(dirRoot, filePath).replace(/\\\\/g, '/')\n const noExt = rel.replace(/\\.(vue|md)$/, '')\n const segments = noExt.split('/').map(pascalCase)\n const fileName = segments.pop() ?? ''\n\n if (prefix !== undefined) {\n const folderPart = pathPrefix ? segments.join('') : ''\n const stripped = prefix && fileName.startsWith(prefix)\n ? fileName.slice(prefix.length)\n : fileName\n return prefix + folderPart + stripped\n }\n\n const folderPart = segments.join('')\n if (folderPart && fileName.startsWith(folderPart)) {\n return fileName\n }\n return folderPart + fileName\n}\n"],"mappings":";;;;;;AA2BA,SAAgB,0BACd,SACA,KAC6B;CAC7B,IAAI,CAAC,SAAS,OAAO,CAAC;CAEtB,QADa,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO,GAC5C,KAAK,MAAM;EACrB,IAAI,OAAO,MAAM,UACf,OAAO;GAAE,MAAM,QAAQ,KAAK,CAAC;GAAG,QAAQ,KAAA;GAAW,YAAY;EAAK;EAEtE,OAAO;GACL,MAAM,QAAQ,KAAK,EAAE,IAAI;GACzB,QAAQ,EAAE;GACV,YAAY,EAAE,cAAc;EAC9B;CACF,CAAC;AACH;AAEA,SAAS,WAAW,GAAmB;CACrC,OAAO,EACJ,QAAQ,gBAAgB,GAAG,MAAM,EAAE,YAAY,CAAC,EAChD,QAAQ,SAAQ,MAAK,EAAE,YAAY,CAAC;AACzC;;;;;;;;;;AAsBA,SAAgB,sBAAsB,MAAoC;CACxE,MAAM,EAAE,UAAU,SAAS,QAAQ,eAAe;CAIlD,MAAM,WAFM,SAAS,SAAS,QAAQ,EAAE,QAAQ,OAAO,GACvC,EAAE,QAAQ,eAAe,EACpB,EAAE,MAAM,GAAG,EAAE,IAAI,UAAU;CAChD,MAAM,WAAW,SAAS,IAAI,KAAK;CAEnC,IAAI,WAAW,KAAA,GAAW;EACxB,MAAM,aAAa,aAAa,SAAS,KAAK,EAAE,IAAI;EACpD,MAAM,WAAW,UAAU,SAAS,WAAW,MAAM,IACjD,SAAS,MAAM,OAAO,MAAM,IAC5B;EACJ,OAAO,SAAS,aAAa;CAC/B;CAEA,MAAM,aAAa,SAAS,KAAK,EAAE;CACnC,IAAI,cAAc,SAAS,WAAW,UAAU,GAC9C,OAAO;CAET,OAAO,aAAa;AACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cssBox.d.ts","names":[],"sources":["../../src/utils/cssBox.ts"],"mappings":";;;cAEa,gBAAA,EAAgB,GAAA;;AAA7B;;;;iBAOgB,UAAA,CAAW,
|
|
1
|
+
{"version":3,"file":"cssBox.d.ts","names":[],"sources":["../../src/utils/cssBox.ts"],"mappings":";;;cAEa,gBAAA,EAAgB,GAAA;;AAA7B;;;;iBAOgB,UAAA,CAAW,KAAa;AAAxC;;;;AAAwC;AAoBxC;;AApBA,iBAoBgB,cAAA,CAAe,KAAA;EAAkB,IAAA;EAAe,KAAA;AAAA;;;AAAK;AAerE;iBAAgB,mBAAA,CAAoB,IAAU,EAAJ,IAAI;;;AAAA;AA8B9C;;;iBAAgB,sBAAA,CAAuB,KAAa;AAAA;AAepD;;;;AAfoD,iBAepC,kBAAA,CAAmB,IAAU,EAAJ,IAAI"}
|
package/dist/utils/cssBox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cssBox.js","names":[],"sources":["../../src/utils/cssBox.ts"],"sourcesContent":["import type { Root } from 'postcss'\n\nexport const NO_BORDER_STYLES = new Set(['none', 'hidden'])\n\n/**\n * Parse a length token into px. Handles `Npx`, `Nrem`, `Nem`, `Npt`, and\n * unitless N (treated as px). Returns null for percentages, calc(),\n * keywords, or anything that doesn't reduce to a concrete length.\n */\nexport function lengthToPx(value: string): number | null {\n const m = value.trim().match(/^([\\d.]+)(px|rem|em|pt)?$/i)\n if (!m) return null\n const n = parseFloat(m[1])\n switch ((m[2] || 'px').toLowerCase()) {\n case 'px': return n\n case 'rem':\n case 'em': return n * 16\n case 'pt': return n * 1.333\n default: return null\n }\n}\n\n/**\n * Expand a 1-4 token CSS shorthand (T R B L) into a left/right pair:\n * 1: all sides\n * 2: TB RL\n * 3: T RL B\n * 4: T R B L\n */\nexport function shorthandSides(value: string): { left?: string; right?: string } {\n const parts = value.trim().split(/\\s+/)\n switch (parts.length) {\n case 1: return { left: parts[0], right: parts[0] }\n case 2:\n case 3: return { left: parts[1], right: parts[1] }\n case 4: return { left: parts[3], right: parts[1] }\n default: return {}\n }\n}\n\n/**\n * Read horizontal padding (left + right) px from a parsed style root.\n * Percentages are skipped since they'd need a known container width.\n */\nexport function horizontalPaddingPx(root: Root): number {\n let left: number | null = null\n let right: number | null = null\n\n root.walkDecls((d) => {\n switch (d.prop) {\n case 'padding': {\n const { left: l, right: r } = shorthandSides(d.value)\n if (l) left = lengthToPx(l)\n if (r) right = lengthToPx(r)\n break\n }\n case 'padding-left':\n left = lengthToPx(d.value)\n break\n case 'padding-right':\n right = lengthToPx(d.value)\n break\n }\n })\n\n return (left ?? 0) + (right ?? 0)\n}\n\n/**\n * Extract a px length from a CSS border shorthand (e.g. `1px solid red` → 1).\n * Returns null when the value indicates no border (`none` or `hidden`).\n * Defaults to 3px (CSS `medium`) when a visible style is set but no\n * explicit width token is present in the shorthand value.\n */\nexport function shorthandBorderWidthPx(value: string): number | null {\n const tokens = value.trim().split(/\\s+/)\n if (tokens.some((t) => NO_BORDER_STYLES.has(t.toLowerCase()))) return null\n for (const t of tokens) {\n const px = lengthToPx(t)\n if (px != null) return px\n }\n return 3\n}\n\n/**\n * Read horizontal border widths (left + right) px from a parsed style root.\n * Per-side `border-style: none|hidden` overrides count as zero\n * contribution. Returns total px or 0 when nothing resolves.\n */\nexport function horizontalBorderPx(root: Root): number {\n let left: number | null = null\n let right: number | null = null\n let leftNone = false\n let rightNone = false\n\n root.walkDecls((d) => {\n switch (d.prop) {\n case 'border': {\n const w = shorthandBorderWidthPx(d.value)\n if (w == null) {\n leftNone = rightNone = true\n }\n else {\n left = right = w\n leftNone = rightNone = false\n }\n break\n }\n case 'border-width': {\n const { left: l, right: r } = shorthandSides(d.value)\n if (l) left = lengthToPx(l) ?? left\n if (r) right = lengthToPx(r) ?? right\n break\n }\n case 'border-style': {\n const { left: l, right: r } = shorthandSides(d.value)\n if (l && NO_BORDER_STYLES.has(l.toLowerCase())) leftNone = true\n if (r && NO_BORDER_STYLES.has(r.toLowerCase())) rightNone = true\n break\n }\n case 'border-left': {\n const w = shorthandBorderWidthPx(d.value)\n if (w == null) leftNone = true\n else { left = w; leftNone = false }\n break\n }\n case 'border-right': {\n const w = shorthandBorderWidthPx(d.value)\n if (w == null) rightNone = true\n else { right = w; rightNone = false }\n break\n }\n case 'border-left-width':\n left = lengthToPx(d.value) ?? left\n break\n case 'border-right-width':\n right = lengthToPx(d.value) ?? right\n break\n case 'border-left-style':\n if (NO_BORDER_STYLES.has(d.value.trim().toLowerCase())) leftNone = true\n break\n case 'border-right-style':\n if (NO_BORDER_STYLES.has(d.value.trim().toLowerCase())) rightNone = true\n break\n }\n })\n\n return (leftNone ? 0 : (left ?? 0)) + (rightNone ? 0 : (right ?? 0))\n}\n"],"mappings":";AAEA,MAAa,mBAAmB,IAAI,IAAI,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"cssBox.js","names":[],"sources":["../../src/utils/cssBox.ts"],"sourcesContent":["import type { Root } from 'postcss'\n\nexport const NO_BORDER_STYLES = new Set(['none', 'hidden'])\n\n/**\n * Parse a length token into px. Handles `Npx`, `Nrem`, `Nem`, `Npt`, and\n * unitless N (treated as px). Returns null for percentages, calc(),\n * keywords, or anything that doesn't reduce to a concrete length.\n */\nexport function lengthToPx(value: string): number | null {\n const m = value.trim().match(/^([\\d.]+)(px|rem|em|pt)?$/i)\n if (!m) return null\n const n = parseFloat(m[1])\n switch ((m[2] || 'px').toLowerCase()) {\n case 'px': return n\n case 'rem':\n case 'em': return n * 16\n case 'pt': return n * 1.333\n default: return null\n }\n}\n\n/**\n * Expand a 1-4 token CSS shorthand (T R B L) into a left/right pair:\n * 1: all sides\n * 2: TB RL\n * 3: T RL B\n * 4: T R B L\n */\nexport function shorthandSides(value: string): { left?: string; right?: string } {\n const parts = value.trim().split(/\\s+/)\n switch (parts.length) {\n case 1: return { left: parts[0], right: parts[0] }\n case 2:\n case 3: return { left: parts[1], right: parts[1] }\n case 4: return { left: parts[3], right: parts[1] }\n default: return {}\n }\n}\n\n/**\n * Read horizontal padding (left + right) px from a parsed style root.\n * Percentages are skipped since they'd need a known container width.\n */\nexport function horizontalPaddingPx(root: Root): number {\n let left: number | null = null\n let right: number | null = null\n\n root.walkDecls((d) => {\n switch (d.prop) {\n case 'padding': {\n const { left: l, right: r } = shorthandSides(d.value)\n if (l) left = lengthToPx(l)\n if (r) right = lengthToPx(r)\n break\n }\n case 'padding-left':\n left = lengthToPx(d.value)\n break\n case 'padding-right':\n right = lengthToPx(d.value)\n break\n }\n })\n\n return (left ?? 0) + (right ?? 0)\n}\n\n/**\n * Extract a px length from a CSS border shorthand (e.g. `1px solid red` → 1).\n * Returns null when the value indicates no border (`none` or `hidden`).\n * Defaults to 3px (CSS `medium`) when a visible style is set but no\n * explicit width token is present in the shorthand value.\n */\nexport function shorthandBorderWidthPx(value: string): number | null {\n const tokens = value.trim().split(/\\s+/)\n if (tokens.some((t) => NO_BORDER_STYLES.has(t.toLowerCase()))) return null\n for (const t of tokens) {\n const px = lengthToPx(t)\n if (px != null) return px\n }\n return 3\n}\n\n/**\n * Read horizontal border widths (left + right) px from a parsed style root.\n * Per-side `border-style: none|hidden` overrides count as zero\n * contribution. Returns total px or 0 when nothing resolves.\n */\nexport function horizontalBorderPx(root: Root): number {\n let left: number | null = null\n let right: number | null = null\n let leftNone = false\n let rightNone = false\n\n root.walkDecls((d) => {\n switch (d.prop) {\n case 'border': {\n const w = shorthandBorderWidthPx(d.value)\n if (w == null) {\n leftNone = rightNone = true\n }\n else {\n left = right = w\n leftNone = rightNone = false\n }\n break\n }\n case 'border-width': {\n const { left: l, right: r } = shorthandSides(d.value)\n if (l) left = lengthToPx(l) ?? left\n if (r) right = lengthToPx(r) ?? right\n break\n }\n case 'border-style': {\n const { left: l, right: r } = shorthandSides(d.value)\n if (l && NO_BORDER_STYLES.has(l.toLowerCase())) leftNone = true\n if (r && NO_BORDER_STYLES.has(r.toLowerCase())) rightNone = true\n break\n }\n case 'border-left': {\n const w = shorthandBorderWidthPx(d.value)\n if (w == null) leftNone = true\n else { left = w; leftNone = false }\n break\n }\n case 'border-right': {\n const w = shorthandBorderWidthPx(d.value)\n if (w == null) rightNone = true\n else { right = w; rightNone = false }\n break\n }\n case 'border-left-width':\n left = lengthToPx(d.value) ?? left\n break\n case 'border-right-width':\n right = lengthToPx(d.value) ?? right\n break\n case 'border-left-style':\n if (NO_BORDER_STYLES.has(d.value.trim().toLowerCase())) leftNone = true\n break\n case 'border-right-style':\n if (NO_BORDER_STYLES.has(d.value.trim().toLowerCase())) rightNone = true\n break\n }\n })\n\n return (leftNone ? 0 : (left ?? 0)) + (rightNone ? 0 : (right ?? 0))\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeStyleEntities.d.ts","names":[],"sources":["../../src/utils/decodeStyleEntities.ts"],"mappings":";;AAUA
|
|
1
|
+
{"version":3,"file":"decodeStyleEntities.d.ts","names":[],"sources":["../../src/utils/decodeStyleEntities.ts"],"mappings":";;AAUA;;;;AAA6C;;;;;iBAA7B,mBAAA,CAAoB,CAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeStyleEntities.js","names":[],"sources":["../../src/utils/decodeStyleEntities.ts"],"sourcesContent":["/**\n * Decode HTML entities that Vue SSR encodes inside `<style>` tags.\n *\n * Vue's `renderToString` HTML-encodes quotes and angle brackets within\n * style elements in templates, breaking CSS like\n * `@import \"tailwindcss\"` → `@import "tailwindcss"`.\n *\n * `&` is decoded last so previously-decoded entities are not\n * re-processed.\n */\nexport function decodeStyleEntities(s: string): string {\n return s\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .replace(/'/g, \"'\")\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/&/g, '&')\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,oBAAoB,GAAmB;CACrD,OAAO,EACJ,QAAQ,WAAW,
|
|
1
|
+
{"version":3,"file":"decodeStyleEntities.js","names":[],"sources":["../../src/utils/decodeStyleEntities.ts"],"sourcesContent":["/**\n * Decode HTML entities that Vue SSR encodes inside `<style>` tags.\n *\n * Vue's `renderToString` HTML-encodes quotes and angle brackets within\n * style elements in templates, breaking CSS like\n * `@import \"tailwindcss\"` → `@import "tailwindcss"`.\n *\n * `&` is decoded last so previously-decoded entities are not\n * re-processed.\n */\nexport function decodeStyleEntities(s: string): string {\n return s\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .replace(/'/g, \"'\")\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/&/g, '&')\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,oBAAoB,GAAmB;CACrD,OAAO,EACJ,QAAQ,WAAW,IAAG,EACtB,QAAQ,UAAU,GAAG,EACrB,QAAQ,WAAW,GAAG,EACtB,QAAQ,SAAS,GAAG,EACpB,QAAQ,SAAS,GAAG,EACpB,QAAQ,UAAU,GAAG;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","names":[],"sources":["../../src/utils/detect.ts"],"mappings":";iBAGgB,SAAA,CAAU,
|
|
1
|
+
{"version":3,"file":"detect.d.ts","names":[],"sources":["../../src/utils/detect.ts"],"mappings":";iBAGgB,SAAA,CAAU,GAA2B"}
|
package/dist/utils/detect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.js","names":[],"sources":["../../src/utils/detect.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function isLaravel(cwd: string = process.cwd()): boolean {\n return existsSync(resolve(cwd, 'artisan'))\n}\n"],"mappings":";;;AAGA,SAAgB,UAAU,MAAc,QAAQ,
|
|
1
|
+
{"version":3,"file":"detect.js","names":[],"sources":["../../src/utils/detect.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function isLaravel(cwd: string = process.cwd()): boolean {\n return existsSync(resolve(cwd, 'artisan'))\n}\n"],"mappings":";;;AAGA,SAAgB,UAAU,MAAc,QAAQ,IAAI,GAAY;CAC9D,OAAO,WAAW,QAAQ,KAAK,SAAS,CAAC;AAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-markers.d.ts","names":[],"sources":["../../src/utils/output-markers.ts"],"mappings":";;AASA
|
|
1
|
+
{"version":3,"file":"output-markers.d.ts","names":[],"sources":["../../src/utils/output-markers.ts"],"mappings":";;AASA;;;;AAAgC;cAAnB,mBAAA;AAAA,cACA,cAAA;;;AAAc;AA+C3B;;;;AAAyC;iBAAzB,YAAA,CAAa,IAAY;;;;AAgBK;;;;iBAA9B,iBAAA,CAAkB,IAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-markers.js","names":[],"sources":["../../src/utils/output-markers.ts"],"sourcesContent":["import { parse, serialize } from './ast/index.ts'\nimport type { ChildNode, Element } from 'domhandler'\n\n/**\n * Sentinel attributes the `<Plaintext>` and `<NotPlaintext>`\n * components stamp on their wrapper `<div>` so the build step\n * can route their slot content to one output and remove it\n * entirely from the other.\n */\nexport const PLAINTEXT_ONLY_ATTR = 'data-maizzle-plaintext-only'\nexport const HTML_ONLY_ATTR = 'data-maizzle-html-only'\n\ntype Op = 'drop' | 'unwrap'\ntype Rule = readonly [attr: string, op: Op]\n\nconst isElement = (n: ChildNode): n is Element => n.type === 'tag'\n\n/**\n * Apply marker rules to a forest of nodes.\n *\n * - `drop` removes the matched element and its descendants.\n * - `unwrap` removes the wrapper element but keeps its children,\n * splicing them into the parent's child list in place.\n *\n * Non-matching elements recurse so nested markers are handled.\n */\nfunction applyRules(nodes: ChildNode[], rules: readonly Rule[]): ChildNode[] {\n const out: ChildNode[] = []\n for (const n of nodes) {\n if (isElement(n)) {\n const match = rules.find(([attr]) => n.attribs?.[attr] !== undefined)\n if (match) {\n const [, op] = match\n if (op === 'drop') continue\n out.push(...applyRules((n.children ?? []) as ChildNode[], rules))\n continue\n }\n if (n.children?.length) {\n n.children = applyRules(n.children as ChildNode[], rules) as Element['children']\n }\n }\n out.push(n)\n }\n return out\n}\n\nconst hasMarkers = (html: string): boolean =>\n html.includes(PLAINTEXT_ONLY_ATTR) || html.includes(HTML_ONLY_ATTR)\n\n/**\n * Strip output markers for the HTML output: drop plaintext-only\n * subtrees entirely, unwrap html-only wrappers (keep children).\n *\n * When no markers are present, the input is returned unchanged so\n * the post-transformer formatting (prettify, XHTML self-closing\n * slashes, etc.) survives intact for the typical case.\n */\nexport function stripForHtml(html: string): string {\n if (!hasMarkers(html)) return html\n const isXhtml = /<!DOCTYPE\\s+[^>]*xhtml/i.test(html)\n return serialize(applyRules(parse(html), [\n [PLAINTEXT_ONLY_ATTR, 'drop'],\n [HTML_ONLY_ATTR, 'unwrap'],\n ]), { selfClosingTags: isXhtml })\n}\n\n/**\n * Strip output markers for the plaintext source: drop html-only\n * subtrees entirely, unwrap plaintext-only wrappers (keep children).\n *\n * The result is fed to `createPlaintext`, which then strips all\n * remaining tags via `string-strip-html`.\n */\nexport function stripForPlaintext(html: string): string {\n if (!hasMarkers(html)) return html\n return serialize(applyRules(parse(html), [\n [HTML_ONLY_ATTR, 'drop'],\n [PLAINTEXT_ONLY_ATTR, 'unwrap'],\n ]))\n}\n"],"mappings":";;;;;;;;;;AASA,MAAa,sBAAsB;AACnC,MAAa,iBAAiB;AAK9B,MAAM,aAAa,MAA+B,EAAE,SAAS;;;;;;;;;;AAW7D,SAAS,WAAW,OAAoB,OAAqC;CAC3E,MAAM,MAAmB,
|
|
1
|
+
{"version":3,"file":"output-markers.js","names":[],"sources":["../../src/utils/output-markers.ts"],"sourcesContent":["import { parse, serialize } from './ast/index.ts'\nimport type { ChildNode, Element } from 'domhandler'\n\n/**\n * Sentinel attributes the `<Plaintext>` and `<NotPlaintext>`\n * components stamp on their wrapper `<div>` so the build step\n * can route their slot content to one output and remove it\n * entirely from the other.\n */\nexport const PLAINTEXT_ONLY_ATTR = 'data-maizzle-plaintext-only'\nexport const HTML_ONLY_ATTR = 'data-maizzle-html-only'\n\ntype Op = 'drop' | 'unwrap'\ntype Rule = readonly [attr: string, op: Op]\n\nconst isElement = (n: ChildNode): n is Element => n.type === 'tag'\n\n/**\n * Apply marker rules to a forest of nodes.\n *\n * - `drop` removes the matched element and its descendants.\n * - `unwrap` removes the wrapper element but keeps its children,\n * splicing them into the parent's child list in place.\n *\n * Non-matching elements recurse so nested markers are handled.\n */\nfunction applyRules(nodes: ChildNode[], rules: readonly Rule[]): ChildNode[] {\n const out: ChildNode[] = []\n for (const n of nodes) {\n if (isElement(n)) {\n const match = rules.find(([attr]) => n.attribs?.[attr] !== undefined)\n if (match) {\n const [, op] = match\n if (op === 'drop') continue\n out.push(...applyRules((n.children ?? []) as ChildNode[], rules))\n continue\n }\n if (n.children?.length) {\n n.children = applyRules(n.children as ChildNode[], rules) as Element['children']\n }\n }\n out.push(n)\n }\n return out\n}\n\nconst hasMarkers = (html: string): boolean =>\n html.includes(PLAINTEXT_ONLY_ATTR) || html.includes(HTML_ONLY_ATTR)\n\n/**\n * Strip output markers for the HTML output: drop plaintext-only\n * subtrees entirely, unwrap html-only wrappers (keep children).\n *\n * When no markers are present, the input is returned unchanged so\n * the post-transformer formatting (prettify, XHTML self-closing\n * slashes, etc.) survives intact for the typical case.\n */\nexport function stripForHtml(html: string): string {\n if (!hasMarkers(html)) return html\n const isXhtml = /<!DOCTYPE\\s+[^>]*xhtml/i.test(html)\n return serialize(applyRules(parse(html), [\n [PLAINTEXT_ONLY_ATTR, 'drop'],\n [HTML_ONLY_ATTR, 'unwrap'],\n ]), { selfClosingTags: isXhtml })\n}\n\n/**\n * Strip output markers for the plaintext source: drop html-only\n * subtrees entirely, unwrap plaintext-only wrappers (keep children).\n *\n * The result is fed to `createPlaintext`, which then strips all\n * remaining tags via `string-strip-html`.\n */\nexport function stripForPlaintext(html: string): string {\n if (!hasMarkers(html)) return html\n return serialize(applyRules(parse(html), [\n [HTML_ONLY_ATTR, 'drop'],\n [PLAINTEXT_ONLY_ATTR, 'unwrap'],\n ]))\n}\n"],"mappings":";;;;;;;;;;AASA,MAAa,sBAAsB;AACnC,MAAa,iBAAiB;AAK9B,MAAM,aAAa,MAA+B,EAAE,SAAS;;;;;;;;;;AAW7D,SAAS,WAAW,OAAoB,OAAqC;CAC3E,MAAM,MAAmB,CAAC;CAC1B,KAAK,MAAM,KAAK,OAAO;EACrB,IAAI,UAAU,CAAC,GAAG;GAChB,MAAM,QAAQ,MAAM,MAAM,CAAC,UAAU,EAAE,UAAU,UAAU,KAAA,CAAS;GACpE,IAAI,OAAO;IACT,MAAM,GAAG,MAAM;IACf,IAAI,OAAO,QAAQ;IACnB,IAAI,KAAK,GAAG,WAAY,EAAE,YAAY,CAAC,GAAmB,KAAK,CAAC;IAChE;GACF;GACA,IAAI,EAAE,UAAU,QACd,EAAE,WAAW,WAAW,EAAE,UAAyB,KAAK;EAE5D;EACA,IAAI,KAAK,CAAC;CACZ;CACA,OAAO;AACT;AAEA,MAAM,cAAc,SAClB,KAAK,SAAA,6BAA4B,KAAK,KAAK,SAAA,wBAAuB;;;;;;;;;AAUpE,SAAgB,aAAa,MAAsB;CACjD,IAAI,CAAC,WAAW,IAAI,GAAG,OAAO;CAC9B,MAAM,UAAU,0BAA0B,KAAK,IAAI;CACnD,OAAO,UAAU,WAAW,MAAM,IAAI,GAAG,CACvC,CAAC,qBAAqB,MAAM,GAC5B,CAAC,gBAAgB,QAAQ,CAC3B,CAAC,GAAG,EAAE,iBAAiB,QAAQ,CAAC;AAClC;;;;;;;;AASA,SAAgB,kBAAkB,MAAsB;CACtD,IAAI,CAAC,WAAW,IAAI,GAAG,OAAO;CAC9B,OAAO,UAAU,WAAW,MAAM,IAAI,GAAG,CACvC,CAAC,gBAAgB,MAAM,GACvB,CAAC,qBAAqB,QAAQ,CAChC,CAAC,CAAC;AACJ"}
|
package/dist/utils/url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","names":[],"sources":["../../src/utils/url.ts"],"mappings":";cAEa,WAAA,EAAa,
|
|
1
|
+
{"version":3,"file":"url.d.ts","names":[],"sources":["../../src/utils/url.ts"],"mappings":";cAEa,WAAA,EAAa,MAAM;AAAA,cAcnB,aAAA;AAAA,iBAEG,aAAA,CAAc,GAAW;AAAA,iBAMzB,aAAA,CAAc,MAAA,UAAgB,OAAe"}
|
package/dist/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","names":[],"sources":["../../src/utils/url.ts"],"sourcesContent":["import isUrl from 'is-url-superb'\n\nexport const defaultTags: Record<string, string[]> = {\n a: ['href'],\n img: ['src', 'srcset'],\n video: ['src', 'poster'],\n source: ['src', 'srcset'],\n link: ['href'],\n script: ['src'],\n object: ['data'],\n embed: ['src'],\n iframe: ['src'],\n 'v:image': ['src'],\n 'v:fill': ['src'],\n}\n\nexport const urlAttributes = [...new Set(Object.values(defaultTags).flat())]\n\nexport function isAbsoluteUrl(url: string): boolean {\n if (!url) return true\n\n return url.startsWith('//') || url.startsWith('#') || url.startsWith('?') || isUrl(url)\n}\n\nexport function processSrcset(srcset: string, baseUrl: string): string {\n return srcset.split(',').map(entry => {\n const parts = entry.trim().split(/\\s+/)\n\n if (parts[0] && !isAbsoluteUrl(parts[0])) {\n parts[0] = baseUrl + parts[0]\n }\n\n return parts.join(' ')\n }).join(', ')\n}\n"],"mappings":";;AAEA,MAAa,cAAwC;CACnD,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"url.js","names":[],"sources":["../../src/utils/url.ts"],"sourcesContent":["import isUrl from 'is-url-superb'\n\nexport const defaultTags: Record<string, string[]> = {\n a: ['href'],\n img: ['src', 'srcset'],\n video: ['src', 'poster'],\n source: ['src', 'srcset'],\n link: ['href'],\n script: ['src'],\n object: ['data'],\n embed: ['src'],\n iframe: ['src'],\n 'v:image': ['src'],\n 'v:fill': ['src'],\n}\n\nexport const urlAttributes = [...new Set(Object.values(defaultTags).flat())]\n\nexport function isAbsoluteUrl(url: string): boolean {\n if (!url) return true\n\n return url.startsWith('//') || url.startsWith('#') || url.startsWith('?') || isUrl(url)\n}\n\nexport function processSrcset(srcset: string, baseUrl: string): string {\n return srcset.split(',').map(entry => {\n const parts = entry.trim().split(/\\s+/)\n\n if (parts[0] && !isAbsoluteUrl(parts[0])) {\n parts[0] = baseUrl + parts[0]\n }\n\n return parts.join(' ')\n }).join(', ')\n}\n"],"mappings":";;AAEA,MAAa,cAAwC;CACnD,GAAG,CAAC,MAAM;CACV,KAAK,CAAC,OAAO,QAAQ;CACrB,OAAO,CAAC,OAAO,QAAQ;CACvB,QAAQ,CAAC,OAAO,QAAQ;CACxB,MAAM,CAAC,MAAM;CACb,QAAQ,CAAC,KAAK;CACd,QAAQ,CAAC,MAAM;CACf,OAAO,CAAC,KAAK;CACb,QAAQ,CAAC,KAAK;CACd,WAAW,CAAC,KAAK;CACjB,UAAU,CAAC,KAAK;AAClB;AAEA,MAAa,gBAAgB,CAAC,GAAG,IAAI,IAAI,OAAO,OAAO,WAAW,EAAE,KAAK,CAAC,CAAC;AAE3E,SAAgB,cAAc,KAAsB;CAClD,IAAI,CAAC,KAAK,OAAO;CAEjB,OAAO,IAAI,WAAW,IAAI,KAAK,IAAI,WAAW,GAAG,KAAK,IAAI,WAAW,GAAG,KAAK,MAAM,GAAG;AACxF;AAEA,SAAgB,cAAc,QAAgB,SAAyB;CACrE,OAAO,OAAO,MAAM,GAAG,EAAE,KAAI,UAAS;EACpC,MAAM,QAAQ,MAAM,KAAK,EAAE,MAAM,KAAK;EAEtC,IAAI,MAAM,MAAM,CAAC,cAAc,MAAM,EAAE,GACrC,MAAM,KAAK,UAAU,MAAM;EAG7B,OAAO,MAAM,KAAK,GAAG;CACvB,CAAC,EAAE,KAAK,IAAI;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchPaths.js","names":[],"sources":["../../src/utils/watchPaths.ts"],"sourcesContent":["import { matchesGlob, relative } from 'node:path'\n\n/**\n * Build a predicate that tells whether an absolute file path emitted by\n * chokidar matches any of the given globs. Patterns are interpreted as\n * project-relative; a leading `./` is stripped so user-supplied globs like\n * `./locales/**` behave identically to `locales/**`.\n */\nexport function createWatchedFileMatcher(patterns: string[], cwd: string) {\n const normalized = patterns.map(p => p.replace(/^\\.\\//, ''))\n return (file: string) => {\n const rel = relative(cwd, file).replace(/\\\\/g, '/')\n return normalized.some(p => matchesGlob(rel, p))\n }\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,yBAAyB,UAAoB,KAAa;CACxE,MAAM,aAAa,SAAS,KAAI,MAAK,EAAE,QAAQ,SAAS,
|
|
1
|
+
{"version":3,"file":"watchPaths.js","names":[],"sources":["../../src/utils/watchPaths.ts"],"sourcesContent":["import { matchesGlob, relative } from 'node:path'\n\n/**\n * Build a predicate that tells whether an absolute file path emitted by\n * chokidar matches any of the given globs. Patterns are interpreted as\n * project-relative; a leading `./` is stripped so user-supplied globs like\n * `./locales/**` behave identically to `locales/**`.\n */\nexport function createWatchedFileMatcher(patterns: string[], cwd: string) {\n const normalized = patterns.map(p => p.replace(/^\\.\\//, ''))\n return (file: string) => {\n const rel = relative(cwd, file).replace(/\\\\/g, '/')\n return normalized.some(p => matchesGlob(rel, p))\n }\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,yBAAyB,UAAoB,KAAa;CACxE,MAAM,aAAa,SAAS,KAAI,MAAK,EAAE,QAAQ,SAAS,EAAE,CAAC;CAC3D,QAAQ,SAAiB;EACvB,MAAM,MAAM,SAAS,KAAK,IAAI,EAAE,QAAQ,OAAO,GAAG;EAClD,OAAO,WAAW,MAAK,MAAK,YAAY,KAAK,CAAC,CAAC;CACjD;AACF"}
|
|
@@ -357,7 +357,7 @@ interface BlockOptions {
|
|
|
357
357
|
declare function block({ input, output, overwrite, hideCursor, }?: BlockOptions): () => void;
|
|
358
358
|
declare const getColumns: (output: Writable) => number;
|
|
359
359
|
declare const getRows: (output: Writable) => number;
|
|
360
|
-
declare function wrapTextWithPrefix(output: Writable | undefined, text: string, prefix: string, startPrefix?: string, lineFormatter?: (line: string, index: number) => string): string;
|
|
360
|
+
declare function wrapTextWithPrefix(output: Writable | undefined, text: string, prefix: string, startPrefix?: string, endPrefix?: string, lineFormatter?: (line: string, index: number) => string): string;
|
|
361
361
|
|
|
362
362
|
export { AutocompletePrompt, ConfirmPrompt, DatePrompt, GroupMultiSelectPrompt, MultiLinePrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, TextPrompt, block, getColumns, getRows, isCancel, settings, updateSettings, wrapTextWithPrefix };
|
|
363
363
|
export type { AutocompleteOptions, ClackSettings, ConfirmOptions, DateFormat, DateOptions, DateParts, GroupMultiSelectOptions, MultiLineOptions, MultiSelectOptions, PasswordOptions, PromptOptions, SelectKeyOptions, SelectOptions, ClackState as State, TextOptions };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{styleText as v}from"node:util";import{stdout as
|
|
1
|
+
import{styleText as v}from"node:util";import{stdout as x,stdin as D}from"node:process";import*as b from"node:readline";import E from"node:readline";import{wrapAnsi as M}from"fast-wrap-ansi";import{cursor as p,erase as V}from"sisteransi";import{ReadStream as O}from"node:tty";function f(r,t,s){if(!s.some(o=>!o.disabled))return r;const e=r+t,i=Math.max(s.length-1,0),n=e<0?i:e>i?0:e;return s[n].disabled?f(n,t<0?-1:1,s):n}function I(r,t,s,e){const i=e.split(`
|
|
2
2
|
`);let n=0,o=r;for(const a of i){if(o<=a.length)break;o-=a.length+1,n++}for(n=Math.max(0,Math.min(i.length-1,n+s)),o=Math.min(o,i[n].length)+t;o<0&&n>0;)n--,o+=i[n].length+1;for(;o>i[n].length&&n<i.length-1;)o-=i[n].length+1,n++;o=Math.max(0,Math.min(i[n].length,o));let u=0;for(let a=0;a<n;a++)u+=i[a].length+1;return u+o}const G=["up","down","left","right","space","enter","cancel"],K=["January","February","March","April","May","June","July","August","September","October","November","December"],h={actions:new Set(G),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...K],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(r,t)=>`There are only ${r} days in ${t}`,afterMin:r=>`Date must be on or after ${r.toISOString().slice(0,10)}`,beforeMax:r=>`Date must be on or before ${r.toISOString().slice(0,10)}`}}};function j(r){if(r.aliases!==void 0){const t=r.aliases;for(const s in t){if(!Object.hasOwn(t,s))continue;const e=t[s];h.actions.has(e)&&(h.aliases.has(s)||h.aliases.set(s,e))}}if(r.messages!==void 0){const t=r.messages;t.cancel!==void 0&&(h.messages.cancel=t.cancel),t.error!==void 0&&(h.messages.error=t.error)}if(r.withGuide!==void 0&&(h.withGuide=r.withGuide!==!1),r.date!==void 0){const t=r.date;t.monthNames!==void 0&&(h.date.monthNames=[...t.monthNames]),t.messages!==void 0&&(t.messages.required!==void 0&&(h.date.messages.required=t.messages.required),t.messages.invalidMonth!==void 0&&(h.date.messages.invalidMonth=t.messages.invalidMonth),t.messages.invalidDay!==void 0&&(h.date.messages.invalidDay=t.messages.invalidDay),t.messages.afterMin!==void 0&&(h.date.messages.afterMin=t.messages.afterMin),t.messages.beforeMax!==void 0&&(h.date.messages.beforeMax=t.messages.beforeMax))}}function C(r,t){if(typeof r=="string")return h.aliases.get(r)===t;for(const s of r)if(s!==void 0&&C(s,t))return!0;return!1}function z(r,t){if(r===t)return;const s=r.split(`
|
|
3
3
|
`),e=t.split(`
|
|
4
|
-
`),i=Math.max(s.length,e.length),n=[];for(let o=0;o<i;o++)s[o]!==e[o]&&n.push(o);return{lines:n,numLinesBefore:s.length,numLinesAfter:e.length,numLines:i}}const Y=globalThis.process.platform.startsWith("win"),k=Symbol("clack:cancel");function q(r){return r===k}function w(r,t){const s=r;s.isTTY&&s.setRawMode(t)}function R({input:r=D,output:t=
|
|
5
|
-
`).map((
|
|
6
|
-
`)}let
|
|
4
|
+
`),i=Math.max(s.length,e.length),n=[];for(let o=0;o<i;o++)s[o]!==e[o]&&n.push(o);return{lines:n,numLinesBefore:s.length,numLinesAfter:e.length,numLines:i}}const Y=globalThis.process.platform.startsWith("win"),k=Symbol("clack:cancel");function q(r){return r===k}function w(r,t){const s=r;s.isTTY&&s.setRawMode(t)}function R({input:r=D,output:t=x,overwrite:s=!0,hideCursor:e=!0}={}){const i=b.createInterface({input:r,output:t,prompt:"",tabSize:1});b.emitKeypressEvents(r,i),r instanceof O&&r.isTTY&&r.setRawMode(!0);const n=(o,{name:u,sequence:a})=>{const l=String(o);if(C([l,u,a],"cancel")){e&&t.write(p.show),process.exit(0);return}if(!s)return;const c=u==="return"?0:-1,y=u==="return"?-1:0;b.moveCursor(t,c,y,()=>{b.clearLine(t,1,()=>{r.once("keypress",n)})})};return e&&t.write(p.hide),r.once("keypress",n),()=>{r.off("keypress",n),e&&t.write(p.show),r instanceof O&&r.isTTY&&!Y&&r.setRawMode(!1),i.terminal=!1,i.close()}}const A=r=>"columns"in r&&typeof r.columns=="number"?r.columns:80,L=r=>"rows"in r&&typeof r.rows=="number"?r.rows:20;function W(r,t,s,e=s,i=s,n){const o=A(r??x);return M(t,o-s.length,{hard:!0,trim:!1}).split(`
|
|
5
|
+
`).map((u,a,l)=>{const c=n?n(u,a):u;return a===0?`${e}${c}`:a===l.length-1?`${i}${c}`:`${s}${c}`}).join(`
|
|
6
|
+
`)}let m=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,s=!0){const{input:e=D,output:i=x,render:n,signal:o,...u}=t;this.opts=u,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=s,this._abortSignal=o,this.input=e,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,s){const e=this._subscribers.get(t)??[];e.push(s),this._subscribers.set(t,e)}on(t,s){this.setSubscriber(t,{cb:s})}once(t,s){this.setSubscriber(t,{cb:s,once:!0})}emit(t,...s){const e=this._subscribers.get(t)??[],i=[];for(const n of e)n.cb(...s),n.once&&i.push(()=>e.splice(e.indexOf(n),1));for(const n of i)n()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(k);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=E.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),w(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(p.show),this.output.off("resize",this.render),w(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(p.show),this.output.off("resize",this.render),w(this.input,!1),t(k)})})}_isActionKey(t,s){return t===" "}_shouldSubmit(t,s){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,s){this.userInput=t??"",this.emit("userInput",this.userInput),s&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,s){if(this._track&&s.name!=="return"&&(s.name&&this._isActionKey(t,s)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),s?.name&&(!this._track&&h.aliases.has(s.name)&&this.emit("cursor",h.aliases.get(s.name)),h.actions.has(s.name)&&this.emit("cursor",s.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t?.toLowerCase(),s),s?.name==="return"&&this._shouldSubmit(t,s)){if(this.opts.validate){const e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}C([t,s?.name,s?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
7
7
|
`),w(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=M(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
8
|
-
`).length-1;this.output.write(
|
|
9
|
-
`);this.output.write(u[o]),this._prevFrame=t,this.output.write(
|
|
8
|
+
`).length-1;this.output.write(p.move(-999,t*-1))}render(){const t=M(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(p.hide);else{const s=z(this._prevFrame,t),e=L(this.output);if(this.restoreCursor(),s){const i=Math.max(0,s.numLinesAfter-e),n=Math.max(0,s.numLinesBefore-e);let o=s.lines.find(u=>u>=i);if(o===void 0){this._prevFrame=t;return}if(s.lines.length===1){this.output.write(p.move(0,o-n)),this.output.write(V.lines(1));const u=t.split(`
|
|
9
|
+
`);this.output.write(u[o]),this._prevFrame=t,this.output.write(p.move(0,u.length-o-1));return}else if(s.lines.length>1){if(i<n)o=i;else{const a=o-n;a>0&&this.output.write(p.move(0,a))}this.output.write(V.down());const u=t.split(`
|
|
10
10
|
`).slice(o);this.output.write(u.join(`
|
|
11
|
-
`)),this._prevFrame=t;return}}this.output.write(V.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};function B(r,t){if(r===void 0||t.length===0)return 0;const s=t.findIndex(e=>e.value===r);return s!==-1?s:0}function J(r,t){return(t.label??String(t.value)).toLowerCase().includes(r.toLowerCase())}function H(r,t){if(t)return r?t:t[0]}let Q=class extends p{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#s=0;#r="";#t;#n;#u;get cursor(){return this.#s}get userInputWithCursor(){if(!this.userInput)return v(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;const t=this.userInput.slice(0,this._cursor),[s,...e]=this.userInput.slice(this._cursor);return`${t}${v("inverse",s)}${e.join("")}`}get options(){return typeof this.#n=="function"?this.#n():this.#n}constructor(t){super(t),this.#n=t.options,this.#u=t.placeholder;const s=this.options;this.filteredOptions=[...s],this.multiple=t.multiple===!0,this.#t=typeof t.options=="function"?t.filter:t.filter??J;let e;if(t.initialValue&&Array.isArray(t.initialValue)?this.multiple?e=t.initialValue:e=t.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(e=[this.options[0].value]),e)for(const i of e){const n=s.findIndex(o=>o.value===i);n!==-1&&(this.toggleSelected(i),this.#s=n)}this.focusedValue=this.options[this.#s]?.value,this.on("key",(i,n)=>this.#e(i,n)),this.on("userInput",i=>this.#i(i))}_isActionKey(t,s){return t===" "||this.multiple&&this.isNavigating&&s.name==="space"&&t!==void 0&&t!==""}#e(t,s){const e=s.name==="up",i=s.name==="down",n=s.name==="return",o=this.userInput===""||this.userInput===" ",u=this.#u,a=this.options,l=u!==void 0&&u!==""&&a.some(f=>!f.disabled&&(this.#t?this.#t(u,f):!0));if(s.name==="tab"&&o&&l){this.userInput===" "&&this._clearUserInput(),this._setUserInput(u,!0),this.isNavigating=!1;return}e||i?(this.#s=d(this.#s,e?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#s]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):n?this.value=H(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(s.name==="tab"||this.isNavigating&&s.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(t){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(t)?this.selectedValues=this.selectedValues.filter(s=>s!==t):this.selectedValues=[...this.selectedValues,t]:this.selectedValues=[t])}#i(t){if(t!==this.#r){this.#r=t;const s=this.options;t&&this.#t?this.filteredOptions=s.filter(n=>this.#t?.(t,n)):this.filteredOptions=[...s];const e=B(this.focusedValue,this.filteredOptions);this.#s=d(e,0,this.filteredOptions);const i=this.filteredOptions[this.#s];i&&!i.disabled?this.focusedValue=i.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class X extends p{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(c.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}const Z={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function P(r){return[...r].map(t=>Z[t])}function tt(r){const t=new Intl.DateTimeFormat(r,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2e3,0,15)),s=[];let e="/";for(const i of t)i.type==="literal"?e=i.value.trim()||i.value:(i.type==="year"||i.type==="month"||i.type==="day")&&s.push({type:i.type,len:i.type==="year"?4:2});return{segments:s,separator:e}}function U(r){return Number.parseInt((r||"0").replace(/_/g,"0"),10)||0}function x(r){return{year:U(r.year),month:U(r.month),day:U(r.day)}}function $(r,t){return new Date(r||2001,t||1,0).getDate()}function F(r){const{year:t,month:s,day:e}=x(r);if(!t||t<0||t>9999||!s||s<1||s>12||!e||e<1)return;const i=new Date(Date.UTC(t,s-1,e));if(!(i.getUTCFullYear()!==t||i.getUTCMonth()!==s-1||i.getUTCDate()!==e))return{year:t,month:s,day:e}}function N(r){const t=F(r);return t?new Date(Date.UTC(t.year,t.month-1,t.day)):void 0}function st(r,t,s,e){const i=s?{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}:null,n=e?{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate()}:null;return r==="year"?{min:i?.year??1,max:n?.year??9999}:r==="month"?{min:i&&t.year===i.year?i.month:1,max:n&&t.year===n.year?n.month:12}:{min:i&&t.year===i.year&&t.month===i.month?i.day:1,max:n&&t.year===n.year&&t.month===n.month?n.day:$(t.year,t.month)}}class et extends p{#s;#r;#t;#n;#u;#e={segmentIndex:0,positionInSegment:0};#i=!0;#o=null;inlineError="";get segmentCursor(){return{...this.#e}}get segmentValues(){return{...this.#t}}get segments(){return this.#s}get separator(){return this.#r}get formattedValue(){return this.#c(this.#t)}#c(t){return this.#s.map(s=>t[s.type]).join(this.#r)}#a(){this._setUserInput(this.#c(this.#t)),this._setValue(N(this.#t)??void 0)}constructor(t){const s=t.format?{segments:P(t.format),separator:t.separator??"/"}:tt(t.locale),e=t.separator??s.separator,i=t.format?P(t.format):s.segments,n=t.initialValue??t.defaultValue,o=n?{year:String(n.getUTCFullYear()).padStart(4,"0"),month:String(n.getUTCMonth()+1).padStart(2,"0"),day:String(n.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},u=i.map(a=>o[a.type]).join(e);super({...t,initialUserInput:u},!1),this.#s=i,this.#r=e,this.#t=o,this.#n=t.minDate,this.#u=t.maxDate,this.#a(),this.on("cursor",a=>this.#d(a)),this.on("key",(a,l)=>this.#f(a,l)),this.on("finalize",()=>this.#g(t))}#h(){const t=Math.max(0,Math.min(this.#e.segmentIndex,this.#s.length-1)),s=this.#s[t];if(s)return this.#e.positionInSegment=Math.max(0,Math.min(this.#e.positionInSegment,s.len-1)),{segment:s,index:t}}#l(t){this.inlineError="",this.#o=null;const s=this.#h();s&&(this.#e.segmentIndex=Math.max(0,Math.min(this.#s.length-1,s.index+t)),this.#e.positionInSegment=0,this.#i=!0)}#p(t){const s=this.#h();if(!s)return;const{segment:e}=s,i=this.#t[e.type],n=!i||i.replace(/_/g,"")==="",o=Number.parseInt((i||"0").replace(/_/g,"0"),10)||0,u=st(e.type,x(this.#t),this.#n,this.#u);let a;n?a=t===1?u.min:u.max:a=Math.max(Math.min(u.max,o+t),u.min),this.#t={...this.#t,[e.type]:a.toString().padStart(e.len,"0")},this.#i=!0,this.#o=null,this.#a()}#d(t){if(t)switch(t){case"right":return this.#l(1);case"left":return this.#l(-1);case"up":return this.#p(1);case"down":return this.#p(-1)}}#f(t,s){if(s?.name==="backspace"||s?.sequence==="\x7F"||s?.sequence==="\b"||t==="\x7F"||t==="\b"){this.inlineError="";const e=this.#h();if(!e)return;if(!this.#t[e.segment.type].replace(/_/g,"")){this.#l(-1);return}this.#t[e.segment.type]="_".repeat(e.segment.len),this.#i=!0,this.#e.positionInSegment=0,this.#a();return}if(s?.name==="tab"){this.inlineError="";const e=this.#h();if(!e)return;const i=s.shift?-1:1,n=e.index+i;n>=0&&n<this.#s.length&&(this.#e.segmentIndex=n,this.#e.positionInSegment=0,this.#i=!0);return}if(t&&/^[0-9]$/.test(t)){const e=this.#h();if(!e)return;const{segment:i}=e,n=!this.#t[i.type].replace(/_/g,"");if(this.#i&&this.#o!==null&&!n){const m=this.#o+t,g={...this.#t,[i.type]:m},_=this.#m(g,i);if(_){this.inlineError=_,this.#o=null,this.#i=!1;return}this.inlineError="",this.#t[i.type]=m,this.#o=null,this.#i=!1,this.#a(),e.index<this.#s.length-1&&(this.#e.segmentIndex=e.index+1,this.#e.positionInSegment=0,this.#i=!0);return}this.#i&&!n&&(this.#t[i.type]="_".repeat(i.len),this.#e.positionInSegment=0),this.#i=!1,this.#o=null;const o=this.#t[i.type],u=o.indexOf("_"),a=u>=0?u:Math.min(this.#e.positionInSegment,i.len-1);if(a<0||a>=i.len)return;let l=o.slice(0,a)+t+o.slice(a+1),f=!1;if(a===0&&o==="__"&&(i.type==="month"||i.type==="day")){const m=Number.parseInt(t,10);l=`0${t}`,f=m<=(i.type==="month"?1:2)}if(i.type==="year"&&(l=(o.replace(/_/g,"")+t).padStart(i.len,"_")),!l.includes("_")){const m={...this.#t,[i.type]:l},g=this.#m(m,i);if(g){this.inlineError=g;return}}this.inlineError="",this.#t[i.type]=l;const y=l.includes("_")?void 0:F(this.#t);if(y){const{year:m,month:g}=y,_=$(m,g);this.#t={year:String(Math.max(0,Math.min(9999,m))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,g))).padStart(2,"0"),day:String(Math.max(1,Math.min(_,y.day))).padStart(2,"0")}}this.#a();const T=l.indexOf("_");f?(this.#i=!0,this.#o=t):T>=0?this.#e.positionInSegment=T:u>=0&&e.index<this.#s.length-1?(this.#e.segmentIndex=e.index+1,this.#e.positionInSegment=0,this.#i=!0):this.#e.positionInSegment=Math.min(a+1,i.len-1)}}#m(t,s){const{month:e,day:i}=x(t);if(s.type==="month"&&(e<0||e>12))return h.date.messages.invalidMonth;if(s.type==="day"&&(i<0||i>31))return h.date.messages.invalidDay(31,"any month")}#g(t){const{year:s,month:e,day:i}=x(this.#t);if(s&&e&&i){const n=$(s,e);this.#t={...this.#t,day:String(Math.min(i,n)).padStart(2,"0")}}this.value=N(this.#t)??t.defaultValue??void 0}}class it extends p{options;cursor=0;#s;getGroupItems(t){return this.options.filter(s=>s.group===t)}isGroupSelected(t){const s=this.getGroupItems(t),e=this.value;return e===void 0?!1:s.every(i=>e.includes(i.value))}toggleValue(){const t=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),t.group===!0){const s=t.value,e=this.getGroupItems(s);this.isGroupSelected(s)?this.value=this.value.filter(i=>e.findIndex(n=>n.value===i)===-1):this.value=[...this.value,...e.map(i=>i.value)],this.value=Array.from(new Set(this.value))}else{const s=this.value.includes(t.value);this.value=s?this.value.filter(e=>e!==t.value):[...this.value,t.value]}}constructor(t){super(t,!1);const{options:s}=t;this.#s=t.selectableGroups!==!1,this.options=Object.entries(s).flatMap(([e,i])=>[{value:e,group:!0,label:e},...i.map(n=>({...n,group:e}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),this.#s?0:1),this.on("cursor",e=>{switch(e){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;const i=this.options[this.cursor]?.group===!0;!this.#s&&i&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;const i=this.options[this.cursor]?.group===!0;!this.#s&&i&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}}class rt extends p{#s=!1;#r;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${t}\u2588`;const s=t.slice(0,this.cursor),e=t[this.cursor],i=t.slice(this.cursor+1);return e===`
|
|
11
|
+
`)),this._prevFrame=t;return}}this.output.write(V.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};function B(r,t){if(r===void 0||t.length===0)return 0;const s=t.findIndex(e=>e.value===r);return s!==-1?s:0}function J(r,t){return(t.label??String(t.value)).toLowerCase().includes(r.toLowerCase())}function H(r,t){if(t)return r?t:t[0]}let Q=class extends m{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#s=0;#r="";#t;#n;#u;get cursor(){return this.#s}get userInputWithCursor(){if(!this.userInput)return v(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;const t=this.userInput.slice(0,this._cursor),[s,...e]=this.userInput.slice(this._cursor);return`${t}${v("inverse",s)}${e.join("")}`}get options(){return typeof this.#n=="function"?this.#n():this.#n}constructor(t){super(t),this.#n=t.options,this.#u=t.placeholder;const s=this.options;this.filteredOptions=[...s],this.multiple=t.multiple===!0,this.#t=typeof t.options=="function"?t.filter:t.filter??J;let e;if(t.initialValue&&Array.isArray(t.initialValue)?this.multiple?e=t.initialValue:e=t.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(e=[this.options[0].value]),e)for(const i of e){const n=s.findIndex(o=>o.value===i);n!==-1&&(this.toggleSelected(i),this.#s=n)}this.focusedValue=this.options[this.#s]?.value,this.on("key",(i,n)=>this.#e(i,n)),this.on("userInput",i=>this.#i(i))}_isActionKey(t,s){return t===" "||this.multiple&&this.isNavigating&&s.name==="space"&&t!==void 0&&t!==""}#e(t,s){const e=s.name==="up",i=s.name==="down",n=s.name==="return",o=this.userInput===""||this.userInput===" ",u=this.#u,a=this.options,l=u!==void 0&&u!==""&&a.some(c=>!c.disabled&&(this.#t?this.#t(u,c):!0));if(s.name==="tab"&&o&&l){this.userInput===" "&&this._clearUserInput(),this._setUserInput(u,!0),this.isNavigating=!1;return}e||i?(this.#s=f(this.#s,e?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#s]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):n?this.value=H(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(s.name==="tab"||this.isNavigating&&s.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(t){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(t)?this.selectedValues=this.selectedValues.filter(s=>s!==t):this.selectedValues=[...this.selectedValues,t]:this.selectedValues=[t])}#i(t){if(t!==this.#r){this.#r=t;const s=this.options;t&&this.#t?this.filteredOptions=s.filter(n=>this.#t?.(t,n)):this.filteredOptions=[...s];const e=B(this.focusedValue,this.filteredOptions);this.#s=f(e,0,this.filteredOptions);const i=this.filteredOptions[this.#s];i&&!i.disabled?this.focusedValue=i.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class X extends m{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(p.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}const Z={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function P(r){return[...r].map(t=>Z[t])}function tt(r){const t=new Intl.DateTimeFormat(r,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2e3,0,15)),s=[];let e="/";for(const i of t)i.type==="literal"?e=i.value.trim()||i.value:(i.type==="year"||i.type==="month"||i.type==="day")&&s.push({type:i.type,len:i.type==="year"?4:2});return{segments:s,separator:e}}function $(r){return Number.parseInt((r||"0").replace(/_/g,"0"),10)||0}function S(r){return{year:$(r.year),month:$(r.month),day:$(r.day)}}function U(r,t){return new Date(r||2001,t||1,0).getDate()}function F(r){const{year:t,month:s,day:e}=S(r);if(!t||t<0||t>9999||!s||s<1||s>12||!e||e<1)return;const i=new Date(Date.UTC(t,s-1,e));if(!(i.getUTCFullYear()!==t||i.getUTCMonth()!==s-1||i.getUTCDate()!==e))return{year:t,month:s,day:e}}function N(r){const t=F(r);return t?new Date(Date.UTC(t.year,t.month-1,t.day)):void 0}function st(r,t,s,e){const i=s?{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}:null,n=e?{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate()}:null;return r==="year"?{min:i?.year??1,max:n?.year??9999}:r==="month"?{min:i&&t.year===i.year?i.month:1,max:n&&t.year===n.year?n.month:12}:{min:i&&t.year===i.year&&t.month===i.month?i.day:1,max:n&&t.year===n.year&&t.month===n.month?n.day:U(t.year,t.month)}}class et extends m{#s;#r;#t;#n;#u;#e={segmentIndex:0,positionInSegment:0};#i=!0;#o=null;inlineError="";get segmentCursor(){return{...this.#e}}get segmentValues(){return{...this.#t}}get segments(){return this.#s}get separator(){return this.#r}get formattedValue(){return this.#c(this.#t)}#c(t){return this.#s.map(s=>t[s.type]).join(this.#r)}#a(){this._setUserInput(this.#c(this.#t)),this._setValue(N(this.#t)??void 0)}constructor(t){const s=t.format?{segments:P(t.format),separator:t.separator??"/"}:tt(t.locale),e=t.separator??s.separator,i=t.format?P(t.format):s.segments,n=t.initialValue??t.defaultValue,o=n?{year:String(n.getUTCFullYear()).padStart(4,"0"),month:String(n.getUTCMonth()+1).padStart(2,"0"),day:String(n.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},u=i.map(a=>o[a.type]).join(e);super({...t,initialUserInput:u},!1),this.#s=i,this.#r=e,this.#t=o,this.#n=t.minDate,this.#u=t.maxDate,this.#a(),this.on("cursor",a=>this.#d(a)),this.on("key",(a,l)=>this.#f(a,l)),this.on("finalize",()=>this.#g(t))}#h(){const t=Math.max(0,Math.min(this.#e.segmentIndex,this.#s.length-1)),s=this.#s[t];if(s)return this.#e.positionInSegment=Math.max(0,Math.min(this.#e.positionInSegment,s.len-1)),{segment:s,index:t}}#l(t){this.inlineError="",this.#o=null;const s=this.#h();s&&(this.#e.segmentIndex=Math.max(0,Math.min(this.#s.length-1,s.index+t)),this.#e.positionInSegment=0,this.#i=!0)}#p(t){const s=this.#h();if(!s)return;const{segment:e}=s,i=this.#t[e.type],n=!i||i.replace(/_/g,"")==="",o=Number.parseInt((i||"0").replace(/_/g,"0"),10)||0,u=st(e.type,S(this.#t),this.#n,this.#u);let a;n?a=t===1?u.min:u.max:a=Math.max(Math.min(u.max,o+t),u.min),this.#t={...this.#t,[e.type]:a.toString().padStart(e.len,"0")},this.#i=!0,this.#o=null,this.#a()}#d(t){if(t)switch(t){case"right":return this.#l(1);case"left":return this.#l(-1);case"up":return this.#p(1);case"down":return this.#p(-1)}}#f(t,s){if(s?.name==="backspace"||s?.sequence==="\x7F"||s?.sequence==="\b"||t==="\x7F"||t==="\b"){this.inlineError="";const e=this.#h();if(!e)return;if(!this.#t[e.segment.type].replace(/_/g,"")){this.#l(-1);return}this.#t[e.segment.type]="_".repeat(e.segment.len),this.#i=!0,this.#e.positionInSegment=0,this.#a();return}if(s?.name==="tab"){this.inlineError="";const e=this.#h();if(!e)return;const i=s.shift?-1:1,n=e.index+i;n>=0&&n<this.#s.length&&(this.#e.segmentIndex=n,this.#e.positionInSegment=0,this.#i=!0);return}if(t&&/^[0-9]$/.test(t)){const e=this.#h();if(!e)return;const{segment:i}=e,n=!this.#t[i.type].replace(/_/g,"");if(this.#i&&this.#o!==null&&!n){const d=this.#o+t,g={...this.#t,[i.type]:d},_=this.#m(g,i);if(_){this.inlineError=_,this.#o=null,this.#i=!1;return}this.inlineError="",this.#t[i.type]=d,this.#o=null,this.#i=!1,this.#a(),e.index<this.#s.length-1&&(this.#e.segmentIndex=e.index+1,this.#e.positionInSegment=0,this.#i=!0);return}this.#i&&!n&&(this.#t[i.type]="_".repeat(i.len),this.#e.positionInSegment=0),this.#i=!1,this.#o=null;const o=this.#t[i.type],u=o.indexOf("_"),a=u>=0?u:Math.min(this.#e.positionInSegment,i.len-1);if(a<0||a>=i.len)return;let l=o.slice(0,a)+t+o.slice(a+1),c=!1;if(a===0&&o==="__"&&(i.type==="month"||i.type==="day")){const d=Number.parseInt(t,10);l=`0${t}`,c=d<=(i.type==="month"?1:2)}if(i.type==="year"&&(l=(o.replace(/_/g,"")+t).padStart(i.len,"_")),!l.includes("_")){const d={...this.#t,[i.type]:l},g=this.#m(d,i);if(g){this.inlineError=g;return}}this.inlineError="",this.#t[i.type]=l;const y=l.includes("_")?void 0:F(this.#t);if(y){const{year:d,month:g}=y,_=U(d,g);this.#t={year:String(Math.max(0,Math.min(9999,d))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,g))).padStart(2,"0"),day:String(Math.max(1,Math.min(_,y.day))).padStart(2,"0")}}this.#a();const T=l.indexOf("_");c?(this.#i=!0,this.#o=t):T>=0?this.#e.positionInSegment=T:u>=0&&e.index<this.#s.length-1?(this.#e.segmentIndex=e.index+1,this.#e.positionInSegment=0,this.#i=!0):this.#e.positionInSegment=Math.min(a+1,i.len-1)}}#m(t,s){const{month:e,day:i}=S(t);if(s.type==="month"&&(e<0||e>12))return h.date.messages.invalidMonth;if(s.type==="day"&&(i<0||i>31))return h.date.messages.invalidDay(31,"any month")}#g(t){const{year:s,month:e,day:i}=S(this.#t);if(s&&e&&i){const n=U(s,e);this.#t={...this.#t,day:String(Math.min(i,n)).padStart(2,"0")}}this.value=N(this.#t)??t.defaultValue??void 0}}class it extends m{options;cursor=0;#s;getGroupItems(t){return this.options.filter(s=>s.group===t)}isGroupSelected(t){const s=this.getGroupItems(t),e=this.value;return e===void 0?!1:s.every(i=>e.includes(i.value))}toggleValue(){const t=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),t.group===!0){const s=t.value,e=this.getGroupItems(s);this.isGroupSelected(s)?this.value=this.value.filter(i=>e.findIndex(n=>n.value===i)===-1):this.value=[...this.value,...e.map(i=>i.value)],this.value=Array.from(new Set(this.value))}else{const s=this.value.includes(t.value);this.value=s?this.value.filter(e=>e!==t.value):[...this.value,t.value]}}constructor(t){super(t,!1);const{options:s}=t;this.#s=t.selectableGroups!==!1,this.options=Object.entries(s).flatMap(([e,i])=>[{value:e,group:!0,label:e},...i.map(n=>({...n,group:e}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),this.#s?0:1),this.on("cursor",e=>{switch(e){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;const i=this.options[this.cursor]?.group===!0;!this.#s&&i&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;const i=this.options[this.cursor]?.group===!0;!this.#s&&i&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}}class rt extends m{#s=!1;#r;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${t}\u2588`;const s=t.slice(0,this.cursor),e=t[this.cursor],i=t.slice(this.cursor+1);return e===`
|
|
12
12
|
`?`${s}\u2588
|
|
13
13
|
${i}`:`${s}${v("inverse",e)}${i}`}get cursor(){return this._cursor}#t(t){if(this.userInput.length===0){this._setUserInput(t);return}this._setUserInput(this.userInput.slice(0,this.cursor)+t+this.userInput.slice(this.cursor))}#n(t){const s=this.value??"";switch(t){case"up":this._cursor=I(this._cursor,0,-1,s);return;case"down":this._cursor=I(this._cursor,0,1,s);return;case"left":this._cursor=I(this._cursor,-1,0,s);return;case"right":this._cursor=I(this._cursor,1,0,s);return}}_shouldSubmit(t,s){if(this.#r)return this.focused==="submit"?!0:(this.#t(`
|
|
14
14
|
`),this._cursor++,!1);const e=this.#s;return this.#s=!0,e?(this.userInput[this.cursor-1]===`
|
|
15
15
|
`&&(this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--),!0):(this.#t(`
|
|
16
|
-
`),this._cursor++,!1)}constructor(t){super(t,!1),this.#r=t.showSubmit??!1,this.on("key",(s,e)=>{if(e?.name&&h.actions.has(e.name)){this.#n(e.name);return}if(s===" "&&this.#r){this.focused=this.focused==="editor"?"submit":"editor";return}if(e?.name!=="return"){if(this.#s=!1,e?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(e?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}s&&(this.#r&&this.focused==="submit"&&(this.focused="editor"),this.#t(s??""),this._cursor++)}}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}let nt=class extends
|
|
16
|
+
`),this._cursor++,!1)}constructor(t){super(t,!1),this.#r=t.showSubmit??!1,this.on("key",(s,e)=>{if(e?.name&&h.actions.has(e.name)){this.#n(e.name);return}if(s===" "&&this.#r){this.focused=this.focused==="editor"?"submit":"editor";return}if(e?.name!=="return"){if(this.#s=!1,e?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(e?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}s&&(this.#r&&this.focused==="submit"&&(this.focused="editor"),this.#t(s??""),this._cursor++)}}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}let nt=class extends m{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter(t=>t.disabled!==!0)}toggleAll(){const t=this._enabledOptions,s=this.value!==void 0&&this.value.length===t.length;this.value=s?[]:t.map(e=>e.value)}toggleInvert(){const t=this.value;if(!t)return;const s=this._enabledOptions.filter(e=>!t.includes(e.value));this.value=s.map(e=>e.value)}toggleValue(){this.value===void 0&&(this.value=[]);const t=this.value.includes(this._value);this.value=t?this.value.filter(s=>s!==this._value):[...this.value,this._value]}constructor(t){super(t,!1),this.options=t.options,this.value=[...t.initialValues??[]];const s=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),0);this.cursor=this.options[s].disabled?f(s,1,this.options):s,this.on("key",e=>{e==="a"&&this.toggleAll(),e==="i"&&this.toggleInvert()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=f(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=f(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}};class ot extends m{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;const t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${v(["inverse","hidden"],"_")}`;const s=this.masked,e=s.slice(0,this.cursor),i=s.slice(this.cursor);return`${e}${v("inverse",i[0])}${i.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...s}){super(s),this._mask=t??"\u2022",this.on("userInput",e=>{this._setValue(e)})}}class ut extends m{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;const s=this.options.findIndex(({value:i})=>i===t.initialValue),e=s===-1?0:s;this.cursor=this.options[e].disabled?f(e,1,this.options):e,this.changeValue(),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=f(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=f(this.cursor,1,this.options);break}this.changeValue()})}}class at extends m{options;cursor=0;constructor(t){super(t,!1),this.options=t.options;const s=t.caseSensitive===!0,e=this.options.map(({value:[i]})=>s?i:i?.toLowerCase());this.cursor=Math.max(e.indexOf(t.initialValue),0),this.on("key",(i,n)=>{if(!i)return;const o=s&&n.shift?i.toUpperCase():i;if(!e.includes(o))return;const u=this.options.find(({value:[a]})=>s?a===o:a?.toLowerCase()===i);u&&(this.value=u.value,this.state="submit",this.emit("submit"))})}}class ht extends m{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const s=t.slice(0,this.cursor),[e,...i]=t.slice(this.cursor);return`${s}${v("inverse",e)}${i.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}export{Q as AutocompletePrompt,X as ConfirmPrompt,et as DatePrompt,it as GroupMultiSelectPrompt,rt as MultiLinePrompt,nt as MultiSelectPrompt,ot as PasswordPrompt,m as Prompt,at as SelectKeyPrompt,ut as SelectPrompt,ht as TextPrompt,R as block,A as getColumns,L as getRows,q as isCancel,h as settings,j as updateSettings,W as wrapTextWithPrefix};
|
|
17
17
|
//# sourceMappingURL=index.mjs.map
|