@volverjs/ui-vue 0.0.10-beta.75 → 0.0.10-beta.77
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 +8 -8
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +3 -3
- package/dist/components/VvAccordion/VvAccordion.es.js +9 -9
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +14 -15
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAction/VvAction.es.js +10 -13
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.es.js +19 -19
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +19 -19
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -8
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +1 -1
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +12 -18
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +32 -38
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +1 -1
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -12
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -20
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +266 -285
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -14
- package/dist/components/VvCombobox/index.d.ts +22 -0
- package/dist/components/VvDialog/VvDialog.es.js +5 -7
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +10 -15
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -2
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +11 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +5 -5
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +45 -57
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +54 -66
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNav.es.js +16 -21
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +10 -13
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +1 -1
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +10 -12
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -20
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +27 -30
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +3 -3
- package/dist/components/VvTab/VvTab.es.js +18 -25
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +47 -57
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +346 -394
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/index.es.js +10 -15
- package/dist/composables/index.umd.js +1 -1
- package/dist/directives/index.es.js +9 -14
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +8 -13
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +1 -1
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +9 -12
- package/dist/index.umd.js +1 -1
- package/dist/resolvers/unplugin.es.js +1 -1
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +2 -2
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/package.json +35 -32
|
@@ -46,7 +46,7 @@ function useAlert() {
|
|
|
46
46
|
icon = DefaultAlertIconMap.get(alertModifier);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
groupMap
|
|
49
|
+
groupMap?.set(id.toString(), {
|
|
50
50
|
id,
|
|
51
51
|
group,
|
|
52
52
|
title,
|
|
@@ -61,12 +61,12 @@ function useAlert() {
|
|
|
61
61
|
};
|
|
62
62
|
const removeAlert = (id, group = DEFAULT_ALERT_GROUP) => {
|
|
63
63
|
const groupMap = groups.get(group);
|
|
64
|
-
groupMap
|
|
64
|
+
groupMap?.delete(id.toString());
|
|
65
65
|
};
|
|
66
66
|
const getAlerts = (group = DEFAULT_ALERT_GROUP) => {
|
|
67
67
|
return computed(() => {
|
|
68
68
|
const groupMap = groups.get(group);
|
|
69
|
-
return groupMap && groupMap instanceof Map ? Array.from(groupMap
|
|
69
|
+
return groupMap && groupMap instanceof Map ? Array.from(groupMap?.values()).sort(
|
|
70
70
|
(a, b) => a.timestamp - b.timestamp
|
|
71
71
|
) : [];
|
|
72
72
|
});
|
|
@@ -90,12 +90,10 @@ function useDropdownContextmenu(dropdownEl, targetEl) {
|
|
|
90
90
|
const target = computed(() => unref(targetEl));
|
|
91
91
|
if (target && getCurrentInstance()) {
|
|
92
92
|
onMounted(() => {
|
|
93
|
-
|
|
94
|
-
(_a = target.value) == null ? void 0 : _a.addEventListener("contextmenu", onContextmenu, false);
|
|
93
|
+
target.value?.addEventListener("contextmenu", onContextmenu, false);
|
|
95
94
|
});
|
|
96
95
|
onUnmounted(() => {
|
|
97
|
-
|
|
98
|
-
(_a = target.value) == null ? void 0 : _a.removeEventListener("contextmenu", onContextmenu);
|
|
96
|
+
target.value?.removeEventListener("contextmenu", onContextmenu);
|
|
99
97
|
});
|
|
100
98
|
}
|
|
101
99
|
return { x, y, getBoundingClientRect, onContextmenu, onScroll };
|
|
@@ -161,15 +159,15 @@ function useDropdownVirtualElement(dropdownEl) {
|
|
|
161
159
|
}
|
|
162
160
|
return { x, y, getBoundingClientRect, onScroll };
|
|
163
161
|
}
|
|
164
|
-
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(
|
|
165
|
-
const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
|
|
162
|
+
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n';
|
|
163
|
+
const blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
166
164
|
function WorkerWrapper(options) {
|
|
167
165
|
let objURL;
|
|
168
166
|
try {
|
|
169
167
|
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
|
170
168
|
if (!objURL) throw "";
|
|
171
169
|
const worker = new Worker(objURL, {
|
|
172
|
-
name: options
|
|
170
|
+
name: options?.name
|
|
173
171
|
});
|
|
174
172
|
worker.addEventListener("error", () => {
|
|
175
173
|
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
@@ -179,11 +177,9 @@ function WorkerWrapper(options) {
|
|
|
179
177
|
return new Worker(
|
|
180
178
|
"data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
|
|
181
179
|
{
|
|
182
|
-
name: options
|
|
180
|
+
name: options?.name
|
|
183
181
|
}
|
|
184
182
|
);
|
|
185
|
-
} finally {
|
|
186
|
-
objURL && (self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
187
183
|
}
|
|
188
184
|
}
|
|
189
185
|
const remoteFunction = wrap(new WorkerWrapper());
|
|
@@ -208,13 +204,12 @@ function getWidthHeightFromMaxSize(width, height, maxSize) {
|
|
|
208
204
|
};
|
|
209
205
|
}
|
|
210
206
|
async function resizeImage(image, width, height) {
|
|
211
|
-
var _a;
|
|
212
207
|
const resizer = new Pica();
|
|
213
208
|
const canvas = document.createElement("canvas");
|
|
214
209
|
canvas.width = width;
|
|
215
210
|
canvas.height = height;
|
|
216
211
|
const result = await resizer.resize(image, canvas);
|
|
217
|
-
return
|
|
212
|
+
return result.getContext("2d")?.getImageData(0, 0, width, height).data;
|
|
218
213
|
}
|
|
219
214
|
function useBlurhash() {
|
|
220
215
|
async function encode(file) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["exports","vue","comlink","pica"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).composables={},t.vue,t.comlink,t.Pica)}(this,(function(t,e,n,r){"use strict";const a="default",o="information",i=new Map([["success","check-circle"],["info",o],["warning","warning"],["danger","error"]]),s=e.reactive(new Map([[a,new Map]]));function l(t){const n=e.ref(0),r=e.ref(0),a=e.ref();let o=0,i=0,s=0,l=0;const c=t=>{const e=t.target;o=e.scrollLeft-l,i=e.scrollTop-s,r.value=r.value-i,n.value=n.value-o,l=e.scrollLeft,s=e.scrollTop},u=()=>({width:0,height:0,x:n.value,y:r.value,top:r.value,left:n.value,right:n.value,bottom:r.value});return e.getCurrentInstance()&&(e.onMounted((()=>{t.value&&(t.value.init({getBoundingClientRect:u}),a.value=function(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every((t=>"auto"===t||"scroll"===t)))return e;e=e.parentElement}return document.documentElement}(t.value.$el),a.value&&a.value.addEventListener("scroll",c))})),e.onUnmounted((()=>{a.value&&a.value.removeEventListener("scroll",c)}))),{x:n,y:r,getBoundingClientRect:u,onScroll:c}}const c='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,((t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r)));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map((t=>Math.max(...t)))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach((t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)})),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",(function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}})),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce(((t,e)=>t[e]),t),n=i.reduce(((t,e)=>t[e]),t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch((t=>({value:t,[d]:0}))).then((n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())})).catch((t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then((()=>{E(t)}))}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)}));function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map((t=>t.toString()))}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map((t=>t.toString())),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise((a=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)}))}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',u="undefined"!=typeof self&&self.Blob&&new Blob([c],{type:"text/javascript;charset=utf-8"});const h=n.wrap(new function(t){let e;try{if(e=u&&(self.URL||self.webkitURL).createObjectURL(u),!e)throw"";const n=new Worker(e,{name:null==t?void 0:t.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(c),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}});function f(t){return new Promise(((e,n)=>{const r=new Image;r.onload=()=>e(r),r.onerror=(...t)=>n(t),r.src=t}))}t.useAlert=function(){const t=(t=a)=>e.computed((()=>{const e=s.get(t);return e&&e instanceof Map?Array.from(null==e?void 0:e.values()).sort(((t,e)=>t.timestamp-e.timestamp)):[]}));return{groups:s,alerts:t(),addAlert:({id:t=crypto.randomUUID(),group:e=a,title:n,icon:r=o,content:l,footer:c,modifiers:u="info",dismissable:h=true,autoClose:f=1e4,timestamp:m=Date.now()}={})=>{s.has(e)||s.set(e,new Map);const d=s.get(e),p="string"==typeof u?u.split(" "):u;if(!r){const t=p.find((t=>i.has(t)));t&&(r=i.get(t))}null==d||d.set(t.toString(),{id:t,group:e,title:n,icon:r,content:l,footer:c,modifiers:u,dismissable:h,autoClose:f,timestamp:m})},removeAlert:(t,e=a)=>{const n=s.get(e);null==n||n.delete(t.toString())},getAlerts:t}},t.useBlurhash=function(){return{encode:async function(t){const e=URL.createObjectURL(t),n=await f(e);if("width"in n&&"height"in n){const{width:t,height:e}=(a=n.width,o=n.height,i=32,a>o?{width:i,height:Math.round(i*(o/a))}:{width:Math.round(i*(a/o)),height:i}),s=await async function(t,e,n){var a;const o=new r,i=document.createElement("canvas");return i.width=e,i.height=n,null==(a=(await o.resize(t,i)).getContext("2d"))?void 0:a.getImageData(0,0,e,n).data}(n,t,e);if(s)return h.encode(s,t,e,4,4)}var a,o,i},decode:h.decode,loadImage:f}},t.useDropdownContextmenu=function(t,n){const{x:r,y:a,getBoundingClientRect:o,onScroll:i}=l(t),s=e=>{r.value=e.clientX,a.value=e.clientY,e.preventDefault(),t.value.show()},c=e.computed((()=>e.unref(n)));return c&&e.getCurrentInstance()&&(e.onMounted((()=>{var t;null==(t=c.value)||t.addEventListener("contextmenu",s,!1)})),e.onUnmounted((()=>{var t;null==(t=c.value)||t.removeEventListener("contextmenu",s)}))),{x:r,y:a,getBoundingClientRect:o,onContextmenu:s,onScroll:i}},t.useDropdownVirtualElement=l,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["exports","vue","comlink","pica"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).composables={},t.vue,t.comlink,t.Pica)}(this,function(t,e,n,r){"use strict";const a="default",o="information",i=new Map([["success","check-circle"],["info",o],["warning","warning"],["danger","error"]]),s=e.reactive(new Map([[a,new Map]]));function l(t){const n=e.ref(0),r=e.ref(0),a=e.ref();let o=0,i=0,s=0,l=0;const c=t=>{const e=t.target;o=e.scrollLeft-l,i=e.scrollTop-s,r.value=r.value-i,n.value=n.value-o,l=e.scrollLeft,s=e.scrollTop},u=()=>({width:0,height:0,x:n.value,y:r.value,top:r.value,left:n.value,right:n.value,bottom:r.value});return e.getCurrentInstance()&&(e.onMounted(()=>{t.value&&(t.value.init({getBoundingClientRect:u}),a.value=function(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}(t.value.$el),a.value&&a.value.addEventListener("scroll",c))}),e.onUnmounted(()=>{a.value&&a.value.removeEventListener("scroll",c)})),{x:n,y:r,getBoundingClientRect:u,onScroll:c}}const c='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',u="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",c],{type:"text/javascript;charset=utf-8"});const h=n.wrap(new function(t){let e;try{if(e=u&&(self.URL||self.webkitURL).createObjectURL(u),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(c),{name:t?.name})}});function f(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>e(r),r.onerror=(...t)=>n(t),r.src=t})}t.useAlert=function(){const t=(t=a)=>e.computed(()=>{const e=s.get(t);return e&&e instanceof Map?Array.from(e?.values()).sort((t,e)=>t.timestamp-e.timestamp):[]});return{groups:s,alerts:t(),addAlert:({id:t=crypto.randomUUID(),group:e=a,title:n,icon:r=o,content:l,footer:c,modifiers:u="info",dismissable:h=true,autoClose:f=1e4,timestamp:m=Date.now()}={})=>{s.has(e)||s.set(e,new Map);const d=s.get(e),p="string"==typeof u?u.split(" "):u;if(!r){const t=p.find(t=>i.has(t));t&&(r=i.get(t))}d?.set(t.toString(),{id:t,group:e,title:n,icon:r,content:l,footer:c,modifiers:u,dismissable:h,autoClose:f,timestamp:m})},removeAlert:(t,e=a)=>{const n=s.get(e);n?.delete(t.toString())},getAlerts:t}},t.useBlurhash=function(){return{encode:async function(t){const e=URL.createObjectURL(t),n=await f(e);if("width"in n&&"height"in n){const{width:t,height:e}=(a=n.width,o=n.height,i=32,a>o?{width:i,height:Math.round(i*(o/a))}:{width:Math.round(i*(a/o)),height:i}),s=await async function(t,e,n){const a=new r,o=document.createElement("canvas");o.width=e,o.height=n;const i=await a.resize(t,o);return i.getContext("2d")?.getImageData(0,0,e,n).data}(n,t,e);if(s)return h.encode(s,t,e,4,4)}var a,o,i},decode:h.decode,loadImage:f}},t.useDropdownContextmenu=function(t,n){const{x:r,y:a,getBoundingClientRect:o,onScroll:i}=l(t),s=e=>{r.value=e.clientX,a.value=e.clientY,e.preventDefault(),t.value.show()},c=e.computed(()=>e.unref(n));return c&&e.getCurrentInstance()&&(e.onMounted(()=>{c.value?.addEventListener("contextmenu",s,!1)}),e.onUnmounted(()=>{c.value?.removeEventListener("contextmenu",s)})),{x:r,y:a,getBoundingClientRect:o,onContextmenu:s,onScroll:i}},t.useDropdownVirtualElement=l,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -48,12 +48,10 @@ function useDropdownContextmenu(dropdownEl, targetEl) {
|
|
|
48
48
|
const target = computed(() => unref(targetEl));
|
|
49
49
|
if (target && getCurrentInstance()) {
|
|
50
50
|
onMounted(() => {
|
|
51
|
-
|
|
52
|
-
(_a = target.value) == null ? void 0 : _a.addEventListener("contextmenu", onContextmenu, false);
|
|
51
|
+
target.value?.addEventListener("contextmenu", onContextmenu, false);
|
|
53
52
|
});
|
|
54
53
|
onUnmounted(() => {
|
|
55
|
-
|
|
56
|
-
(_a = target.value) == null ? void 0 : _a.removeEventListener("contextmenu", onContextmenu);
|
|
54
|
+
target.value?.removeEventListener("contextmenu", onContextmenu);
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
return { x, y, getBoundingClientRect, onContextmenu, onScroll };
|
|
@@ -119,15 +117,15 @@ function useDropdownVirtualElement(dropdownEl) {
|
|
|
119
117
|
}
|
|
120
118
|
return { x, y, getBoundingClientRect, onScroll };
|
|
121
119
|
}
|
|
122
|
-
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(
|
|
123
|
-
const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
|
|
120
|
+
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n';
|
|
121
|
+
const blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
124
122
|
function WorkerWrapper(options) {
|
|
125
123
|
let objURL;
|
|
126
124
|
try {
|
|
127
125
|
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
|
128
126
|
if (!objURL) throw "";
|
|
129
127
|
const worker = new Worker(objURL, {
|
|
130
|
-
name: options
|
|
128
|
+
name: options?.name
|
|
131
129
|
});
|
|
132
130
|
worker.addEventListener("error", () => {
|
|
133
131
|
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
@@ -137,11 +135,9 @@ function WorkerWrapper(options) {
|
|
|
137
135
|
return new Worker(
|
|
138
136
|
"data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
|
|
139
137
|
{
|
|
140
|
-
name: options
|
|
138
|
+
name: options?.name
|
|
141
139
|
}
|
|
142
140
|
);
|
|
143
|
-
} finally {
|
|
144
|
-
objURL && (self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
145
141
|
}
|
|
146
142
|
}
|
|
147
143
|
wrap(new WorkerWrapper());
|
|
@@ -163,11 +159,10 @@ const contextmenu = {
|
|
|
163
159
|
el.additionalData = { onContextmenu, onScroll, scrollContainerEl };
|
|
164
160
|
},
|
|
165
161
|
beforeUnmount(el) {
|
|
166
|
-
|
|
167
|
-
if ((_a = el == null ? void 0 : el.additionalData) == null ? void 0 : _a.onContextmenu) {
|
|
162
|
+
if (el?.additionalData?.onContextmenu) {
|
|
168
163
|
el.removeEventListener("contextmenu", el.additionalData.onContextmenu);
|
|
169
164
|
}
|
|
170
|
-
if (
|
|
165
|
+
if (el?.additionalData?.onScroll && el?.additionalData?.scrollContainerEl) {
|
|
171
166
|
el.additionalData.scrollContainerEl.removeEventListener("scroll", el.additionalData.onScroll);
|
|
172
167
|
}
|
|
173
168
|
}
|
|
@@ -235,7 +230,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
235
230
|
const toReturn = {
|
|
236
231
|
[prefix]: true
|
|
237
232
|
};
|
|
238
|
-
const modifiersArray = typeof
|
|
233
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
239
234
|
if (modifiersArray) {
|
|
240
235
|
if (Array.isArray(modifiersArray)) {
|
|
241
236
|
modifiersArray.forEach((modifier) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["exports","vue","comlink","pica"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).directives={},t.vue,t.comlink)}(this,(function(t,e,n){"use strict";var r=(t=>(t.local="local",t.session="session",t))(r||{}),o=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(o||{}),a=(t=>(t.before="before",t.after="after",t))(a||{}),l=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(l||{}),i=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(i||{});function s(t,n){const{x:r,y:o,getBoundingClientRect:a,onScroll:l}=function(t){const n=e.ref(0),r=e.ref(0),o=e.ref();let a=0,l=0,i=0,s=0;const c=t=>{const e=t.target;a=e.scrollLeft-s,l=e.scrollTop-i,r.value=r.value-l,n.value=n.value-a,s=e.scrollLeft,i=e.scrollTop},f=()=>({width:0,height:0,x:n.value,y:r.value,top:r.value,left:n.value,right:n.value,bottom:r.value});e.getCurrentInstance()&&(e.onMounted((()=>{t.value&&(t.value.init({getBoundingClientRect:f}),o.value=u(t.value.$el),o.value&&o.value.addEventListener("scroll",c))})),e.onUnmounted((()=>{o.value&&o.value.removeEventListener("scroll",c)})));return{x:n,y:r,getBoundingClientRect:f,onScroll:c}}(t),i=e=>{r.value=e.clientX,o.value=e.clientY,e.preventDefault(),t.value.show()},s=e.computed((()=>e.unref(n)));return s&&e.getCurrentInstance()&&(e.onMounted((()=>{var t;null==(t=s.value)||t.addEventListener("contextmenu",i,!1)})),e.onUnmounted((()=>{var t;null==(t=s.value)||t.removeEventListener("contextmenu",i)}))),{x:r,y:o,getBoundingClientRect:a,onContextmenu:i,onScroll:l}}function u(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every((t=>"auto"===t||"scroll"===t)))return e;e=e.parentElement}return document.documentElement}e.reactive(new Map([["default",new Map]]));const c='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,((t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r)));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map((t=>Math.max(...t)))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach((t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)})),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",(function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}})),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce(((t,e)=>t[e]),t),n=i.reduce(((t,e)=>t[e]),t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch((t=>({value:t,[d]:0}))).then((n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())})).catch((t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then((()=>{E(t)}))}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)}));function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map((t=>t.toString()))}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map((t=>t.toString())),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise((a=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)}))}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',f="undefined"!=typeof self&&self.Blob&&new Blob([c],{type:"text/javascript;charset=utf-8"});n.wrap(new function(t){let e;try{if(e=f&&(self.URL||self.webkitURL).createObjectURL(f),!e)throw"";const n=new Worker(e,{name:null==t?void 0:t.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(c),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}});const h={beforeUpdate(t,e){const{onContextmenu:n,onScroll:r,getBoundingClientRect:o}=s(e);e.value.init({getBoundingClientRect:o}),t.addEventListener("contextmenu",n,!1);const a=u(e.value.$el);a&&a.addEventListener("scroll",r),t.additionalData={onContextmenu:n,onScroll:r,scrollContainerEl:a}},beforeUnmount(t){var e,n,r;(null==(e=null==t?void 0:t.additionalData)?void 0:e.onContextmenu)&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),(null==(n=null==t?void 0:t.additionalData)?void 0:n.onScroll)&&(null==(r=null==t?void 0:t.additionalData)?void 0:r.scrollContainerEl)&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}},d={modifiers:{type:[String,Array],default:void 0}};a.before,o.bottom,l.button,i.button,r.local;const p={...d,position:{type:String,default:o.bottom},value:{type:String}};const m=e.defineComponent({name:"VvTooltip",props:p,setup(t){const n=t,{modifiers:r}=e.toRefs(n),o=function(t,n,r){return e.computed((()=>{const o={[t]:!0},a="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((n=>{o[`${t}--${n}`]=e.unref(r.value[n])})),o}))}("vv-tooltip",r,e.computed((()=>({[n.position]:!0}))));return(t,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(o)),role:"tooltip",inert:""},[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.value),1)]))],2))}}),v=(()=>({beforeMount(t,n){const r=e.h(m,{value:n.value,position:n.arg});e.render(r,t)},updated(t,n){const r=e.h(m,{value:n.value,position:n.arg});e.render(r,t)}}))();t.vContextmenu=h,t.vTooltip=v,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["exports","vue","comlink","pica"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).directives={},t.vue,t.comlink)}(this,function(t,e,n){"use strict";var r=(t=>(t.local="local",t.session="session",t))(r||{}),o=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(o||{}),a=(t=>(t.before="before",t.after="after",t))(a||{}),l=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(l||{}),i=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(i||{});function s(t,n){const{x:r,y:o,getBoundingClientRect:a,onScroll:l}=function(t){const n=e.ref(0),r=e.ref(0),o=e.ref();let a=0,l=0,i=0,s=0;const u=t=>{const e=t.target;a=e.scrollLeft-s,l=e.scrollTop-i,r.value=r.value-l,n.value=n.value-a,s=e.scrollLeft,i=e.scrollTop},f=()=>({width:0,height:0,x:n.value,y:r.value,top:r.value,left:n.value,right:n.value,bottom:r.value});e.getCurrentInstance()&&(e.onMounted(()=>{t.value&&(t.value.init({getBoundingClientRect:f}),o.value=c(t.value.$el),o.value&&o.value.addEventListener("scroll",u))}),e.onUnmounted(()=>{o.value&&o.value.removeEventListener("scroll",u)}));return{x:n,y:r,getBoundingClientRect:f,onScroll:u}}(t),i=e=>{r.value=e.clientX,o.value=e.clientY,e.preventDefault(),t.value.show()},s=e.computed(()=>e.unref(n));return s&&e.getCurrentInstance()&&(e.onMounted(()=>{s.value?.addEventListener("contextmenu",i,!1)}),e.onUnmounted(()=>{s.value?.removeEventListener("contextmenu",i)})),{x:r,y:o,getBoundingClientRect:a,onContextmenu:i,onScroll:l}}function c(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}e.reactive(new Map([["default",new Map]]));const u='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',f="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",u],{type:"text/javascript;charset=utf-8"});n.wrap(new function(t){let e;try{if(e=f&&(self.URL||self.webkitURL).createObjectURL(f),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(u),{name:t?.name})}});const h={beforeUpdate(t,e){const{onContextmenu:n,onScroll:r,getBoundingClientRect:o}=s(e);e.value.init({getBoundingClientRect:o}),t.addEventListener("contextmenu",n,!1);const a=c(e.value.$el);a&&a.addEventListener("scroll",r),t.additionalData={onContextmenu:n,onScroll:r,scrollContainerEl:a}},beforeUnmount(t){t?.additionalData?.onContextmenu&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),t?.additionalData?.onScroll&&t?.additionalData?.scrollContainerEl&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}},p={modifiers:{type:[String,Array],default:void 0}};a.before,o.bottom,l.button,i.button,r.local;const m={...p,position:{type:String,default:o.bottom},value:{type:String}};const d=e.defineComponent({name:"VvTooltip",props:m,setup(t){const n=t,{modifiers:r}=e.toRefs(n),o=function(t,n,r){return e.computed(()=>{const o={[t]:!0},a="string"==typeof n?.value?n.value.split(" "):n?.value;return a&&Array.isArray(a)&&a.forEach(e=>{e&&(o[`${t}--${e}`]=!0)}),r&&Object.keys(r.value).forEach(n=>{o[`${t}--${n}`]=e.unref(r.value[n])}),o})}("vv-tooltip",r,e.computed(()=>({[n.position]:!0})));return(t,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(o)),role:"tooltip",inert:""},[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.value),1)])],2))}}),g=(()=>({beforeMount(t,n){const r=e.h(d,{value:n.value,position:n.arg});e.render(r,t)},updated(t,n){const r=e.h(d,{value:n.value,position:n.arg});e.render(r,t)}}))();t.vContextmenu=h,t.vTooltip=g,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -18,12 +18,10 @@ function useDropdownContextmenu(dropdownEl, targetEl) {
|
|
|
18
18
|
const target = computed(() => unref(targetEl));
|
|
19
19
|
if (target && getCurrentInstance()) {
|
|
20
20
|
onMounted(() => {
|
|
21
|
-
|
|
22
|
-
(_a = target.value) == null ? void 0 : _a.addEventListener("contextmenu", onContextmenu, false);
|
|
21
|
+
target.value?.addEventListener("contextmenu", onContextmenu, false);
|
|
23
22
|
});
|
|
24
23
|
onUnmounted(() => {
|
|
25
|
-
|
|
26
|
-
(_a = target.value) == null ? void 0 : _a.removeEventListener("contextmenu", onContextmenu);
|
|
24
|
+
target.value?.removeEventListener("contextmenu", onContextmenu);
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
return { x, y, getBoundingClientRect, onContextmenu, onScroll };
|
|
@@ -89,15 +87,15 @@ function useDropdownVirtualElement(dropdownEl) {
|
|
|
89
87
|
}
|
|
90
88
|
return { x, y, getBoundingClientRect, onScroll };
|
|
91
89
|
}
|
|
92
|
-
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(
|
|
93
|
-
const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
|
|
90
|
+
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n';
|
|
91
|
+
const blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
94
92
|
function WorkerWrapper(options) {
|
|
95
93
|
let objURL;
|
|
96
94
|
try {
|
|
97
95
|
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
|
98
96
|
if (!objURL) throw "";
|
|
99
97
|
const worker = new Worker(objURL, {
|
|
100
|
-
name: options
|
|
98
|
+
name: options?.name
|
|
101
99
|
});
|
|
102
100
|
worker.addEventListener("error", () => {
|
|
103
101
|
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
@@ -107,11 +105,9 @@ function WorkerWrapper(options) {
|
|
|
107
105
|
return new Worker(
|
|
108
106
|
"data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
|
|
109
107
|
{
|
|
110
|
-
name: options
|
|
108
|
+
name: options?.name
|
|
111
109
|
}
|
|
112
110
|
);
|
|
113
|
-
} finally {
|
|
114
|
-
objURL && (self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
113
|
wrap(new WorkerWrapper());
|
|
@@ -133,11 +129,10 @@ const contextmenu = {
|
|
|
133
129
|
el.additionalData = { onContextmenu, onScroll, scrollContainerEl };
|
|
134
130
|
},
|
|
135
131
|
beforeUnmount(el) {
|
|
136
|
-
|
|
137
|
-
if ((_a = el == null ? void 0 : el.additionalData) == null ? void 0 : _a.onContextmenu) {
|
|
132
|
+
if (el?.additionalData?.onContextmenu) {
|
|
138
133
|
el.removeEventListener("contextmenu", el.additionalData.onContextmenu);
|
|
139
134
|
}
|
|
140
|
-
if (
|
|
135
|
+
if (el?.additionalData?.onScroll && el?.additionalData?.scrollContainerEl) {
|
|
141
136
|
el.additionalData.scrollContainerEl.removeEventListener("scroll", el.additionalData.onScroll);
|
|
142
137
|
}
|
|
143
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["vue","comlink","pica"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["v-contextmenu"]=e(t.vue,t.comlink)}(this,(function(t,e){"use strict";function n(e,n){const{x:a,y:o,getBoundingClientRect:l,onScroll:i}=function(e){const n=t.ref(0),a=t.ref(0),o=t.ref();let l=0,i=0,s=0,c=0;const u=t=>{const e=t.target;l=e.scrollLeft-c,i=e.scrollTop-s,a.value=a.value-i,n.value=n.value-l,c=e.scrollLeft,s=e.scrollTop},h=()=>({width:0,height:0,x:n.value,y:a.value,top:a.value,left:n.value,right:n.value,bottom:a.value});t.getCurrentInstance()&&(t.onMounted((()=>{e.value&&(e.value.init({getBoundingClientRect:h}),o.value=r(e.value.$el),o.value&&o.value.addEventListener("scroll",u))})),t.onUnmounted((()=>{o.value&&o.value.removeEventListener("scroll",u)})));return{x:n,y:a,getBoundingClientRect:h,onScroll:u}}(e),s=t=>{a.value=t.clientX,o.value=t.clientY,t.preventDefault(),e.value.show()},c=t.computed((()=>t.unref(n)));return c&&t.getCurrentInstance()&&(t.onMounted((()=>{var t;null==(t=c.value)||t.addEventListener("contextmenu",s,!1)})),t.onUnmounted((()=>{var t;null==(t=c.value)||t.removeEventListener("contextmenu",s)}))),{x:a,y:o,getBoundingClientRect:l,onContextmenu:s,onScroll:i}}function r(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every((t=>"auto"===t||"scroll"===t)))return e;e=e.parentElement}return document.documentElement}t.reactive(new Map([["default",new Map]]));const a='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,((t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r)));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map((t=>Math.max(...t)))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach((t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)})),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",(function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}})),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce(((t,e)=>t[e]),t),n=i.reduce(((t,e)=>t[e]),t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch((t=>({value:t,[d]:0}))).then((n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())})).catch((t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then((()=>{E(t)}))}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)}));function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map((t=>t.toString()))}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map((t=>t.toString())),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise((a=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)}))}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',o="undefined"!=typeof self&&self.Blob&&new Blob([a],{type:"text/javascript;charset=utf-8"});e.wrap(new function(t){let e;try{if(e=o&&(self.URL||self.webkitURL).createObjectURL(o),!e)throw"";const n=new Worker(e,{name:null==t?void 0:t.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(a),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}});return{beforeUpdate(t,e){const{onContextmenu:a,onScroll:o,getBoundingClientRect:l}=n(e);e.value.init({getBoundingClientRect:l}),t.addEventListener("contextmenu",a,!1);const i=r(e.value.$el);i&&i.addEventListener("scroll",o),t.additionalData={onContextmenu:a,onScroll:o,scrollContainerEl:i}},beforeUnmount(t){var e,n,r;(null==(e=null==t?void 0:t.additionalData)?void 0:e.onContextmenu)&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),(null==(n=null==t?void 0:t.additionalData)?void 0:n.onScroll)&&(null==(r=null==t?void 0:t.additionalData)?void 0:r.scrollContainerEl)&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}}}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["vue","comlink","pica"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["v-contextmenu"]=e(t.vue,t.comlink)}(this,function(t,e){"use strict";function n(e,n){const{x:a,y:o,getBoundingClientRect:l,onScroll:i}=function(e){const n=t.ref(0),a=t.ref(0),o=t.ref();let l=0,i=0,s=0,c=0;const u=t=>{const e=t.target;l=e.scrollLeft-c,i=e.scrollTop-s,a.value=a.value-i,n.value=n.value-l,c=e.scrollLeft,s=e.scrollTop},h=()=>({width:0,height:0,x:n.value,y:a.value,top:a.value,left:n.value,right:n.value,bottom:a.value});t.getCurrentInstance()&&(t.onMounted(()=>{e.value&&(e.value.init({getBoundingClientRect:h}),o.value=r(e.value.$el),o.value&&o.value.addEventListener("scroll",u))}),t.onUnmounted(()=>{o.value&&o.value.removeEventListener("scroll",u)}));return{x:n,y:a,getBoundingClientRect:h,onScroll:u}}(e),s=t=>{a.value=t.clientX,o.value=t.clientY,t.preventDefault(),e.value.show()},c=t.computed(()=>t.unref(n));return c&&t.getCurrentInstance()&&(t.onMounted(()=>{c.value?.addEventListener("contextmenu",s,!1)}),t.onUnmounted(()=>{c.value?.removeEventListener("contextmenu",s)})),{x:a,y:o,getBoundingClientRect:l,onContextmenu:s,onScroll:i}}function r(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}t.reactive(new Map([["default",new Map]]));const a='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',o="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",a],{type:"text/javascript;charset=utf-8"});e.wrap(new function(t){let e;try{if(e=o&&(self.URL||self.webkitURL).createObjectURL(o),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(a),{name:t?.name})}});return{beforeUpdate(t,e){const{onContextmenu:a,onScroll:o,getBoundingClientRect:l}=n(e);e.value.init({getBoundingClientRect:l}),t.addEventListener("contextmenu",a,!1);const i=r(e.value.$el);i&&i.addEventListener("scroll",o),t.additionalData={onContextmenu:a,onScroll:o,scrollContainerEl:i}},beforeUnmount(t){t?.additionalData?.onContextmenu&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),t?.additionalData?.onScroll&&t?.additionalData?.scrollContainerEl&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}}});
|
|
@@ -92,7 +92,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
92
92
|
const toReturn = {
|
|
93
93
|
[prefix]: true
|
|
94
94
|
};
|
|
95
|
-
const modifiersArray = typeof
|
|
95
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
96
96
|
if (modifiersArray) {
|
|
97
97
|
if (Array.isArray(modifiersArray)) {
|
|
98
98
|
modifiersArray.forEach((modifier) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["v-tooltip"]=t(e.vue)}(this,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["v-tooltip"]=t(e.vue)}(this,function(e){"use strict";var t=(e=>(e.local="local",e.session="session",e))(t||{}),o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),i=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(i||{});const u={modifiers:{type:[String,Array],default:void 0}};n.before,o.bottom,r.button,i.button,t.local;const l={...u,position:{type:String,default:o.bottom},value:{type:String}};const s=e.defineComponent({name:"VvTooltip",props:l,setup(t){const o=t,{modifiers:n}=e.toRefs(o),r=function(t,o,n){return e.computed(()=>{const r={[t]:!0},i="string"==typeof o?.value?o.value.split(" "):o?.value;return i&&Array.isArray(i)&&i.forEach(e=>{e&&(r[`${t}--${e}`]=!0)}),n&&Object.keys(n.value).forEach(o=>{r[`${t}--${o}`]=e.unref(n.value[o])}),r})}("vv-tooltip",n,e.computed(()=>({[o.position]:!0})));return(t,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(r)),role:"tooltip",inert:""},[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.value),1)])],2))}});return(()=>({beforeMount(t,o){const n=e.h(s,{value:o.value,position:o.arg});e.render(n,t)},updated(t,o){const n=e.h(s,{value:o.value,position:o.arg});e.render(n,t)}}))()});
|