@maizzle/framework 6.0.0-rc.9 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/maizzle.mjs +1 -1
- package/dist/build.d.ts +38 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +234 -0
- package/dist/build.js.map +1 -0
- package/dist/components/Body.vue +32 -3
- package/dist/components/Button.vue +91 -62
- package/dist/components/CodeBlock.vue +6 -4
- package/dist/components/CodeInline.vue +77 -6
- package/dist/components/Column.vue +67 -31
- package/dist/components/Container.vue +73 -12
- package/dist/components/Font.vue +96 -0
- package/dist/components/Head.vue +1 -1
- package/dist/components/Heading.vue +1 -1
- package/dist/components/Hr.vue +33 -0
- package/dist/components/Html.vue +36 -3
- package/dist/components/Img.vue +332 -0
- package/dist/components/Layout.vue +71 -21
- package/dist/components/Link.vue +1 -1
- package/dist/components/Markdown.vue +51 -24
- package/dist/components/MarkdownLayout.vue +39 -0
- package/dist/components/NotPlaintext.vue +14 -0
- package/dist/components/Outlook.vue +38 -11
- package/dist/components/OutlookBg.vue +241 -0
- package/dist/components/Plaintext.vue +14 -0
- package/dist/components/Preheader.vue +35 -10
- package/dist/components/QrCode.vue +157 -0
- package/dist/components/Raw.vue +28 -0
- package/dist/components/Row.vue +115 -22
- package/dist/components/Section.vue +65 -26
- package/dist/components/Spacer.vue +35 -29
- package/dist/components/Tailwind.vue +45 -0
- package/dist/components/Text.vue +3 -3
- package/dist/components/Vml.vue +207 -94
- package/dist/components/utils.d.ts +53 -0
- package/dist/components/utils.d.ts.map +1 -0
- package/dist/components/utils.js +80 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/components/utils.ts +102 -0
- package/dist/composables/defineConfig.d.ts +13 -0
- package/dist/composables/defineConfig.d.ts.map +1 -0
- package/dist/composables/{defineConfig.mjs → defineConfig.js} +7 -9
- package/dist/composables/defineConfig.js.map +1 -0
- package/dist/composables/renderContext.d.ts +37 -0
- package/dist/composables/renderContext.d.ts.map +1 -0
- package/dist/composables/renderContext.js +6 -0
- package/dist/composables/renderContext.js.map +1 -0
- package/dist/composables/useBaseUrl.d.ts +19 -0
- package/dist/composables/useBaseUrl.d.ts.map +1 -0
- package/dist/composables/useBaseUrl.js +26 -0
- package/dist/composables/useBaseUrl.js.map +1 -0
- package/dist/composables/useConfig.d.ts +16 -0
- package/dist/composables/useConfig.d.ts.map +1 -0
- package/dist/composables/useConfig.js +19 -0
- package/dist/composables/useConfig.js.map +1 -0
- package/dist/composables/useCurrentTemplate.d.ts +31 -0
- package/dist/composables/useCurrentTemplate.d.ts.map +1 -0
- package/dist/composables/useCurrentTemplate.js +42 -0
- package/dist/composables/useCurrentTemplate.js.map +1 -0
- package/dist/composables/{useDoctype.d.mts → useDoctype.d.ts} +1 -1
- package/dist/composables/useDoctype.d.ts.map +1 -0
- package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
- package/dist/composables/useDoctype.js.map +1 -0
- package/dist/composables/{useEvent.d.mts → useEvent.d.ts} +3 -3
- package/dist/composables/useEvent.d.ts.map +1 -0
- package/dist/composables/{useEvent.mjs → useEvent.js} +4 -5
- package/dist/composables/useEvent.js.map +1 -0
- package/dist/composables/useFont.d.ts +50 -0
- package/dist/composables/useFont.d.ts.map +1 -0
- package/dist/composables/useFont.js +92 -0
- package/dist/composables/useFont.js.map +1 -0
- package/dist/composables/useOutlookFallback.d.ts +21 -0
- package/dist/composables/useOutlookFallback.d.ts.map +1 -0
- package/dist/composables/useOutlookFallback.js +29 -0
- package/dist/composables/useOutlookFallback.js.map +1 -0
- package/dist/composables/useOutputPath.d.ts +17 -0
- package/dist/composables/useOutputPath.d.ts.map +1 -0
- package/dist/composables/useOutputPath.js +23 -0
- package/dist/composables/useOutputPath.js.map +1 -0
- package/dist/composables/{usePlaintext.d.mts → usePlaintext.d.ts} +3 -1
- package/dist/composables/usePlaintext.d.ts.map +1 -0
- package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
- package/dist/composables/usePlaintext.js.map +1 -0
- package/dist/composables/usePreheader.d.ts +25 -0
- package/dist/composables/usePreheader.d.ts.map +1 -0
- package/dist/composables/usePreheader.js +28 -0
- package/dist/composables/usePreheader.js.map +1 -0
- package/dist/composables/useTransformers.d.ts +34 -0
- package/dist/composables/useTransformers.d.ts.map +1 -0
- package/dist/composables/useTransformers.js +48 -0
- package/dist/composables/useTransformers.js.map +1 -0
- package/dist/composables/useUrlQuery.d.ts +19 -0
- package/dist/composables/useUrlQuery.d.ts.map +1 -0
- package/dist/composables/useUrlQuery.js +26 -0
- package/dist/composables/useUrlQuery.js.map +1 -0
- package/dist/config/{defaults.d.mts → defaults.d.ts} +2 -2
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/{defaults.mjs → defaults.js} +10 -6
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +24 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/{index.mjs → index.js} +45 -14
- package/dist/config/index.js.map +1 -0
- package/dist/events/{index.d.mts → index.d.ts} +35 -12
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/{index.mjs → index.js} +31 -13
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +40 -0
- package/dist/{plaintext.d.mts → plaintext.d.ts} +1 -1
- package/dist/plaintext.d.ts.map +1 -0
- package/dist/{plaintext.mjs → plaintext.js} +4 -5
- package/dist/plaintext.js.map +1 -0
- package/dist/{plugin.d.mts → plugin.d.ts} +2 -2
- package/dist/plugin.d.ts.map +1 -0
- package/dist/{plugin.mjs → plugin.js} +8 -9
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.d.mts → mergeMediaQueries.d.ts} +2 -2
- package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +2 -3
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
- package/dist/plugins/postcss/{pruneVars.d.mts → pruneVars.d.ts} +1 -1
- package/dist/plugins/postcss/pruneVars.d.ts.map +1 -0
- package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +2 -2
- package/dist/plugins/postcss/pruneVars.js.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts +13 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.js +84 -0
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.d.mts → removeDeclarations.d.ts} +1 -1
- package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +2 -2
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts +16 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js +39 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
- package/dist/plugins/postcss/resolveProps.d.ts +8 -0
- package/dist/plugins/postcss/resolveProps.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveProps.js +155 -0
- package/dist/plugins/postcss/resolveProps.js.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.d.mts → tailwindCleanup.d.ts} +2 -2
- package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.mjs → tailwindCleanup.js} +5 -3
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
- package/dist/prepare.d.ts +17 -0
- package/dist/prepare.d.ts.map +1 -0
- package/dist/prepare.js +44 -0
- package/dist/prepare.js.map +1 -0
- package/dist/render/active.d.ts +8 -0
- package/dist/render/active.d.ts.map +1 -0
- package/dist/render/active.js +12 -0
- package/dist/render/active.js.map +1 -0
- package/dist/render/buildTemplate.d.ts +49 -0
- package/dist/render/buildTemplate.d.ts.map +1 -0
- package/dist/render/buildTemplate.js +141 -0
- package/dist/render/buildTemplate.js.map +1 -0
- package/dist/render/{createRenderer.d.mts → createRenderer.d.ts} +14 -6
- package/dist/render/createRenderer.d.ts.map +1 -0
- package/dist/render/createRenderer.js +468 -0
- package/dist/render/createRenderer.js.map +1 -0
- package/dist/render/index.d.ts +18 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +59 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/injectFonts.d.ts +15 -0
- package/dist/render/injectFonts.d.ts.map +1 -0
- package/dist/render/injectFonts.js +45 -0
- package/dist/render/injectFonts.js.map +1 -0
- package/dist/render/parallel/buildWorker.d.ts +31 -0
- package/dist/render/parallel/buildWorker.d.ts.map +1 -0
- package/dist/render/parallel/buildWorker.js +66 -0
- package/dist/render/parallel/buildWorker.js.map +1 -0
- package/dist/render/parallel/worker.mjs +28 -0
- package/dist/render/plugins/codeBlockExtract.d.ts +14 -0
- package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -0
- package/dist/render/plugins/codeBlockExtract.js +38 -0
- package/dist/render/plugins/codeBlockExtract.js.map +1 -0
- package/dist/render/plugins/markdownExtract.d.ts +12 -0
- package/dist/render/plugins/markdownExtract.d.ts.map +1 -0
- package/dist/render/plugins/markdownExtract.js +49 -0
- package/dist/render/plugins/markdownExtract.js.map +1 -0
- package/dist/render/plugins/rawExtract.d.ts +14 -0
- package/dist/render/plugins/rawExtract.d.ts.map +1 -0
- package/dist/render/plugins/rawExtract.js +34 -0
- package/dist/render/plugins/rawExtract.js.map +1 -0
- package/dist/render/plugins/rowSourceLocation.d.ts +18 -0
- package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -0
- package/dist/render/plugins/rowSourceLocation.js +45 -0
- package/dist/render/plugins/rowSourceLocation.js.map +1 -0
- package/dist/{serve.d.mts → serve.d.ts} +5 -3
- package/dist/serve.d.ts.map +1 -0
- package/dist/{serve.mjs → serve.js} +201 -107
- package/dist/serve.js.map +1 -0
- package/dist/server/compatibility.d.ts +59 -0
- package/dist/server/compatibility.d.ts.map +1 -0
- package/dist/server/compatibility.js +959 -0
- package/dist/server/compatibility.js.map +1 -0
- package/dist/server/{email.d.mts → email.d.ts} +2 -2
- package/dist/server/email.d.ts.map +1 -0
- package/dist/server/{email.mjs → email.js} +2 -3
- package/dist/server/email.js.map +1 -0
- package/dist/server/linter.d.ts +20 -0
- package/dist/server/linter.d.ts.map +1 -0
- package/dist/server/linter.js +345 -0
- package/dist/server/linter.js.map +1 -0
- package/dist/server/sfc-utils.d.ts +21 -0
- package/dist/server/sfc-utils.d.ts.map +1 -0
- package/dist/server/sfc-utils.js +198 -0
- package/dist/server/sfc-utils.js.map +1 -0
- package/dist/server/ui/.vite/deps/@lucide_vue.js +44967 -0
- package/dist/server/ui/.vite/deps/@lucide_vue.js.map +1 -0
- package/dist/server/ui/.vite/deps/@vueuse_core.js +8155 -0
- package/dist/server/ui/.vite/deps/@vueuse_core.js.map +1 -0
- package/dist/server/ui/.vite/deps/@vueuse_shared.js +1859 -0
- package/dist/server/ui/.vite/deps/@vueuse_shared.js.map +1 -0
- package/dist/server/ui/.vite/deps/_metadata.json +78 -0
- package/dist/server/ui/.vite/deps/chunk-EAsCxrDo.js +14 -0
- package/dist/server/ui/.vite/deps/class-variance-authority.js +57 -0
- package/dist/server/ui/.vite/deps/class-variance-authority.js.map +1 -0
- package/dist/server/ui/.vite/deps/clsx.js +18 -0
- package/dist/server/ui/.vite/deps/clsx.js.map +1 -0
- package/dist/server/ui/.vite/deps/culori.js +4312 -0
- package/dist/server/ui/.vite/deps/culori.js.map +1 -0
- package/dist/server/ui/.vite/deps/package.json +3 -0
- package/dist/server/ui/.vite/deps/reka-ui.js +44464 -0
- package/dist/server/ui/.vite/deps/reka-ui.js.map +1 -0
- package/dist/server/ui/.vite/deps/tailwind-merge.js +3458 -0
- package/dist/server/ui/.vite/deps/tailwind-merge.js.map +1 -0
- package/dist/server/ui/.vite/deps/vue-router.js +6383 -0
- package/dist/server/ui/.vite/deps/vue-router.js.map +1 -0
- package/dist/server/ui/.vite/deps/vue.js +2 -0
- package/dist/server/ui/.vite/deps/vue.runtime.esm-bundler-DaqjATE_.js +8785 -0
- package/dist/server/ui/.vite/deps/vue.runtime.esm-bundler-DaqjATE_.js.map +1 -0
- package/dist/server/ui/App.vue +106 -66
- package/dist/server/ui/components/SidebarClose.vue +12 -0
- package/dist/server/ui/components/ui/checkbox/Checkbox.vue +1 -1
- package/dist/server/ui/components/ui/command/Command.vue +5 -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/input/Input.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +2 -2
- package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +1 -1
- package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +1 -1
- package/dist/server/ui/lib/emulated-dark-mode.ts +146 -0
- package/dist/server/ui/main.css +25 -0
- package/dist/server/ui/pages/Home.vue +1 -1
- package/dist/server/ui/pages/Preview.vue +377 -186
- package/dist/server/ui/vite-env.d.ts +1 -0
- package/dist/tests/render/_helpers.d.ts +6 -0
- package/dist/tests/render/_helpers.d.ts.map +1 -0
- package/dist/tests/render/_helpers.js +16 -0
- package/dist/tests/render/_helpers.js.map +1 -0
- package/dist/transformers/addAttributes.d.ts +42 -0
- package/dist/transformers/addAttributes.d.ts.map +1 -0
- package/dist/transformers/{addAttributes.mjs → addAttributes.js} +40 -24
- package/dist/transformers/addAttributes.js.map +1 -0
- package/dist/transformers/attributeToStyle.d.ts +38 -0
- package/dist/transformers/attributeToStyle.d.ts.map +1 -0
- package/dist/transformers/attributeToStyle.js +94 -0
- package/dist/transformers/attributeToStyle.js.map +1 -0
- package/dist/transformers/base.d.ts +71 -0
- package/dist/transformers/base.d.ts.map +1 -0
- package/dist/transformers/{base.mjs → base.js} +65 -40
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/columnWidth.d.ts +31 -0
- package/dist/transformers/columnWidth.d.ts.map +1 -0
- package/dist/transformers/columnWidth.js +527 -0
- package/dist/transformers/columnWidth.js.map +1 -0
- package/dist/transformers/entities.d.ts +37 -0
- package/dist/transformers/entities.d.ts.map +1 -0
- package/dist/transformers/entities.js +74 -0
- package/dist/transformers/entities.js.map +1 -0
- package/dist/transformers/filters/{defaults.d.mts → defaults.d.ts} +1 -1
- package/dist/transformers/filters/defaults.d.ts.map +1 -0
- package/dist/transformers/filters/{defaults.mjs → defaults.js} +2 -2
- package/dist/transformers/filters/defaults.js.map +1 -0
- package/dist/transformers/filters/index.d.ts +43 -0
- package/dist/transformers/filters/index.d.ts.map +1 -0
- package/dist/transformers/filters/index.js +89 -0
- package/dist/transformers/filters/index.js.map +1 -0
- package/dist/transformers/format.d.ts +22 -0
- package/dist/transformers/format.d.ts.map +1 -0
- package/dist/transformers/format.js +30 -0
- package/dist/transformers/format.js.map +1 -0
- package/dist/transformers/imgWidth.d.ts +20 -0
- package/dist/transformers/imgWidth.d.ts.map +1 -0
- package/dist/transformers/imgWidth.js +76 -0
- package/dist/transformers/imgWidth.js.map +1 -0
- package/dist/transformers/{index.d.mts → index.d.ts} +4 -3
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +163 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/inlineCss.d.ts +85 -0
- package/dist/transformers/inlineCss.d.ts.map +1 -0
- package/dist/transformers/inlineCss.js +112 -0
- package/dist/transformers/inlineCss.js.map +1 -0
- package/dist/transformers/inlineLink.d.ts +35 -0
- package/dist/transformers/inlineLink.d.ts.map +1 -0
- package/dist/transformers/{inlineLink.mjs → inlineLink.js} +35 -11
- package/dist/transformers/inlineLink.js.map +1 -0
- package/dist/transformers/minify.d.ts +21 -0
- package/dist/transformers/minify.d.ts.map +1 -0
- package/dist/transformers/minify.js +25 -0
- package/dist/transformers/minify.js.map +1 -0
- package/dist/transformers/minifyCodeInline.d.ts +29 -0
- package/dist/transformers/minifyCodeInline.d.ts.map +1 -0
- package/dist/transformers/minifyCodeInline.js +36 -0
- package/dist/transformers/minifyCodeInline.js.map +1 -0
- package/dist/transformers/msoPlaceholders.d.ts +33 -0
- package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
- package/dist/transformers/msoPlaceholders.js +114 -0
- package/dist/transformers/msoPlaceholders.js.map +1 -0
- package/dist/transformers/purgeCss.d.ts +43 -0
- package/dist/transformers/purgeCss.d.ts.map +1 -0
- package/dist/transformers/purgeCss.js +207 -0
- package/dist/transformers/purgeCss.js.map +1 -0
- package/dist/transformers/removeAttributes.d.ts +54 -0
- package/dist/transformers/removeAttributes.d.ts.map +1 -0
- package/dist/transformers/removeAttributes.js +72 -0
- package/dist/transformers/removeAttributes.js.map +1 -0
- package/dist/transformers/{replaceStrings.d.mts → replaceStrings.d.ts} +2 -2
- package/dist/transformers/replaceStrings.d.ts.map +1 -0
- package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
- package/dist/transformers/replaceStrings.js.map +1 -0
- package/dist/transformers/safeSelectors.d.ts +37 -0
- package/dist/transformers/safeSelectors.d.ts.map +1 -0
- package/dist/transformers/{safeClassNames.mjs → safeSelectors.js} +40 -10
- package/dist/transformers/safeSelectors.js.map +1 -0
- package/dist/transformers/shorthandCss.d.ts +47 -0
- package/dist/transformers/shorthandCss.d.ts.map +1 -0
- package/dist/transformers/shorthandCss.js +92 -0
- package/dist/transformers/shorthandCss.js.map +1 -0
- package/dist/transformers/sixHex.d.ts +25 -0
- package/dist/transformers/sixHex.d.ts.map +1 -0
- package/dist/transformers/sixHex.js +42 -0
- package/dist/transformers/sixHex.js.map +1 -0
- package/dist/transformers/tailwindComponent.d.ts +16 -0
- package/dist/transformers/tailwindComponent.d.ts.map +1 -0
- package/dist/transformers/tailwindComponent.js +101 -0
- package/dist/transformers/tailwindComponent.js.map +1 -0
- package/dist/transformers/{tailwindcss.d.mts → tailwindcss.d.ts} +2 -2
- package/dist/transformers/tailwindcss.d.ts.map +1 -0
- package/dist/transformers/{tailwindcss.mjs → tailwindcss.js} +33 -74
- package/dist/transformers/tailwindcss.js.map +1 -0
- package/dist/transformers/urlQuery.d.ts +36 -0
- package/dist/transformers/urlQuery.d.ts.map +1 -0
- package/dist/transformers/urlQuery.js +77 -0
- package/dist/transformers/urlQuery.js.map +1 -0
- package/dist/types/{config.d.mts → config.d.ts} +231 -46
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/ast/index.d.ts +4 -0
- package/dist/utils/ast/index.js +4 -0
- package/dist/utils/ast/{parser.d.mts → parser.d.ts} +1 -1
- package/dist/utils/ast/parser.d.ts.map +1 -0
- package/dist/utils/ast/{parser.mjs → parser.js} +2 -3
- package/dist/utils/ast/parser.js.map +1 -0
- package/dist/utils/ast/{serializer.d.mts → serializer.d.ts} +1 -1
- package/dist/utils/ast/serializer.d.ts.map +1 -0
- package/dist/utils/ast/serializer.js +46 -0
- package/dist/utils/ast/serializer.js.map +1 -0
- package/dist/utils/ast/{walker.d.mts → walker.d.ts} +1 -1
- package/dist/utils/ast/walker.d.ts.map +1 -0
- package/dist/utils/ast/{walker.mjs → walker.js} +2 -2
- package/dist/utils/ast/walker.js.map +1 -0
- package/dist/utils/cloneConfig.d.ts +13 -0
- package/dist/utils/cloneConfig.d.ts.map +1 -0
- package/dist/utils/cloneConfig.js +21 -0
- package/dist/utils/cloneConfig.js.map +1 -0
- package/dist/utils/compileTailwindCss.d.ts +16 -0
- package/dist/utils/compileTailwindCss.d.ts.map +1 -0
- package/dist/utils/compileTailwindCss.js +55 -0
- package/dist/utils/compileTailwindCss.js.map +1 -0
- package/dist/utils/componentSources.d.ts +50 -0
- package/dist/utils/componentSources.d.ts.map +1 -0
- package/dist/utils/componentSources.js +50 -0
- package/dist/utils/componentSources.js.map +1 -0
- package/dist/utils/cssBox.d.ts +42 -0
- package/dist/utils/cssBox.d.ts.map +1 -0
- package/dist/utils/cssBox.js +151 -0
- package/dist/utils/cssBox.js.map +1 -0
- package/dist/utils/decodeStyleEntities.d.ts +15 -0
- package/dist/utils/decodeStyleEntities.d.ts.map +1 -0
- package/dist/utils/decodeStyleEntities.js +18 -0
- package/dist/utils/decodeStyleEntities.js.map +1 -0
- package/dist/utils/{detect.d.mts → detect.d.ts} +1 -1
- package/dist/utils/detect.d.ts.map +1 -0
- package/dist/utils/{detect.mjs → detect.js} +2 -3
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/output-markers.d.ts +29 -0
- package/dist/utils/output-markers.d.ts.map +1 -0
- package/dist/utils/output-markers.js +68 -0
- package/dist/utils/output-markers.js.map +1 -0
- package/dist/utils/{url.d.mts → url.d.ts} +1 -1
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/{url.mjs → url.js} +2 -3
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/watchPaths.d.ts +11 -0
- package/dist/utils/watchPaths.d.ts.map +1 -0
- package/dist/utils/watchPaths.js +19 -0
- package/dist/utils/watchPaths.js.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +44 -0
- package/node_modules/@clack/core/dist/index.d.mts +125 -5
- package/node_modules/@clack/core/dist/index.mjs +972 -11
- package/node_modules/@clack/core/package.json +6 -2
- package/node_modules/@clack/prompts/CHANGELOG.md +70 -0
- package/node_modules/@clack/prompts/README.md +129 -3
- package/node_modules/@clack/prompts/dist/index.d.mts +567 -33
- package/node_modules/@clack/prompts/dist/index.mjs +1378 -133
- package/node_modules/@clack/prompts/package.json +7 -4
- package/node_modules/fast-string-truncated-width/dist/index.js +36 -96
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +0 -3
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +3 -3
- package/node_modules/fast-string-truncated-width/dist/utils.js +14 -9
- package/node_modules/fast-string-truncated-width/package.json +1 -1
- package/node_modules/fast-string-truncated-width/readme.md +2 -3
- package/node_modules/fast-string-width/package.json +2 -2
- package/node_modules/fast-string-width/readme.md +0 -3
- package/node_modules/fast-wrap-ansi/lib/main.js +4 -2
- package/node_modules/fast-wrap-ansi/package.json +11 -11
- package/node_modules/maizzle/README.md +24 -0
- package/node_modules/maizzle/dist/commands/make/component.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/config.mjs +8 -7
- package/node_modules/maizzle/dist/commands/make/layout.mjs +3 -3
- package/node_modules/maizzle/dist/commands/make/scaffold.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/stubs/Layout.vue +146 -0
- package/node_modules/maizzle/dist/commands/make/stubs/component.vue +2 -4
- package/node_modules/maizzle/dist/commands/make/stubs/config.ts +1 -5
- package/node_modules/maizzle/dist/commands/make/template.mjs +1 -1
- package/node_modules/maizzle/dist/commands/new.mjs +46 -135
- package/node_modules/maizzle/dist/index.d.mts +1 -0
- package/node_modules/maizzle/dist/index.mjs +30 -7
- package/node_modules/maizzle/package.json +5 -4
- package/node_modules/nypm/dist/cli.mjs +28 -5
- package/node_modules/nypm/dist/index.d.mts +0 -8
- package/node_modules/nypm/dist/index.mjs +27 -4
- package/node_modules/nypm/package.json +12 -12
- package/node_modules/tinyexec/README.md +9 -1
- package/node_modules/tinyexec/dist/main.d.mts +22 -7
- package/node_modules/tinyexec/dist/main.mjs +189 -491
- package/node_modules/tinyexec/package.json +14 -16
- package/package.json +37 -30
- package/dist/_virtual/_rolldown/runtime.mjs +0 -32
- package/dist/build.d.mts +0 -19
- package/dist/build.d.mts.map +0 -1
- package/dist/build.mjs +0 -141
- package/dist/build.mjs.map +0 -1
- package/dist/components/Divider.vue +0 -133
- package/dist/components/Image.vue +0 -70
- package/dist/components/Overlap.vue +0 -80
- package/dist/components/utils.d.mts +0 -5
- package/dist/components/utils.d.mts.map +0 -1
- package/dist/components/utils.mjs +0 -9
- package/dist/components/utils.mjs.map +0 -1
- package/dist/composables/defineConfig.d.mts +0 -14
- package/dist/composables/defineConfig.d.mts.map +0 -1
- package/dist/composables/defineConfig.mjs.map +0 -1
- package/dist/composables/renderContext.d.mts +0 -24
- package/dist/composables/renderContext.d.mts.map +0 -1
- package/dist/composables/renderContext.mjs +0 -6
- package/dist/composables/renderContext.mjs.map +0 -1
- package/dist/composables/useConfig.d.mts +0 -9
- package/dist/composables/useConfig.d.mts.map +0 -1
- package/dist/composables/useConfig.mjs +0 -13
- package/dist/composables/useConfig.mjs.map +0 -1
- package/dist/composables/useDoctype.d.mts.map +0 -1
- package/dist/composables/useDoctype.mjs.map +0 -1
- package/dist/composables/useEvent.d.mts.map +0 -1
- package/dist/composables/useEvent.mjs.map +0 -1
- package/dist/composables/usePlaintext.d.mts.map +0 -1
- package/dist/composables/usePlaintext.mjs.map +0 -1
- package/dist/composables/usePreviewText.d.mts +0 -24
- package/dist/composables/usePreviewText.d.mts.map +0 -1
- package/dist/composables/usePreviewText.mjs +0 -29
- package/dist/composables/usePreviewText.mjs.map +0 -1
- package/dist/config/defaults.d.mts.map +0 -1
- package/dist/config/defaults.mjs.map +0 -1
- package/dist/config/index.d.mts +0 -15
- package/dist/config/index.d.mts.map +0 -1
- package/dist/config/index.mjs.map +0 -1
- package/dist/events/index.d.mts.map +0 -1
- package/dist/events/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -31
- package/dist/index.mjs +0 -31
- package/dist/node_modules/picomatch/index.mjs +0 -13
- package/dist/node_modules/picomatch/index.mjs.map +0 -1
- package/dist/node_modules/picomatch/lib/constants.mjs +0 -174
- package/dist/node_modules/picomatch/lib/constants.mjs.map +0 -1
- package/dist/node_modules/picomatch/lib/parse.mjs +0 -1067
- package/dist/node_modules/picomatch/lib/parse.mjs.map +0 -1
- package/dist/node_modules/picomatch/lib/picomatch.mjs +0 -304
- package/dist/node_modules/picomatch/lib/picomatch.mjs.map +0 -1
- package/dist/node_modules/picomatch/lib/scan.mjs +0 -296
- package/dist/node_modules/picomatch/lib/scan.mjs.map +0 -1
- package/dist/node_modules/picomatch/lib/utils.mjs +0 -53
- package/dist/node_modules/picomatch/lib/utils.mjs.map +0 -1
- package/dist/plaintext.d.mts.map +0 -1
- package/dist/plaintext.mjs.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/plugin.mjs.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
- package/dist/plugins/postcss/pruneVars.d.mts.map +0 -1
- package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.d.mts.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
- package/dist/render/createRenderer.d.mts.map +0 -1
- package/dist/render/createRenderer.mjs +0 -286
- package/dist/render/createRenderer.mjs.map +0 -1
- package/dist/render/index.d.mts +0 -26
- package/dist/render/index.d.mts.map +0 -1
- package/dist/render/index.mjs +0 -46
- package/dist/render/index.mjs.map +0 -1
- package/dist/serve.d.mts.map +0 -1
- package/dist/serve.mjs.map +0 -1
- package/dist/server/compatibility.d.mts +0 -5
- package/dist/server/compatibility.d.mts.map +0 -1
- package/dist/server/compatibility.mjs +0 -97
- package/dist/server/compatibility.mjs.map +0 -1
- package/dist/server/email.d.mts.map +0 -1
- package/dist/server/email.mjs.map +0 -1
- package/dist/server/linter.d.mts +0 -5
- package/dist/server/linter.d.mts.map +0 -1
- package/dist/server/linter.mjs +0 -189
- package/dist/server/linter.mjs.map +0 -1
- package/dist/transformers/addAttributes.d.mts +0 -32
- package/dist/transformers/addAttributes.d.mts.map +0 -1
- package/dist/transformers/addAttributes.mjs.map +0 -1
- package/dist/transformers/attributeToStyle.d.mts +0 -25
- package/dist/transformers/attributeToStyle.d.mts.map +0 -1
- package/dist/transformers/attributeToStyle.mjs +0 -80
- package/dist/transformers/attributeToStyle.mjs.map +0 -1
- package/dist/transformers/base.d.mts +0 -8
- package/dist/transformers/base.d.mts.map +0 -1
- package/dist/transformers/base.mjs.map +0 -1
- package/dist/transformers/entities.d.mts +0 -8
- package/dist/transformers/entities.d.mts.map +0 -1
- package/dist/transformers/entities.mjs +0 -41
- package/dist/transformers/entities.mjs.map +0 -1
- package/dist/transformers/filters/defaults.d.mts.map +0 -1
- package/dist/transformers/filters/defaults.mjs.map +0 -1
- package/dist/transformers/filters/index.d.mts +0 -22
- package/dist/transformers/filters/index.d.mts.map +0 -1
- package/dist/transformers/filters/index.mjs +0 -67
- package/dist/transformers/filters/index.mjs.map +0 -1
- package/dist/transformers/format.d.mts +0 -15
- package/dist/transformers/format.d.mts.map +0 -1
- package/dist/transformers/format.mjs +0 -26
- package/dist/transformers/format.mjs.map +0 -1
- package/dist/transformers/index.d.mts.map +0 -1
- package/dist/transformers/index.mjs +0 -81
- package/dist/transformers/index.mjs.map +0 -1
- package/dist/transformers/inlineCSS.d.mts +0 -17
- package/dist/transformers/inlineCSS.d.mts.map +0 -1
- package/dist/transformers/inlineCSS.mjs +0 -70
- package/dist/transformers/inlineCSS.mjs.map +0 -1
- package/dist/transformers/inlineLink.d.mts +0 -14
- package/dist/transformers/inlineLink.d.mts.map +0 -1
- package/dist/transformers/inlineLink.mjs.map +0 -1
- package/dist/transformers/minify.d.mts +0 -17
- package/dist/transformers/minify.d.mts.map +0 -1
- package/dist/transformers/minify.mjs +0 -24
- package/dist/transformers/minify.mjs.map +0 -1
- package/dist/transformers/purgeCSS.d.mts +0 -23
- package/dist/transformers/purgeCSS.d.mts.map +0 -1
- package/dist/transformers/purgeCSS.mjs +0 -132
- package/dist/transformers/purgeCSS.mjs.map +0 -1
- package/dist/transformers/removeAttributes.d.mts +0 -31
- package/dist/transformers/removeAttributes.d.mts.map +0 -1
- package/dist/transformers/removeAttributes.mjs +0 -63
- package/dist/transformers/removeAttributes.mjs.map +0 -1
- package/dist/transformers/replaceStrings.d.mts.map +0 -1
- package/dist/transformers/replaceStrings.mjs.map +0 -1
- package/dist/transformers/safeClassNames.d.mts +0 -22
- package/dist/transformers/safeClassNames.d.mts.map +0 -1
- package/dist/transformers/safeClassNames.mjs.map +0 -1
- package/dist/transformers/shorthandCSS.d.mts +0 -24
- package/dist/transformers/shorthandCSS.d.mts.map +0 -1
- package/dist/transformers/shorthandCSS.mjs +0 -48
- package/dist/transformers/shorthandCSS.mjs.map +0 -1
- package/dist/transformers/sixHex.d.mts +0 -16
- package/dist/transformers/sixHex.d.mts.map +0 -1
- package/dist/transformers/sixHex.mjs +0 -30
- package/dist/transformers/sixHex.mjs.map +0 -1
- package/dist/transformers/tailwindcss.d.mts.map +0 -1
- package/dist/transformers/tailwindcss.mjs.map +0 -1
- package/dist/transformers/urlQuery.d.mts +0 -24
- package/dist/transformers/urlQuery.d.mts.map +0 -1
- package/dist/transformers/urlQuery.mjs +0 -65
- package/dist/transformers/urlQuery.mjs.map +0 -1
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs +0 -1
- package/dist/types/index.d.mts +0 -2
- package/dist/types/index.mjs +0 -1
- package/dist/utils/ast/index.d.mts +0 -4
- package/dist/utils/ast/index.mjs +0 -5
- package/dist/utils/ast/parser.d.mts.map +0 -1
- package/dist/utils/ast/parser.mjs.map +0 -1
- package/dist/utils/ast/serializer.d.mts.map +0 -1
- package/dist/utils/ast/serializer.mjs +0 -37
- package/dist/utils/ast/serializer.mjs.map +0 -1
- package/dist/utils/ast/walker.d.mts.map +0 -1
- package/dist/utils/ast/walker.mjs.map +0 -1
- package/dist/utils/detect.d.mts.map +0 -1
- package/dist/utils/detect.mjs.map +0 -1
- package/dist/utils/url.d.mts.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/node_modules/@clack/core/dist/index.mjs.map +0 -1
- package/node_modules/@clack/prompts/dist/index.mjs.map +0 -1
- package/node_modules/fast-wrap-ansi/lib/main.js.map +0 -1
- package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
- package/node_modules/tinyexec/dist/LICENSES.txt +0 -83
|
@@ -0,0 +1,1859 @@
|
|
|
1
|
+
import { $n as toRef$1, Bt as onUnmounted, Gn as reactive, Hn as onScopeDispose, It as onMounted, Kn as readonly, Ln as isReactive, Mt as onBeforeUnmount, Nn as effectScope, Pn as getCurrentScope, St as inject, W as computed, Wt as provide, Xn as shallowRef, Yn as shallowReadonly, _n as watch, dt as getCurrentInstance, er as toRefs$1, gt as hasInjectionContext, jn as customRef, jt as onBeforeMount, kt as nextTick, qn as ref, rr as unref, tr as toValue, vn as watchEffect, zn as isRef } from "./vue.runtime.esm-bundler-DaqjATE_.js";
|
|
2
|
+
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@vueuse/shared/dist/index.js
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @deprecated This function will be removed in future version.
|
|
6
|
+
*
|
|
7
|
+
* Note: If you are using Vue 3.4+, you can straight use computed instead.
|
|
8
|
+
* Because in Vue 3.4+, if computed new value does not change,
|
|
9
|
+
* computed, effect, watch, watchEffect, render dependencies will not be triggered.
|
|
10
|
+
* refer: https://github.com/vuejs/core/pull/5912
|
|
11
|
+
*
|
|
12
|
+
* @param fn effect function
|
|
13
|
+
* @param options WatchOptionsBase
|
|
14
|
+
* @returns readonly shallowRef
|
|
15
|
+
*/
|
|
16
|
+
function computedEager(fn, options) {
|
|
17
|
+
var _options$flush;
|
|
18
|
+
const result = shallowRef();
|
|
19
|
+
watchEffect(() => {
|
|
20
|
+
result.value = fn();
|
|
21
|
+
}, {
|
|
22
|
+
...options,
|
|
23
|
+
flush: (_options$flush = options === null || options === void 0 ? void 0 : options.flush) !== null && _options$flush !== void 0 ? _options$flush : "sync"
|
|
24
|
+
});
|
|
25
|
+
return readonly(result);
|
|
26
|
+
}
|
|
27
|
+
/** @deprecated use `computedEager` instead */
|
|
28
|
+
var eagerComputed = computedEager;
|
|
29
|
+
/**
|
|
30
|
+
* Explicitly define the deps of computed.
|
|
31
|
+
*
|
|
32
|
+
* @param source
|
|
33
|
+
* @param fn
|
|
34
|
+
*/
|
|
35
|
+
function computedWithControl(source, fn, options = {}) {
|
|
36
|
+
let v = void 0;
|
|
37
|
+
let track;
|
|
38
|
+
let trigger;
|
|
39
|
+
let dirty = true;
|
|
40
|
+
const update = () => {
|
|
41
|
+
dirty = true;
|
|
42
|
+
trigger();
|
|
43
|
+
};
|
|
44
|
+
watch(source, update, {
|
|
45
|
+
flush: "sync",
|
|
46
|
+
...options
|
|
47
|
+
});
|
|
48
|
+
const get = typeof fn === "function" ? fn : fn.get;
|
|
49
|
+
const set = typeof fn === "function" ? void 0 : fn.set;
|
|
50
|
+
const result = customRef((_track, _trigger) => {
|
|
51
|
+
track = _track;
|
|
52
|
+
trigger = _trigger;
|
|
53
|
+
return {
|
|
54
|
+
get() {
|
|
55
|
+
if (dirty) {
|
|
56
|
+
v = get(v);
|
|
57
|
+
dirty = false;
|
|
58
|
+
}
|
|
59
|
+
track();
|
|
60
|
+
return v;
|
|
61
|
+
},
|
|
62
|
+
set(v) {
|
|
63
|
+
set === null || set === void 0 || set(v);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
result.trigger = update;
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
/** @deprecated use `computedWithControl` instead */
|
|
71
|
+
var controlledComputed = computedWithControl;
|
|
72
|
+
/**
|
|
73
|
+
* Utility for authoring disposable directives. Reactive effects created within `mounted` directive hook will be tracked and automatically disposed when directive is unmounted.
|
|
74
|
+
*
|
|
75
|
+
* @see https://vueuse.org/createDisposableDirective
|
|
76
|
+
*
|
|
77
|
+
* @__NO_SIDE_EFFECTS__
|
|
78
|
+
*/
|
|
79
|
+
function createDisposableDirective(origin = {}) {
|
|
80
|
+
function isFunc(fn) {
|
|
81
|
+
return typeof fn === "function";
|
|
82
|
+
}
|
|
83
|
+
const normalisedOrigin = isFunc(origin) ? {
|
|
84
|
+
mounted: origin,
|
|
85
|
+
updated: origin
|
|
86
|
+
} : origin;
|
|
87
|
+
const { mounted, unmounted } = normalisedOrigin;
|
|
88
|
+
if (!isFunc(mounted)) return origin;
|
|
89
|
+
const scopeWeakMap = /* @__PURE__ */ new WeakMap();
|
|
90
|
+
return {
|
|
91
|
+
...normalisedOrigin,
|
|
92
|
+
mounted(el, binding, vNode, prevNode) {
|
|
93
|
+
var _scopeWeakMap$get;
|
|
94
|
+
const scope = (_scopeWeakMap$get = scopeWeakMap.get(el)) !== null && _scopeWeakMap$get !== void 0 ? _scopeWeakMap$get : effectScope();
|
|
95
|
+
scopeWeakMap.set(el, scope);
|
|
96
|
+
scope.run(() => {
|
|
97
|
+
mounted === null || mounted === void 0 || mounted(el, binding, vNode, prevNode);
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
unmounted(el, binding, vNode, prevNode) {
|
|
101
|
+
var _scopeWeakMap$get2;
|
|
102
|
+
(_scopeWeakMap$get2 = scopeWeakMap.get(el)) === null || _scopeWeakMap$get2 === void 0 || _scopeWeakMap$get2.stop();
|
|
103
|
+
scopeWeakMap.delete(el);
|
|
104
|
+
if (isFunc(unmounted)) unmounted(el, binding, vNode, prevNode);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
110
|
+
*
|
|
111
|
+
* @param fn
|
|
112
|
+
*/
|
|
113
|
+
function tryOnScopeDispose(fn, failSilently) {
|
|
114
|
+
if (getCurrentScope()) {
|
|
115
|
+
onScopeDispose(fn, failSilently);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Utility for creating event hooks
|
|
122
|
+
*
|
|
123
|
+
* @see https://vueuse.org/createEventHook
|
|
124
|
+
*
|
|
125
|
+
* @__NO_SIDE_EFFECTS__
|
|
126
|
+
*/
|
|
127
|
+
function createEventHook() {
|
|
128
|
+
const fns = /* @__PURE__ */ new Set();
|
|
129
|
+
const off = (fn) => {
|
|
130
|
+
fns.delete(fn);
|
|
131
|
+
};
|
|
132
|
+
const clear = () => {
|
|
133
|
+
fns.clear();
|
|
134
|
+
};
|
|
135
|
+
const on = (fn) => {
|
|
136
|
+
fns.add(fn);
|
|
137
|
+
const offFn = () => off(fn);
|
|
138
|
+
tryOnScopeDispose(offFn);
|
|
139
|
+
return { off: offFn };
|
|
140
|
+
};
|
|
141
|
+
const trigger = (...args) => {
|
|
142
|
+
return Promise.all(Array.from(fns).map((fn) => fn(...args)));
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
on,
|
|
146
|
+
off,
|
|
147
|
+
trigger,
|
|
148
|
+
clear
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Keep states in the global scope to be reusable across Vue instances.
|
|
153
|
+
*
|
|
154
|
+
* @see https://vueuse.org/createGlobalState
|
|
155
|
+
* @param stateFactory A factory function to create the state
|
|
156
|
+
*
|
|
157
|
+
* @__NO_SIDE_EFFECTS__
|
|
158
|
+
*/
|
|
159
|
+
function createGlobalState(stateFactory) {
|
|
160
|
+
let initialized = false;
|
|
161
|
+
let state;
|
|
162
|
+
const scope = effectScope(true);
|
|
163
|
+
return ((...args) => {
|
|
164
|
+
if (!initialized) {
|
|
165
|
+
state = scope.run(() => stateFactory(...args));
|
|
166
|
+
initialized = true;
|
|
167
|
+
}
|
|
168
|
+
return state;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
var localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
172
|
+
/**
|
|
173
|
+
* On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* injectLocal('MyInjectionKey', 1)
|
|
178
|
+
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @__NO_SIDE_EFFECTS__
|
|
182
|
+
*/
|
|
183
|
+
var injectLocal = (...args) => {
|
|
184
|
+
var _getCurrentInstance;
|
|
185
|
+
const key = args[0];
|
|
186
|
+
const instance = (_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy;
|
|
187
|
+
const owner = instance !== null && instance !== void 0 ? instance : getCurrentScope();
|
|
188
|
+
if (owner == null && !hasInjectionContext()) throw new Error("injectLocal must be called in setup");
|
|
189
|
+
if (owner && localProvidedStateMap.has(owner) && key in localProvidedStateMap.get(owner)) return localProvidedStateMap.get(owner)[key];
|
|
190
|
+
return inject(...args);
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* On the basis of `provide`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* provideLocal('MyInjectionKey', 1)
|
|
198
|
+
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
function provideLocal(key, value) {
|
|
202
|
+
var _getCurrentInstance;
|
|
203
|
+
const instance = (_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy;
|
|
204
|
+
const owner = instance !== null && instance !== void 0 ? instance : getCurrentScope();
|
|
205
|
+
if (owner == null) throw new Error("provideLocal must be called in setup");
|
|
206
|
+
if (!localProvidedStateMap.has(owner)) localProvidedStateMap.set(owner, Object.create(null));
|
|
207
|
+
const localProvidedState = localProvidedStateMap.get(owner);
|
|
208
|
+
localProvidedState[key] = value;
|
|
209
|
+
return provide(key, value);
|
|
210
|
+
}
|
|
211
|
+
function createInjectionState(composable, options) {
|
|
212
|
+
const key = (options === null || options === void 0 ? void 0 : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
213
|
+
const defaultValue = options === null || options === void 0 ? void 0 : options.defaultValue;
|
|
214
|
+
const useProvidingState = (...args) => {
|
|
215
|
+
const state = composable(...args);
|
|
216
|
+
provideLocal(key, state);
|
|
217
|
+
return state;
|
|
218
|
+
};
|
|
219
|
+
const useInjectedState = () => injectLocal(key, defaultValue);
|
|
220
|
+
return [useProvidingState, useInjectedState];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns a `deepRef` or `shallowRef` depending on the `deep` param.
|
|
224
|
+
*
|
|
225
|
+
* @example createRef(1) // ShallowRef<number>
|
|
226
|
+
* @example createRef(1, false) // ShallowRef<number>
|
|
227
|
+
* @example createRef(1, true) // Ref<number>
|
|
228
|
+
* @example createRef("string") // ShallowRef<string>
|
|
229
|
+
* @example createRef<"A"|"B">("A", true) // Ref<"A"|"B">
|
|
230
|
+
*
|
|
231
|
+
* @param value
|
|
232
|
+
* @param deep
|
|
233
|
+
* @returns the `deepRef` or `shallowRef`
|
|
234
|
+
*
|
|
235
|
+
* @__NO_SIDE_EFFECTS__
|
|
236
|
+
*/
|
|
237
|
+
function createRef(value, deep) {
|
|
238
|
+
if (deep === true) return ref(value);
|
|
239
|
+
else return shallowRef(value);
|
|
240
|
+
}
|
|
241
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
242
|
+
var isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
243
|
+
var isDef = (val) => typeof val !== "undefined";
|
|
244
|
+
var notNullish = (val) => val != null;
|
|
245
|
+
var assert = (condition, ...infos) => {
|
|
246
|
+
if (!condition) console.warn(...infos);
|
|
247
|
+
};
|
|
248
|
+
var toString = Object.prototype.toString;
|
|
249
|
+
var isObject = (val) => toString.call(val) === "[object Object]";
|
|
250
|
+
var now = () => Date.now();
|
|
251
|
+
var timestamp = () => +Date.now();
|
|
252
|
+
var clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
253
|
+
var noop = () => {};
|
|
254
|
+
var rand = (min, max) => {
|
|
255
|
+
min = Math.ceil(min);
|
|
256
|
+
max = Math.floor(max);
|
|
257
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
258
|
+
};
|
|
259
|
+
var hasOwn = (val, key) => Object.hasOwn(val, key);
|
|
260
|
+
var isIOS = /* @__PURE__ */ getIsIOS();
|
|
261
|
+
function getIsIOS() {
|
|
262
|
+
var _window, _window2, _window3;
|
|
263
|
+
return isClient && !!((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.navigator) === null || _window2 === void 0 ? void 0 : _window2.maxTouchPoints) > 2 && /iPad|Macintosh/.test((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.navigator.userAgent));
|
|
264
|
+
}
|
|
265
|
+
function toRef(...args) {
|
|
266
|
+
if (args.length !== 1) return toRef$1(...args);
|
|
267
|
+
const r = args[0];
|
|
268
|
+
return typeof r === "function" ? readonly(customRef(() => ({
|
|
269
|
+
get: r,
|
|
270
|
+
set: noop
|
|
271
|
+
}))) : ref(r);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @internal
|
|
275
|
+
*/
|
|
276
|
+
function createFilterWrapper(filter, fn) {
|
|
277
|
+
function wrapper(...args) {
|
|
278
|
+
return new Promise((resolve, reject) => {
|
|
279
|
+
Promise.resolve(filter(() => fn.apply(this, args), {
|
|
280
|
+
fn,
|
|
281
|
+
thisArg: this,
|
|
282
|
+
args
|
|
283
|
+
})).then(resolve).catch(reject);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return wrapper;
|
|
287
|
+
}
|
|
288
|
+
var bypassFilter = (invoke) => {
|
|
289
|
+
return invoke();
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Create an EventFilter that debounce the events
|
|
293
|
+
*/
|
|
294
|
+
function debounceFilter(ms, options = {}) {
|
|
295
|
+
let timer;
|
|
296
|
+
let maxTimer;
|
|
297
|
+
let lastRejector = noop;
|
|
298
|
+
const _clearTimeout = (timer) => {
|
|
299
|
+
clearTimeout(timer);
|
|
300
|
+
lastRejector();
|
|
301
|
+
lastRejector = noop;
|
|
302
|
+
};
|
|
303
|
+
let lastInvoker;
|
|
304
|
+
const filter = (invoke) => {
|
|
305
|
+
const duration = toValue(ms);
|
|
306
|
+
const maxDuration = toValue(options.maxWait);
|
|
307
|
+
if (timer) _clearTimeout(timer);
|
|
308
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
309
|
+
if (maxTimer) {
|
|
310
|
+
_clearTimeout(maxTimer);
|
|
311
|
+
maxTimer = void 0;
|
|
312
|
+
}
|
|
313
|
+
return Promise.resolve(invoke());
|
|
314
|
+
}
|
|
315
|
+
return new Promise((resolve, reject) => {
|
|
316
|
+
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
317
|
+
lastInvoker = invoke;
|
|
318
|
+
if (maxDuration && !maxTimer) maxTimer = setTimeout(() => {
|
|
319
|
+
if (timer) _clearTimeout(timer);
|
|
320
|
+
maxTimer = void 0;
|
|
321
|
+
resolve(lastInvoker());
|
|
322
|
+
}, maxDuration);
|
|
323
|
+
timer = setTimeout(() => {
|
|
324
|
+
if (maxTimer) _clearTimeout(maxTimer);
|
|
325
|
+
maxTimer = void 0;
|
|
326
|
+
resolve(invoke());
|
|
327
|
+
}, duration);
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
return filter;
|
|
331
|
+
}
|
|
332
|
+
function throttleFilter(...args) {
|
|
333
|
+
let lastExec = 0;
|
|
334
|
+
let timer;
|
|
335
|
+
let isLeading = true;
|
|
336
|
+
let lastRejector = noop;
|
|
337
|
+
let lastValue;
|
|
338
|
+
let ms;
|
|
339
|
+
let trailing;
|
|
340
|
+
let leading;
|
|
341
|
+
let rejectOnCancel;
|
|
342
|
+
if (!isRef(args[0]) && typeof args[0] === "object") ({delay: ms, trailing = true, leading = true, rejectOnCancel = false} = args[0]);
|
|
343
|
+
else [ms, trailing = true, leading = true, rejectOnCancel = false] = args;
|
|
344
|
+
const clear = () => {
|
|
345
|
+
if (timer) {
|
|
346
|
+
clearTimeout(timer);
|
|
347
|
+
timer = void 0;
|
|
348
|
+
lastRejector();
|
|
349
|
+
lastRejector = noop;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
const filter = (_invoke) => {
|
|
353
|
+
const duration = toValue(ms);
|
|
354
|
+
const elapsed = Date.now() - lastExec;
|
|
355
|
+
const invoke = () => {
|
|
356
|
+
return lastValue = _invoke();
|
|
357
|
+
};
|
|
358
|
+
clear();
|
|
359
|
+
if (duration <= 0) {
|
|
360
|
+
lastExec = Date.now();
|
|
361
|
+
return invoke();
|
|
362
|
+
}
|
|
363
|
+
if (elapsed > duration) {
|
|
364
|
+
lastExec = Date.now();
|
|
365
|
+
if (leading || !isLeading) invoke();
|
|
366
|
+
} else if (trailing) lastValue = new Promise((resolve, reject) => {
|
|
367
|
+
lastRejector = rejectOnCancel ? reject : resolve;
|
|
368
|
+
timer = setTimeout(() => {
|
|
369
|
+
lastExec = Date.now();
|
|
370
|
+
isLeading = true;
|
|
371
|
+
resolve(invoke());
|
|
372
|
+
clear();
|
|
373
|
+
}, Math.max(0, duration - elapsed));
|
|
374
|
+
});
|
|
375
|
+
if (!leading && !timer) timer = setTimeout(() => isLeading = true, duration);
|
|
376
|
+
isLeading = false;
|
|
377
|
+
return lastValue;
|
|
378
|
+
};
|
|
379
|
+
return filter;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* EventFilter that gives extra controls to pause and resume the filter
|
|
383
|
+
*
|
|
384
|
+
* @param extendFilter Extra filter to apply when the PausableFilter is active, default to none
|
|
385
|
+
* @param options Options to configure the filter
|
|
386
|
+
*/
|
|
387
|
+
function pausableFilter(extendFilter = bypassFilter, options = {}) {
|
|
388
|
+
const { initialState = "active" } = options;
|
|
389
|
+
const isActive = toRef(initialState === "active");
|
|
390
|
+
function pause() {
|
|
391
|
+
isActive.value = false;
|
|
392
|
+
}
|
|
393
|
+
function resume() {
|
|
394
|
+
isActive.value = true;
|
|
395
|
+
}
|
|
396
|
+
const eventFilter = (...args) => {
|
|
397
|
+
if (isActive.value) extendFilter(...args);
|
|
398
|
+
};
|
|
399
|
+
return {
|
|
400
|
+
isActive: shallowReadonly(isActive),
|
|
401
|
+
pause,
|
|
402
|
+
resume,
|
|
403
|
+
eventFilter
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
407
|
+
return new Promise((resolve, reject) => {
|
|
408
|
+
if (throwOnTimeout) setTimeout(reject, ms, reason);
|
|
409
|
+
else setTimeout(resolve, ms);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function identity(arg) {
|
|
413
|
+
return arg;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Create singleton promise function
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```
|
|
420
|
+
* const promise = createSingletonPromise(async () => { ... })
|
|
421
|
+
*
|
|
422
|
+
* await promise()
|
|
423
|
+
* await promise() // all of them will be bind to a single promise instance
|
|
424
|
+
* await promise() // and be resolved together
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
function createSingletonPromise(fn) {
|
|
428
|
+
let _promise;
|
|
429
|
+
function wrapper() {
|
|
430
|
+
if (!_promise) _promise = fn();
|
|
431
|
+
return _promise;
|
|
432
|
+
}
|
|
433
|
+
wrapper.reset = async () => {
|
|
434
|
+
const _prev = _promise;
|
|
435
|
+
_promise = void 0;
|
|
436
|
+
if (_prev) await _prev;
|
|
437
|
+
};
|
|
438
|
+
return wrapper;
|
|
439
|
+
}
|
|
440
|
+
function invoke(fn) {
|
|
441
|
+
return fn();
|
|
442
|
+
}
|
|
443
|
+
function containsProp(obj, ...props) {
|
|
444
|
+
return props.some((k) => k in obj);
|
|
445
|
+
}
|
|
446
|
+
function increaseWithUnit(target, delta) {
|
|
447
|
+
var _target$match;
|
|
448
|
+
if (typeof target === "number") return target + delta;
|
|
449
|
+
const value = ((_target$match = target.match(/^-?\d+\.?\d*/)) === null || _target$match === void 0 ? void 0 : _target$match[0]) || "";
|
|
450
|
+
const unit = target.slice(value.length);
|
|
451
|
+
const result = Number.parseFloat(value) + delta;
|
|
452
|
+
if (Number.isNaN(result)) return target;
|
|
453
|
+
return result + unit;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
|
|
457
|
+
*/
|
|
458
|
+
function pxValue(px) {
|
|
459
|
+
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Create a new subset object by giving keys
|
|
463
|
+
*/
|
|
464
|
+
function objectPick(obj, keys, omitUndefined = false) {
|
|
465
|
+
return keys.reduce((n, k) => {
|
|
466
|
+
if (k in obj) {
|
|
467
|
+
if (!omitUndefined || obj[k] !== void 0) n[k] = obj[k];
|
|
468
|
+
}
|
|
469
|
+
return n;
|
|
470
|
+
}, {});
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Create a new subset object by omit giving keys
|
|
474
|
+
*/
|
|
475
|
+
function objectOmit(obj, keys, omitUndefined = false) {
|
|
476
|
+
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
477
|
+
return (!omitUndefined || value !== void 0) && !keys.includes(key);
|
|
478
|
+
}));
|
|
479
|
+
}
|
|
480
|
+
function objectEntries(obj) {
|
|
481
|
+
return Object.entries(obj);
|
|
482
|
+
}
|
|
483
|
+
function toArray(value) {
|
|
484
|
+
return Array.isArray(value) ? value : [value];
|
|
485
|
+
}
|
|
486
|
+
function cacheStringFunction(fn) {
|
|
487
|
+
const cache = Object.create(null);
|
|
488
|
+
return ((str) => {
|
|
489
|
+
return cache[str] || (cache[str] = fn(str));
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
var hyphenateRE = /\B([A-Z])/g;
|
|
493
|
+
var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
494
|
+
var camelizeRE = /-(\w)/g;
|
|
495
|
+
var camelize = cacheStringFunction((str) => {
|
|
496
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
497
|
+
});
|
|
498
|
+
function getLifeCycleTarget(target) {
|
|
499
|
+
return target || getCurrentInstance();
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Make a composable function usable with multiple Vue instances.
|
|
503
|
+
*
|
|
504
|
+
* @see https://vueuse.org/createSharedComposable
|
|
505
|
+
*
|
|
506
|
+
* @__NO_SIDE_EFFECTS__
|
|
507
|
+
*/
|
|
508
|
+
function createSharedComposable(composable) {
|
|
509
|
+
if (!isClient) return composable;
|
|
510
|
+
let subscribers = 0;
|
|
511
|
+
let state;
|
|
512
|
+
let scope;
|
|
513
|
+
const dispose = () => {
|
|
514
|
+
subscribers -= 1;
|
|
515
|
+
if (scope && subscribers <= 0) {
|
|
516
|
+
scope.stop();
|
|
517
|
+
state = void 0;
|
|
518
|
+
scope = void 0;
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
return ((...args) => {
|
|
522
|
+
subscribers += 1;
|
|
523
|
+
if (!scope) {
|
|
524
|
+
scope = effectScope(true);
|
|
525
|
+
state = scope.run(() => composable(...args));
|
|
526
|
+
}
|
|
527
|
+
tryOnScopeDispose(dispose);
|
|
528
|
+
return state;
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
|
|
532
|
+
for (const [key, value] of Object.entries(extend)) {
|
|
533
|
+
if (key === "value") continue;
|
|
534
|
+
if (isRef(value) && unwrap) Object.defineProperty(ref, key, {
|
|
535
|
+
get() {
|
|
536
|
+
return value.value;
|
|
537
|
+
},
|
|
538
|
+
set(v) {
|
|
539
|
+
value.value = v;
|
|
540
|
+
},
|
|
541
|
+
enumerable
|
|
542
|
+
});
|
|
543
|
+
else Object.defineProperty(ref, key, {
|
|
544
|
+
value,
|
|
545
|
+
enumerable
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
return ref;
|
|
549
|
+
}
|
|
550
|
+
function get(obj, key) {
|
|
551
|
+
if (key == null) return unref(obj);
|
|
552
|
+
return unref(obj)[key];
|
|
553
|
+
}
|
|
554
|
+
function isDefined(v) {
|
|
555
|
+
return unref(v) != null;
|
|
556
|
+
}
|
|
557
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
558
|
+
function makeDestructurable(obj, arr) {
|
|
559
|
+
if (typeof Symbol !== "undefined") {
|
|
560
|
+
const clone = { ...obj };
|
|
561
|
+
Object.defineProperty(clone, Symbol.iterator, {
|
|
562
|
+
enumerable: false,
|
|
563
|
+
value() {
|
|
564
|
+
let index = 0;
|
|
565
|
+
return { next: () => ({
|
|
566
|
+
value: arr[index++],
|
|
567
|
+
done: index > arr.length
|
|
568
|
+
}) };
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
return clone;
|
|
572
|
+
} else return Object.assign([...arr], obj);
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Converts plain function into a reactive function.
|
|
576
|
+
* The converted function accepts refs as it's arguments
|
|
577
|
+
* and returns a ComputedRef, with proper typing.
|
|
578
|
+
*
|
|
579
|
+
* @param fn - Source function
|
|
580
|
+
* @param options - Options
|
|
581
|
+
*
|
|
582
|
+
* @__NO_SIDE_EFFECTS__
|
|
583
|
+
*/
|
|
584
|
+
function reactify(fn, options) {
|
|
585
|
+
const unrefFn = (options === null || options === void 0 ? void 0 : options.computedGetter) === false ? unref : toValue;
|
|
586
|
+
return function(...args) {
|
|
587
|
+
return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
/** @deprecated use `reactify` instead */
|
|
591
|
+
var createReactiveFn = reactify;
|
|
592
|
+
/**
|
|
593
|
+
* Apply `reactify` to an object
|
|
594
|
+
*
|
|
595
|
+
* @__NO_SIDE_EFFECTS__
|
|
596
|
+
*/
|
|
597
|
+
function reactifyObject(obj, optionsOrKeys = {}) {
|
|
598
|
+
let keys = [];
|
|
599
|
+
let options;
|
|
600
|
+
if (Array.isArray(optionsOrKeys)) keys = optionsOrKeys;
|
|
601
|
+
else {
|
|
602
|
+
options = optionsOrKeys;
|
|
603
|
+
const { includeOwnProperties = true } = optionsOrKeys;
|
|
604
|
+
keys.push(...Object.keys(obj));
|
|
605
|
+
if (includeOwnProperties) keys.push(...Object.getOwnPropertyNames(obj));
|
|
606
|
+
}
|
|
607
|
+
return Object.fromEntries(keys.map((key) => {
|
|
608
|
+
const value = obj[key];
|
|
609
|
+
return [key, typeof value === "function" ? reactify(value.bind(obj), options) : value];
|
|
610
|
+
}));
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Converts ref to reactive.
|
|
614
|
+
*
|
|
615
|
+
* @see https://vueuse.org/toReactive
|
|
616
|
+
* @param objectRef A ref of object
|
|
617
|
+
*/
|
|
618
|
+
function toReactive(objectRef) {
|
|
619
|
+
if (!isRef(objectRef)) return reactive(objectRef);
|
|
620
|
+
return reactive(new Proxy({}, {
|
|
621
|
+
get(_, p, receiver) {
|
|
622
|
+
return unref(Reflect.get(objectRef.value, p, receiver));
|
|
623
|
+
},
|
|
624
|
+
set(_, p, value) {
|
|
625
|
+
if (isRef(objectRef.value[p]) && !isRef(value)) objectRef.value[p].value = value;
|
|
626
|
+
else objectRef.value[p] = value;
|
|
627
|
+
return true;
|
|
628
|
+
},
|
|
629
|
+
deleteProperty(_, p) {
|
|
630
|
+
return Reflect.deleteProperty(objectRef.value, p);
|
|
631
|
+
},
|
|
632
|
+
has(_, p) {
|
|
633
|
+
return Reflect.has(objectRef.value, p);
|
|
634
|
+
},
|
|
635
|
+
ownKeys() {
|
|
636
|
+
return Object.keys(objectRef.value);
|
|
637
|
+
},
|
|
638
|
+
getOwnPropertyDescriptor() {
|
|
639
|
+
return {
|
|
640
|
+
enumerable: true,
|
|
641
|
+
configurable: true
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
}));
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Computed reactive object.
|
|
648
|
+
*/
|
|
649
|
+
function reactiveComputed(fn) {
|
|
650
|
+
return toReactive(computed(fn));
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Reactively omit fields from a reactive object
|
|
654
|
+
*
|
|
655
|
+
* @see https://vueuse.org/reactiveOmit
|
|
656
|
+
*/
|
|
657
|
+
function reactiveOmit(obj, ...keys) {
|
|
658
|
+
const flatKeys = keys.flat();
|
|
659
|
+
const predicate = flatKeys[0];
|
|
660
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Reactively pick fields from a reactive object
|
|
664
|
+
*
|
|
665
|
+
* @see https://vueuse.org/reactivePick
|
|
666
|
+
*/
|
|
667
|
+
function reactivePick(obj, ...keys) {
|
|
668
|
+
const flatKeys = keys.flat();
|
|
669
|
+
const predicate = flatKeys[0];
|
|
670
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Create a ref which will be reset to the default value after some time.
|
|
674
|
+
*
|
|
675
|
+
* @see https://vueuse.org/refAutoReset
|
|
676
|
+
* @param defaultValue The value which will be set.
|
|
677
|
+
* @param afterMs A zero-or-greater delay in milliseconds.
|
|
678
|
+
*/
|
|
679
|
+
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
680
|
+
return customRef((track, trigger) => {
|
|
681
|
+
let value = toValue(defaultValue);
|
|
682
|
+
let timer;
|
|
683
|
+
const resetAfter = () => setTimeout(() => {
|
|
684
|
+
value = toValue(defaultValue);
|
|
685
|
+
trigger();
|
|
686
|
+
}, toValue(afterMs));
|
|
687
|
+
tryOnScopeDispose(() => {
|
|
688
|
+
clearTimeout(timer);
|
|
689
|
+
});
|
|
690
|
+
return {
|
|
691
|
+
get() {
|
|
692
|
+
track();
|
|
693
|
+
return value;
|
|
694
|
+
},
|
|
695
|
+
set(newValue) {
|
|
696
|
+
value = newValue;
|
|
697
|
+
trigger();
|
|
698
|
+
clearTimeout(timer);
|
|
699
|
+
timer = resetAfter();
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
/** @deprecated use `refAutoReset` instead */
|
|
705
|
+
var autoResetRef = refAutoReset;
|
|
706
|
+
/**
|
|
707
|
+
* Debounce execution of a function.
|
|
708
|
+
*
|
|
709
|
+
* @see https://vueuse.org/useDebounceFn
|
|
710
|
+
* @param fn A function to be executed after delay milliseconds debounced.
|
|
711
|
+
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
712
|
+
* @param options Options
|
|
713
|
+
*
|
|
714
|
+
* @return A new, debounce, function.
|
|
715
|
+
*
|
|
716
|
+
* @__NO_SIDE_EFFECTS__
|
|
717
|
+
*/
|
|
718
|
+
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
719
|
+
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Debounce updates of a ref.
|
|
723
|
+
*
|
|
724
|
+
* @return A new debounced ref.
|
|
725
|
+
*/
|
|
726
|
+
function refDebounced(value, ms = 200, options = {}) {
|
|
727
|
+
const debounced = ref(toValue(value));
|
|
728
|
+
const updater = useDebounceFn(() => {
|
|
729
|
+
debounced.value = value.value;
|
|
730
|
+
}, ms, options);
|
|
731
|
+
watch(value, () => updater());
|
|
732
|
+
return shallowReadonly(debounced);
|
|
733
|
+
}
|
|
734
|
+
/** @deprecated use `refDebounced` instead */
|
|
735
|
+
var debouncedRef = refDebounced;
|
|
736
|
+
/** @deprecated use `refDebounced` instead */
|
|
737
|
+
var useDebounce = refDebounced;
|
|
738
|
+
/**
|
|
739
|
+
* Apply default value to a ref.
|
|
740
|
+
*
|
|
741
|
+
* @__NO_SIDE_EFFECTS__
|
|
742
|
+
*/
|
|
743
|
+
function refDefault(source, defaultValue) {
|
|
744
|
+
return computed({
|
|
745
|
+
get() {
|
|
746
|
+
var _source$value;
|
|
747
|
+
return (_source$value = source.value) !== null && _source$value !== void 0 ? _source$value : defaultValue;
|
|
748
|
+
},
|
|
749
|
+
set(value) {
|
|
750
|
+
source.value = value;
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Create a ref with manual reset functionality.
|
|
756
|
+
*
|
|
757
|
+
* @see https://vueuse.org/refManualReset
|
|
758
|
+
* @param defaultValue The value which will be set.
|
|
759
|
+
*/
|
|
760
|
+
function refManualReset(defaultValue) {
|
|
761
|
+
let value = toValue(defaultValue);
|
|
762
|
+
let trigger;
|
|
763
|
+
const reset = () => {
|
|
764
|
+
value = toValue(defaultValue);
|
|
765
|
+
trigger();
|
|
766
|
+
};
|
|
767
|
+
const refValue = customRef((track, _trigger) => {
|
|
768
|
+
trigger = _trigger;
|
|
769
|
+
return {
|
|
770
|
+
get() {
|
|
771
|
+
track();
|
|
772
|
+
return value;
|
|
773
|
+
},
|
|
774
|
+
set(newValue) {
|
|
775
|
+
value = newValue;
|
|
776
|
+
trigger();
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
});
|
|
780
|
+
refValue.reset = reset;
|
|
781
|
+
return refValue;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
785
|
+
* execution of handlers on events like resize and scroll.
|
|
786
|
+
*
|
|
787
|
+
* @param fn A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
788
|
+
* to `callback` when the throttled-function is executed.
|
|
789
|
+
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
790
|
+
* (default value: 200)
|
|
791
|
+
*
|
|
792
|
+
* @param [trailing] if true, call fn again after the time is up (default value: false)
|
|
793
|
+
*
|
|
794
|
+
* @param [leading] if true, call fn on the leading edge of the ms timeout (default value: true)
|
|
795
|
+
*
|
|
796
|
+
* @param [rejectOnCancel] if true, reject the last call if it's been cancel (default value: false)
|
|
797
|
+
*
|
|
798
|
+
* @return A new, throttled, function.
|
|
799
|
+
*
|
|
800
|
+
* @__NO_SIDE_EFFECTS__
|
|
801
|
+
*/
|
|
802
|
+
function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
|
|
803
|
+
return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn);
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
807
|
+
* execution of handlers on events like resize and scroll.
|
|
808
|
+
*
|
|
809
|
+
* @param value Ref value to be watched with throttle effect
|
|
810
|
+
* @param delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
811
|
+
* @param trailing if true, update the value again after the delay time is up
|
|
812
|
+
* @param leading if true, update the value on the leading edge of the ms timeout
|
|
813
|
+
*/
|
|
814
|
+
function refThrottled(value, delay = 200, trailing = true, leading = true) {
|
|
815
|
+
if (delay <= 0) return value;
|
|
816
|
+
const throttled = ref(toValue(value));
|
|
817
|
+
const updater = useThrottleFn(() => {
|
|
818
|
+
throttled.value = value.value;
|
|
819
|
+
}, delay, trailing, leading);
|
|
820
|
+
watch(value, () => updater());
|
|
821
|
+
return throttled;
|
|
822
|
+
}
|
|
823
|
+
/** @deprecated use `refThrottled` instead */
|
|
824
|
+
var throttledRef = refThrottled;
|
|
825
|
+
/** @deprecated use `refThrottled` instead */
|
|
826
|
+
var useThrottle = refThrottled;
|
|
827
|
+
/**
|
|
828
|
+
* Fine-grained controls over ref and its reactivity.
|
|
829
|
+
*
|
|
830
|
+
* @__NO_SIDE_EFFECTS__
|
|
831
|
+
*/
|
|
832
|
+
function refWithControl(initial, options = {}) {
|
|
833
|
+
let source = initial;
|
|
834
|
+
let track;
|
|
835
|
+
let trigger;
|
|
836
|
+
const ref = customRef((_track, _trigger) => {
|
|
837
|
+
track = _track;
|
|
838
|
+
trigger = _trigger;
|
|
839
|
+
return {
|
|
840
|
+
get() {
|
|
841
|
+
return get();
|
|
842
|
+
},
|
|
843
|
+
set(v) {
|
|
844
|
+
set(v);
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
});
|
|
848
|
+
function get(tracking = true) {
|
|
849
|
+
if (tracking) track();
|
|
850
|
+
return source;
|
|
851
|
+
}
|
|
852
|
+
function set(value, triggering = true) {
|
|
853
|
+
var _options$onBeforeChan, _options$onChanged;
|
|
854
|
+
if (value === source) return;
|
|
855
|
+
const old = source;
|
|
856
|
+
if (((_options$onBeforeChan = options.onBeforeChange) === null || _options$onBeforeChan === void 0 ? void 0 : _options$onBeforeChan.call(options, value, old)) === false) return;
|
|
857
|
+
source = value;
|
|
858
|
+
(_options$onChanged = options.onChanged) === null || _options$onChanged === void 0 || _options$onChanged.call(options, value, old);
|
|
859
|
+
if (triggering) trigger();
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Get the value without tracked in the reactivity system
|
|
863
|
+
*/
|
|
864
|
+
const untrackedGet = () => get(false);
|
|
865
|
+
/**
|
|
866
|
+
* Set the value without triggering the reactivity system
|
|
867
|
+
*/
|
|
868
|
+
const silentSet = (v) => set(v, false);
|
|
869
|
+
/**
|
|
870
|
+
* Get the value without tracked in the reactivity system.
|
|
871
|
+
*
|
|
872
|
+
* Alias for `untrackedGet()`
|
|
873
|
+
*/
|
|
874
|
+
const peek = () => get(false);
|
|
875
|
+
/**
|
|
876
|
+
* Set the value without triggering the reactivity system
|
|
877
|
+
*
|
|
878
|
+
* Alias for `silentSet(v)`
|
|
879
|
+
*/
|
|
880
|
+
const lay = (v) => set(v, false);
|
|
881
|
+
return extendRef(ref, {
|
|
882
|
+
get,
|
|
883
|
+
set,
|
|
884
|
+
untrackedGet,
|
|
885
|
+
silentSet,
|
|
886
|
+
peek,
|
|
887
|
+
lay
|
|
888
|
+
}, { enumerable: true });
|
|
889
|
+
}
|
|
890
|
+
/** @deprecated use `refWithControl` instead */
|
|
891
|
+
var controlledRef = refWithControl;
|
|
892
|
+
/**
|
|
893
|
+
* Shorthand for `ref.value = x`
|
|
894
|
+
*/
|
|
895
|
+
function set(...args) {
|
|
896
|
+
if (args.length === 2) {
|
|
897
|
+
const [ref, value] = args;
|
|
898
|
+
ref.value = value;
|
|
899
|
+
}
|
|
900
|
+
if (args.length === 3) {
|
|
901
|
+
const [target, key, value] = args;
|
|
902
|
+
target[key] = value;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
function watchWithFilter(source, cb, options = {}) {
|
|
906
|
+
const { eventFilter = bypassFilter, ...watchOptions } = options;
|
|
907
|
+
return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
908
|
+
}
|
|
909
|
+
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
910
|
+
function watchPausable(source, cb, options = {}) {
|
|
911
|
+
const { eventFilter: filter, initialState = "active", ...watchOptions } = options;
|
|
912
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });
|
|
913
|
+
return {
|
|
914
|
+
stop: watchWithFilter(source, cb, {
|
|
915
|
+
...watchOptions,
|
|
916
|
+
eventFilter
|
|
917
|
+
}),
|
|
918
|
+
pause,
|
|
919
|
+
resume,
|
|
920
|
+
isActive
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
924
|
+
var pausableWatch = watchPausable;
|
|
925
|
+
/**
|
|
926
|
+
* Two-way refs synchronization.
|
|
927
|
+
* From the set theory perspective to restrict the option's type
|
|
928
|
+
* Check in the following order:
|
|
929
|
+
* 1. L = R
|
|
930
|
+
* 2. L ∩ R ≠ ∅
|
|
931
|
+
* 3. L ⊆ R
|
|
932
|
+
* 4. L ∩ R = ∅
|
|
933
|
+
*/
|
|
934
|
+
function syncRef(left, right, ...[options]) {
|
|
935
|
+
const { flush = "sync", deep = false, immediate = true, direction = "both", transform = {} } = options || {};
|
|
936
|
+
const watchers = [];
|
|
937
|
+
const transformLTR = "ltr" in transform && transform.ltr || ((v) => v);
|
|
938
|
+
const transformRTL = "rtl" in transform && transform.rtl || ((v) => v);
|
|
939
|
+
if (direction === "both" || direction === "ltr") watchers.push(watchPausable(left, (newValue) => {
|
|
940
|
+
watchers.forEach((w) => w.pause());
|
|
941
|
+
right.value = transformLTR(newValue);
|
|
942
|
+
watchers.forEach((w) => w.resume());
|
|
943
|
+
}, {
|
|
944
|
+
flush,
|
|
945
|
+
deep,
|
|
946
|
+
immediate
|
|
947
|
+
}));
|
|
948
|
+
if (direction === "both" || direction === "rtl") watchers.push(watchPausable(right, (newValue) => {
|
|
949
|
+
watchers.forEach((w) => w.pause());
|
|
950
|
+
left.value = transformRTL(newValue);
|
|
951
|
+
watchers.forEach((w) => w.resume());
|
|
952
|
+
}, {
|
|
953
|
+
flush,
|
|
954
|
+
deep,
|
|
955
|
+
immediate
|
|
956
|
+
}));
|
|
957
|
+
const stop = () => {
|
|
958
|
+
watchers.forEach((w) => w.stop());
|
|
959
|
+
};
|
|
960
|
+
return stop;
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Keep target ref(s) in sync with the source ref
|
|
964
|
+
*
|
|
965
|
+
* @param source source ref
|
|
966
|
+
* @param targets
|
|
967
|
+
*/
|
|
968
|
+
function syncRefs(source, targets, options = {}) {
|
|
969
|
+
const { flush = "sync", deep = false, immediate = true } = options;
|
|
970
|
+
const targetsArray = toArray(targets);
|
|
971
|
+
return watch(source, (newValue) => targetsArray.forEach((target) => target.value = newValue), {
|
|
972
|
+
flush,
|
|
973
|
+
deep,
|
|
974
|
+
immediate
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Extended `toRefs` that also accepts refs of an object.
|
|
979
|
+
*
|
|
980
|
+
* @see https://vueuse.org/toRefs
|
|
981
|
+
* @param objectRef A ref or normal object or array.
|
|
982
|
+
* @param options Options
|
|
983
|
+
*/
|
|
984
|
+
function toRefs(objectRef, options = {}) {
|
|
985
|
+
if (!isRef(objectRef)) return toRefs$1(objectRef);
|
|
986
|
+
const result = Array.isArray(objectRef.value) ? Array.from({ length: objectRef.value.length }) : {};
|
|
987
|
+
for (const key in objectRef.value) result[key] = customRef(() => ({
|
|
988
|
+
get() {
|
|
989
|
+
return objectRef.value[key];
|
|
990
|
+
},
|
|
991
|
+
set(v) {
|
|
992
|
+
var _toValue;
|
|
993
|
+
if ((_toValue = toValue(options.replaceRef)) !== null && _toValue !== void 0 ? _toValue : true) if (Array.isArray(objectRef.value)) {
|
|
994
|
+
const copy = [...objectRef.value];
|
|
995
|
+
copy[key] = v;
|
|
996
|
+
objectRef.value = copy;
|
|
997
|
+
} else {
|
|
998
|
+
const newObject = {
|
|
999
|
+
...objectRef.value,
|
|
1000
|
+
[key]: v
|
|
1001
|
+
};
|
|
1002
|
+
Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));
|
|
1003
|
+
objectRef.value = newObject;
|
|
1004
|
+
}
|
|
1005
|
+
else objectRef.value[key] = v;
|
|
1006
|
+
}
|
|
1007
|
+
}));
|
|
1008
|
+
return result;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
|
|
1012
|
+
*
|
|
1013
|
+
* @param fn
|
|
1014
|
+
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
1015
|
+
* @param target
|
|
1016
|
+
*/
|
|
1017
|
+
function tryOnBeforeMount(fn, sync = true, target) {
|
|
1018
|
+
if (getLifeCycleTarget(target)) onBeforeMount(fn, target);
|
|
1019
|
+
else if (sync) fn();
|
|
1020
|
+
else nextTick(fn);
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
|
|
1024
|
+
*
|
|
1025
|
+
* @param fn
|
|
1026
|
+
* @param target
|
|
1027
|
+
*/
|
|
1028
|
+
function tryOnBeforeUnmount(fn, target) {
|
|
1029
|
+
if (getLifeCycleTarget(target)) onBeforeUnmount(fn, target);
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Call onMounted() if it's inside a component lifecycle, if not, just call the function
|
|
1033
|
+
*
|
|
1034
|
+
* @param fn
|
|
1035
|
+
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
1036
|
+
* @param target
|
|
1037
|
+
*/
|
|
1038
|
+
function tryOnMounted(fn, sync = true, target) {
|
|
1039
|
+
if (getLifeCycleTarget(target)) onMounted(fn, target);
|
|
1040
|
+
else if (sync) fn();
|
|
1041
|
+
else nextTick(fn);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
|
|
1045
|
+
*
|
|
1046
|
+
* @param fn
|
|
1047
|
+
* @param target
|
|
1048
|
+
*/
|
|
1049
|
+
function tryOnUnmounted(fn, target) {
|
|
1050
|
+
if (getLifeCycleTarget(target)) onUnmounted(fn, target);
|
|
1051
|
+
}
|
|
1052
|
+
function createUntil(r, isNot = false) {
|
|
1053
|
+
function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
|
|
1054
|
+
let stop = null;
|
|
1055
|
+
const promises = [new Promise((resolve) => {
|
|
1056
|
+
stop = watch(r, (v) => {
|
|
1057
|
+
if (condition(v) !== isNot) {
|
|
1058
|
+
if (stop) stop();
|
|
1059
|
+
else nextTick(() => stop === null || stop === void 0 ? void 0 : stop());
|
|
1060
|
+
resolve(v);
|
|
1061
|
+
}
|
|
1062
|
+
}, {
|
|
1063
|
+
flush,
|
|
1064
|
+
deep,
|
|
1065
|
+
immediate: true
|
|
1066
|
+
});
|
|
1067
|
+
})];
|
|
1068
|
+
if (timeout != null) promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop === null || stop === void 0 ? void 0 : stop()));
|
|
1069
|
+
return Promise.race(promises);
|
|
1070
|
+
}
|
|
1071
|
+
function toBe(value, options) {
|
|
1072
|
+
if (!isRef(value)) return toMatch((v) => v === value, options);
|
|
1073
|
+
const { flush = "sync", deep = false, timeout, throwOnTimeout } = options !== null && options !== void 0 ? options : {};
|
|
1074
|
+
let stop = null;
|
|
1075
|
+
const promises = [new Promise((resolve) => {
|
|
1076
|
+
stop = watch([r, value], ([v1, v2]) => {
|
|
1077
|
+
if (isNot !== (v1 === v2)) {
|
|
1078
|
+
if (stop) stop();
|
|
1079
|
+
else nextTick(() => stop === null || stop === void 0 ? void 0 : stop());
|
|
1080
|
+
resolve(v1);
|
|
1081
|
+
}
|
|
1082
|
+
}, {
|
|
1083
|
+
flush,
|
|
1084
|
+
deep,
|
|
1085
|
+
immediate: true
|
|
1086
|
+
});
|
|
1087
|
+
})];
|
|
1088
|
+
if (timeout != null) promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
|
|
1089
|
+
stop === null || stop === void 0 || stop();
|
|
1090
|
+
return toValue(r);
|
|
1091
|
+
}));
|
|
1092
|
+
return Promise.race(promises);
|
|
1093
|
+
}
|
|
1094
|
+
function toBeTruthy(options) {
|
|
1095
|
+
return toMatch((v) => Boolean(v), options);
|
|
1096
|
+
}
|
|
1097
|
+
function toBeNull(options) {
|
|
1098
|
+
return toBe(null, options);
|
|
1099
|
+
}
|
|
1100
|
+
function toBeUndefined(options) {
|
|
1101
|
+
return toBe(void 0, options);
|
|
1102
|
+
}
|
|
1103
|
+
function toBeNaN(options) {
|
|
1104
|
+
return toMatch(Number.isNaN, options);
|
|
1105
|
+
}
|
|
1106
|
+
function toContains(value, options) {
|
|
1107
|
+
return toMatch((v) => {
|
|
1108
|
+
const array = Array.from(v);
|
|
1109
|
+
return array.includes(value) || array.includes(toValue(value));
|
|
1110
|
+
}, options);
|
|
1111
|
+
}
|
|
1112
|
+
function changed(options) {
|
|
1113
|
+
return changedTimes(1, options);
|
|
1114
|
+
}
|
|
1115
|
+
function changedTimes(n = 1, options) {
|
|
1116
|
+
let count = -1;
|
|
1117
|
+
return toMatch(() => {
|
|
1118
|
+
count += 1;
|
|
1119
|
+
return count >= n;
|
|
1120
|
+
}, options);
|
|
1121
|
+
}
|
|
1122
|
+
if (Array.isArray(toValue(r))) return {
|
|
1123
|
+
toMatch,
|
|
1124
|
+
toContains,
|
|
1125
|
+
changed,
|
|
1126
|
+
changedTimes,
|
|
1127
|
+
get not() {
|
|
1128
|
+
return createUntil(r, !isNot);
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
else return {
|
|
1132
|
+
toMatch,
|
|
1133
|
+
toBe,
|
|
1134
|
+
toBeTruthy,
|
|
1135
|
+
toBeNull,
|
|
1136
|
+
toBeNaN,
|
|
1137
|
+
toBeUndefined,
|
|
1138
|
+
changed,
|
|
1139
|
+
changedTimes,
|
|
1140
|
+
get not() {
|
|
1141
|
+
return createUntil(r, !isNot);
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
function until(r) {
|
|
1146
|
+
return createUntil(r);
|
|
1147
|
+
}
|
|
1148
|
+
function defaultComparator(value, othVal) {
|
|
1149
|
+
return value === othVal;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Reactive get array difference of two array
|
|
1153
|
+
* @see https://vueuse.org/useArrayDifference
|
|
1154
|
+
* @returns - the difference of two array
|
|
1155
|
+
* @param args
|
|
1156
|
+
*
|
|
1157
|
+
* @__NO_SIDE_EFFECTS__
|
|
1158
|
+
*/
|
|
1159
|
+
function useArrayDifference(...args) {
|
|
1160
|
+
var _args$, _args$2;
|
|
1161
|
+
const list = args[0];
|
|
1162
|
+
const values = args[1];
|
|
1163
|
+
let compareFn = (_args$ = args[2]) !== null && _args$ !== void 0 ? _args$ : defaultComparator;
|
|
1164
|
+
const { symmetric = false } = (_args$2 = args[3]) !== null && _args$2 !== void 0 ? _args$2 : {};
|
|
1165
|
+
if (typeof compareFn === "string") {
|
|
1166
|
+
const key = compareFn;
|
|
1167
|
+
compareFn = (value, othVal) => value[key] === othVal[key];
|
|
1168
|
+
}
|
|
1169
|
+
const diff1 = computed(() => toValue(list).filter((x) => toValue(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
1170
|
+
if (symmetric) {
|
|
1171
|
+
const diff2 = computed(() => toValue(values).filter((x) => toValue(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
1172
|
+
return computed(() => symmetric ? [...toValue(diff1), ...toValue(diff2)] : toValue(diff1));
|
|
1173
|
+
} else return diff1;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Reactive `Array.every`
|
|
1177
|
+
*
|
|
1178
|
+
* @see https://vueuse.org/useArrayEvery
|
|
1179
|
+
* @param list - the array was called upon.
|
|
1180
|
+
* @param fn - a function to test each element.
|
|
1181
|
+
*
|
|
1182
|
+
* @returns **true** if the `fn` function returns a **truthy** value for every element from the array. Otherwise, **false**.
|
|
1183
|
+
*
|
|
1184
|
+
* @__NO_SIDE_EFFECTS__
|
|
1185
|
+
*/
|
|
1186
|
+
function useArrayEvery(list, fn) {
|
|
1187
|
+
return computed(() => toValue(list).every((element, index, array) => fn(toValue(element), index, array)));
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Reactive `Array.filter`
|
|
1191
|
+
*
|
|
1192
|
+
* @see https://vueuse.org/useArrayFilter
|
|
1193
|
+
* @param list - the array was called upon.
|
|
1194
|
+
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
1195
|
+
*
|
|
1196
|
+
* @returns a shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
|
|
1197
|
+
*
|
|
1198
|
+
* @__NO_SIDE_EFFECTS__
|
|
1199
|
+
*/
|
|
1200
|
+
function useArrayFilter(list, fn) {
|
|
1201
|
+
return computed(() => toValue(list).map((i) => toValue(i)).filter(fn));
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Reactive `Array.find`
|
|
1205
|
+
*
|
|
1206
|
+
* @see https://vueuse.org/useArrayFind
|
|
1207
|
+
* @param list - the array was called upon.
|
|
1208
|
+
* @param fn - a function to test each element.
|
|
1209
|
+
*
|
|
1210
|
+
* @returns the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
1211
|
+
*
|
|
1212
|
+
* @__NO_SIDE_EFFECTS__
|
|
1213
|
+
*/
|
|
1214
|
+
function useArrayFind(list, fn) {
|
|
1215
|
+
return computed(() => toValue(toValue(list).find((element, index, array) => fn(toValue(element), index, array))));
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Reactive `Array.findIndex`
|
|
1219
|
+
*
|
|
1220
|
+
* @see https://vueuse.org/useArrayFindIndex
|
|
1221
|
+
* @param list - the array was called upon.
|
|
1222
|
+
* @param fn - a function to test each element.
|
|
1223
|
+
*
|
|
1224
|
+
* @returns the index of the first element in the array that passes the test. Otherwise, "-1".
|
|
1225
|
+
*
|
|
1226
|
+
* @__NO_SIDE_EFFECTS__
|
|
1227
|
+
*/
|
|
1228
|
+
function useArrayFindIndex(list, fn) {
|
|
1229
|
+
return computed(() => toValue(list).findIndex((element, index, array) => fn(toValue(element), index, array)));
|
|
1230
|
+
}
|
|
1231
|
+
function findLast(arr, cb) {
|
|
1232
|
+
let index = arr.length;
|
|
1233
|
+
while (index-- > 0) if (cb(arr[index], index, arr)) return arr[index];
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Reactive `Array.findLast`
|
|
1237
|
+
*
|
|
1238
|
+
* @see https://vueuse.org/useArrayFindLast
|
|
1239
|
+
* @param list - the array was called upon.
|
|
1240
|
+
* @param fn - a function to test each element.
|
|
1241
|
+
*
|
|
1242
|
+
* @returns the last element in the array that satisfies the provided testing function. Otherwise, undefined is returned.
|
|
1243
|
+
*
|
|
1244
|
+
* @__NO_SIDE_EFFECTS__
|
|
1245
|
+
*/
|
|
1246
|
+
function useArrayFindLast(list, fn) {
|
|
1247
|
+
return computed(() => toValue(!Array.prototype.findLast ? findLast(toValue(list), (element, index, array) => fn(toValue(element), index, array)) : toValue(list).findLast((element, index, array) => fn(toValue(element), index, array))));
|
|
1248
|
+
}
|
|
1249
|
+
function isArrayIncludesOptions(obj) {
|
|
1250
|
+
return isObject(obj) && containsProp(obj, "formIndex", "comparator");
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Reactive `Array.includes`
|
|
1254
|
+
*
|
|
1255
|
+
* @see https://vueuse.org/useArrayIncludes
|
|
1256
|
+
*
|
|
1257
|
+
* @returns true if the `value` is found in the array. Otherwise, false.
|
|
1258
|
+
*
|
|
1259
|
+
* @__NO_SIDE_EFFECTS__
|
|
1260
|
+
*/
|
|
1261
|
+
function useArrayIncludes(...args) {
|
|
1262
|
+
var _comparator;
|
|
1263
|
+
const list = args[0];
|
|
1264
|
+
const value = args[1];
|
|
1265
|
+
let comparator = args[2];
|
|
1266
|
+
let formIndex = 0;
|
|
1267
|
+
if (isArrayIncludesOptions(comparator)) {
|
|
1268
|
+
var _comparator$fromIndex;
|
|
1269
|
+
formIndex = (_comparator$fromIndex = comparator.fromIndex) !== null && _comparator$fromIndex !== void 0 ? _comparator$fromIndex : 0;
|
|
1270
|
+
comparator = comparator.comparator;
|
|
1271
|
+
}
|
|
1272
|
+
if (typeof comparator === "string") {
|
|
1273
|
+
const key = comparator;
|
|
1274
|
+
comparator = (element, value) => element[key] === toValue(value);
|
|
1275
|
+
}
|
|
1276
|
+
comparator = (_comparator = comparator) !== null && _comparator !== void 0 ? _comparator : ((element, value) => element === toValue(value));
|
|
1277
|
+
return computed(() => toValue(list).slice(formIndex).some((element, index, array) => comparator(toValue(element), toValue(value), index, toValue(array))));
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Reactive `Array.join`
|
|
1281
|
+
*
|
|
1282
|
+
* @see https://vueuse.org/useArrayJoin
|
|
1283
|
+
* @param list - the array was called upon.
|
|
1284
|
+
* @param separator - a string to separate each pair of adjacent elements of the array. If omitted, the array elements are separated with a comma (",").
|
|
1285
|
+
*
|
|
1286
|
+
* @returns a string with all array elements joined. If arr.length is 0, the empty string is returned.
|
|
1287
|
+
*
|
|
1288
|
+
* @__NO_SIDE_EFFECTS__
|
|
1289
|
+
*/
|
|
1290
|
+
function useArrayJoin(list, separator) {
|
|
1291
|
+
return computed(() => toValue(list).map((i) => toValue(i)).join(toValue(separator)));
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Reactive `Array.map`
|
|
1295
|
+
*
|
|
1296
|
+
* @see https://vueuse.org/useArrayMap
|
|
1297
|
+
* @param list - the array was called upon.
|
|
1298
|
+
* @param fn - a function that is called for every element of the given `list`. Each time `fn` executes, the returned value is added to the new array.
|
|
1299
|
+
*
|
|
1300
|
+
* @returns a new array with each element being the result of the callback function.
|
|
1301
|
+
*
|
|
1302
|
+
* @__NO_SIDE_EFFECTS__
|
|
1303
|
+
*/
|
|
1304
|
+
function useArrayMap(list, fn) {
|
|
1305
|
+
return computed(() => toValue(list).map((i) => toValue(i)).map(fn));
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Reactive `Array.reduce`
|
|
1309
|
+
*
|
|
1310
|
+
* @see https://vueuse.org/useArrayReduce
|
|
1311
|
+
* @param list - the array was called upon.
|
|
1312
|
+
* @param reducer - a "reducer" function.
|
|
1313
|
+
* @param args
|
|
1314
|
+
*
|
|
1315
|
+
* @returns the value that results from running the "reducer" callback function to completion over the entire array.
|
|
1316
|
+
*
|
|
1317
|
+
* @__NO_SIDE_EFFECTS__
|
|
1318
|
+
*/
|
|
1319
|
+
function useArrayReduce(list, reducer, ...args) {
|
|
1320
|
+
const reduceCallback = (sum, value, index) => reducer(toValue(sum), toValue(value), index);
|
|
1321
|
+
return computed(() => {
|
|
1322
|
+
const resolved = toValue(list);
|
|
1323
|
+
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? toValue(args[0]()) : toValue(args[0])) : resolved.reduce(reduceCallback);
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Reactive `Array.some`
|
|
1328
|
+
*
|
|
1329
|
+
* @see https://vueuse.org/useArraySome
|
|
1330
|
+
* @param list - the array was called upon.
|
|
1331
|
+
* @param fn - a function to test each element.
|
|
1332
|
+
*
|
|
1333
|
+
* @returns **true** if the `fn` function returns a **truthy** value for any element from the array. Otherwise, **false**.
|
|
1334
|
+
*
|
|
1335
|
+
* @__NO_SIDE_EFFECTS__
|
|
1336
|
+
*/
|
|
1337
|
+
function useArraySome(list, fn) {
|
|
1338
|
+
return computed(() => toValue(list).some((element, index, array) => fn(toValue(element), index, array)));
|
|
1339
|
+
}
|
|
1340
|
+
function uniq(array) {
|
|
1341
|
+
return Array.from(new Set(array));
|
|
1342
|
+
}
|
|
1343
|
+
function uniqueElementsBy(array, fn) {
|
|
1344
|
+
return array.reduce((acc, v) => {
|
|
1345
|
+
if (!acc.some((x) => fn(v, x, array))) acc.push(v);
|
|
1346
|
+
return acc;
|
|
1347
|
+
}, []);
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* reactive unique array
|
|
1351
|
+
* @see https://vueuse.org/useArrayUnique
|
|
1352
|
+
* @param list - the array was called upon.
|
|
1353
|
+
* @param compareFn
|
|
1354
|
+
* @returns A computed ref that returns a unique array of items.
|
|
1355
|
+
*
|
|
1356
|
+
* @__NO_SIDE_EFFECTS__
|
|
1357
|
+
*/
|
|
1358
|
+
function useArrayUnique(list, compareFn) {
|
|
1359
|
+
return computed(() => {
|
|
1360
|
+
const resolvedList = toValue(list).map((element) => toValue(element));
|
|
1361
|
+
return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Basic counter with utility functions.
|
|
1366
|
+
*
|
|
1367
|
+
* @see https://vueuse.org/useCounter
|
|
1368
|
+
* @param [initialValue]
|
|
1369
|
+
* @param options
|
|
1370
|
+
*/
|
|
1371
|
+
function useCounter(initialValue = 0, options = {}) {
|
|
1372
|
+
let _initialValue = unref(initialValue);
|
|
1373
|
+
const count = shallowRef(initialValue);
|
|
1374
|
+
const { max = Number.POSITIVE_INFINITY, min = Number.NEGATIVE_INFINITY } = options;
|
|
1375
|
+
const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);
|
|
1376
|
+
const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);
|
|
1377
|
+
const get = () => count.value;
|
|
1378
|
+
const set = (val) => count.value = Math.max(min, Math.min(max, val));
|
|
1379
|
+
const reset = (val = _initialValue) => {
|
|
1380
|
+
_initialValue = val;
|
|
1381
|
+
return set(val);
|
|
1382
|
+
};
|
|
1383
|
+
return {
|
|
1384
|
+
count: shallowReadonly(count),
|
|
1385
|
+
inc,
|
|
1386
|
+
dec,
|
|
1387
|
+
get,
|
|
1388
|
+
set,
|
|
1389
|
+
reset
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
|
|
1393
|
+
var REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;
|
|
1394
|
+
function defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {
|
|
1395
|
+
let m = hours < 12 ? "AM" : "PM";
|
|
1396
|
+
if (hasPeriod) m = m.split("").reduce((acc, curr) => acc += `${curr}.`, "");
|
|
1397
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
1398
|
+
}
|
|
1399
|
+
function formatOrdinal(num) {
|
|
1400
|
+
const suffixes = [
|
|
1401
|
+
"th",
|
|
1402
|
+
"st",
|
|
1403
|
+
"nd",
|
|
1404
|
+
"rd"
|
|
1405
|
+
];
|
|
1406
|
+
const v = num % 100;
|
|
1407
|
+
return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);
|
|
1408
|
+
}
|
|
1409
|
+
function formatDate(date, formatStr, options = {}) {
|
|
1410
|
+
var _options$customMeridi;
|
|
1411
|
+
const years = date.getFullYear();
|
|
1412
|
+
const month = date.getMonth();
|
|
1413
|
+
const days = date.getDate();
|
|
1414
|
+
const hours = date.getHours();
|
|
1415
|
+
const minutes = date.getMinutes();
|
|
1416
|
+
const seconds = date.getSeconds();
|
|
1417
|
+
const milliseconds = date.getMilliseconds();
|
|
1418
|
+
const day = date.getDay();
|
|
1419
|
+
const meridiem = (_options$customMeridi = options.customMeridiem) !== null && _options$customMeridi !== void 0 ? _options$customMeridi : defaultMeridiem;
|
|
1420
|
+
const stripTimeZone = (dateString) => {
|
|
1421
|
+
var _dateString$split$;
|
|
1422
|
+
return (_dateString$split$ = dateString.split(" ")[1]) !== null && _dateString$split$ !== void 0 ? _dateString$split$ : "";
|
|
1423
|
+
};
|
|
1424
|
+
const matches = {
|
|
1425
|
+
Yo: () => formatOrdinal(years),
|
|
1426
|
+
YY: () => String(years).slice(-2),
|
|
1427
|
+
YYYY: () => years,
|
|
1428
|
+
M: () => month + 1,
|
|
1429
|
+
Mo: () => formatOrdinal(month + 1),
|
|
1430
|
+
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
1431
|
+
MMM: () => date.toLocaleDateString(toValue(options.locales), { month: "short" }),
|
|
1432
|
+
MMMM: () => date.toLocaleDateString(toValue(options.locales), { month: "long" }),
|
|
1433
|
+
D: () => String(days),
|
|
1434
|
+
Do: () => formatOrdinal(days),
|
|
1435
|
+
DD: () => `${days}`.padStart(2, "0"),
|
|
1436
|
+
H: () => String(hours),
|
|
1437
|
+
Ho: () => formatOrdinal(hours),
|
|
1438
|
+
HH: () => `${hours}`.padStart(2, "0"),
|
|
1439
|
+
h: () => `${hours % 12 || 12}`.padStart(1, "0"),
|
|
1440
|
+
ho: () => formatOrdinal(hours % 12 || 12),
|
|
1441
|
+
hh: () => `${hours % 12 || 12}`.padStart(2, "0"),
|
|
1442
|
+
m: () => String(minutes),
|
|
1443
|
+
mo: () => formatOrdinal(minutes),
|
|
1444
|
+
mm: () => `${minutes}`.padStart(2, "0"),
|
|
1445
|
+
s: () => String(seconds),
|
|
1446
|
+
so: () => formatOrdinal(seconds),
|
|
1447
|
+
ss: () => `${seconds}`.padStart(2, "0"),
|
|
1448
|
+
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
1449
|
+
d: () => day,
|
|
1450
|
+
dd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "narrow" }),
|
|
1451
|
+
ddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "short" }),
|
|
1452
|
+
dddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "long" }),
|
|
1453
|
+
A: () => meridiem(hours, minutes),
|
|
1454
|
+
AA: () => meridiem(hours, minutes, false, true),
|
|
1455
|
+
a: () => meridiem(hours, minutes, true),
|
|
1456
|
+
aa: () => meridiem(hours, minutes, true, true),
|
|
1457
|
+
z: () => stripTimeZone(date.toLocaleDateString(toValue(options.locales), { timeZoneName: "shortOffset" })),
|
|
1458
|
+
zz: () => stripTimeZone(date.toLocaleDateString(toValue(options.locales), { timeZoneName: "shortOffset" })),
|
|
1459
|
+
zzz: () => stripTimeZone(date.toLocaleDateString(toValue(options.locales), { timeZoneName: "shortOffset" })),
|
|
1460
|
+
zzzz: () => stripTimeZone(date.toLocaleDateString(toValue(options.locales), { timeZoneName: "longOffset" }))
|
|
1461
|
+
};
|
|
1462
|
+
return formatStr.replace(REGEX_FORMAT, (match, $1) => {
|
|
1463
|
+
var _ref, _matches$match;
|
|
1464
|
+
return (_ref = $1 !== null && $1 !== void 0 ? $1 : (_matches$match = matches[match]) === null || _matches$match === void 0 ? void 0 : _matches$match.call(matches)) !== null && _ref !== void 0 ? _ref : match;
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
function normalizeDate(date) {
|
|
1468
|
+
if (date === null) return /* @__PURE__ */ new Date(NaN);
|
|
1469
|
+
if (date === void 0) return /* @__PURE__ */ new Date();
|
|
1470
|
+
if (date instanceof Date) return new Date(date);
|
|
1471
|
+
if (typeof date === "string" && !/Z$/i.test(date)) {
|
|
1472
|
+
const d = date.match(REGEX_PARSE);
|
|
1473
|
+
if (d) {
|
|
1474
|
+
const m = d[2] - 1 || 0;
|
|
1475
|
+
const ms = (d[7] || "0").substring(0, 3);
|
|
1476
|
+
return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
return new Date(date);
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Get the formatted date according to the string of tokens passed in.
|
|
1483
|
+
*
|
|
1484
|
+
* @see https://vueuse.org/useDateFormat
|
|
1485
|
+
* @param date - The date to format, can either be a `Date` object, a timestamp, or a string
|
|
1486
|
+
* @param formatStr - The combination of tokens to format the date
|
|
1487
|
+
* @param options - UseDateFormatOptions
|
|
1488
|
+
*
|
|
1489
|
+
* @__NO_SIDE_EFFECTS__
|
|
1490
|
+
*/
|
|
1491
|
+
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1492
|
+
return computed(() => formatDate(normalizeDate(toValue(date)), toValue(formatStr), options));
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Wrapper for `setInterval` with controls
|
|
1496
|
+
*
|
|
1497
|
+
* @see https://vueuse.org/useIntervalFn
|
|
1498
|
+
* @param cb
|
|
1499
|
+
* @param interval
|
|
1500
|
+
* @param options
|
|
1501
|
+
*/
|
|
1502
|
+
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
1503
|
+
const { immediate = true, immediateCallback = false } = options;
|
|
1504
|
+
let timer = null;
|
|
1505
|
+
const isActive = shallowRef(false);
|
|
1506
|
+
function clean() {
|
|
1507
|
+
if (timer) {
|
|
1508
|
+
clearInterval(timer);
|
|
1509
|
+
timer = null;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
function pause() {
|
|
1513
|
+
isActive.value = false;
|
|
1514
|
+
clean();
|
|
1515
|
+
}
|
|
1516
|
+
function resume() {
|
|
1517
|
+
const intervalValue = toValue(interval);
|
|
1518
|
+
if (intervalValue <= 0) return;
|
|
1519
|
+
isActive.value = true;
|
|
1520
|
+
if (immediateCallback) cb();
|
|
1521
|
+
clean();
|
|
1522
|
+
if (isActive.value) timer = setInterval(cb, intervalValue);
|
|
1523
|
+
}
|
|
1524
|
+
if (immediate && isClient) resume();
|
|
1525
|
+
if (isRef(interval) || typeof interval === "function") tryOnScopeDispose(watch(interval, () => {
|
|
1526
|
+
if (isActive.value && isClient) resume();
|
|
1527
|
+
}));
|
|
1528
|
+
tryOnScopeDispose(pause);
|
|
1529
|
+
return {
|
|
1530
|
+
isActive: shallowReadonly(isActive),
|
|
1531
|
+
pause,
|
|
1532
|
+
resume
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function useInterval(interval = 1e3, options = {}) {
|
|
1536
|
+
const { controls: exposeControls = false, immediate = true, callback } = options;
|
|
1537
|
+
const counter = shallowRef(0);
|
|
1538
|
+
const update = () => counter.value += 1;
|
|
1539
|
+
const reset = () => {
|
|
1540
|
+
counter.value = 0;
|
|
1541
|
+
};
|
|
1542
|
+
const controls = useIntervalFn(callback ? () => {
|
|
1543
|
+
update();
|
|
1544
|
+
callback(counter.value);
|
|
1545
|
+
} : update, interval, { immediate });
|
|
1546
|
+
if (exposeControls) return {
|
|
1547
|
+
counter: shallowReadonly(counter),
|
|
1548
|
+
reset,
|
|
1549
|
+
...controls
|
|
1550
|
+
};
|
|
1551
|
+
else return shallowReadonly(counter);
|
|
1552
|
+
}
|
|
1553
|
+
function useLastChanged(source, options = {}) {
|
|
1554
|
+
var _options$initialValue;
|
|
1555
|
+
const ms = shallowRef((_options$initialValue = options.initialValue) !== null && _options$initialValue !== void 0 ? _options$initialValue : null);
|
|
1556
|
+
watch(source, () => ms.value = timestamp(), options);
|
|
1557
|
+
return shallowReadonly(ms);
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Wrapper for `setTimeout` with controls.
|
|
1561
|
+
*
|
|
1562
|
+
* @param cb
|
|
1563
|
+
* @param interval
|
|
1564
|
+
* @param options
|
|
1565
|
+
*/
|
|
1566
|
+
function useTimeoutFn(cb, interval, options = {}) {
|
|
1567
|
+
const { immediate = true, immediateCallback = false } = options;
|
|
1568
|
+
const isPending = shallowRef(false);
|
|
1569
|
+
let timer;
|
|
1570
|
+
function clear() {
|
|
1571
|
+
if (timer) {
|
|
1572
|
+
clearTimeout(timer);
|
|
1573
|
+
timer = void 0;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
function stop() {
|
|
1577
|
+
isPending.value = false;
|
|
1578
|
+
clear();
|
|
1579
|
+
}
|
|
1580
|
+
function start(...args) {
|
|
1581
|
+
if (immediateCallback) cb();
|
|
1582
|
+
clear();
|
|
1583
|
+
isPending.value = true;
|
|
1584
|
+
timer = setTimeout(() => {
|
|
1585
|
+
isPending.value = false;
|
|
1586
|
+
timer = void 0;
|
|
1587
|
+
cb(...args);
|
|
1588
|
+
}, toValue(interval));
|
|
1589
|
+
}
|
|
1590
|
+
if (immediate) {
|
|
1591
|
+
isPending.value = true;
|
|
1592
|
+
if (isClient) start();
|
|
1593
|
+
}
|
|
1594
|
+
tryOnScopeDispose(stop);
|
|
1595
|
+
return {
|
|
1596
|
+
isPending: shallowReadonly(isPending),
|
|
1597
|
+
start,
|
|
1598
|
+
stop
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
function useTimeout(interval = 1e3, options = {}) {
|
|
1602
|
+
const { controls: exposeControls = false, callback } = options;
|
|
1603
|
+
const controls = useTimeoutFn(callback !== null && callback !== void 0 ? callback : noop, interval, options);
|
|
1604
|
+
const ready = computed(() => !controls.isPending.value);
|
|
1605
|
+
if (exposeControls) return {
|
|
1606
|
+
ready,
|
|
1607
|
+
...controls
|
|
1608
|
+
};
|
|
1609
|
+
else return ready;
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Reactively convert a string ref to number.
|
|
1613
|
+
*
|
|
1614
|
+
* @__NO_SIDE_EFFECTS__
|
|
1615
|
+
*/
|
|
1616
|
+
function useToNumber(value, options = {}) {
|
|
1617
|
+
const { method = "parseFloat", radix, nanToZero } = options;
|
|
1618
|
+
return computed(() => {
|
|
1619
|
+
let resolved = toValue(value);
|
|
1620
|
+
if (typeof method === "function") resolved = method(resolved);
|
|
1621
|
+
else if (typeof resolved === "string") resolved = Number[method](resolved, radix);
|
|
1622
|
+
if (nanToZero && Number.isNaN(resolved)) resolved = 0;
|
|
1623
|
+
return resolved;
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Reactively convert a ref to string.
|
|
1628
|
+
*
|
|
1629
|
+
* @see https://vueuse.org/useToString
|
|
1630
|
+
*
|
|
1631
|
+
* @__NO_SIDE_EFFECTS__
|
|
1632
|
+
*/
|
|
1633
|
+
function useToString(value) {
|
|
1634
|
+
return computed(() => `${toValue(value)}`);
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* A boolean ref with a toggler
|
|
1638
|
+
*
|
|
1639
|
+
* @see https://vueuse.org/useToggle
|
|
1640
|
+
* @param [initialValue]
|
|
1641
|
+
* @param options
|
|
1642
|
+
*
|
|
1643
|
+
* @__NO_SIDE_EFFECTS__
|
|
1644
|
+
*/
|
|
1645
|
+
function useToggle(initialValue = false, options = {}) {
|
|
1646
|
+
const { truthyValue = true, falsyValue = false } = options;
|
|
1647
|
+
const valueIsRef = isRef(initialValue);
|
|
1648
|
+
const _value = shallowRef(initialValue);
|
|
1649
|
+
function toggle(value) {
|
|
1650
|
+
if (arguments.length) {
|
|
1651
|
+
_value.value = value;
|
|
1652
|
+
return _value.value;
|
|
1653
|
+
} else {
|
|
1654
|
+
const truthy = toValue(truthyValue);
|
|
1655
|
+
_value.value = _value.value === truthy ? toValue(falsyValue) : truthy;
|
|
1656
|
+
return _value.value;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
if (valueIsRef) return toggle;
|
|
1660
|
+
else return [_value, toggle];
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Watch for an array with additions and removals.
|
|
1664
|
+
*
|
|
1665
|
+
* @see https://vueuse.org/watchArray
|
|
1666
|
+
*/
|
|
1667
|
+
function watchArray(source, cb, options) {
|
|
1668
|
+
let oldList = (options === null || options === void 0 ? void 0 : options.immediate) ? [] : [...typeof source === "function" ? source() : Array.isArray(source) ? source : toValue(source)];
|
|
1669
|
+
return watch(source, (newList, _, onCleanup) => {
|
|
1670
|
+
const oldListRemains = Array.from({ length: oldList.length });
|
|
1671
|
+
const added = [];
|
|
1672
|
+
for (const obj of newList) {
|
|
1673
|
+
let found = false;
|
|
1674
|
+
for (let i = 0; i < oldList.length; i++) if (!oldListRemains[i] && obj === oldList[i]) {
|
|
1675
|
+
oldListRemains[i] = true;
|
|
1676
|
+
found = true;
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1679
|
+
if (!found) added.push(obj);
|
|
1680
|
+
}
|
|
1681
|
+
const removed = oldList.filter((_, i) => !oldListRemains[i]);
|
|
1682
|
+
cb(newList, oldList, added, removed, onCleanup);
|
|
1683
|
+
oldList = [...newList];
|
|
1684
|
+
}, options);
|
|
1685
|
+
}
|
|
1686
|
+
function watchAtMost(source, cb, options) {
|
|
1687
|
+
const { count, ...watchOptions } = options;
|
|
1688
|
+
const current = shallowRef(0);
|
|
1689
|
+
const { stop, resume, pause } = watchWithFilter(source, (...args) => {
|
|
1690
|
+
current.value += 1;
|
|
1691
|
+
if (current.value >= toValue(count)) nextTick(() => stop());
|
|
1692
|
+
cb(...args);
|
|
1693
|
+
}, watchOptions);
|
|
1694
|
+
return {
|
|
1695
|
+
count: current,
|
|
1696
|
+
stop,
|
|
1697
|
+
resume,
|
|
1698
|
+
pause
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
function watchDebounced(source, cb, options = {}) {
|
|
1702
|
+
const { debounce = 0, maxWait = void 0, ...watchOptions } = options;
|
|
1703
|
+
return watchWithFilter(source, cb, {
|
|
1704
|
+
...watchOptions,
|
|
1705
|
+
eventFilter: debounceFilter(debounce, { maxWait })
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
/** @deprecated use `watchDebounced` instead */
|
|
1709
|
+
var debouncedWatch = watchDebounced;
|
|
1710
|
+
/**
|
|
1711
|
+
* Shorthand for watching value with {deep: true}
|
|
1712
|
+
*
|
|
1713
|
+
* @see https://vueuse.org/watchDeep
|
|
1714
|
+
*/
|
|
1715
|
+
function watchDeep(source, cb, options) {
|
|
1716
|
+
return watch(source, cb, {
|
|
1717
|
+
...options,
|
|
1718
|
+
deep: true
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
function watchIgnorable(source, cb, options = {}) {
|
|
1722
|
+
const { eventFilter = bypassFilter, ...watchOptions } = options;
|
|
1723
|
+
const filteredCb = createFilterWrapper(eventFilter, cb);
|
|
1724
|
+
let ignoreUpdates;
|
|
1725
|
+
let ignorePrevAsyncUpdates;
|
|
1726
|
+
let stop;
|
|
1727
|
+
if (watchOptions.flush === "sync") {
|
|
1728
|
+
let ignore = false;
|
|
1729
|
+
ignorePrevAsyncUpdates = () => {};
|
|
1730
|
+
ignoreUpdates = (updater) => {
|
|
1731
|
+
ignore = true;
|
|
1732
|
+
updater();
|
|
1733
|
+
ignore = false;
|
|
1734
|
+
};
|
|
1735
|
+
stop = watch(source, (...args) => {
|
|
1736
|
+
if (!ignore) filteredCb(...args);
|
|
1737
|
+
}, watchOptions);
|
|
1738
|
+
} else {
|
|
1739
|
+
const disposables = [];
|
|
1740
|
+
let ignoreCounter = 0;
|
|
1741
|
+
let syncCounter = 0;
|
|
1742
|
+
ignorePrevAsyncUpdates = () => {
|
|
1743
|
+
ignoreCounter = syncCounter;
|
|
1744
|
+
};
|
|
1745
|
+
disposables.push(watch(source, () => {
|
|
1746
|
+
syncCounter++;
|
|
1747
|
+
}, {
|
|
1748
|
+
...watchOptions,
|
|
1749
|
+
flush: "sync"
|
|
1750
|
+
}));
|
|
1751
|
+
ignoreUpdates = (updater) => {
|
|
1752
|
+
const syncCounterPrev = syncCounter;
|
|
1753
|
+
updater();
|
|
1754
|
+
ignoreCounter += syncCounter - syncCounterPrev;
|
|
1755
|
+
};
|
|
1756
|
+
disposables.push(watch(source, (...args) => {
|
|
1757
|
+
const ignore = ignoreCounter > 0 && ignoreCounter === syncCounter;
|
|
1758
|
+
ignoreCounter = 0;
|
|
1759
|
+
syncCounter = 0;
|
|
1760
|
+
if (ignore) return;
|
|
1761
|
+
filteredCb(...args);
|
|
1762
|
+
}, watchOptions));
|
|
1763
|
+
stop = () => {
|
|
1764
|
+
disposables.forEach((fn) => fn());
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
return {
|
|
1768
|
+
stop,
|
|
1769
|
+
ignoreUpdates,
|
|
1770
|
+
ignorePrevAsyncUpdates
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
/** @deprecated use `watchIgnorable` instead */
|
|
1774
|
+
var ignorableWatch = watchIgnorable;
|
|
1775
|
+
/**
|
|
1776
|
+
* Shorthand for watching value with {immediate: true}
|
|
1777
|
+
*
|
|
1778
|
+
* @see https://vueuse.org/watchImmediate
|
|
1779
|
+
*/
|
|
1780
|
+
function watchImmediate(source, cb, options) {
|
|
1781
|
+
return watch(source, cb, {
|
|
1782
|
+
...options,
|
|
1783
|
+
immediate: true
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Shorthand for watching value with { once: true }
|
|
1788
|
+
*
|
|
1789
|
+
* @see https://vueuse.org/watchOnce
|
|
1790
|
+
*/
|
|
1791
|
+
function watchOnce(source, cb, options) {
|
|
1792
|
+
return watch(source, cb, {
|
|
1793
|
+
...options,
|
|
1794
|
+
once: true
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
function watchThrottled(source, cb, options = {}) {
|
|
1798
|
+
const { throttle = 0, trailing = true, leading = true, ...watchOptions } = options;
|
|
1799
|
+
return watchWithFilter(source, cb, {
|
|
1800
|
+
...watchOptions,
|
|
1801
|
+
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
/** @deprecated use `watchThrottled` instead */
|
|
1805
|
+
var throttledWatch = watchThrottled;
|
|
1806
|
+
function watchTriggerable(source, cb, options = {}) {
|
|
1807
|
+
let cleanupFn;
|
|
1808
|
+
function onEffect() {
|
|
1809
|
+
if (!cleanupFn) return;
|
|
1810
|
+
const fn = cleanupFn;
|
|
1811
|
+
cleanupFn = void 0;
|
|
1812
|
+
fn();
|
|
1813
|
+
}
|
|
1814
|
+
/** Register the function `cleanupFn` */
|
|
1815
|
+
function onCleanup(callback) {
|
|
1816
|
+
cleanupFn = callback;
|
|
1817
|
+
}
|
|
1818
|
+
const _cb = (value, oldValue) => {
|
|
1819
|
+
onEffect();
|
|
1820
|
+
return cb(value, oldValue, onCleanup);
|
|
1821
|
+
};
|
|
1822
|
+
const res = watchIgnorable(source, _cb, options);
|
|
1823
|
+
const { ignoreUpdates } = res;
|
|
1824
|
+
const trigger = () => {
|
|
1825
|
+
let res;
|
|
1826
|
+
ignoreUpdates(() => {
|
|
1827
|
+
res = _cb(getWatchSources(source), getOldValue(source));
|
|
1828
|
+
});
|
|
1829
|
+
return res;
|
|
1830
|
+
};
|
|
1831
|
+
return {
|
|
1832
|
+
...res,
|
|
1833
|
+
trigger
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
function getWatchSources(sources) {
|
|
1837
|
+
if (isReactive(sources)) return sources;
|
|
1838
|
+
if (Array.isArray(sources)) return sources.map((item) => toValue(item));
|
|
1839
|
+
return toValue(sources);
|
|
1840
|
+
}
|
|
1841
|
+
function getOldValue(source) {
|
|
1842
|
+
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
1843
|
+
}
|
|
1844
|
+
function whenever(source, cb, options) {
|
|
1845
|
+
const stop = watch(source, (v, ov, onInvalidate) => {
|
|
1846
|
+
if (v) {
|
|
1847
|
+
if (options === null || options === void 0 ? void 0 : options.once) nextTick(() => stop());
|
|
1848
|
+
cb(v, ov, onInvalidate);
|
|
1849
|
+
}
|
|
1850
|
+
}, {
|
|
1851
|
+
...options,
|
|
1852
|
+
once: false
|
|
1853
|
+
});
|
|
1854
|
+
return stop;
|
|
1855
|
+
}
|
|
1856
|
+
//#endregion
|
|
1857
|
+
export { assert, autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, controlledComputed, controlledRef, createDisposableDirective, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, createReactiveFn, createRef, createSharedComposable, createSingletonPromise, debounceFilter, debouncedRef, debouncedWatch, eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, pausableWatch, promiseTimeout, provideLocal, pxValue, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refManualReset, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, throttledRef, throttledWatch, timestamp, toArray, toReactive, toRef, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
|
1858
|
+
|
|
1859
|
+
//# sourceMappingURL=@vueuse_shared.js.map
|