@maizzle/framework 6.0.0-rc.2 → 6.0.0-rc.20

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.
Files changed (542) hide show
  1. package/README.md +3 -3
  2. package/bin/maizzle.mjs +1 -1
  3. package/dist/build.d.ts +20 -0
  4. package/dist/build.d.ts.map +1 -0
  5. package/dist/{build.mjs → build.js} +33 -19
  6. package/dist/build.js.map +1 -0
  7. package/dist/components/Body.vue +128 -0
  8. package/dist/components/Button.vue +148 -52
  9. package/dist/components/CodeBlock.vue +69 -0
  10. package/dist/components/CodeInline.vue +49 -0
  11. package/dist/components/Column.vue +108 -0
  12. package/dist/components/Container.vue +123 -0
  13. package/dist/components/Font.vue +96 -0
  14. package/dist/components/Head.vue +30 -0
  15. package/dist/components/Heading.vue +28 -0
  16. package/dist/components/Hr.vue +33 -0
  17. package/dist/components/Html.vue +137 -0
  18. package/dist/components/Img.vue +70 -0
  19. package/dist/components/Layout.vue +143 -0
  20. package/dist/components/Link.vue +26 -0
  21. package/dist/components/Markdown.vue +89 -0
  22. package/dist/components/MarkdownLayout.vue +39 -0
  23. package/dist/components/NotPlaintext.vue +14 -0
  24. package/dist/components/Outlook.vue +74 -11
  25. package/dist/components/OutlookBg.vue +241 -0
  26. package/dist/components/Overlap.vue +156 -0
  27. package/dist/components/Plaintext.vue +14 -0
  28. package/dist/components/Preheader.vue +15 -0
  29. package/dist/components/QrCode.vue +157 -0
  30. package/dist/components/Raw.vue +28 -0
  31. package/dist/components/Row.vue +184 -0
  32. package/dist/components/Section.vue +124 -0
  33. package/dist/components/Spacer.vue +70 -21
  34. package/dist/components/Tailwind.vue +43 -0
  35. package/dist/components/Text.vue +29 -0
  36. package/dist/components/utils.d.ts +28 -0
  37. package/dist/components/utils.d.ts.map +1 -0
  38. package/dist/components/utils.js +50 -0
  39. package/dist/components/utils.js.map +1 -0
  40. package/dist/components/utils.ts +51 -0
  41. package/dist/composables/{defineConfig.d.mts → defineConfig.d.ts} +2 -2
  42. package/dist/composables/defineConfig.d.ts.map +1 -0
  43. package/dist/composables/{defineConfig.mjs → defineConfig.js} +4 -5
  44. package/dist/composables/defineConfig.js.map +1 -0
  45. package/dist/composables/renderContext.d.ts +37 -0
  46. package/dist/composables/renderContext.d.ts.map +1 -0
  47. package/dist/composables/{renderContext.mjs → renderContext.js} +2 -2
  48. package/dist/composables/renderContext.js.map +1 -0
  49. package/dist/composables/useBaseUrl.d.ts +19 -0
  50. package/dist/composables/useBaseUrl.d.ts.map +1 -0
  51. package/dist/composables/useBaseUrl.js +26 -0
  52. package/dist/composables/useBaseUrl.js.map +1 -0
  53. package/dist/composables/{useConfig.d.mts → useConfig.d.ts} +2 -2
  54. package/dist/composables/useConfig.d.ts.map +1 -0
  55. package/dist/composables/{useConfig.mjs → useConfig.js} +2 -3
  56. package/dist/composables/useConfig.js.map +1 -0
  57. package/dist/composables/{useDoctype.d.mts → useDoctype.d.ts} +1 -1
  58. package/dist/composables/useDoctype.d.ts.map +1 -0
  59. package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
  60. package/dist/composables/useDoctype.js.map +1 -0
  61. package/dist/composables/{useEvent.d.mts → useEvent.d.ts} +2 -2
  62. package/dist/composables/useEvent.d.ts.map +1 -0
  63. package/dist/composables/{useEvent.mjs → useEvent.js} +3 -4
  64. package/dist/composables/useEvent.js.map +1 -0
  65. package/dist/composables/useFont.d.ts +50 -0
  66. package/dist/composables/useFont.d.ts.map +1 -0
  67. package/dist/composables/useFont.js +92 -0
  68. package/dist/composables/useFont.js.map +1 -0
  69. package/dist/composables/useOutlookFallback.d.ts +21 -0
  70. package/dist/composables/useOutlookFallback.d.ts.map +1 -0
  71. package/dist/composables/useOutlookFallback.js +29 -0
  72. package/dist/composables/useOutlookFallback.js.map +1 -0
  73. package/dist/composables/{usePlaintext.d.mts → usePlaintext.d.ts} +3 -1
  74. package/dist/composables/usePlaintext.d.ts.map +1 -0
  75. package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
  76. package/dist/composables/usePlaintext.js.map +1 -0
  77. package/dist/composables/usePreheader.d.ts +24 -0
  78. package/dist/composables/usePreheader.d.ts.map +1 -0
  79. package/dist/composables/usePreheader.js +28 -0
  80. package/dist/composables/usePreheader.js.map +1 -0
  81. package/dist/composables/useTransformers.d.ts +34 -0
  82. package/dist/composables/useTransformers.d.ts.map +1 -0
  83. package/dist/composables/useTransformers.js +48 -0
  84. package/dist/composables/useTransformers.js.map +1 -0
  85. package/dist/composables/useUrlQuery.d.ts +19 -0
  86. package/dist/composables/useUrlQuery.d.ts.map +1 -0
  87. package/dist/composables/useUrlQuery.js +26 -0
  88. package/dist/composables/useUrlQuery.js.map +1 -0
  89. package/dist/config/{defaults.d.mts → defaults.d.ts} +2 -2
  90. package/dist/config/defaults.d.ts.map +1 -0
  91. package/dist/config/{defaults.mjs → defaults.js} +10 -6
  92. package/dist/config/defaults.js.map +1 -0
  93. package/dist/config/{index.d.mts → index.d.ts} +4 -4
  94. package/dist/config/index.d.ts.map +1 -0
  95. package/dist/config/{index.mjs → index.js} +12 -10
  96. package/dist/config/index.js.map +1 -0
  97. package/dist/events/{index.d.mts → index.d.ts} +10 -4
  98. package/dist/events/index.d.ts.map +1 -0
  99. package/dist/events/{index.mjs → index.js} +21 -5
  100. package/dist/events/index.js.map +1 -0
  101. package/dist/index.d.ts +38 -0
  102. package/dist/index.js +37 -0
  103. package/dist/{plaintext.d.mts → plaintext.d.ts} +1 -1
  104. package/dist/plaintext.d.ts.map +1 -0
  105. package/dist/{plaintext.mjs → plaintext.js} +4 -5
  106. package/dist/plaintext.js.map +1 -0
  107. package/dist/{plugin.d.mts → plugin.d.ts} +2 -2
  108. package/dist/plugin.d.ts.map +1 -0
  109. package/dist/plugin.js +57 -0
  110. package/dist/plugin.js.map +1 -0
  111. package/dist/plugins/postcss/{mergeMediaQueries.d.mts → mergeMediaQueries.d.ts} +2 -2
  112. package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -0
  113. package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +2 -3
  114. package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
  115. package/dist/plugins/postcss/{pruneVars.d.mts → pruneVars.d.ts} +1 -1
  116. package/dist/plugins/postcss/pruneVars.d.ts.map +1 -0
  117. package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +2 -2
  118. package/dist/plugins/postcss/pruneVars.js.map +1 -0
  119. package/dist/plugins/postcss/quoteFontFamilies.d.ts +13 -0
  120. package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -0
  121. package/dist/plugins/postcss/quoteFontFamilies.js +84 -0
  122. package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
  123. package/dist/plugins/postcss/{removeDeclarations.d.mts → removeDeclarations.d.ts} +1 -1
  124. package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -0
  125. package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +2 -2
  126. package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
  127. package/dist/plugins/postcss/resolveMaizzleImports.d.ts +16 -0
  128. package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -0
  129. package/dist/plugins/postcss/resolveMaizzleImports.js +39 -0
  130. package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
  131. package/dist/plugins/postcss/resolveProps.d.ts +8 -0
  132. package/dist/plugins/postcss/resolveProps.d.ts.map +1 -0
  133. package/dist/plugins/postcss/resolveProps.js +144 -0
  134. package/dist/plugins/postcss/resolveProps.js.map +1 -0
  135. package/dist/plugins/postcss/{tailwindCleanup.d.mts → tailwindCleanup.d.ts} +2 -2
  136. package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -0
  137. package/dist/plugins/postcss/tailwindCleanup.js +68 -0
  138. package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
  139. package/dist/prepare.d.ts +17 -0
  140. package/dist/prepare.d.ts.map +1 -0
  141. package/dist/prepare.js +44 -0
  142. package/dist/prepare.js.map +1 -0
  143. package/dist/render/active.d.ts +8 -0
  144. package/dist/render/active.d.ts.map +1 -0
  145. package/dist/render/active.js +12 -0
  146. package/dist/render/active.js.map +1 -0
  147. package/dist/render/{createRenderer.d.mts → createRenderer.d.ts} +15 -7
  148. package/dist/render/createRenderer.d.ts.map +1 -0
  149. package/dist/render/createRenderer.js +319 -0
  150. package/dist/render/createRenderer.js.map +1 -0
  151. package/dist/render/index.d.ts +18 -0
  152. package/dist/render/index.d.ts.map +1 -0
  153. package/dist/render/index.js +53 -0
  154. package/dist/render/index.js.map +1 -0
  155. package/dist/render/injectFonts.d.ts +15 -0
  156. package/dist/render/injectFonts.d.ts.map +1 -0
  157. package/dist/render/injectFonts.js +45 -0
  158. package/dist/render/injectFonts.js.map +1 -0
  159. package/dist/render/plugins/codeBlockExtract.d.ts +14 -0
  160. package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -0
  161. package/dist/render/plugins/codeBlockExtract.js +34 -0
  162. package/dist/render/plugins/codeBlockExtract.js.map +1 -0
  163. package/dist/render/plugins/markdownExtract.d.ts +12 -0
  164. package/dist/render/plugins/markdownExtract.d.ts.map +1 -0
  165. package/dist/render/plugins/markdownExtract.js +49 -0
  166. package/dist/render/plugins/markdownExtract.js.map +1 -0
  167. package/dist/render/plugins/rawExtract.d.ts +14 -0
  168. package/dist/render/plugins/rawExtract.d.ts.map +1 -0
  169. package/dist/render/plugins/rawExtract.js +34 -0
  170. package/dist/render/plugins/rawExtract.js.map +1 -0
  171. package/dist/render/plugins/rowSourceLocation.d.ts +18 -0
  172. package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -0
  173. package/dist/render/plugins/rowSourceLocation.js +45 -0
  174. package/dist/render/plugins/rowSourceLocation.js.map +1 -0
  175. package/dist/{serve.d.mts → serve.d.ts} +4 -2
  176. package/dist/serve.d.ts.map +1 -0
  177. package/dist/{serve.mjs → serve.js} +203 -79
  178. package/dist/serve.js.map +1 -0
  179. package/dist/server/compatibility.d.ts +59 -0
  180. package/dist/server/compatibility.d.ts.map +1 -0
  181. package/dist/server/compatibility.js +911 -0
  182. package/dist/server/compatibility.js.map +1 -0
  183. package/dist/server/email.d.ts +17 -0
  184. package/dist/server/email.d.ts.map +1 -0
  185. package/dist/server/email.js +40 -0
  186. package/dist/server/email.js.map +1 -0
  187. package/dist/server/linter.d.ts +20 -0
  188. package/dist/server/linter.d.ts.map +1 -0
  189. package/dist/server/linter.js +339 -0
  190. package/dist/server/linter.js.map +1 -0
  191. package/dist/server/sfc-utils.d.ts +21 -0
  192. package/dist/server/sfc-utils.d.ts.map +1 -0
  193. package/dist/server/sfc-utils.js +198 -0
  194. package/dist/server/sfc-utils.js.map +1 -0
  195. package/dist/server/ui/App.vue +253 -77
  196. package/dist/server/ui/components/SidebarClose.vue +12 -0
  197. package/dist/server/ui/components/ui/checkbox/Checkbox.vue +35 -0
  198. package/dist/server/ui/components/ui/checkbox/index.ts +1 -0
  199. package/dist/server/ui/components/ui/command/Command.vue +5 -1
  200. package/dist/server/ui/components/ui/command/CommandDialog.vue +1 -1
  201. package/dist/server/ui/components/ui/command/CommandInput.vue +19 -1
  202. package/dist/server/ui/components/ui/command/CommandItem.vue +1 -1
  203. package/dist/server/ui/components/ui/command/CommandList.vue +1 -1
  204. package/dist/server/ui/components/ui/command/CommandShortcut.vue +1 -1
  205. package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +9 -1
  206. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
  207. package/dist/server/ui/components/ui/input/Input.vue +1 -1
  208. package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +1 -1
  209. package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
  210. package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +9 -1
  211. package/dist/server/ui/components/ui/sidebar/Sidebar.vue +8 -1
  212. package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +1 -1
  213. package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +5 -4
  214. package/dist/server/ui/components/ui/tags-input/TagsInput.vue +26 -0
  215. package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +17 -0
  216. package/dist/server/ui/components/ui/tags-input/TagsInputItem.vue +19 -0
  217. package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +22 -0
  218. package/dist/server/ui/components/ui/tags-input/TagsInputItemText.vue +17 -0
  219. package/dist/server/ui/components/ui/tags-input/index.ts +5 -0
  220. package/dist/server/ui/components/ui/toggle/index.ts +3 -3
  221. package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +1 -1
  222. package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +2 -2
  223. package/dist/server/ui/lib/emulated-dark-mode.ts +131 -0
  224. package/dist/server/ui/main.css +20 -20
  225. package/dist/server/ui/pages/Home.vue +12 -5
  226. package/dist/server/ui/pages/Preview.vue +716 -276
  227. package/dist/tests/render/_helpers.d.ts +6 -0
  228. package/dist/tests/render/_helpers.d.ts.map +1 -0
  229. package/dist/tests/render/_helpers.js +16 -0
  230. package/dist/tests/render/_helpers.js.map +1 -0
  231. package/dist/transformers/{addAttributes.d.mts → addAttributes.d.ts} +2 -2
  232. package/dist/transformers/addAttributes.d.ts.map +1 -0
  233. package/dist/transformers/{addAttributes.mjs → addAttributes.js} +16 -13
  234. package/dist/transformers/addAttributes.js.map +1 -0
  235. package/dist/transformers/attributeToStyle.d.ts +38 -0
  236. package/dist/transformers/attributeToStyle.d.ts.map +1 -0
  237. package/dist/transformers/attributeToStyle.js +94 -0
  238. package/dist/transformers/attributeToStyle.js.map +1 -0
  239. package/dist/transformers/base.d.ts +71 -0
  240. package/dist/transformers/base.d.ts.map +1 -0
  241. package/dist/transformers/{base.mjs → base.js} +56 -30
  242. package/dist/transformers/base.js.map +1 -0
  243. package/dist/transformers/columnWidth.d.ts +31 -0
  244. package/dist/transformers/columnWidth.d.ts.map +1 -0
  245. package/dist/transformers/columnWidth.js +546 -0
  246. package/dist/transformers/columnWidth.js.map +1 -0
  247. package/dist/transformers/entities.d.ts +37 -0
  248. package/dist/transformers/entities.d.ts.map +1 -0
  249. package/dist/transformers/entities.js +73 -0
  250. package/dist/transformers/entities.js.map +1 -0
  251. package/dist/transformers/filters/defaults.d.ts +6 -0
  252. package/dist/transformers/filters/defaults.d.ts.map +1 -0
  253. package/dist/transformers/filters/defaults.js +78 -0
  254. package/dist/transformers/filters/defaults.js.map +1 -0
  255. package/dist/transformers/filters/index.d.ts +43 -0
  256. package/dist/transformers/filters/index.d.ts.map +1 -0
  257. package/dist/transformers/filters/index.js +89 -0
  258. package/dist/transformers/filters/index.js.map +1 -0
  259. package/dist/transformers/format.d.ts +22 -0
  260. package/dist/transformers/format.d.ts.map +1 -0
  261. package/dist/transformers/format.js +30 -0
  262. package/dist/transformers/format.js.map +1 -0
  263. package/dist/transformers/{index.d.mts → index.d.ts} +14 -11
  264. package/dist/transformers/index.d.ts.map +1 -0
  265. package/dist/transformers/index.js +133 -0
  266. package/dist/transformers/index.js.map +1 -0
  267. package/dist/transformers/inlineCss.d.ts +84 -0
  268. package/dist/transformers/inlineCss.d.ts.map +1 -0
  269. package/dist/transformers/inlineCss.js +91 -0
  270. package/dist/transformers/inlineCss.js.map +1 -0
  271. package/dist/transformers/inlineLink.d.ts +35 -0
  272. package/dist/transformers/inlineLink.d.ts.map +1 -0
  273. package/dist/transformers/{inlineLink.mjs → inlineLink.js} +34 -10
  274. package/dist/transformers/inlineLink.js.map +1 -0
  275. package/dist/transformers/minify.d.ts +21 -0
  276. package/dist/transformers/minify.d.ts.map +1 -0
  277. package/dist/transformers/minify.js +25 -0
  278. package/dist/transformers/minify.js.map +1 -0
  279. package/dist/transformers/msoPlaceholders.d.ts +28 -0
  280. package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
  281. package/dist/transformers/msoPlaceholders.js +88 -0
  282. package/dist/transformers/msoPlaceholders.js.map +1 -0
  283. package/dist/transformers/purgeCss.d.ts +43 -0
  284. package/dist/transformers/purgeCss.d.ts.map +1 -0
  285. package/dist/transformers/purgeCss.js +181 -0
  286. package/dist/transformers/purgeCss.js.map +1 -0
  287. package/dist/transformers/removeAttributes.d.ts +54 -0
  288. package/dist/transformers/removeAttributes.d.ts.map +1 -0
  289. package/dist/transformers/removeAttributes.js +70 -0
  290. package/dist/transformers/removeAttributes.js.map +1 -0
  291. package/dist/transformers/{replaceStrings.d.mts → replaceStrings.d.ts} +2 -2
  292. package/dist/transformers/replaceStrings.d.ts.map +1 -0
  293. package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
  294. package/dist/transformers/replaceStrings.js.map +1 -0
  295. package/dist/transformers/{safeClassNames.d.mts → safeClassNames.d.ts} +2 -2
  296. package/dist/transformers/safeClassNames.d.ts.map +1 -0
  297. package/dist/transformers/{safeClassNames.mjs → safeClassNames.js} +4 -5
  298. package/dist/transformers/safeClassNames.js.map +1 -0
  299. package/dist/transformers/shorthandCss.d.ts +47 -0
  300. package/dist/transformers/shorthandCss.d.ts.map +1 -0
  301. package/dist/transformers/shorthandCss.js +61 -0
  302. package/dist/transformers/shorthandCss.js.map +1 -0
  303. package/dist/transformers/sixHex.d.ts +25 -0
  304. package/dist/transformers/sixHex.d.ts.map +1 -0
  305. package/dist/transformers/sixHex.js +42 -0
  306. package/dist/transformers/sixHex.js.map +1 -0
  307. package/dist/transformers/tailwindComponent.d.ts +16 -0
  308. package/dist/transformers/tailwindComponent.d.ts.map +1 -0
  309. package/dist/transformers/tailwindComponent.js +92 -0
  310. package/dist/transformers/tailwindComponent.js.map +1 -0
  311. package/dist/transformers/{tailwindcss.d.mts → tailwindcss.d.ts} +8 -4
  312. package/dist/transformers/tailwindcss.d.ts.map +1 -0
  313. package/dist/transformers/tailwindcss.js +97 -0
  314. package/dist/transformers/tailwindcss.js.map +1 -0
  315. package/dist/transformers/urlQuery.d.ts +36 -0
  316. package/dist/transformers/urlQuery.d.ts.map +1 -0
  317. package/dist/transformers/urlQuery.js +77 -0
  318. package/dist/transformers/urlQuery.js.map +1 -0
  319. package/dist/types/config.d.ts +727 -0
  320. package/dist/types/config.d.ts.map +1 -0
  321. package/dist/types/config.js +1 -0
  322. package/dist/types/index.d.ts +2 -0
  323. package/dist/types/index.js +1 -0
  324. package/dist/utils/ast/index.d.ts +4 -0
  325. package/dist/utils/ast/index.js +4 -0
  326. package/dist/utils/ast/{parser.d.mts → parser.d.ts} +1 -1
  327. package/dist/utils/ast/parser.d.ts.map +1 -0
  328. package/dist/utils/ast/{parser.mjs → parser.js} +2 -3
  329. package/dist/utils/ast/parser.js.map +1 -0
  330. package/dist/utils/ast/serializer.d.ts +8 -0
  331. package/dist/utils/ast/serializer.d.ts.map +1 -0
  332. package/dist/utils/ast/serializer.js +36 -0
  333. package/dist/utils/ast/serializer.js.map +1 -0
  334. package/dist/utils/ast/{walker.d.mts → walker.d.ts} +1 -1
  335. package/dist/utils/ast/walker.d.ts.map +1 -0
  336. package/dist/utils/ast/{walker.mjs → walker.js} +2 -2
  337. package/dist/utils/ast/walker.js.map +1 -0
  338. package/dist/utils/compileTailwindCss.d.ts +16 -0
  339. package/dist/utils/compileTailwindCss.d.ts.map +1 -0
  340. package/dist/utils/compileTailwindCss.js +54 -0
  341. package/dist/utils/compileTailwindCss.js.map +1 -0
  342. package/dist/utils/componentSources.d.ts +50 -0
  343. package/dist/utils/componentSources.d.ts.map +1 -0
  344. package/dist/utils/componentSources.js +50 -0
  345. package/dist/utils/componentSources.js.map +1 -0
  346. package/dist/utils/decodeStyleEntities.d.ts +15 -0
  347. package/dist/utils/decodeStyleEntities.d.ts.map +1 -0
  348. package/dist/utils/decodeStyleEntities.js +18 -0
  349. package/dist/utils/decodeStyleEntities.js.map +1 -0
  350. package/dist/utils/detect.d.ts +5 -0
  351. package/dist/utils/detect.d.ts.map +1 -0
  352. package/dist/utils/detect.js +10 -0
  353. package/dist/utils/detect.js.map +1 -0
  354. package/dist/utils/output-markers.d.ts +29 -0
  355. package/dist/utils/output-markers.d.ts.map +1 -0
  356. package/dist/utils/output-markers.js +68 -0
  357. package/dist/utils/output-markers.js.map +1 -0
  358. package/dist/utils/{url.d.mts → url.d.ts} +1 -1
  359. package/dist/utils/url.d.ts.map +1 -0
  360. package/dist/utils/{url.mjs → url.js} +2 -3
  361. package/dist/utils/url.js.map +1 -0
  362. package/node_modules/@clack/core/CHANGELOG.md +8 -0
  363. package/node_modules/@clack/core/dist/index.d.mts +18 -4
  364. package/node_modules/@clack/core/dist/index.mjs +16 -10
  365. package/node_modules/@clack/core/dist/index.mjs.map +1 -1
  366. package/node_modules/@clack/core/package.json +5 -2
  367. package/node_modules/@clack/prompts/CHANGELOG.md +15 -0
  368. package/node_modules/@clack/prompts/README.md +107 -2
  369. package/node_modules/@clack/prompts/dist/index.d.mts +16 -11
  370. package/node_modules/@clack/prompts/dist/index.mjs +114 -107
  371. package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
  372. package/node_modules/@clack/prompts/package.json +7 -4
  373. package/node_modules/fast-string-truncated-width/dist/index.js +36 -96
  374. package/node_modules/fast-string-truncated-width/dist/types.d.ts +0 -3
  375. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +3 -3
  376. package/node_modules/fast-string-truncated-width/dist/utils.js +14 -9
  377. package/node_modules/fast-string-truncated-width/package.json +1 -1
  378. package/node_modules/fast-string-truncated-width/readme.md +2 -3
  379. package/node_modules/fast-string-width/package.json +2 -2
  380. package/node_modules/fast-string-width/readme.md +0 -3
  381. package/node_modules/fast-wrap-ansi/lib/main.js +4 -1
  382. package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -1
  383. package/node_modules/fast-wrap-ansi/package.json +2 -2
  384. package/node_modules/maizzle/README.md +24 -0
  385. package/node_modules/maizzle/dist/commands/make/component.mjs +1 -1
  386. package/node_modules/maizzle/dist/commands/make/config.mjs +1 -1
  387. package/node_modules/maizzle/dist/commands/make/layout.mjs +3 -3
  388. package/node_modules/maizzle/dist/commands/make/scaffold.mjs +1 -1
  389. package/node_modules/maizzle/dist/commands/make/stubs/Layout.vue +146 -0
  390. package/node_modules/maizzle/dist/commands/make/stubs/component.vue +2 -4
  391. package/node_modules/maizzle/dist/commands/make/stubs/config.ts +1 -5
  392. package/node_modules/maizzle/dist/commands/make/template.mjs +1 -1
  393. package/node_modules/maizzle/dist/commands/new.mjs +32 -52
  394. package/node_modules/maizzle/dist/index.d.mts +1 -0
  395. package/node_modules/maizzle/dist/index.mjs +30 -7
  396. package/node_modules/maizzle/package.json +4 -3
  397. package/node_modules/nypm/dist/cli.mjs +28 -5
  398. package/node_modules/nypm/dist/index.d.mts +0 -8
  399. package/node_modules/nypm/dist/index.mjs +27 -4
  400. package/node_modules/nypm/package.json +12 -12
  401. package/node_modules/tinyexec/README.md +1 -1
  402. package/node_modules/tinyexec/dist/main.d.mts +6 -6
  403. package/node_modules/tinyexec/dist/main.mjs +126 -134
  404. package/node_modules/tinyexec/package.json +9 -9
  405. package/package.json +31 -21
  406. package/dist/build.d.mts +0 -19
  407. package/dist/build.d.mts.map +0 -1
  408. package/dist/build.mjs.map +0 -1
  409. package/dist/components/Divider.vue +0 -105
  410. package/dist/components/Vml.vue +0 -89
  411. package/dist/components/utils.d.mts +0 -5
  412. package/dist/components/utils.d.mts.map +0 -1
  413. package/dist/components/utils.mjs +0 -9
  414. package/dist/components/utils.mjs.map +0 -1
  415. package/dist/composables/defineConfig.d.mts.map +0 -1
  416. package/dist/composables/defineConfig.mjs.map +0 -1
  417. package/dist/composables/renderContext.d.mts +0 -19
  418. package/dist/composables/renderContext.d.mts.map +0 -1
  419. package/dist/composables/renderContext.mjs.map +0 -1
  420. package/dist/composables/useConfig.d.mts.map +0 -1
  421. package/dist/composables/useConfig.mjs.map +0 -1
  422. package/dist/composables/useDoctype.d.mts.map +0 -1
  423. package/dist/composables/useDoctype.mjs.map +0 -1
  424. package/dist/composables/useEvent.d.mts.map +0 -1
  425. package/dist/composables/useEvent.mjs.map +0 -1
  426. package/dist/composables/usePlaintext.d.mts.map +0 -1
  427. package/dist/composables/usePlaintext.mjs.map +0 -1
  428. package/dist/config/defaults.d.mts.map +0 -1
  429. package/dist/config/defaults.mjs.map +0 -1
  430. package/dist/config/index.d.mts.map +0 -1
  431. package/dist/config/index.mjs.map +0 -1
  432. package/dist/events/index.d.mts.map +0 -1
  433. package/dist/events/index.mjs.map +0 -1
  434. package/dist/index.d.mts +0 -29
  435. package/dist/index.mjs +0 -29
  436. package/dist/plaintext.d.mts.map +0 -1
  437. package/dist/plaintext.mjs.map +0 -1
  438. package/dist/plugin.d.mts.map +0 -1
  439. package/dist/plugin.mjs +0 -41
  440. package/dist/plugin.mjs.map +0 -1
  441. package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +0 -1
  442. package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
  443. package/dist/plugins/postcss/pruneVars.d.mts.map +0 -1
  444. package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
  445. package/dist/plugins/postcss/removeDeclarations.d.mts.map +0 -1
  446. package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
  447. package/dist/plugins/postcss/tailwindCleanup.d.mts.map +0 -1
  448. package/dist/plugins/postcss/tailwindCleanup.mjs +0 -35
  449. package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
  450. package/dist/render/createRenderer.d.mts.map +0 -1
  451. package/dist/render/createRenderer.mjs +0 -155
  452. package/dist/render/createRenderer.mjs.map +0 -1
  453. package/dist/render/index.d.mts +0 -26
  454. package/dist/render/index.d.mts.map +0 -1
  455. package/dist/render/index.mjs +0 -44
  456. package/dist/render/index.mjs.map +0 -1
  457. package/dist/serve.d.mts.map +0 -1
  458. package/dist/serve.mjs.map +0 -1
  459. package/dist/server/compatibility.d.mts +0 -6
  460. package/dist/server/compatibility.d.mts.map +0 -1
  461. package/dist/server/compatibility.mjs +0 -83
  462. package/dist/server/compatibility.mjs.map +0 -1
  463. package/dist/server/linter.d.mts +0 -6
  464. package/dist/server/linter.d.mts.map +0 -1
  465. package/dist/server/linter.mjs +0 -200
  466. package/dist/server/linter.mjs.map +0 -1
  467. package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +0 -30
  468. package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +0 -21
  469. package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +0 -25
  470. package/dist/server/ui/components/ui/resizable/index.ts +0 -3
  471. package/dist/transformers/addAttributes.d.mts.map +0 -1
  472. package/dist/transformers/addAttributes.mjs.map +0 -1
  473. package/dist/transformers/attributeToStyle.d.mts +0 -25
  474. package/dist/transformers/attributeToStyle.d.mts.map +0 -1
  475. package/dist/transformers/attributeToStyle.mjs +0 -80
  476. package/dist/transformers/attributeToStyle.mjs.map +0 -1
  477. package/dist/transformers/base.d.mts +0 -8
  478. package/dist/transformers/base.d.mts.map +0 -1
  479. package/dist/transformers/base.mjs.map +0 -1
  480. package/dist/transformers/entities.d.mts +0 -8
  481. package/dist/transformers/entities.d.mts.map +0 -1
  482. package/dist/transformers/entities.mjs +0 -38
  483. package/dist/transformers/entities.mjs.map +0 -1
  484. package/dist/transformers/format.d.mts +0 -15
  485. package/dist/transformers/format.d.mts.map +0 -1
  486. package/dist/transformers/format.mjs +0 -26
  487. package/dist/transformers/format.mjs.map +0 -1
  488. package/dist/transformers/index.d.mts.map +0 -1
  489. package/dist/transformers/index.mjs +0 -73
  490. package/dist/transformers/index.mjs.map +0 -1
  491. package/dist/transformers/inlineCSS.d.mts +0 -30
  492. package/dist/transformers/inlineCSS.d.mts.map +0 -1
  493. package/dist/transformers/inlineCSS.mjs +0 -79
  494. package/dist/transformers/inlineCSS.mjs.map +0 -1
  495. package/dist/transformers/inlineLink.d.mts +0 -14
  496. package/dist/transformers/inlineLink.d.mts.map +0 -1
  497. package/dist/transformers/inlineLink.mjs.map +0 -1
  498. package/dist/transformers/minify.d.mts +0 -17
  499. package/dist/transformers/minify.d.mts.map +0 -1
  500. package/dist/transformers/minify.mjs +0 -24
  501. package/dist/transformers/minify.mjs.map +0 -1
  502. package/dist/transformers/purgeCSS.d.mts +0 -23
  503. package/dist/transformers/purgeCSS.d.mts.map +0 -1
  504. package/dist/transformers/purgeCSS.mjs +0 -66
  505. package/dist/transformers/purgeCSS.mjs.map +0 -1
  506. package/dist/transformers/removeAttributes.d.mts +0 -31
  507. package/dist/transformers/removeAttributes.d.mts.map +0 -1
  508. package/dist/transformers/removeAttributes.mjs +0 -63
  509. package/dist/transformers/removeAttributes.mjs.map +0 -1
  510. package/dist/transformers/replaceStrings.d.mts.map +0 -1
  511. package/dist/transformers/replaceStrings.mjs.map +0 -1
  512. package/dist/transformers/safeClassNames.d.mts.map +0 -1
  513. package/dist/transformers/safeClassNames.mjs.map +0 -1
  514. package/dist/transformers/shorthandCSS.d.mts +0 -24
  515. package/dist/transformers/shorthandCSS.d.mts.map +0 -1
  516. package/dist/transformers/shorthandCSS.mjs +0 -48
  517. package/dist/transformers/shorthandCSS.mjs.map +0 -1
  518. package/dist/transformers/tailwindcss.d.mts.map +0 -1
  519. package/dist/transformers/tailwindcss.mjs +0 -136
  520. package/dist/transformers/tailwindcss.mjs.map +0 -1
  521. package/dist/transformers/urlQuery.d.mts +0 -24
  522. package/dist/transformers/urlQuery.d.mts.map +0 -1
  523. package/dist/transformers/urlQuery.mjs +0 -65
  524. package/dist/transformers/urlQuery.mjs.map +0 -1
  525. package/dist/types/config.d.mts +0 -149
  526. package/dist/types/config.d.mts.map +0 -1
  527. package/dist/types/config.mjs +0 -1
  528. package/dist/types/index.d.mts +0 -2
  529. package/dist/types/index.mjs +0 -1
  530. package/dist/utils/ast/index.d.mts +0 -4
  531. package/dist/utils/ast/index.mjs +0 -5
  532. package/dist/utils/ast/parser.d.mts.map +0 -1
  533. package/dist/utils/ast/parser.mjs.map +0 -1
  534. package/dist/utils/ast/serializer.d.mts +0 -7
  535. package/dist/utils/ast/serializer.d.mts.map +0 -1
  536. package/dist/utils/ast/serializer.mjs +0 -13
  537. package/dist/utils/ast/serializer.mjs.map +0 -1
  538. package/dist/utils/ast/walker.d.mts.map +0 -1
  539. package/dist/utils/ast/walker.mjs.map +0 -1
  540. package/dist/utils/url.d.mts.map +0 -1
  541. package/dist/utils/url.mjs.map +0 -1
  542. package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
@@ -100,7 +100,6 @@ interface PromptOptions<TValue, Self extends Prompt<TValue>> {
100
100
  validate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;
101
101
  input?: Readable;
102
102
  output?: Writable;
103
- debug?: boolean;
104
103
  signal?: AbortSignal;
105
104
  }
106
105
  declare class Prompt<TValue> {
@@ -148,6 +147,7 @@ declare class Prompt<TValue> {
148
147
  emit<T extends keyof ClackEvents<TValue>>(event: T, ...data: Parameters<ClackEvents<TValue>[T]>): void;
149
148
  prompt(): Promise<symbol | TValue | undefined>;
150
149
  protected _isActionKey(char: string | undefined, _key: Key): boolean;
150
+ protected _shouldSubmit(_char: string | undefined, _key: Key): boolean;
151
151
  protected _setValue(value: TValue | undefined): void;
152
152
  protected _setUserInput(value: string | undefined, write?: boolean): void;
153
153
  protected _clearUserInput(): void;
@@ -258,6 +258,20 @@ declare class GroupMultiSelectPrompt<T extends {
258
258
  constructor(opts: GroupMultiSelectOptions<T>);
259
259
  }
260
260
 
261
+ interface MultiLineOptions extends PromptOptions<string, MultiLinePrompt> {
262
+ placeholder?: string;
263
+ defaultValue?: string;
264
+ showSubmit?: boolean;
265
+ }
266
+ declare class MultiLinePrompt extends Prompt<string> {
267
+ #private;
268
+ focused: 'editor' | 'submit';
269
+ get userInputWithCursor(): string;
270
+ get cursor(): number;
271
+ protected _shouldSubmit(_char: string | undefined, _key: Key): boolean;
272
+ constructor(opts: MultiLineOptions);
273
+ }
274
+
261
275
  interface OptionLike {
262
276
  value: any;
263
277
  disabled?: boolean;
@@ -343,7 +357,7 @@ interface BlockOptions {
343
357
  declare function block({ input, output, overwrite, hideCursor, }?: BlockOptions): () => void;
344
358
  declare const getColumns: (output: Writable) => number;
345
359
  declare const getRows: (output: Writable) => number;
346
- declare function wrapTextWithPrefix(output: Writable | undefined, text: string, prefix: string, startPrefix?: string): string;
360
+ declare function wrapTextWithPrefix(output: Writable | undefined, text: string, prefix: string, startPrefix?: string, lineFormatter?: (line: string, index: number) => string): string;
347
361
 
348
- export { AutocompletePrompt, ConfirmPrompt, DatePrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, TextPrompt, block, getColumns, getRows, isCancel, settings, updateSettings, wrapTextWithPrefix };
349
- export type { AutocompleteOptions, ClackSettings, ConfirmOptions, DateFormat, DateOptions, DateParts, GroupMultiSelectOptions, MultiSelectOptions, PasswordOptions, PromptOptions, SelectKeyOptions, SelectOptions, ClackState as State, TextOptions };
362
+ export { AutocompletePrompt, ConfirmPrompt, DatePrompt, GroupMultiSelectPrompt, MultiLinePrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, TextPrompt, block, getColumns, getRows, isCancel, settings, updateSettings, wrapTextWithPrefix };
363
+ export type { AutocompleteOptions, ClackSettings, ConfirmOptions, DateFormat, DateOptions, DateParts, GroupMultiSelectOptions, MultiLineOptions, MultiSelectOptions, PasswordOptions, PromptOptions, SelectKeyOptions, SelectOptions, ClackState as State, TextOptions };
@@ -1,11 +1,17 @@
1
- import{styleText as y}from"node:util";import{stdout as S,stdin as $}from"node:process";import*as _ from"node:readline";import P from"node:readline";import{wrapAnsi as x}from"fast-wrap-ansi";import{cursor as c,erase as M}from"sisteransi";import{ReadStream as D}from"node:tty";function d(r,t,e){if(!e.some(o=>!o.disabled))return r;const s=r+t,i=Math.max(e.length-1,0),n=s<0?i:s>i?0:s;return e[n].disabled?d(n,t<0?-1:1,e):n}const E=["up","down","left","right","space","enter","cancel"],G=["January","February","March","April","May","June","July","August","September","October","November","December"],u={actions:new Set(E),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:[...G],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 K(r){if(r.aliases!==void 0){const t=r.aliases;for(const e in t){if(!Object.hasOwn(t,e))continue;const s=t[e];u.actions.has(s)&&(u.aliases.has(e)||u.aliases.set(e,s))}}if(r.messages!==void 0){const t=r.messages;t.cancel!==void 0&&(u.messages.cancel=t.cancel),t.error!==void 0&&(u.messages.error=t.error)}if(r.withGuide!==void 0&&(u.withGuide=r.withGuide!==!1),r.date!==void 0){const t=r.date;t.monthNames!==void 0&&(u.date.monthNames=[...t.monthNames]),t.messages!==void 0&&(t.messages.required!==void 0&&(u.date.messages.required=t.messages.required),t.messages.invalidMonth!==void 0&&(u.date.messages.invalidMonth=t.messages.invalidMonth),t.messages.invalidDay!==void 0&&(u.date.messages.invalidDay=t.messages.invalidDay),t.messages.afterMin!==void 0&&(u.date.messages.afterMin=t.messages.afterMin),t.messages.beforeMax!==void 0&&(u.date.messages.beforeMax=t.messages.beforeMax))}}function V(r,t){if(typeof r=="string")return u.aliases.get(r)===t;for(const e of r)if(e!==void 0&&V(e,t))return!0;return!1}function j(r,t){if(r===t)return;const e=r.split(`
2
- `),s=t.split(`
3
- `),i=Math.max(e.length,s.length),n=[];for(let o=0;o<i;o++)e[o]!==s[o]&&n.push(o);return{lines:n,numLinesBefore:e.length,numLinesAfter:s.length,numLines:i}}const Y=globalThis.process.platform.startsWith("win"),C=Symbol("clack:cancel");function q(r){return r===C}function w(r,t){const e=r;e.isTTY&&e.setRawMode(t)}function z({input:r=$,output:t=S,overwrite:e=!0,hideCursor:s=!0}={}){const i=_.createInterface({input:r,output:t,prompt:"",tabSize:1});_.emitKeypressEvents(r,i),r instanceof D&&r.isTTY&&r.setRawMode(!0);const n=(o,{name:a,sequence:h})=>{const l=String(o);if(V([l,a,h],"cancel")){s&&t.write(c.show),process.exit(0);return}if(!e)return;const f=a==="return"?0:-1,v=a==="return"?-1:0;_.moveCursor(t,f,v,()=>{_.clearLine(t,1,()=>{r.once("keypress",n)})})};return s&&t.write(c.hide),r.once("keypress",n),()=>{r.off("keypress",n),s&&t.write(c.show),r instanceof D&&r.isTTY&&!Y&&r.setRawMode(!1),i.terminal=!1,i.close()}}const O=r=>"columns"in r&&typeof r.columns=="number"?r.columns:80,A=r=>"rows"in r&&typeof r.rows=="number"?r.rows:20;function R(r,t,e,s=e){const i=O(r??S);return x(t,i-e.length,{hard:!0,trim:!1}).split(`
4
- `).map((n,o)=>`${o===0?s:e}${n}`).join(`
5
- `)}let p=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,e=!0){const{input:s=$,output:i=S,render:n,signal:o,...a}=t;this.opts=a,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=e,this._abortSignal=o,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,e){const s=this._subscribers.get(t)??[];s.push(e),this._subscribers.set(t,s)}on(t,e){this.setSubscriber(t,{cb:e})}once(t,e){this.setSubscriber(t,{cb:e,once:!0})}emit(t,...e){const s=this._subscribers.get(t)??[],i=[];for(const n of s)n.cb(...e),n.once&&i.push(()=>s.splice(s.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(C);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=P.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(c.show),this.output.off("resize",this.render),w(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(c.show),this.output.off("resize",this.render),w(this.input,!1),t(C)})})}_isActionKey(t,e){return t===" "}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,e){this.userInput=t??"",this.emit("userInput",this.userInput),e&&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,e){if(this._track&&e.name!=="return"&&(e.name&&this._isActionKey(t,e)&&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"),e?.name&&(!this._track&&u.aliases.has(e.name)&&this.emit("cursor",u.aliases.get(e.name)),u.actions.has(e.name)&&this.emit("cursor",e.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t?.toLowerCase(),e),e?.name==="return"){if(this.opts.validate){const s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}V([t,e?.name,e?.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(`
6
- `),w(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=x(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
7
- `).length-1;this.output.write(c.move(-999,t*-1))}render(){const t=x(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(c.hide);else{const e=j(this._prevFrame,t),s=A(this.output);if(this.restoreCursor(),e){const i=Math.max(0,e.numLinesAfter-s),n=Math.max(0,e.numLinesBefore-s);let o=e.lines.find(a=>a>=i);if(o===void 0){this._prevFrame=t;return}if(e.lines.length===1){this.output.write(c.move(0,o-n)),this.output.write(M.lines(1));const a=t.split(`
8
- `);this.output.write(a[o]),this._prevFrame=t,this.output.write(c.move(0,a.length-o-1));return}else if(e.lines.length>1){if(i<n)o=i;else{const h=o-n;h>0&&this.output.write(c.move(0,h))}this.output.write(M.down());const a=t.split(`
9
- `).slice(o);this.output.write(a.join(`
10
- `)),this._prevFrame=t;return}}this.output.write(M.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};function W(r,t){if(r===void 0||t.length===0)return 0;const e=t.findIndex(s=>s.value===r);return e!==-1?e:0}function B(r,t){return(t.label??String(t.value)).toLowerCase().includes(r.toLowerCase())}function J(r,t){if(t)return r?t:t[0]}let H=class extends p{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#e=0;#o="";#t;#n;#a;get cursor(){return this.#e}get userInputWithCursor(){if(!this.userInput)return y(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;const t=this.userInput.slice(0,this._cursor),[e,...s]=this.userInput.slice(this._cursor);return`${t}${y("inverse",e)}${s.join("")}`}get options(){return typeof this.#n=="function"?this.#n():this.#n}constructor(t){super(t),this.#n=t.options,this.#a=t.placeholder;const e=this.options;this.filteredOptions=[...e],this.multiple=t.multiple===!0,this.#t=typeof t.options=="function"?t.filter:t.filter??B;let s;if(t.initialValue&&Array.isArray(t.initialValue)?this.multiple?s=t.initialValue:s=t.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(s=[this.options[0].value]),s)for(const i of s){const n=e.findIndex(o=>o.value===i);n!==-1&&(this.toggleSelected(i),this.#e=n)}this.focusedValue=this.options[this.#e]?.value,this.on("key",(i,n)=>this.#s(i,n)),this.on("userInput",i=>this.#i(i))}_isActionKey(t,e){return t===" "||this.multiple&&this.isNavigating&&e.name==="space"&&t!==void 0&&t!==""}#s(t,e){const s=e.name==="up",i=e.name==="down",n=e.name==="return",o=this.userInput===""||this.userInput===" ",a=this.#a,h=this.options,l=a!==void 0&&a!==""&&h.some(f=>!f.disabled&&(this.#t?this.#t(a,f):!0));if(e.name==="tab"&&o&&l){this.userInput===" "&&this._clearUserInput(),this._setUserInput(a,!0),this.isNavigating=!1;return}s||i?(this.#e=d(this.#e,s?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#e]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):n?this.value=J(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(e.name==="tab"||this.isNavigating&&e.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(e=>e!==t):this.selectedValues=[...this.selectedValues,t]:this.selectedValues=[t])}#i(t){if(t!==this.#o){this.#o=t;const e=this.options;t&&this.#t?this.filteredOptions=e.filter(n=>this.#t?.(t,n)):this.filteredOptions=[...e];const s=W(this.focusedValue,this.filteredOptions);this.#e=d(s,0,this.filteredOptions);const i=this.filteredOptions[this.#e];i&&!i.disabled?this.focusedValue=i.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class Q 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",e=>{this.output.write(c.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}const X={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function L(r){return[...r].map(t=>X[t])}function Z(r){const t=new Intl.DateTimeFormat(r,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2e3,0,15)),e=[];let s="/";for(const i of t)i.type==="literal"?s=i.value.trim()||i.value:(i.type==="year"||i.type==="month"||i.type==="day")&&e.push({type:i.type,len:i.type==="year"?4:2});return{segments:e,separator:s}}function k(r){return Number.parseInt((r||"0").replace(/_/g,"0"),10)||0}function I(r){return{year:k(r.year),month:k(r.month),day:k(r.day)}}function T(r,t){return new Date(r||2001,t||1,0).getDate()}function F(r){const{year:t,month:e,day:s}=I(r);if(!t||t<0||t>9999||!e||e<1||e>12||!s||s<1)return;const i=new Date(Date.UTC(t,e-1,s));if(!(i.getUTCFullYear()!==t||i.getUTCMonth()!==e-1||i.getUTCDate()!==s))return{year:t,month:e,day:s}}function N(r){const t=F(r);return t?new Date(Date.UTC(t.year,t.month-1,t.day)):void 0}function tt(r,t,e,s){const i=e?{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate()}:null,n=s?{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.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(t.year,t.month)}}class et extends p{#e;#o;#t;#n;#a;#s={segmentIndex:0,positionInSegment:0};#i=!0;#r=null;inlineError="";get segmentCursor(){return{...this.#s}}get segmentValues(){return{...this.#t}}get segments(){return this.#e}get separator(){return this.#o}get formattedValue(){return this.#c(this.#t)}#c(t){return this.#e.map(e=>t[e.type]).join(this.#o)}#h(){this._setUserInput(this.#c(this.#t)),this._setValue(N(this.#t)??void 0)}constructor(t){const e=t.format?{segments:L(t.format),separator:t.separator??"/"}:Z(t.locale),s=t.separator??e.separator,i=t.format?L(t.format):e.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:"__"},a=i.map(h=>o[h.type]).join(s);super({...t,initialUserInput:a},!1),this.#e=i,this.#o=s,this.#t=o,this.#n=t.minDate,this.#a=t.maxDate,this.#h(),this.on("cursor",h=>this.#d(h)),this.on("key",(h,l)=>this.#f(h,l)),this.on("finalize",()=>this.#g(t))}#u(){const t=Math.max(0,Math.min(this.#s.segmentIndex,this.#e.length-1)),e=this.#e[t];if(e)return this.#s.positionInSegment=Math.max(0,Math.min(this.#s.positionInSegment,e.len-1)),{segment:e,index:t}}#l(t){this.inlineError="",this.#r=null;const e=this.#u();e&&(this.#s.segmentIndex=Math.max(0,Math.min(this.#e.length-1,e.index+t)),this.#s.positionInSegment=0,this.#i=!0)}#p(t){const e=this.#u();if(!e)return;const{segment:s}=e,i=this.#t[s.type],n=!i||i.replace(/_/g,"")==="",o=Number.parseInt((i||"0").replace(/_/g,"0"),10)||0,a=tt(s.type,I(this.#t),this.#n,this.#a);let h;n?h=t===1?a.min:a.max:h=Math.max(Math.min(a.max,o+t),a.min),this.#t={...this.#t,[s.type]:h.toString().padStart(s.len,"0")},this.#i=!0,this.#r=null,this.#h()}#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,e){if(e?.name==="backspace"||e?.sequence==="\x7F"||e?.sequence==="\b"||t==="\x7F"||t==="\b"){this.inlineError="";const s=this.#u();if(!s)return;if(!this.#t[s.segment.type].replace(/_/g,"")){this.#l(-1);return}this.#t[s.segment.type]="_".repeat(s.segment.len),this.#i=!0,this.#s.positionInSegment=0,this.#h();return}if(e?.name==="tab"){this.inlineError="";const s=this.#u();if(!s)return;const i=e.shift?-1:1,n=s.index+i;n>=0&&n<this.#e.length&&(this.#s.segmentIndex=n,this.#s.positionInSegment=0,this.#i=!0);return}if(t&&/^[0-9]$/.test(t)){const s=this.#u();if(!s)return;const{segment:i}=s,n=!this.#t[i.type].replace(/_/g,"");if(this.#i&&this.#r!==null&&!n){const m=this.#r+t,g={...this.#t,[i.type]:m},b=this.#m(g,i);if(b){this.inlineError=b,this.#r=null,this.#i=!1;return}this.inlineError="",this.#t[i.type]=m,this.#r=null,this.#i=!1,this.#h(),s.index<this.#e.length-1&&(this.#s.segmentIndex=s.index+1,this.#s.positionInSegment=0,this.#i=!0);return}this.#i&&!n&&(this.#t[i.type]="_".repeat(i.len),this.#s.positionInSegment=0),this.#i=!1,this.#r=null;const o=this.#t[i.type],a=o.indexOf("_"),h=a>=0?a:Math.min(this.#s.positionInSegment,i.len-1);if(h<0||h>=i.len)return;let l=o.slice(0,h)+t+o.slice(h+1),f=!1;if(h===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 v=l.includes("_")?void 0:F(this.#t);if(v){const{year:m,month:g}=v,b=T(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(b,v.day))).padStart(2,"0")}}this.#h();const U=l.indexOf("_");f?(this.#i=!0,this.#r=t):U>=0?this.#s.positionInSegment=U:a>=0&&s.index<this.#e.length-1?(this.#s.segmentIndex=s.index+1,this.#s.positionInSegment=0,this.#i=!0):this.#s.positionInSegment=Math.min(h+1,i.len-1)}}#m(t,e){const{month:s,day:i}=I(t);if(e.type==="month"&&(s<0||s>12))return u.date.messages.invalidMonth;if(e.type==="day"&&(i<0||i>31))return u.date.messages.invalidDay(31,"any month")}#g(t){const{year:e,month:s,day:i}=I(this.#t);if(e&&s&&i){const n=T(e,s);this.#t={...this.#t,day:String(Math.min(i,n)).padStart(2,"0")}}this.value=N(this.#t)??t.defaultValue??void 0}}class st extends p{options;cursor=0;#e;getGroupItems(t){return this.options.filter(e=>e.group===t)}isGroupSelected(t){const e=this.getGroupItems(t),s=this.value;return s===void 0?!1:e.every(i=>s.includes(i.value))}toggleValue(){const t=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),t.group===!0){const e=t.value,s=this.getGroupItems(e);this.isGroupSelected(e)?this.value=this.value.filter(i=>s.findIndex(n=>n.value===i)===-1):this.value=[...this.value,...s.map(i=>i.value)],this.value=Array.from(new Set(this.value))}else{const e=this.value.includes(t.value);this.value=e?this.value.filter(s=>s!==t.value):[...this.value,t.value]}}constructor(t){super(t,!1);const{options:e}=t;this.#e=t.selectableGroups!==!1,this.options=Object.entries(e).flatMap(([s,i])=>[{value:s,group:!0,label:s},...i.map(n=>({...n,group:s}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:s})=>s===t.cursorAt),this.#e?0:1),this.on("cursor",s=>{switch(s){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.#e&&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.#e&&i&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}}let it=class extends p{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,e=this.value!==void 0&&this.value.length===t.length;this.value=e?[]:t.map(s=>s.value)}toggleInvert(){const t=this.value;if(!t)return;const e=this._enabledOptions.filter(s=>!t.includes(s.value));this.value=e.map(s=>s.value)}toggleValue(){this.value===void 0&&(this.value=[]);const t=this.value.includes(this._value);this.value=t?this.value.filter(e=>e!==this._value):[...this.value,this._value]}constructor(t){super(t,!1),this.options=t.options,this.value=[...t.initialValues??[]];const e=Math.max(this.options.findIndex(({value:s})=>s===t.cursorAt),0);this.cursor=this.options[e].disabled?d(e,1,this.options):e,this.on("key",s=>{s==="a"&&this.toggleAll(),s==="i"&&this.toggleInvert()}),this.on("cursor",s=>{switch(s){case"left":case"up":this.cursor=d(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=d(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}};class rt extends p{_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}${y(["inverse","hidden"],"_")}`;const e=this.masked,s=e.slice(0,this.cursor),i=e.slice(this.cursor);return`${s}${y("inverse",i[0])}${i.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...e}){super(e),this._mask=t??"\u2022",this.on("userInput",s=>{this._setValue(s)})}}class nt extends p{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 e=this.options.findIndex(({value:i})=>i===t.initialValue),s=e===-1?0:e;this.cursor=this.options[s].disabled?d(s,1,this.options):s,this.changeValue(),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=d(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=d(this.cursor,1,this.options);break}this.changeValue()})}}class ot extends p{options;cursor=0;constructor(t){super(t,!1),this.options=t.options;const e=t.caseSensitive===!0,s=this.options.map(({value:[i]})=>e?i:i?.toLowerCase());this.cursor=Math.max(s.indexOf(t.initialValue),0),this.on("key",(i,n)=>{if(!i)return;const o=e&&n.shift?i.toUpperCase():i;if(!s.includes(o))return;const a=this.options.find(({value:[h]})=>e?h===o:h?.toLowerCase()===i);a&&(this.value=a.value,this.state="submit",this.emit("submit"))})}}class at extends p{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const e=t.slice(0,this.cursor),[s,...i]=t.slice(this.cursor);return`${e}${y("inverse",s)}${i.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",e=>{this._setValue(e)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}export{H as AutocompletePrompt,Q as ConfirmPrompt,et as DatePrompt,st as GroupMultiSelectPrompt,it as MultiSelectPrompt,rt as PasswordPrompt,p as Prompt,ot as SelectKeyPrompt,nt as SelectPrompt,at as TextPrompt,z as block,O as getColumns,A as getRows,q as isCancel,u as settings,K as updateSettings,R as wrapTextWithPrefix};
1
+ import{styleText as v}from"node:util";import{stdout as S,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 c,erase as V}from"sisteransi";import{ReadStream as O}from"node:tty";function d(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?d(n,t<0?-1:1,s):n}function I(r,t,s,e){const i=e.split(`
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
+ `),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=S,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(c.show),process.exit(0);return}if(!s)return;const f=u==="return"?0:-1,y=u==="return"?-1:0;b.moveCursor(t,f,y,()=>{b.clearLine(t,1,()=>{r.once("keypress",n)})})};return e&&t.write(c.hide),r.once("keypress",n),()=>{r.off("keypress",n),e&&t.write(c.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){const n=A(r??S);return M(t,n-s.length,{hard:!0,trim:!1}).split(`
5
+ `).map((o,u)=>{const a=i?i(o,u):o;return`${u===0?e:s}${a}`}).join(`
6
+ `)}let p=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=S,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(c.show),this.output.off("resize",this.render),w(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(c.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
+ `),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(c.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(c.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(c.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(c.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(c.move(0,a))}this.output.write(V.down());const u=t.split(`
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===`
12
+ `?`${s}\u2588
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
+ `),this._cursor++,!1);const e=this.#s;return this.#s=!0,e?(this.userInput[this.cursor-1]===`
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 p{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?d(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=d(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=d(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}};class ot extends p{_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 p{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?d(e,1,this.options):e,this.changeValue(),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=d(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=d(this.cursor,1,this.options);break}this.changeValue()})}}class at extends p{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 p{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,p 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};
11
17
  //# sourceMappingURL=index.mjs.map