@wfrog/vc-ui 1.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 +95 -0
- package/dist/es/chunk/-EkpfdcW.mjs +1100 -0
- package/dist/es/chunk/8rLUmOVR.mjs +29 -0
- package/dist/es/chunk/B-rxnVJv.mjs +3 -0
- package/dist/es/chunk/BAGoDD49.mjs +36 -0
- package/dist/es/chunk/BAtns-Mc.mjs +96 -0
- package/dist/es/chunk/BJS5Pdfp.mjs +55 -0
- package/dist/es/chunk/BMzd-IS6.mjs +900 -0
- package/dist/es/chunk/BWcCXRRK.mjs +229 -0
- package/dist/es/chunk/BX-Ogf7p.mjs +3743 -0
- package/dist/es/chunk/B_tU9Nax.mjs +49 -0
- package/dist/es/chunk/BdDihk0t.mjs +3420 -0
- package/dist/es/chunk/C2LgraHx.mjs +489 -0
- package/dist/es/chunk/C5hWsUfD.mjs +64 -0
- package/dist/es/chunk/C7iSSBUr.mjs +303 -0
- package/dist/es/chunk/CD98REcR.mjs +666 -0
- package/dist/es/chunk/CEClY-_T.mjs +445 -0
- package/dist/es/chunk/CEm0brzD.mjs +35 -0
- package/dist/es/chunk/CMABHk8B.mjs +1942 -0
- package/dist/es/chunk/CS4VKsqy.mjs +19 -0
- package/dist/es/chunk/CVlj9F0I.mjs +291 -0
- package/dist/es/chunk/CZ4ggqDE.mjs +140 -0
- package/dist/es/chunk/CaTfZePA.mjs +533 -0
- package/dist/es/chunk/Ce9ApjrT.mjs +201 -0
- package/dist/es/chunk/ClZGuAIb.mjs +10 -0
- package/dist/es/chunk/Coex0GxM.mjs +450 -0
- package/dist/es/chunk/Ct6q2FXg.mjs +5 -0
- package/dist/es/chunk/CyxEcbcy.mjs +29 -0
- package/dist/es/chunk/D389hx_T.mjs +35 -0
- package/dist/es/chunk/D3DXeVfC.mjs +1171 -0
- package/dist/es/chunk/D3uV7vm-.mjs +45 -0
- package/dist/es/chunk/D5259bwd.mjs +50 -0
- package/dist/es/chunk/DMHNh_tw.mjs +49 -0
- package/dist/es/chunk/DVNTpOBR.mjs +4 -0
- package/dist/es/chunk/DZACQ9LT.mjs +95 -0
- package/dist/es/chunk/De_EXLIy.mjs +22 -0
- package/dist/es/chunk/Dh4jaUSg.mjs +89 -0
- package/dist/es/chunk/DhhdKtyu.mjs +439 -0
- package/dist/es/chunk/DqUIKX7f.mjs +2039 -0
- package/dist/es/chunk/Dqz1zvKN.mjs +59 -0
- package/dist/es/chunk/Dvi7RsXg.mjs +727 -0
- package/dist/es/chunk/DyDMGLoF.mjs +123 -0
- package/dist/es/chunk/E_WRn0OP.mjs +449 -0
- package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
- package/dist/es/chunk/HSv8BL8o.mjs +72 -0
- package/dist/es/chunk/JCIyOUEY.mjs +105 -0
- package/dist/es/chunk/O-uhUKF4.mjs +43 -0
- package/dist/es/chunk/Spa-JKB4.mjs +1046 -0
- package/dist/es/chunk/VAdRxe-1.mjs +16 -0
- package/dist/es/chunk/VCrtRnxt.mjs +1477 -0
- package/dist/es/chunk/ViP2SEY4.mjs +211 -0
- package/dist/es/chunk/aibQ9WSZ.mjs +249 -0
- package/dist/es/chunk/nWBcrYxV.mjs +690 -0
- package/dist/es/chunk/pcqpp-6-.mjs +9 -0
- package/dist/es/chunk/qY9OvNHY.mjs +283 -0
- package/dist/es/chunk/su2Zrql0.mjs +53 -0
- package/dist/es/chunk/zfg5SOj1.mjs +138 -0
- package/dist/es/components/awesome-icon/awesome-icon.d.ts +6 -0
- package/dist/es/components/awesome-icon/awesome-icon.mjs +41 -0
- package/dist/es/components/awesome-icon/awesome-icon.vue.d.ts +5 -0
- package/dist/es/components/awesome-icon/index.d.ts +4 -0
- package/dist/es/components/awesome-icon/index.mjs +6 -0
- package/dist/es/components/backbottom/backbottom.d.ts +7 -0
- package/dist/es/components/backbottom/backbottom.mjs +172 -0
- package/dist/es/components/backbottom/backbottom.vue.d.ts +7 -0
- package/dist/es/components/backbottom/components/child.vue.d.ts +30 -0
- package/dist/es/components/backbottom/index.d.ts +4 -0
- package/dist/es/components/backbottom/index.mjs +6 -0
- package/dist/es/components/button/button.d.ts +18 -0
- package/dist/es/components/button/button.mjs +313 -0
- package/dist/es/components/button/button.vue.d.ts +33 -0
- package/dist/es/components/button/index.css +9 -0
- package/dist/es/components/button/index.d.ts +4 -0
- package/dist/es/components/button/index.mjs +6 -0
- package/dist/es/components/cdn-tag.vue.d.ts +5 -0
- package/dist/es/components/chat-container/chat-container.d.ts +9 -0
- package/dist/es/components/chat-container/chat-container.mjs +77 -0
- package/dist/es/components/chat-container/chat-container.vue.d.ts +29 -0
- package/dist/es/components/chat-container/index.css +9 -0
- package/dist/es/components/chat-container/index.d.ts +4 -0
- package/dist/es/components/chat-container/index.mjs +6 -0
- package/dist/es/components/choice/choice.d.ts +6 -0
- package/dist/es/components/choice/choice.mjs +53 -0
- package/dist/es/components/choice/choice.vue.d.ts +5 -0
- package/dist/es/components/choice/index.css +7 -0
- package/dist/es/components/choice/index.d.ts +4 -0
- package/dist/es/components/choice/index.mjs +6 -0
- package/dist/es/components/choice-boolean/choice-boolean.d.ts +5 -0
- package/dist/es/components/choice-boolean/choice-boolean.mjs +32 -0
- package/dist/es/components/choice-boolean/choice-boolean.vue.d.ts +10 -0
- package/dist/es/components/choice-boolean/index.d.ts +4 -0
- package/dist/es/components/choice-boolean/index.mjs +6 -0
- package/dist/es/components/config-provider/config-provider.d.ts +16 -0
- package/dist/es/components/config-provider/config-provider.mjs +29 -0
- package/dist/es/components/config-provider/config-provider.vue.d.ts +18 -0
- package/dist/es/components/config-provider/config-provider2.mjs +6 -0
- package/dist/es/components/config-provider/index.d.ts +4 -0
- package/dist/es/components/config-provider/index.mjs +6 -0
- package/dist/es/components/cropper/cropper.d.ts +12 -0
- package/dist/es/components/cropper/cropper.mjs +333 -0
- package/dist/es/components/cropper/cropper.vue.d.ts +32 -0
- package/dist/es/components/cropper/index.css +4 -0
- package/dist/es/components/cropper/index.d.ts +4 -0
- package/dist/es/components/cropper/index.mjs +6 -0
- package/dist/es/components/currency/currency.d.ts +21 -0
- package/dist/es/components/currency/currency.mjs +185 -0
- package/dist/es/components/currency/currency.vue.d.ts +14 -0
- package/dist/es/components/currency/index.css +8 -0
- package/dist/es/components/currency/index.d.ts +4 -0
- package/dist/es/components/currency/index.mjs +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.d.ts +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.mjs +5550 -0
- package/dist/es/components/daterange-picker/daterange-picker.vue.d.ts +13 -0
- package/dist/es/components/daterange-picker/index.d.ts +4 -0
- package/dist/es/components/daterange-picker/index.mjs +6 -0
- package/dist/es/components/dialog/dialog.d.ts +13 -0
- package/dist/es/components/dialog/dialog.mjs +537 -0
- package/dist/es/components/dialog/dialog.vue.d.ts +38 -0
- package/dist/es/components/dialog/index.css +87 -0
- package/dist/es/components/dialog/index.d.ts +4 -0
- package/dist/es/components/dialog/index.mjs +6 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.d.ts +33 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +412 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.vue.d.ts +23 -0
- package/dist/es/components/dialog-camera-upload/index.css +66 -0
- package/dist/es/components/dialog-camera-upload/index.d.ts +4 -0
- package/dist/es/components/dialog-camera-upload/index.mjs +6 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.d.ts +9 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +183 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.vue.d.ts +22 -0
- package/dist/es/components/dialog-map-point/index.css +11 -0
- package/dist/es/components/dialog-map-point/index.d.ts +4 -0
- package/dist/es/components/dialog-map-point/index.mjs +6 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.d.ts +16 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +1391 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.vue.d.ts +19 -0
- package/dist/es/components/dialog-upload-images/index.css +62 -0
- package/dist/es/components/dialog-upload-images/index.d.ts +4 -0
- package/dist/es/components/dialog-upload-images/index.mjs +6 -0
- package/dist/es/components/document.vue.d.ts +14 -0
- package/dist/es/components/drawer/drawer.d.ts +7 -0
- package/dist/es/components/drawer/drawer.mjs +412 -0
- package/dist/es/components/drawer/drawer.vue.d.ts +31 -0
- package/dist/es/components/drawer/index.css +56 -0
- package/dist/es/components/drawer/index.d.ts +4 -0
- package/dist/es/components/drawer/index.mjs +6 -0
- package/dist/es/components/easy-pagination/easy-pagination.d.ts +8 -0
- package/dist/es/components/easy-pagination/easy-pagination.mjs +74 -0
- package/dist/es/components/easy-pagination/easy-pagination.vue.d.ts +19 -0
- package/dist/es/components/easy-pagination/index.css +10 -0
- package/dist/es/components/easy-pagination/index.d.ts +4 -0
- package/dist/es/components/easy-pagination/index.mjs +6 -0
- package/dist/es/components/el-icon/el-icon.d.ts +6 -0
- package/dist/es/components/el-icon/el-icon.mjs +46 -0
- package/dist/es/components/el-icon/el-icon.vue.d.ts +6 -0
- package/dist/es/components/el-icon/index.css +7 -0
- package/dist/es/components/el-icon/index.d.ts +4 -0
- package/dist/es/components/el-icon/index.mjs +6 -0
- package/dist/es/components/example-wrapper.vue.d.ts +19 -0
- package/dist/es/components/flag/flag.mjs +44 -0
- package/dist/es/components/flag/flag.vue.d.ts +5 -0
- package/dist/es/components/flag/flags.d.ts +8 -0
- package/dist/es/components/flag/index.d.ts +4 -0
- package/dist/es/components/flag/index.mjs +6 -0
- package/dist/es/components/icon/icon.d.ts +6 -0
- package/dist/es/components/icon/icon.mjs +54 -0
- package/dist/es/components/icon/icon.vue.d.ts +3 -0
- package/dist/es/components/icon/icon2.mjs +27 -0
- package/dist/es/components/icon/index.css +9 -0
- package/dist/es/components/icon/index.d.ts +4 -0
- package/dist/es/components/icon/index.mjs +6 -0
- package/dist/es/components/image/image.d.ts +16 -0
- package/dist/es/components/image/image.mjs +167 -0
- package/dist/es/components/image/image.vue.d.ts +206 -0
- package/dist/es/components/image/index.css +20 -0
- package/dist/es/components/image/index.d.ts +4 -0
- package/dist/es/components/image/index.mjs +6 -0
- package/dist/es/components/input/index.css +9 -0
- package/dist/es/components/input/index.d.ts +4 -0
- package/dist/es/components/input/index.mjs +6 -0
- package/dist/es/components/input/input.d.ts +4 -0
- package/dist/es/components/input/input.mjs +85 -0
- package/dist/es/components/input/input.vue.d.ts +1232 -0
- package/dist/es/components/input-number/index.css +24 -0
- package/dist/es/components/input-number/index.d.ts +4 -0
- package/dist/es/components/input-number/index.mjs +6 -0
- package/dist/es/components/input-number/input-number.d.ts +8 -0
- package/dist/es/components/input-number/input-number.mjs +137 -0
- package/dist/es/components/input-number/input-number.vue.d.ts +35 -0
- package/dist/es/components/pca-picker/components/c.vue.d.ts +123 -0
- package/dist/es/components/pca-picker/components/elevator-item.vue.d.ts +7 -0
- package/dist/es/components/pca-picker/components/filter.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/history.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/hot.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/p.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/pca.vue.d.ts +9 -0
- package/dist/es/components/pca-picker/index.css +107 -0
- package/dist/es/components/pca-picker/index.d.ts +4 -0
- package/dist/es/components/pca-picker/index.mjs +6 -0
- package/dist/es/components/pca-picker/pca-picker.d.ts +78 -0
- package/dist/es/components/pca-picker/pca-picker.mjs +1667 -0
- package/dist/es/components/pca-picker/pca-picker.vue.d.ts +583 -0
- package/dist/es/components/qr-code/index.d.ts +4 -0
- package/dist/es/components/qr-code/index.mjs +6 -0
- package/dist/es/components/qr-code/qr-code.d.ts +9 -0
- package/dist/es/components/qr-code/qr-code.mjs +69 -0
- package/dist/es/components/qr-code/qr-code.vue.d.ts +13 -0
- package/dist/es/components/screenfull/index.css +14 -0
- package/dist/es/components/screenfull/index.d.ts +4 -0
- package/dist/es/components/screenfull/index.mjs +6 -0
- package/dist/es/components/screenfull/screenfull.d.ts +4 -0
- package/dist/es/components/screenfull/screenfull.mjs +91 -0
- package/dist/es/components/screenfull/screenfull.vue.d.ts +20 -0
- package/dist/es/components/select/index.css +9 -0
- package/dist/es/components/select/index.d.ts +4 -0
- package/dist/es/components/select/index.mjs +6 -0
- package/dist/es/components/select/select.d.ts +6 -0
- package/dist/es/components/select/select.mjs +63 -0
- package/dist/es/components/select/select.vue.d.ts +6 -0
- package/dist/es/components/single-player/index.css +45 -0
- package/dist/es/components/single-player/index.d.ts +4 -0
- package/dist/es/components/single-player/index.mjs +6 -0
- package/dist/es/components/single-player/single-player.d.ts +4 -0
- package/dist/es/components/single-player/single-player.mjs +1172 -0
- package/dist/es/components/single-player/single-player.vue.d.ts +13 -0
- package/dist/es/components/svg-icon/index.css +9 -0
- package/dist/es/components/svg-icon/index.d.ts +4 -0
- package/dist/es/components/svg-icon/index.mjs +6 -0
- package/dist/es/components/svg-icon/svg-icon.d.ts +5 -0
- package/dist/es/components/svg-icon/svg-icon.mjs +46 -0
- package/dist/es/components/svg-icon/svg-icon.vue.d.ts +18 -0
- package/dist/es/components/switch/index.css +15 -0
- package/dist/es/components/switch/index.d.ts +4 -0
- package/dist/es/components/switch/index.mjs +6 -0
- package/dist/es/components/switch/switch.d.ts +9 -0
- package/dist/es/components/switch/switch.mjs +82 -0
- package/dist/es/components/switch/switch.vue.d.ts +14 -0
- package/dist/es/components/sync-scroll-container/index.css +82 -0
- package/dist/es/components/sync-scroll-container/index.d.ts +4 -0
- package/dist/es/components/sync-scroll-container/index.mjs +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.d.ts +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +157 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.vue.d.ts +36 -0
- package/dist/es/components/tags/index.css +17 -0
- package/dist/es/components/tags/index.d.ts +4 -0
- package/dist/es/components/tags/index.mjs +6 -0
- package/dist/es/components/tags/tags.d.ts +9 -0
- package/dist/es/components/tags/tags.mjs +296 -0
- package/dist/es/components/tags/tags.vue.d.ts +20 -0
- package/dist/es/components/text-ellipsis/index.css +15 -0
- package/dist/es/components/text-ellipsis/index.d.ts +4 -0
- package/dist/es/components/text-ellipsis/index.mjs +6 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.d.ts +12 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +137 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.vue.d.ts +41 -0
- package/dist/es/components/thousand-input/index.css +4 -0
- package/dist/es/components/thousand-input/index.d.ts +4 -0
- package/dist/es/components/thousand-input/index.mjs +6 -0
- package/dist/es/components/thousand-input/thousand-input.d.ts +11 -0
- package/dist/es/components/thousand-input/thousand-input.mjs +159 -0
- package/dist/es/components/thousand-input/thousand-input.vue.d.ts +2558 -0
- package/dist/es/components/tinymce/config.d.ts +25 -0
- package/dist/es/components/tinymce/index.css +9 -0
- package/dist/es/components/tinymce/index.d.ts +4 -0
- package/dist/es/components/tinymce/index.mjs +6 -0
- package/dist/es/components/tinymce/tinymce.d.ts +9 -0
- package/dist/es/components/tinymce/tinymce.mjs +176 -0
- package/dist/es/components/tinymce/tinymce.vue.d.ts +20 -0
- package/dist/es/components/tree-picker/components/popover-cascader.d.ts +8 -0
- package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +1361 -0
- package/dist/es/components/tree-picker/docs/data.d.ts +2 -0
- package/dist/es/components/tree-picker/index.css +41 -0
- package/dist/es/components/tree-picker/index.d.ts +4 -0
- package/dist/es/components/tree-picker/index.mjs +6 -0
- package/dist/es/components/tree-picker/popover-cascader.css +23 -0
- package/dist/es/components/tree-picker/tree-picker.d.ts +14 -0
- package/dist/es/components/tree-picker/tree-picker.mjs +173 -0
- package/dist/es/components/tree-picker/tree-picker.vue.d.ts +575 -0
- package/dist/es/components/upload-file/index.css +30 -0
- package/dist/es/components/upload-file/index.d.ts +4 -0
- package/dist/es/components/upload-file/index.mjs +6 -0
- package/dist/es/components/upload-file/upload-file.d.ts +39 -0
- package/dist/es/components/upload-file/upload-file.mjs +202 -0
- package/dist/es/components/upload-file/upload-file.vue.d.ts +30 -0
- package/dist/es/directives/cleave/index.d.ts +3 -0
- package/dist/es/directives/focus/index.d.ts +4 -0
- package/dist/es/directives/index.d.ts +3 -0
- package/dist/es/directives/thousand/index.d.ts +3 -0
- package/dist/es/index.d.ts +42 -0
- package/dist/es/index.mjs +122 -0
- package/dist/es/use/useSmallScreen/index.d.ts +4 -0
- package/dist/es/use/useSmallScreen/index.mjs +10 -0
- package/dist/es/use/useStore/index.d.ts +3 -0
- package/dist/es/use/useStore/index.mjs +22 -0
- package/dist/es/utils/index.d.ts +6 -0
- package/dist/es/utils/resolver.d.ts +3 -0
- package/dist/es/utils/resolver.mjs +24 -0
- package/dist/es/utils/typescript.d.ts +6 -0
- package/dist/global.d.ts +42 -0
- package/dist/index.css +869 -0
- package/package.json +58 -0
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
import { i as isDef, t as tryOnScopeDispose, b as isClient, n as noop, p as pausableWatch, c as tryOnMounted, d as toArray, w as watchImmediate, e as pxValue, f as injectLocal, g as isObject } from './qY9OvNHY.mjs';
|
|
2
|
+
import { getCurrentInstance, ref, watch, nextTick, computed, shallowRef, onMounted, toValue, watchEffect, hasInjectionContext, unref } from 'vue';
|
|
3
|
+
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region _configurable.ts
|
|
6
|
+
const defaultWindow = isClient ? window : void 0;
|
|
7
|
+
const defaultNavigator = isClient ? window.navigator : void 0;
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region unrefElement/index.ts
|
|
11
|
+
/**
|
|
12
|
+
* Get the dom element of a ref of element or Vue component instance
|
|
13
|
+
*
|
|
14
|
+
* @param elRef
|
|
15
|
+
*/
|
|
16
|
+
function unrefElement(elRef) {
|
|
17
|
+
var _$el;
|
|
18
|
+
const plain = toValue(elRef);
|
|
19
|
+
return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region useEventListener/index.ts
|
|
24
|
+
function useEventListener(...args) {
|
|
25
|
+
const register = (el, event, listener, options) => {
|
|
26
|
+
el.addEventListener(event, listener, options);
|
|
27
|
+
return () => el.removeEventListener(event, listener, options);
|
|
28
|
+
};
|
|
29
|
+
const firstParamTargets = computed(() => {
|
|
30
|
+
const test = toArray(toValue(args[0])).filter((e) => e != null);
|
|
31
|
+
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
32
|
+
});
|
|
33
|
+
return watchImmediate(() => {
|
|
34
|
+
var _firstParamTargets$va, _firstParamTargets$va2;
|
|
35
|
+
return [
|
|
36
|
+
(_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null),
|
|
37
|
+
toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
38
|
+
toArray(unref(firstParamTargets.value ? args[2] : args[1])),
|
|
39
|
+
toValue(firstParamTargets.value ? args[3] : args[2])
|
|
40
|
+
];
|
|
41
|
+
}, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => {
|
|
42
|
+
if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return;
|
|
43
|
+
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
44
|
+
const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))));
|
|
45
|
+
onCleanup(() => {
|
|
46
|
+
cleanups.forEach((fn) => fn());
|
|
47
|
+
});
|
|
48
|
+
}, { flush: "post" });
|
|
49
|
+
}
|
|
50
|
+
function onClickOutside(target, handler, options = {}) {
|
|
51
|
+
const { window: window$1 = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options;
|
|
52
|
+
if (!window$1) return controls ? {
|
|
53
|
+
stop: noop,
|
|
54
|
+
cancel: noop,
|
|
55
|
+
trigger: noop
|
|
56
|
+
} : noop;
|
|
57
|
+
let shouldListen = true;
|
|
58
|
+
const shouldIgnore = (event) => {
|
|
59
|
+
return toValue(ignore).some((target$1) => {
|
|
60
|
+
if (typeof target$1 === "string") return Array.from(window$1.document.querySelectorAll(target$1)).some((el) => el === event.target || event.composedPath().includes(el));
|
|
61
|
+
else {
|
|
62
|
+
const el = unrefElement(target$1);
|
|
63
|
+
return el && (event.target === el || event.composedPath().includes(el));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the given target has multiple root elements.
|
|
69
|
+
* Referenced from: https://github.com/vuejs/test-utils/blob/ccb460be55f9f6be05ab708500a41ec8adf6f4bc/src/vue-wrapper.ts#L21
|
|
70
|
+
*/
|
|
71
|
+
function hasMultipleRoots(target$1) {
|
|
72
|
+
const vm = toValue(target$1);
|
|
73
|
+
return vm && vm.$.subTree.shapeFlag === 16;
|
|
74
|
+
}
|
|
75
|
+
function checkMultipleRoots(target$1, event) {
|
|
76
|
+
const vm = toValue(target$1);
|
|
77
|
+
const children = vm.$.subTree && vm.$.subTree.children;
|
|
78
|
+
if (children == null || !Array.isArray(children)) return false;
|
|
79
|
+
return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
|
|
80
|
+
}
|
|
81
|
+
const listener = (event) => {
|
|
82
|
+
const el = unrefElement(target);
|
|
83
|
+
if (event.target == null) return;
|
|
84
|
+
if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return;
|
|
85
|
+
if (!el || el === event.target || event.composedPath().includes(el)) return;
|
|
86
|
+
if ("detail" in event && event.detail === 0) shouldListen = !shouldIgnore(event);
|
|
87
|
+
if (!shouldListen) {
|
|
88
|
+
shouldListen = true;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
handler(event);
|
|
92
|
+
};
|
|
93
|
+
let isProcessingClick = false;
|
|
94
|
+
const cleanup = [
|
|
95
|
+
useEventListener(window$1, "click", (event) => {
|
|
96
|
+
if (!isProcessingClick) {
|
|
97
|
+
isProcessingClick = true;
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
isProcessingClick = false;
|
|
100
|
+
}, 0);
|
|
101
|
+
listener(event);
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
passive: true,
|
|
105
|
+
capture
|
|
106
|
+
}),
|
|
107
|
+
useEventListener(window$1, "pointerdown", (e) => {
|
|
108
|
+
const el = unrefElement(target);
|
|
109
|
+
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
110
|
+
}, { passive: true }),
|
|
111
|
+
detectIframe && useEventListener(window$1, "blur", (event) => {
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
var _window$document$acti;
|
|
114
|
+
const el = unrefElement(target);
|
|
115
|
+
if (((_window$document$acti = window$1.document.activeElement) === null || _window$document$acti === void 0 ? void 0 : _window$document$acti.tagName) === "IFRAME" && !(el === null || el === void 0 ? void 0 : el.contains(window$1.document.activeElement))) handler(event);
|
|
116
|
+
}, 0);
|
|
117
|
+
}, { passive: true })
|
|
118
|
+
].filter(Boolean);
|
|
119
|
+
const stop = () => cleanup.forEach((fn) => fn());
|
|
120
|
+
if (controls) return {
|
|
121
|
+
stop,
|
|
122
|
+
cancel: () => {
|
|
123
|
+
shouldListen = false;
|
|
124
|
+
},
|
|
125
|
+
trigger: (event) => {
|
|
126
|
+
shouldListen = true;
|
|
127
|
+
listener(event);
|
|
128
|
+
shouldListen = false;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return stop;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region useMounted/index.ts
|
|
136
|
+
/**
|
|
137
|
+
* Mounted state in ref.
|
|
138
|
+
*
|
|
139
|
+
* @see https://vueuse.org/useMounted
|
|
140
|
+
*
|
|
141
|
+
* @__NO_SIDE_EFFECTS__
|
|
142
|
+
*/
|
|
143
|
+
function useMounted() {
|
|
144
|
+
const isMounted = shallowRef(false);
|
|
145
|
+
const instance = getCurrentInstance();
|
|
146
|
+
if (instance) onMounted(() => {
|
|
147
|
+
isMounted.value = true;
|
|
148
|
+
}, instance);
|
|
149
|
+
return isMounted;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region useSupported/index.ts
|
|
154
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
155
|
+
function useSupported(callback) {
|
|
156
|
+
const isMounted = useMounted();
|
|
157
|
+
return computed(() => {
|
|
158
|
+
isMounted.value;
|
|
159
|
+
return Boolean(callback());
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region useSSRWidth/index.ts
|
|
165
|
+
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
166
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
167
|
+
function useSSRWidth() {
|
|
168
|
+
const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
|
|
169
|
+
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region useMediaQuery/index.ts
|
|
174
|
+
/**
|
|
175
|
+
* Reactive Media Query.
|
|
176
|
+
*
|
|
177
|
+
* @see https://vueuse.org/useMediaQuery
|
|
178
|
+
* @param query
|
|
179
|
+
* @param options
|
|
180
|
+
*/
|
|
181
|
+
function useMediaQuery(query, options = {}) {
|
|
182
|
+
const { window: window$1 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
183
|
+
const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "matchMedia" in window$1 && typeof window$1.matchMedia === "function");
|
|
184
|
+
const ssrSupport = shallowRef(typeof ssrWidth === "number");
|
|
185
|
+
const mediaQuery = shallowRef();
|
|
186
|
+
const matches = shallowRef(false);
|
|
187
|
+
const handler = (event) => {
|
|
188
|
+
matches.value = event.matches;
|
|
189
|
+
};
|
|
190
|
+
watchEffect(() => {
|
|
191
|
+
if (ssrSupport.value) {
|
|
192
|
+
ssrSupport.value = !isSupported.value;
|
|
193
|
+
matches.value = toValue(query).split(",").some((queryString) => {
|
|
194
|
+
const not = queryString.includes("not all");
|
|
195
|
+
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
196
|
+
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
197
|
+
let res = Boolean(minWidth || maxWidth);
|
|
198
|
+
if (minWidth && res) res = ssrWidth >= pxValue(minWidth[1]);
|
|
199
|
+
if (maxWidth && res) res = ssrWidth <= pxValue(maxWidth[1]);
|
|
200
|
+
return not ? !res : res;
|
|
201
|
+
});
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (!isSupported.value) return;
|
|
205
|
+
mediaQuery.value = window$1.matchMedia(toValue(query));
|
|
206
|
+
matches.value = mediaQuery.value.matches;
|
|
207
|
+
});
|
|
208
|
+
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
209
|
+
return computed(() => matches.value);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region useCloned/index.ts
|
|
214
|
+
function cloneFnJSON(source) {
|
|
215
|
+
return JSON.parse(JSON.stringify(source));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region ssr-handlers.ts
|
|
220
|
+
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
221
|
+
const globalKey = "__vueuse_ssr_handlers__";
|
|
222
|
+
const handlers = /* @__PURE__ */ getHandlers();
|
|
223
|
+
function getHandlers() {
|
|
224
|
+
if (!(globalKey in _global)) _global[globalKey] = _global[globalKey] || {};
|
|
225
|
+
return _global[globalKey];
|
|
226
|
+
}
|
|
227
|
+
function getSSRHandler(key, fallback) {
|
|
228
|
+
return handlers[key] || fallback;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region useStorage/guess.ts
|
|
233
|
+
function guessSerializerType(rawInit) {
|
|
234
|
+
return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region useStorage/index.ts
|
|
239
|
+
const StorageSerializers = {
|
|
240
|
+
boolean: {
|
|
241
|
+
read: (v) => v === "true",
|
|
242
|
+
write: (v) => String(v)
|
|
243
|
+
},
|
|
244
|
+
object: {
|
|
245
|
+
read: (v) => JSON.parse(v),
|
|
246
|
+
write: (v) => JSON.stringify(v)
|
|
247
|
+
},
|
|
248
|
+
number: {
|
|
249
|
+
read: (v) => Number.parseFloat(v),
|
|
250
|
+
write: (v) => String(v)
|
|
251
|
+
},
|
|
252
|
+
any: {
|
|
253
|
+
read: (v) => v,
|
|
254
|
+
write: (v) => String(v)
|
|
255
|
+
},
|
|
256
|
+
string: {
|
|
257
|
+
read: (v) => v,
|
|
258
|
+
write: (v) => String(v)
|
|
259
|
+
},
|
|
260
|
+
map: {
|
|
261
|
+
read: (v) => new Map(JSON.parse(v)),
|
|
262
|
+
write: (v) => JSON.stringify(Array.from(v.entries()))
|
|
263
|
+
},
|
|
264
|
+
set: {
|
|
265
|
+
read: (v) => new Set(JSON.parse(v)),
|
|
266
|
+
write: (v) => JSON.stringify(Array.from(v))
|
|
267
|
+
},
|
|
268
|
+
date: {
|
|
269
|
+
read: (v) => new Date(v),
|
|
270
|
+
write: (v) => v.toISOString()
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const customStorageEventName = "vueuse-storage";
|
|
274
|
+
/**
|
|
275
|
+
* Reactive LocalStorage/SessionStorage.
|
|
276
|
+
*
|
|
277
|
+
* @see https://vueuse.org/useStorage
|
|
278
|
+
*/
|
|
279
|
+
function useStorage(key, defaults$1, storage, options = {}) {
|
|
280
|
+
var _options$serializer;
|
|
281
|
+
const { flush = "pre", deep = true, listenToStorageChanges = true, writeDefaults = true, mergeDefaults = false, shallow, window: window$1 = defaultWindow, eventFilter, onError = (e) => {
|
|
282
|
+
console.error(e);
|
|
283
|
+
}, initOnMounted } = options;
|
|
284
|
+
const data = (shallow ? shallowRef : ref)(typeof defaults$1 === "function" ? defaults$1() : defaults$1);
|
|
285
|
+
const keyComputed = computed(() => toValue(key));
|
|
286
|
+
if (!storage) try {
|
|
287
|
+
storage = getSSRHandler("getDefaultStorage", () => defaultWindow === null || defaultWindow === void 0 ? void 0 : defaultWindow.localStorage)();
|
|
288
|
+
} catch (e) {
|
|
289
|
+
onError(e);
|
|
290
|
+
}
|
|
291
|
+
if (!storage) return data;
|
|
292
|
+
const rawInit = toValue(defaults$1);
|
|
293
|
+
const type = guessSerializerType(rawInit);
|
|
294
|
+
const serializer = (_options$serializer = options.serializer) !== null && _options$serializer !== void 0 ? _options$serializer : StorageSerializers[type];
|
|
295
|
+
const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(data, (newValue) => write(newValue), {
|
|
296
|
+
flush,
|
|
297
|
+
deep,
|
|
298
|
+
eventFilter
|
|
299
|
+
});
|
|
300
|
+
watch(keyComputed, () => update(), { flush });
|
|
301
|
+
let firstMounted = false;
|
|
302
|
+
const onStorageEvent = (ev) => {
|
|
303
|
+
if (initOnMounted && !firstMounted) return;
|
|
304
|
+
update(ev);
|
|
305
|
+
};
|
|
306
|
+
const onStorageCustomEvent = (ev) => {
|
|
307
|
+
if (initOnMounted && !firstMounted) return;
|
|
308
|
+
updateFromCustomEvent(ev);
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* The custom event is needed for same-document syncing when using custom
|
|
312
|
+
* storage backends, but it doesn't work across different documents.
|
|
313
|
+
*
|
|
314
|
+
* TODO: Consider implementing a BroadcastChannel-based solution that fixes this.
|
|
315
|
+
*/
|
|
316
|
+
if (window$1 && listenToStorageChanges) if (storage instanceof Storage) useEventListener(window$1, "storage", onStorageEvent, { passive: true });
|
|
317
|
+
else useEventListener(window$1, customStorageEventName, onStorageCustomEvent);
|
|
318
|
+
if (initOnMounted) tryOnMounted(() => {
|
|
319
|
+
firstMounted = true;
|
|
320
|
+
update();
|
|
321
|
+
});
|
|
322
|
+
else update();
|
|
323
|
+
function dispatchWriteEvent(oldValue, newValue) {
|
|
324
|
+
if (window$1) {
|
|
325
|
+
const payload = {
|
|
326
|
+
key: keyComputed.value,
|
|
327
|
+
oldValue,
|
|
328
|
+
newValue,
|
|
329
|
+
storageArea: storage
|
|
330
|
+
};
|
|
331
|
+
window$1.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, { detail: payload }));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function write(v) {
|
|
335
|
+
try {
|
|
336
|
+
const oldValue = storage.getItem(keyComputed.value);
|
|
337
|
+
if (v == null) {
|
|
338
|
+
dispatchWriteEvent(oldValue, null);
|
|
339
|
+
storage.removeItem(keyComputed.value);
|
|
340
|
+
} else {
|
|
341
|
+
const serialized = serializer.write(v);
|
|
342
|
+
if (oldValue !== serialized) {
|
|
343
|
+
storage.setItem(keyComputed.value, serialized);
|
|
344
|
+
dispatchWriteEvent(oldValue, serialized);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
} catch (e) {
|
|
348
|
+
onError(e);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function read(event) {
|
|
352
|
+
const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
|
|
353
|
+
if (rawValue == null) {
|
|
354
|
+
if (writeDefaults && rawInit != null) storage.setItem(keyComputed.value, serializer.write(rawInit));
|
|
355
|
+
return rawInit;
|
|
356
|
+
} else if (!event && mergeDefaults) {
|
|
357
|
+
const value = serializer.read(rawValue);
|
|
358
|
+
if (typeof mergeDefaults === "function") return mergeDefaults(value, rawInit);
|
|
359
|
+
else if (type === "object" && !Array.isArray(value)) return {
|
|
360
|
+
...rawInit,
|
|
361
|
+
...value
|
|
362
|
+
};
|
|
363
|
+
return value;
|
|
364
|
+
} else if (typeof rawValue !== "string") return rawValue;
|
|
365
|
+
else return serializer.read(rawValue);
|
|
366
|
+
}
|
|
367
|
+
function update(event) {
|
|
368
|
+
if (event && event.storageArea !== storage) return;
|
|
369
|
+
if (event && event.key == null) {
|
|
370
|
+
data.value = rawInit;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (event && event.key !== keyComputed.value) return;
|
|
374
|
+
pauseWatch();
|
|
375
|
+
try {
|
|
376
|
+
const serializedData = serializer.write(data.value);
|
|
377
|
+
if (event === void 0 || (event === null || event === void 0 ? void 0 : event.newValue) !== serializedData) data.value = read(event);
|
|
378
|
+
} catch (e) {
|
|
379
|
+
onError(e);
|
|
380
|
+
} finally {
|
|
381
|
+
if (event) nextTick(resumeWatch);
|
|
382
|
+
else resumeWatch();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function updateFromCustomEvent(event) {
|
|
386
|
+
update(event.detail);
|
|
387
|
+
}
|
|
388
|
+
return data;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region useResizeObserver/index.ts
|
|
393
|
+
/**
|
|
394
|
+
* Reports changes to the dimensions of an Element's content or the border-box
|
|
395
|
+
*
|
|
396
|
+
* @see https://vueuse.org/useResizeObserver
|
|
397
|
+
* @param target
|
|
398
|
+
* @param callback
|
|
399
|
+
* @param options
|
|
400
|
+
*/
|
|
401
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
402
|
+
const { window: window$1 = defaultWindow,...observerOptions } = options;
|
|
403
|
+
let observer;
|
|
404
|
+
const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "ResizeObserver" in window$1);
|
|
405
|
+
const cleanup = () => {
|
|
406
|
+
if (observer) {
|
|
407
|
+
observer.disconnect();
|
|
408
|
+
observer = void 0;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const stopWatch = watch(computed(() => {
|
|
412
|
+
const _targets = toValue(target);
|
|
413
|
+
return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
|
|
414
|
+
}), (els) => {
|
|
415
|
+
cleanup();
|
|
416
|
+
if (isSupported.value && window$1) {
|
|
417
|
+
observer = new ResizeObserver(callback);
|
|
418
|
+
for (const _el of els) if (_el) observer.observe(_el, observerOptions);
|
|
419
|
+
}
|
|
420
|
+
}, {
|
|
421
|
+
immediate: true,
|
|
422
|
+
flush: "post"
|
|
423
|
+
});
|
|
424
|
+
const stop = () => {
|
|
425
|
+
cleanup();
|
|
426
|
+
stopWatch();
|
|
427
|
+
};
|
|
428
|
+
tryOnScopeDispose(stop);
|
|
429
|
+
return {
|
|
430
|
+
isSupported,
|
|
431
|
+
stop
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region useElementSize/index.ts
|
|
437
|
+
/**
|
|
438
|
+
* Reactive size of an HTML element.
|
|
439
|
+
*
|
|
440
|
+
* @see https://vueuse.org/useElementSize
|
|
441
|
+
*/
|
|
442
|
+
function useElementSize(target, initialSize = {
|
|
443
|
+
width: 0,
|
|
444
|
+
height: 0
|
|
445
|
+
}, options = {}) {
|
|
446
|
+
const { window: window$1 = defaultWindow, box = "content-box" } = options;
|
|
447
|
+
const isSVG = computed(() => {
|
|
448
|
+
var _unrefElement;
|
|
449
|
+
return (_unrefElement = unrefElement(target)) === null || _unrefElement === void 0 || (_unrefElement = _unrefElement.namespaceURI) === null || _unrefElement === void 0 ? void 0 : _unrefElement.includes("svg");
|
|
450
|
+
});
|
|
451
|
+
const width = shallowRef(initialSize.width);
|
|
452
|
+
const height = shallowRef(initialSize.height);
|
|
453
|
+
const { stop: stop1 } = useResizeObserver(target, ([entry]) => {
|
|
454
|
+
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
455
|
+
if (window$1 && isSVG.value) {
|
|
456
|
+
const $elem = unrefElement(target);
|
|
457
|
+
if ($elem) {
|
|
458
|
+
const rect = $elem.getBoundingClientRect();
|
|
459
|
+
width.value = rect.width;
|
|
460
|
+
height.value = rect.height;
|
|
461
|
+
}
|
|
462
|
+
} else if (boxSize) {
|
|
463
|
+
const formatBoxSize = toArray(boxSize);
|
|
464
|
+
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
|
|
465
|
+
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
|
|
466
|
+
} else {
|
|
467
|
+
width.value = entry.contentRect.width;
|
|
468
|
+
height.value = entry.contentRect.height;
|
|
469
|
+
}
|
|
470
|
+
}, options);
|
|
471
|
+
tryOnMounted(() => {
|
|
472
|
+
const ele = unrefElement(target);
|
|
473
|
+
if (ele) {
|
|
474
|
+
width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
|
|
475
|
+
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
const stop2 = watch(() => unrefElement(target), (ele) => {
|
|
479
|
+
width.value = ele ? initialSize.width : 0;
|
|
480
|
+
height.value = ele ? initialSize.height : 0;
|
|
481
|
+
});
|
|
482
|
+
function stop() {
|
|
483
|
+
stop1();
|
|
484
|
+
stop2();
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
width,
|
|
488
|
+
height,
|
|
489
|
+
stop
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region useUserMedia/index.ts
|
|
495
|
+
/**
|
|
496
|
+
* Reactive `mediaDevices.getUserMedia` streaming
|
|
497
|
+
*
|
|
498
|
+
* @see https://vueuse.org/useUserMedia
|
|
499
|
+
* @param options
|
|
500
|
+
*/
|
|
501
|
+
function useUserMedia(options = {}) {
|
|
502
|
+
var _options$enabled, _options$autoSwitch;
|
|
503
|
+
const enabled = shallowRef((_options$enabled = options.enabled) !== null && _options$enabled !== void 0 ? _options$enabled : false);
|
|
504
|
+
const autoSwitch = shallowRef((_options$autoSwitch = options.autoSwitch) !== null && _options$autoSwitch !== void 0 ? _options$autoSwitch : true);
|
|
505
|
+
const constraints = ref(options.constraints);
|
|
506
|
+
const { navigator: navigator$1 = defaultNavigator } = options;
|
|
507
|
+
const isSupported = /* @__PURE__ */ useSupported(() => {
|
|
508
|
+
var _navigator$mediaDevic;
|
|
509
|
+
return navigator$1 === null || navigator$1 === void 0 || (_navigator$mediaDevic = navigator$1.mediaDevices) === null || _navigator$mediaDevic === void 0 ? void 0 : _navigator$mediaDevic.getUserMedia;
|
|
510
|
+
});
|
|
511
|
+
const stream = shallowRef();
|
|
512
|
+
function getDeviceOptions(type) {
|
|
513
|
+
switch (type) {
|
|
514
|
+
case "video":
|
|
515
|
+
if (constraints.value) return constraints.value.video || false;
|
|
516
|
+
break;
|
|
517
|
+
case "audio":
|
|
518
|
+
if (constraints.value) return constraints.value.audio || false;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
async function _start() {
|
|
523
|
+
if (!isSupported.value || stream.value) return;
|
|
524
|
+
stream.value = await navigator$1.mediaDevices.getUserMedia({
|
|
525
|
+
video: getDeviceOptions("video"),
|
|
526
|
+
audio: getDeviceOptions("audio")
|
|
527
|
+
});
|
|
528
|
+
return stream.value;
|
|
529
|
+
}
|
|
530
|
+
function _stop() {
|
|
531
|
+
var _stream$value;
|
|
532
|
+
(_stream$value = stream.value) === null || _stream$value === void 0 || _stream$value.getTracks().forEach((t) => t.stop());
|
|
533
|
+
stream.value = void 0;
|
|
534
|
+
}
|
|
535
|
+
function stop() {
|
|
536
|
+
_stop();
|
|
537
|
+
enabled.value = false;
|
|
538
|
+
}
|
|
539
|
+
async function start() {
|
|
540
|
+
await _start();
|
|
541
|
+
if (stream.value) enabled.value = true;
|
|
542
|
+
return stream.value;
|
|
543
|
+
}
|
|
544
|
+
async function restart() {
|
|
545
|
+
_stop();
|
|
546
|
+
return await start();
|
|
547
|
+
}
|
|
548
|
+
watch(enabled, (v) => {
|
|
549
|
+
if (v) _start();
|
|
550
|
+
else _stop();
|
|
551
|
+
}, { immediate: true });
|
|
552
|
+
watch(constraints, () => {
|
|
553
|
+
if (autoSwitch.value && stream.value) restart();
|
|
554
|
+
}, {
|
|
555
|
+
immediate: true,
|
|
556
|
+
deep: true
|
|
557
|
+
});
|
|
558
|
+
tryOnScopeDispose(() => {
|
|
559
|
+
stop();
|
|
560
|
+
});
|
|
561
|
+
return {
|
|
562
|
+
isSupported,
|
|
563
|
+
stream,
|
|
564
|
+
start,
|
|
565
|
+
stop,
|
|
566
|
+
restart,
|
|
567
|
+
constraints,
|
|
568
|
+
enabled,
|
|
569
|
+
autoSwitch
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region useVModel/index.ts
|
|
575
|
+
/**
|
|
576
|
+
* Shorthand for v-model binding, props + emit -> ref
|
|
577
|
+
*
|
|
578
|
+
* @see https://vueuse.org/useVModel
|
|
579
|
+
* @param props
|
|
580
|
+
* @param key (default 'modelValue')
|
|
581
|
+
* @param emit
|
|
582
|
+
* @param options
|
|
583
|
+
*
|
|
584
|
+
* @__NO_SIDE_EFFECTS__
|
|
585
|
+
*/
|
|
586
|
+
function useVModel(props, key, emit, options = {}) {
|
|
587
|
+
var _vm$$emit, _vm$proxy;
|
|
588
|
+
const { clone = false, passive = false, eventName, deep = false, defaultValue, shouldEmit } = options;
|
|
589
|
+
const vm = getCurrentInstance();
|
|
590
|
+
const _emit = emit || (vm === null || vm === void 0 ? void 0 : vm.emit) || (vm === null || vm === void 0 || (_vm$$emit = vm.$emit) === null || _vm$$emit === void 0 ? void 0 : _vm$$emit.bind(vm)) || (vm === null || vm === void 0 || (_vm$proxy = vm.proxy) === null || _vm$proxy === void 0 || (_vm$proxy = _vm$proxy.$emit) === null || _vm$proxy === void 0 ? void 0 : _vm$proxy.bind(vm === null || vm === void 0 ? void 0 : vm.proxy));
|
|
591
|
+
let event = eventName;
|
|
592
|
+
event = event || `update:${key.toString()}`;
|
|
593
|
+
const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val);
|
|
594
|
+
const getValue$1 = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
|
|
595
|
+
const triggerEmit = (value) => {
|
|
596
|
+
if (shouldEmit) {
|
|
597
|
+
if (shouldEmit(value)) _emit(event, value);
|
|
598
|
+
} else _emit(event, value);
|
|
599
|
+
};
|
|
600
|
+
if (passive) {
|
|
601
|
+
const proxy = ref(getValue$1());
|
|
602
|
+
let isUpdating = false;
|
|
603
|
+
watch(() => props[key], (v) => {
|
|
604
|
+
if (!isUpdating) {
|
|
605
|
+
isUpdating = true;
|
|
606
|
+
proxy.value = cloneFn(v);
|
|
607
|
+
nextTick(() => isUpdating = false);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
watch(proxy, (v) => {
|
|
611
|
+
if (!isUpdating && (v !== props[key] || deep)) triggerEmit(v);
|
|
612
|
+
}, { deep });
|
|
613
|
+
return proxy;
|
|
614
|
+
} else return computed({
|
|
615
|
+
get() {
|
|
616
|
+
return getValue$1();
|
|
617
|
+
},
|
|
618
|
+
set(value) {
|
|
619
|
+
triggerEmit(value);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region useWindowSize/index.ts
|
|
626
|
+
/**
|
|
627
|
+
* Reactive window size.
|
|
628
|
+
*
|
|
629
|
+
* @see https://vueuse.org/useWindowSize
|
|
630
|
+
* @param options
|
|
631
|
+
*
|
|
632
|
+
* @__NO_SIDE_EFFECTS__
|
|
633
|
+
*/
|
|
634
|
+
function useWindowSize(options = {}) {
|
|
635
|
+
const { window: window$1 = defaultWindow, initialWidth = Number.POSITIVE_INFINITY, initialHeight = Number.POSITIVE_INFINITY, listenOrientation = true, includeScrollbar = true, type = "inner" } = options;
|
|
636
|
+
const width = shallowRef(initialWidth);
|
|
637
|
+
const height = shallowRef(initialHeight);
|
|
638
|
+
const update = () => {
|
|
639
|
+
if (window$1) if (type === "outer") {
|
|
640
|
+
width.value = window$1.outerWidth;
|
|
641
|
+
height.value = window$1.outerHeight;
|
|
642
|
+
} else if (type === "visual" && window$1.visualViewport) {
|
|
643
|
+
const { width: visualViewportWidth, height: visualViewportHeight, scale } = window$1.visualViewport;
|
|
644
|
+
width.value = Math.round(visualViewportWidth * scale);
|
|
645
|
+
height.value = Math.round(visualViewportHeight * scale);
|
|
646
|
+
} else if (includeScrollbar) {
|
|
647
|
+
width.value = window$1.innerWidth;
|
|
648
|
+
height.value = window$1.innerHeight;
|
|
649
|
+
} else {
|
|
650
|
+
width.value = window$1.document.documentElement.clientWidth;
|
|
651
|
+
height.value = window$1.document.documentElement.clientHeight;
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
update();
|
|
655
|
+
tryOnMounted(update);
|
|
656
|
+
const listenerOptions = { passive: true };
|
|
657
|
+
useEventListener("resize", update, listenerOptions);
|
|
658
|
+
if (window$1 && type === "visual" && window$1.visualViewport) useEventListener(window$1.visualViewport, "resize", update, listenerOptions);
|
|
659
|
+
if (listenOrientation) watch(useMediaQuery("(orientation: portrait)"), () => update());
|
|
660
|
+
return {
|
|
661
|
+
width,
|
|
662
|
+
height
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export { useUserMedia as a, useStorage as b, useElementSize as c, useWindowSize as d, onClickOutside as o, useVModel as u };
|