拿掉 build files

This commit is contained in:
2022-07-18 16:33:23 +08:00
parent 41e2287bcb
commit 3707f158a3
31953 changed files with 0 additions and 4411796 deletions
-63
View File
@@ -1,63 +0,0 @@
function defaultConditional() {
return true;
}
function directive(e, el, binding) {
const handler = typeof binding.value === 'function' ? binding.value : binding.value.handler;
const isActive = typeof binding.value === 'object' && binding.value.closeConditional || defaultConditional; // The include element callbacks below can be expensive
// so we should avoid calling them when we're not active.
// Explicitly check for false to allow fallback compatibility
// with non-toggleable components
if (!e || isActive(e) === false) return; // If click was triggered programmaticaly (domEl.click()) then
// it shouldn't be treated as click-outside
// Chrome/Firefox support isTrusted property
// IE/Edge support pointerType property (empty if not triggered
// by pointing device)
if ('isTrusted' in e && !e.isTrusted || 'pointerType' in e && !e.pointerType) return; // Check if additional elements were passed to be included in check
// (click must be outside all included elements, if any)
const elements = (typeof binding.value === 'object' && binding.value.include || (() => []))(); // Add the root element for the component this directive was defined on
elements.push(el); // Check if it's a click outside our elements, and then if our callback returns true.
// Non-toggleable components should take action in their callback and return falsy.
// Toggleable can return true if it wants to deactivate.
// Note that, because we're in the capture phase, this callback will occur before
// the bubbling click event on any outside elements.
!elements.some(el => el.contains(e.target)) && setTimeout(() => {
isActive(e) && handler && handler(e);
}, 0);
}
export const ClickOutside = {
// [data-app] may not be found
// if using bind, inserted makes
// sure that the root element is
// available, iOS does not support
// clicks on body
inserted(el, binding) {
const onClick = e => directive(e, el, binding); // iOS does not recognize click events on document
// or body, this is the entire purpose of the v-app
// component and [data-app], stop removing this
const app = document.querySelector('[data-app]') || document.body; // This is only for unit tests
app.addEventListener('click', onClick, true);
el._clickOutside = onClick;
},
unbind(el) {
if (!el._clickOutside) return;
const app = document.querySelector('[data-app]') || document.body; // This is only for unit tests
app && app.removeEventListener('click', el._clickOutside, true);
delete el._clickOutside;
}
};
export default ClickOutside;
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/directives/click-outside/index.ts"],"names":[],"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AAiD;AACvD,UAAM,OAAO,GAAI,CAAD,IAAc,SAAS,CAAC,CAAD,EAAoB,EAApB,EAAwB,OAAxB,CAAvC,CADuD,CAEvD;AACA;AACA;;;AACA,UAAM,GAAG,GAAG,QAAQ,CAAC,aAAT,CAAuB,YAAvB,KACV,QAAQ,CAAC,IADX,CALuD,CAMvC;;AAChB,IAAA,GAAG,CAAC,gBAAJ,CAAqB,OAArB,EAA8B,OAA9B,EAAuC,IAAvC;AACA,IAAA,EAAE,CAAC,aAAH,GAAmB,OAAnB;AACD,GAfyB;;AAiB1B,EAAA,MAAM,CAAE,EAAF,EAAiB;AACrB,QAAI,CAAC,EAAE,CAAC,aAAR,EAAuB;AAEvB,UAAM,GAAG,GAAG,QAAQ,CAAC,aAAT,CAAuB,YAAvB,KACV,QAAQ,CAAC,IADX,CAHqB,CAIL;;AAChB,IAAA,GAAG,IAAI,GAAG,CAAC,mBAAJ,CAAwB,OAAxB,EAAiC,EAAE,CAAC,aAApC,EAAmD,IAAnD,CAAP;AACA,WAAO,EAAE,CAAC,aAAV;AACD;;AAxByB,CAArB;AA2BP,eAAe,YAAf","sourcesContent":["import { VNodeDirective } from 'vue/types/vnode'\n\ninterface ClickOutsideBindingArgs {\n handler: (e: Event) => void\n closeConditional?: (e: Event) => boolean\n include?: () => HTMLElement[]\n}\n\ninterface ClickOutsideDirective extends VNodeDirective {\n value?: ((e: Event) => void) | ClickOutsideBindingArgs\n}\n\nfunction defaultConditional () {\n return true\n}\n\nfunction directive (e: PointerEvent, el: HTMLElement, binding: ClickOutsideDirective): void {\n const handler = typeof binding.value === 'function' ? binding.value : binding.value!.handler\n\n const isActive = (typeof binding.value === 'object' && binding.value.closeConditional) || defaultConditional\n\n // The include element callbacks below can be expensive\n // so we should avoid calling them when we're not active.\n // Explicitly check for false to allow fallback compatibility\n // with non-toggleable components\n if (!e || isActive(e) === false) return\n\n // If click was triggered programmaticaly (domEl.click()) then\n // it shouldn't be treated as click-outside\n // Chrome/Firefox support isTrusted property\n // IE/Edge support pointerType property (empty if not triggered\n // by pointing device)\n if (('isTrusted' in e && !e.isTrusted) ||\n ('pointerType' in e && !e.pointerType)\n ) return\n\n // Check if additional elements were passed to be included in check\n // (click must be outside all included elements, if any)\n const elements = ((typeof binding.value === 'object' && binding.value.include) || (() => []))()\n // Add the root element for the component this directive was defined on\n elements.push(el)\n\n // Check if it's a click outside our elements, and then if our callback returns true.\n // Non-toggleable components should take action in their callback and return falsy.\n // Toggleable can return true if it wants to deactivate.\n // Note that, because we're in the capture phase, this callback will occur before\n // the bubbling click event on any outside elements.\n !elements.some(el => el.contains(e.target as Node)) && setTimeout(() => {\n isActive(e) && handler && handler(e)\n }, 0)\n}\n\nexport const ClickOutside = {\n // [data-app] may not be found\n // if using bind, inserted makes\n // sure that the root element is\n // available, iOS does not support\n // clicks on body\n inserted (el: HTMLElement, binding: ClickOutsideDirective) {\n const onClick = (e: Event) => directive(e as PointerEvent, el, binding)\n // iOS does not recognize click events on document\n // or body, this is the entire purpose of the v-app\n // component and [data-app], stop removing this\n const app = document.querySelector('[data-app]') ||\n document.body // This is only for unit tests\n app.addEventListener('click', onClick, true)\n el._clickOutside = onClick\n },\n\n unbind (el: HTMLElement) {\n if (!el._clickOutside) return\n\n const app = document.querySelector('[data-app]') ||\n document.body // This is only for unit tests\n app && app.removeEventListener('click', el._clickOutside, true)\n delete el._clickOutside\n },\n}\n\nexport default ClickOutside\n"],"sourceRoot":"","file":"index.js"}
-59
View File
@@ -1,59 +0,0 @@
// Utilities
import { classToHex, isCssColor, parseGradient } from '../../util/colorUtils';
import colors from '../../util/colors';
function setTextColor(el, color, currentTheme) {
const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color;
el.style.color = cssColor;
el.style.caretColor = cssColor;
}
function setBackgroundColor(el, color, currentTheme) {
const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color;
el.style.backgroundColor = cssColor;
el.style.borderColor = cssColor;
}
function setBorderColor(el, color, currentTheme, modifiers) {
const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color;
if (!modifiers || !Object.keys(modifiers).length) {
el.style.borderColor = cssColor;
return;
}
if (modifiers.top) el.style.borderTopColor = cssColor;
if (modifiers.right) el.style.borderRightColor = cssColor;
if (modifiers.bottom) el.style.borderBottomColor = cssColor;
if (modifiers.left) el.style.borderLeftColor = cssColor;
}
function setGradientColor(el, gradient, currentTheme) {
el.style.backgroundImage = `linear-gradient(${parseGradient(gradient, colors, currentTheme)})`;
}
function updateColor(el, binding, node) {
const currentTheme = node.context.$vuetify.theme.currentTheme;
if (binding.arg === undefined) {
setBackgroundColor(el, binding.value, currentTheme);
} else if (binding.arg === 'text') {
setTextColor(el, binding.value, currentTheme);
} else if (binding.arg === 'border') {
setBorderColor(el, binding.value, currentTheme, binding.modifiers);
} else if (binding.arg === 'gradient') {
setGradientColor(el, binding.value, currentTheme);
}
}
function update(el, binding, node) {
if (binding.value === binding.oldValue) return;
updateColor(el, binding, node);
}
export const Color = {
bind: updateColor,
update
};
export default Color;
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/directives/color/index.ts"],"names":[],"mappings":"AAAA;AACA,SACE,UADF,EAEE,UAFF,EAGE,aAHF,QAIO,uBAJP;AAKA,OAAO,MAAP,MAAmB,mBAAnB;;AAaA,SAAS,YAAT,CACE,EADF,EAEE,KAFF,EAGE,YAHF,EAG4C;AAE1C,QAAM,QAAQ,GAAG,CAAC,UAAU,CAAC,KAAD,CAAX,GAAqB,UAAU,CAAC,KAAD,EAAQ,MAAR,EAAgB,YAAhB,CAA/B,GAA+D,KAAhF;AAEA,EAAA,EAAE,CAAC,KAAH,CAAS,KAAT,GAAiB,QAAjB;AACA,EAAA,EAAE,CAAC,KAAH,CAAS,UAAT,GAAsB,QAAtB;AACD;;AAED,SAAS,kBAAT,CACE,EADF,EAEE,KAFF,EAGE,YAHF,EAG4C;AAE1C,QAAM,QAAQ,GAAG,CAAC,UAAU,C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AI,OAAO,CAAC,GAAR,KAAgB,SAApB,EAA+B;AAC7B,IAAA,kBAAkB,CAAC,EAAD,EAAK,OAAO,CAAC,KAAb,EAAoB,YAApB,CAAlB;AACD,GAFD,MAEO,IAAI,OAAO,CAAC,GAAR,KAAgB,MAApB,EAA4B;AACjC,IAAA,YAAY,CAAC,EAAD,EAAK,OAAO,CAAC,KAAb,EAAoB,YAApB,CAAZ;AACD,GAFM,MAEA,IAAI,OAAO,CAAC,GAAR,KAAgB,QAApB,EAA8B;AACnC,IAAA,cAAc,CAAC,EAAD,EAAK,OAAO,CAAC,KAAb,EAAoB,YAApB,EAAkC,OAAO,CAAC,SAA1C,CAAd;AACD,GAFM,MAEA,IAAI,OAAO,CAAC,GAAR,KAAgB,UAApB,EAAgC;AACrC,IAAA,gBAAgB,CAAC,EAAD,EAAK,OAAO,CAAC,KAAb,EAAoB,YAApB,CAAhB;AACD;AACF;;AAED,SAAS,MAAT,CACE,EADF,EAEE,OAFF,EAGE,IAHF,EAGa;AAEX,MAAI,OAAO,CAAC,KAAR,KAAkB,OAAO,CAAC,QAA9B,EAAwC;AAExC,EAAA,WAAW,CAAC,EAAD,EAAK,OAAL,EAAc,IAAd,CAAX;AACD;;AAED,OAAO,MAAM,KAAK,GAAG;AACnB,EAAA,IAAI,EAAE,WADa;AAEnB,EAAA;AAFmB,CAAd;AAKP,eAAe,KAAf","sourcesContent":["// Utilities\nimport {\n classToHex,\n isCssColor,\n parseGradient,\n} from '../../util/colorUtils'\nimport colors from '../../util/colors'\n\n// Types\nimport { VuetifyThemeVariant } from 'types/services/theme'\nimport { VNode, VNodeDirective } from 'vue'\n\ninterface BorderModifiers {\n top?: Boolean\n right?: Boolean\n bottom?: Boolean\n left?: Boolean\n}\n\nfunction setTextColor (\n el: HTMLElement,\n color: string,\n currentTheme: Partial<VuetifyThemeVariant>,\n) {\n const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color\n\n el.style.color = cssColor\n el.style.caretColor = cssColor\n}\n\nfunction setBackgroundColor (\n el: HTMLElement,\n color: string,\n currentTheme: Partial<VuetifyThemeVariant>,\n) {\n const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color\n\n el.style.backgroundColor = cssColor\n el.style.borderColor = cssColor\n}\n\nfunction setBorderColor (\n el: HTMLElement,\n color: string,\n currentTheme: Partial<VuetifyThemeVariant>,\n modifiers?: BorderModifiers,\n) {\n const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color\n\n if (!modifiers || !Object.keys(modifiers).length) {\n el.style.borderColor = cssColor\n return\n }\n\n if (modifiers.top) el.style.borderTopColor = cssColor\n if (modifiers.right) el.style.borderRightColor = cssColor\n if (modifiers.bottom) el.style.borderBottomColor = cssColor\n if (modifiers.left) el.style.borderLeftColor = cssColor\n}\n\nfunction setGradientColor (\n el: HTMLElement,\n gradient: string,\n currentTheme: Partial<VuetifyThemeVariant>,\n) {\n el.style.backgroundImage = `linear-gradient(${\n parseGradient(gradient, colors, currentTheme)\n })`\n}\n\nfunction updateColor (\n el: HTMLElement,\n binding: VNodeDirective,\n node: VNode\n) {\n const currentTheme = node.context!.$vuetify.theme.currentTheme\n\n if (binding.arg === undefined) {\n setBackgroundColor(el, binding.value, currentTheme)\n } else if (binding.arg === 'text') {\n setTextColor(el, binding.value, currentTheme)\n } else if (binding.arg === 'border') {\n setBorderColor(el, binding.value, currentTheme, binding.modifiers)\n } else if (binding.arg === 'gradient') {\n setGradientColor(el, binding.value, currentTheme)\n }\n}\n\nfunction update (\n el: HTMLElement,\n binding: VNodeDirective,\n node: VNode\n) {\n if (binding.value === binding.oldValue) return\n\n updateColor(el, binding, node)\n}\n\nexport const Color = {\n bind: updateColor,\n update,\n}\n\nexport default Color\n"],"sourceRoot":"","file":"index.js"}
-8
View File
@@ -1,8 +0,0 @@
export { ClickOutside } from './click-outside';
export { Intersect } from './intersect';
export { Mutate } from './mutate';
export { Resize } from './resize';
export { Ripple } from './ripple';
export { Scroll } from './scroll';
export { Touch } from './touch';
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../src/directives/index.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,QAA6B,iBAA7B;AACA,SAAS,SAAT,QAA0B,aAA1B;AACA,SAAS,MAAT,QAAuB,UAAvB;AACA,SAAS,MAAT,QAAuB,UAAvB;AACA,SAAS,MAAT,QAAuB,UAAvB;AACA,SAAS,MAAT,QAAuB,UAAvB;AACA,SAAS,KAAT,QAAsB,SAAtB","sourcesContent":["export { ClickOutside } from './click-outside'\nexport { Intersect } from './intersect'\nexport { Mutate } from './mutate'\nexport { Resize } from './resize'\nexport { Ripple } from './ripple'\nexport { Scroll } from './scroll'\nexport { Touch } from './touch'\n"],"sourceRoot":"","file":"index.js"}
-48
View File
@@ -1,48 +0,0 @@
function inserted(el, binding) {
const modifiers = binding.modifiers || {};
const value = binding.value;
const {
handler,
options
} = typeof value === 'object' ? value : {
handler: value,
options: {}
};
const observer = new IntersectionObserver((entries = [], observer) => {
/* istanbul ignore if */
if (!el._observe) return; // Just in case, should never fire
// If is not quiet or has already been
// initted, invoke the user callback
if (handler && (!modifiers.quiet || el._observe.init)) {
const isIntersecting = Boolean(entries.find(entry => entry.isIntersecting));
handler(entries, observer, isIntersecting);
} // If has already been initted and
// has the once modifier, unbind
if (el._observe.init && modifiers.once) unbind(el); // Otherwise, mark the observer as initted
else el._observe.init = true;
}, options);
el._observe = {
init: false,
observer
};
observer.observe(el);
}
function unbind(el) {
/* istanbul ignore if */
if (!el._observe) return;
el._observe.observer.unobserve(el);
delete el._observe;
}
export const Intersect = {
inserted,
unbind
};
export default Intersect;
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/directives/intersect/index.ts"],"names":[],"mappings":"AAgBA,SAAS,QAAT,CAAmB,EAAnB,EAAoC,OAApC,EAAkE;AAChE,QAAM,SAAS,GAAG,OAAO,CAAC,SAAR,IAAqB,EAAvC;AACA,QAAM,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uB;AAEvB,EAAA;AAFuB,CAAlB;AAKP,eAAe,SAAf","sourcesContent":["import { VNodeDirective } from 'vue/types/vnode'\n\ntype ObserveHandler = (\n entries: IntersectionObserverEntry[],\n observer: IntersectionObserver,\n isIntersecting: boolean,\n) => void\n\ninterface ObserveVNodeDirective extends Omit<VNodeDirective, 'modifiers'> {\n value?: ObserveHandler | { handler: ObserveHandler, options?: IntersectionObserverInit }\n modifiers?: {\n once?: boolean\n quiet?: boolean\n }\n}\n\nfunction inserted (el: HTMLElement, binding: ObserveVNodeDirective) {\n const modifiers = binding.modifiers || {}\n const value = binding.value\n const { handler, options } = typeof value === 'object'\n ? value\n : { handler: value, options: {} }\n const observer = new IntersectionObserver((\n entries: IntersectionObserverEntry[] = [],\n observer: IntersectionObserver\n ) => {\n /* istanbul ignore if */\n if (!el._observe) return // Just in case, should never fire\n\n // If is not quiet or has already been\n // initted, invoke the user callback\n if (\n handler && (\n !modifiers.quiet ||\n el._observe.init\n )\n ) {\n const isIntersecting = Boolean(entries.find(entry => entry.isIntersecting))\n\n handler(entries, observer, isIntersecting)\n }\n\n // If has already been initted and\n // has the once modifier, unbind\n if (el._observe.init && modifiers.once) unbind(el)\n // Otherwise, mark the observer as initted\n else (el._observe.init = true)\n }, options)\n\n el._observe = { init: false, observer }\n\n observer.observe(el)\n}\n\nfunction unbind (el: HTMLElement) {\n /* istanbul ignore if */\n if (!el._observe) return\n\n el._observe.observer.unobserve(el)\n delete el._observe\n}\n\nexport const Intersect = {\n inserted,\n unbind,\n}\n\nexport default Intersect\n"],"sourceRoot":"","file":"index.js"}
-52
View File
@@ -1,52 +0,0 @@
function inserted(el, binding) {
const modifiers = binding.modifiers || {};
const value = binding.value;
const callback = typeof value === 'object' ? value.handler : value;
const {
once,
...modifierKeys
} = modifiers;
const hasModifiers = Object.keys(modifierKeys).length > 0; // Options take top priority
const options = typeof value === 'object' && value.options ? value.options : hasModifiers // If we have modifiers, use only those provided
? {
attributes: modifierKeys.attr,
childList: modifierKeys.child,
subtree: modifierKeys.sub,
characterData: modifierKeys.char // Defaults to everything on
} : {
attributes: true,
childList: true,
subtree: true,
characterData: true
};
const observer = new MutationObserver((mutationsList, observer) => {
/* istanbul ignore if */
if (!el._mutate) return; // Just in case, should never fire
callback(mutationsList, observer); // If has the once modifier, unbind
once && unbind(el);
});
observer.observe(el, options);
el._mutate = {
observer
};
}
function unbind(el) {
/* istanbul ignore if */
if (!el._mutate) return;
el._mutate.observer.disconnect();
delete el._mutate;
}
export const Mutate = {
inserted,
unbind
};
export default Mutate;
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/directives/mutate/index.ts"],"names":[],"mappings":"AAkBA,SAAS,QAAT,CAAmB,EAAnB,EAAoC,OAApC,EAAiE;AAC/D,QAAM,SAAS,GAAG,OAAO,CAAC,SAAR,IAAqB,EAAvC;AACA,QAAM,KAAK,GAAG,OAAO,CAAC,KAAtB;AACA,QAAM,QAAQ,GAAG,OAAO,KAAP,KAAiB,QAAjB,GAA4B,KAAK,CAAC,OAAlC,GAA4C,KAA7D;AACA,QAAM;AAAE,IAAA,IAAF;AAAQ,OAAG;AAAX,MAA4B,SAAlC;AACA,QAAM,YAAY,GAAG,MAAM,CAAC,IAAP,CAAY,YAAZ,EAA0B,MAA1B,GAAmC,CAAxD,CAL+D,CAO/D;;AACA,QAAM,OAAO,GAAG,OAAO,KAAP,KAAiB,QAAjB,IAA6B,KAAK,CAAC,OAAnC,GACZ,KAAK,CAAC,OADM,GAEZ,YAAY,CACZ;AADY,IAEV;AACA,IAAA,UAAU,EAAE,YAAY,CAAC,IADzB;AAEA,IAAA,SAAS,EAAE,YAAY,CAAC,KAFxB;AAGA,IAAA,OAAO,EAAE,YAAY,CAAC,GAHtB;AAIA,IAAA,aAAa,EAAE,YAAY,CAAC,IAJ5B,CAMF;;AANE,GAFU,GASV;AACA,IAAA,UAAU,EAAE,IADZ;AAEA,IAAA,SAAS,EAAE,IAFX;AAGA,IAAA,OAAO,EAAE,IAHT;AAIA,IAAA,aAAa,EAAE;AAJf,GAXN;AAkBA,QAAM,QAAQ,GAAG,IAAI,gBAAJ,CAAqB,CACpC,aADoC,EAEpC,QAFoC,KAGlC;AACF;AACA,QAAI,CAAC,EAAE,CAAC,OAAR,EAAiB,OAFf,CAEsB;;AAExB,IAAA,QAAQ,CAAC,aAAD,EAAgB,QAAhB,CAAR,CAJE,CAMF;;AACA,IAAA,IAAI,IAAI,MAAM,CAAC,EAAD,CAAd;AACD,GAXgB,CAAjB;AAaA,EAAA,QAAQ,CAAC,OAAT,CAAiB,EAAjB,EAAqB,OAArB;AACA,EAAA,EAAE,CAAC,OAAH,GAAa;AAAE,IAAA;AAAF,GAAb;AACD;;AAED,SAAS,MAAT,CAAiB,EAAjB,EAAgC;AAC9B;AACA,MAAI,CAAC,EAAE,CAAC,OAAR,EAAiB;;AAEjB,EAAA,EAAE,CAAC,OAAH,CAAW,QAAX,CAAoB,UAApB;;AACA,SAAO,EAAE,CAAC,OAAV;AACD;;AAED,OAAO,MAAM,MAAM,GAAG;AACpB,EAAA,QADoB;AAEpB,EAAA;AAFoB,CAAf;AAKP,eAAe,MAAf","sourcesContent":["import { VNodeDirective } from 'vue'\n\ntype MutateHandler = (\n mutationsList: MutationRecord[],\n observer: MutationObserver,\n) => void\n\ninterface MutateVNodeDirective extends Omit<VNodeDirective, 'modifiers'> {\n value?: MutateHandler | { handler: MutateHandler, options?: MutationObserverInit }\n modifiers?: {\n once?: boolean\n attr?: boolean\n child?: boolean\n sub?: boolean\n char?: boolean\n }\n}\n\nfunction inserted (el: HTMLElement, binding: MutateVNodeDirective) {\n const modifiers = binding.modifiers || {}\n const value = binding.value\n const callback = typeof value === 'object' ? value.handler : value!\n const { once, ...modifierKeys } = modifiers\n const hasModifiers = Object.keys(modifierKeys).length > 0\n\n // Options take top priority\n const options = typeof value === 'object' && value.options\n ? value.options\n : hasModifiers\n // If we have modifiers, use only those provided\n ? {\n attributes: modifierKeys.attr,\n childList: modifierKeys.child,\n subtree: modifierKeys.sub,\n characterData: modifierKeys.char,\n }\n // Defaults to everything on\n : {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true,\n }\n\n const observer = new MutationObserver((\n mutationsList: MutationRecord[],\n observer: MutationObserver\n ) => {\n /* istanbul ignore if */\n if (!el._mutate) return // Just in case, should never fire\n\n callback(mutationsList, observer)\n\n // If has the once modifier, unbind\n once && unbind(el)\n })\n\n observer.observe(el, options)\n el._mutate = { observer }\n}\n\nfunction unbind (el: HTMLElement) {\n /* istanbul ignore if */\n if (!el._mutate) return\n\n el._mutate.observer.disconnect()\n delete el._mutate\n}\n\nexport const Mutate = {\n inserted,\n unbind,\n}\n\nexport default Mutate\n"],"sourceRoot":"","file":"index.js"}
-32
View File
@@ -1,32 +0,0 @@
function inserted(el, binding) {
const callback = binding.value;
const options = binding.options || {
passive: true
};
window.addEventListener('resize', callback, options);
el._onResize = {
callback,
options
};
if (!binding.modifiers || !binding.modifiers.quiet) {
callback();
}
}
function unbind(el) {
if (!el._onResize) return;
const {
callback,
options
} = el._onResize;
window.removeEventListener('resize', callback, options);
delete el._onResize;
}
export const Resize = {
inserted,
unbind
};
export default Resize;
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/directives/resize/index.ts"],"names":[],"mappings":"AAOA,SAAS,QAAT,CAAmB,EAAnB,EAAoC,OAApC,EAAiE;AAC/D,QAAM,QAAQ,GAAG,OAAO,CAAC,KAAzB;AACA,QAAM,OAAO,GAAG,OAAO,CAAC,OAAR,IAAmB;AAAE,IAAA,OAAO,EAAE;AAAX,GAAnC;AAEA,EAAA,MAAM,CAAC,gBAAP,CAAwB,QAAxB,EAAkC,QAAlC,EAA4C,OAA5C;AACA,EAAA,EAAE,CAAC,SAAH,GAAe;AACb,IAAA,QADa;AAEb,IAAA;AAFa,GAAf;;AAKA,MAAI,CAAC,OAAO,CAAC,SAAT,IAAsB,CAAC,OAAO,CAAC,SAAR,CAAkB,KAA7C,EAAoD;AAClD,IAAA,QAAQ;AACT;AACF;;AAED,SAAS,MAAT,CAAiB,EAAjB,EAAgC;AAC9B,MAAI,CAAC,EAAE,CAAC,SAAR,EAAmB;AAEnB,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAAwB,EAAE,CAAC,SAAjC;AACA,EAAA,MAAM,CAAC,mBAAP,CAA2B,QAA3B,EAAqC,QAArC,EAA+C,OAA/C;AACA,SAAO,EAAE,CAAC,SAAV;AACD;;AAED,OAAO,MAAM,MAAM,GAAG;AACpB,EAAA,QADoB;AAEpB,EAAA;AAFoB,CAAf;AAKP,eAAe,MAAf","sourcesContent":["import { VNodeDirective } from 'vue/types/vnode'\n\ninterface ResizeVNodeDirective extends VNodeDirective {\n value?: () => void\n options?: boolean | AddEventListenerOptions\n}\n\nfunction inserted (el: HTMLElement, binding: ResizeVNodeDirective) {\n const callback = binding.value!\n const options = binding.options || { passive: true }\n\n window.addEventListener('resize', callback, options)\n el._onResize = {\n callback,\n options,\n }\n\n if (!binding.modifiers || !binding.modifiers.quiet) {\n callback()\n }\n}\n\nfunction unbind (el: HTMLElement) {\n if (!el._onResize) return\n\n const { callback, options } = el._onResize\n window.removeEventListener('resize', callback, options)\n delete el._onResize\n}\n\nexport const Resize = {\n inserted,\n unbind,\n}\n\nexport default Resize\n"],"sourceRoot":"","file":"index.js"}
-330
View File
@@ -1,330 +0,0 @@
// Styles
import "../../../src/directives/ripple/VRipple.sass"; // Utilities
import { consoleWarn } from '../../util/console';
import { keyCodes } from '../../util/helpers';
const DELAY_RIPPLE = 80;
function transform(el, value) {
el.style['transform'] = value;
el.style['webkitTransform'] = value;
}
function opacity(el, value) {
el.style['opacity'] = value.toString();
}
function isTouchEvent(e) {
return e.constructor.name === 'TouchEvent';
}
function isKeyboardEvent(e) {
return e.constructor.name === 'KeyboardEvent';
}
const calculate = (e, el, value = {}) => {
let localX = 0;
let localY = 0;
if (!isKeyboardEvent(e)) {
const offset = el.getBoundingClientRect();
const target = isTouchEvent(e) ? e.touches[e.touches.length - 1] : e;
localX = target.clientX - offset.left;
localY = target.clientY - offset.top;
}
let radius = 0;
let scale = 0.3;
if (el._ripple && el._ripple.circle) {
scale = 0.15;
radius = el.clientWidth / 2;
radius = value.center ? radius : radius + Math.sqrt((localX - radius) ** 2 + (localY - radius) ** 2) / 4;
} else {
radius = Math.sqrt(el.clientWidth ** 2 + el.clientHeight ** 2) / 2;
}
const centerX = `${(el.clientWidth - radius * 2) / 2}px`;
const centerY = `${(el.clientHeight - radius * 2) / 2}px`;
const x = value.center ? centerX : `${localX - radius}px`;
const y = value.center ? centerY : `${localY - radius}px`;
return {
radius,
scale,
x,
y,
centerX,
centerY
};
};
const ripples = {
/* eslint-disable max-statements */
show(e, el, value = {}) {
if (!el._ripple || !el._ripple.enabled) {
return;
}
const container = document.createElement('span');
const animation = document.createElement('span');
container.appendChild(animation);
container.className = 'v-ripple__container';
if (value.class) {
container.className += ` ${value.class}`;
}
const {
radius,
scale,
x,
y,
centerX,
centerY
} = calculate(e, el, value);
const size = `${radius * 2}px`;
animation.className = 'v-ripple__animation';
animation.style.width = size;
animation.style.height = size;
el.appendChild(container);
const computed = window.getComputedStyle(el);
if (computed && computed.position === 'static') {
el.style.position = 'relative';
el.dataset.previousPosition = 'static';
}
animation.classList.add('v-ripple__animation--enter');
animation.classList.add('v-ripple__animation--visible');
transform(animation, `translate(${x}, ${y}) scale3d(${scale},${scale},${scale})`);
opacity(animation, 0);
animation.dataset.activated = String(performance.now());
setTimeout(() => {
animation.classList.remove('v-ripple__animation--enter');
animation.classList.add('v-ripple__animation--in');
transform(animation, `translate(${centerX}, ${centerY}) scale3d(1,1,1)`);
opacity(animation, 0.25);
}, 0);
},
hide(el) {
if (!el || !el._ripple || !el._ripple.enabled) return;
const ripples = el.getElementsByClassName('v-ripple__animation');
if (ripples.length === 0) return;
const animation = ripples[ripples.length - 1];
if (animation.dataset.isHiding) return;else animation.dataset.isHiding = 'true';
const diff = performance.now() - Number(animation.dataset.activated);
const delay = Math.max(250 - diff, 0);
setTimeout(() => {
animation.classList.remove('v-ripple__animation--in');
animation.classList.add('v-ripple__animation--out');
opacity(animation, 0);
setTimeout(() => {
const ripples = el.getElementsByClassName('v-ripple__animation');
if (ripples.length === 1 && el.dataset.previousPosition) {
el.style.position = el.dataset.previousPosition;
delete el.dataset.previousPosition;
}
animation.parentNode && el.removeChild(animation.parentNode);
}, 300);
}, delay);
}
};
function isRippleEnabled(value) {
return typeof value === 'undefined' || !!value;
}
function rippleShow(e) {
const value = {};
const element = e.currentTarget;
if (!element || !element._ripple || element._ripple.touched) return;
if (isTouchEvent(e)) {
element._ripple.touched = true;
element._ripple.isTouch = true;
} else {
// It's possible for touch events to fire
// as mouse events on Android/iOS, this
// will skip the event call if it has
// already been registered as touch
if (element._ripple.isTouch) return;
}
value.center = element._ripple.centered || isKeyboardEvent(e);
if (element._ripple.class) {
value.class = element._ripple.class;
}
if (isTouchEvent(e)) {
// already queued that shows or hides the ripple
if (element._ripple.showTimerCommit) return;
element._ripple.showTimerCommit = () => {
ripples.show(e, element, value);
};
element._ripple.showTimer = window.setTimeout(() => {
if (element && element._ripple && element._ripple.showTimerCommit) {
element._ripple.showTimerCommit();
element._ripple.showTimerCommit = null;
}
}, DELAY_RIPPLE);
} else {
ripples.show(e, element, value);
}
}
function rippleHide(e) {
const element = e.currentTarget;
if (!element || !element._ripple) return;
window.clearTimeout(element._ripple.showTimer); // The touch interaction occurs before the show timer is triggered.
// We still want to show ripple effect.
if (e.type === 'touchend' && element._ripple.showTimerCommit) {
element._ripple.showTimerCommit();
element._ripple.showTimerCommit = null; // re-queue ripple hiding
element._ripple.showTimer = setTimeout(() => {
rippleHide(e);
});
return;
}
window.setTimeout(() => {
if (element._ripple) {
element._ripple.touched = false;
}
});
ripples.hide(element);
}
function rippleCancelShow(e) {
const element = e.currentTarget;
if (!element || !element._ripple) return;
if (element._ripple.showTimerCommit) {
element._ripple.showTimerCommit = null;
}
window.clearTimeout(element._ripple.showTimer);
}
let keyboardRipple = false;
function keyboardRippleShow(e) {
if (!keyboardRipple && (e.keyCode === keyCodes.enter || e.keyCode === keyCodes.space)) {
keyboardRipple = true;
rippleShow(e);
}
}
function keyboardRippleHide(e) {
keyboardRipple = false;
rippleHide(e);
}
function updateRipple(el, binding, wasEnabled) {
const enabled = isRippleEnabled(binding.value);
if (!enabled) {
ripples.hide(el);
}
el._ripple = el._ripple || {};
el._ripple.enabled = enabled;
const value = binding.value || {};
if (value.center) {
el._ripple.centered = true;
}
if (value.class) {
el._ripple.class = binding.value.class;
}
if (value.circle) {
el._ripple.circle = value.circle;
}
if (enabled && !wasEnabled) {
el.addEventListener('touchstart', rippleShow, {
passive: true
});
el.addEventListener('touchend', rippleHide, {
passive: true
});
el.addEventListener('touchmove', rippleCancelShow, {
passive: true
});
el.addEventListener('touchcancel', rippleHide);
el.addEventListener('mousedown', rippleShow);
el.addEventListener('mouseup', rippleHide);
el.addEventListener('mouseleave', rippleHide);
el.addEventListener('keydown', keyboardRippleShow);
el.addEventListener('keyup', keyboardRippleHide); // Anchor tags can be dragged, causes other hides to fail - #1537
el.addEventListener('dragstart', rippleHide, {
passive: true
});
} else if (!enabled && wasEnabled) {
removeListeners(el);
}
}
function removeListeners(el) {
el.removeEventListener('mousedown', rippleShow);
el.removeEventListener('touchstart', rippleShow);
el.removeEventListener('touchend', rippleHide);
el.removeEventListener('touchmove', rippleCancelShow);
el.removeEventListener('touchcancel', rippleHide);
el.removeEventListener('mouseup', rippleHide);
el.removeEventListener('mouseleave', rippleHide);
el.removeEventListener('keydown', keyboardRippleShow);
el.removeEventListener('keyup', keyboardRippleHide);
el.removeEventListener('dragstart', rippleHide);
}
function directive(el, binding, node) {
updateRipple(el, binding, false);
if (process.env.NODE_ENV === 'development') {
// warn if an inline element is used, waiting for el to be in the DOM first
node.context && node.context.$nextTick(() => {
const computed = window.getComputedStyle(el);
if (computed && computed.display === 'inline') {
const context = node.fnOptions ? [node.fnOptions, node.context] : [node.componentInstance];
consoleWarn('v-ripple can only be used on block-level elements', ...context);
}
});
}
}
function unbind(el) {
delete el._ripple;
removeListeners(el);
}
function update(el, binding) {
if (binding.value === binding.oldValue) {
return;
}
const wasEnabled = isRippleEnabled(binding.oldValue);
updateRipple(el, binding, wasEnabled);
}
export const Ripple = {
bind: directive,
unbind,
update
};
export default Ripple;
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long
-37
View File
@@ -1,37 +0,0 @@
function inserted(el, binding) {
const {
self = false
} = binding.modifiers || {};
const value = binding.value;
const options = typeof value === 'object' && value.options || {
passive: true
};
const handler = typeof value === 'function' || 'handleEvent' in value ? value : value.handler;
const target = self ? el : binding.arg ? document.querySelector(binding.arg) : window;
if (!target) return;
target.addEventListener('scroll', handler, options);
el._onScroll = {
handler,
options,
// Don't reference self
target: self ? undefined : target
};
}
function unbind(el) {
if (!el._onScroll) return;
const {
handler,
options,
target = el
} = el._onScroll;
target.removeEventListener('scroll', handler, options);
delete el._onScroll;
}
export const Scroll = {
inserted,
unbind
};
export default Scroll;
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../../src/directives/scroll/index.ts"],"names":[],"mappings":"AAaA,SAAS,QAAT,CAAmB,EAAnB,EAAoC,OAApC,EAAiE;AAC/D,QAAM;AAAE,IAAA,IAAI,GAAG;AAAT,MAAmB,OAAO,CAAC,SAAR,IAAqB,EAA9C;AACA,QAAM,KAAK,GAAG,OAAO,CAAC,KAAtB;AACA,QAAM,OAAO,GAAI,OAAO,KAAP,KAAiB,QAAjB,IAA6B,KAAK,CAAC,OAApC,IAAgD;AAAE,IAAA,OAAO,EAAE;AAAX,GAAhE;AACA,QAAM,OAAO,GAAG,OAAO,KAAP,KAAiB,UAAjB,IAA+B,iBAAiB,KAAhD,GAAwD,KAAxD,GAAgE,KAAK,CAAC,OAAtF;AAEA,QAAM,MAAM,GAAG,IAAI,GACf,EADe,GAEf,OAAO,CAAC,GAAR,GACE,QAAQ,CAAC,aAAT,CAAuB,OAAO,CAAC,GAA/B,CADF,GAEE,MAJN;AAMA,MAAI,CAAC,MAAL,EAAa;AAEb,EAAA,MAAM,CAAC,gBAAP,CAAwB,QAAxB,EAAkC,OAAlC,EAA2C,OAA3C;AAEA,EAAA,EAAE,CAAC,SAAH,GAAe;AACb,IAAA,OADa;AAEb,IAAA,OAFa;AAGb;AACA,IAAA,MAAM,EAAE,IAAI,GAAG,SAAH,GAAe;AAJd,GAAf;AAMD;;AAED,SAAS,MAAT,CAAiB,EAAjB,EAAgC;AAC9B,MAAI,CAAC,EAAE,CAAC,SAAR,EAAmB;AAEnB,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA,OAAX;AAAoB,IAAA,MAAM,GAAG;AAA7B,MAAoC,EAAE,CAAC,SAA7C;AAEA,EAAA,MAAM,CAAC,mBAAP,CAA2B,QAA3B,EAAqC,OAArC,EAA8C,OAA9C;AACA,SAAO,EAAE,CAAC,SAAV;AACD;;AAED,OAAO,MAAM,MAAM,GAAG;AACpB,EAAA,QADoB;AAEpB,EAAA;AAFoB,CAAf;AAKP,eAAe,MAAf","sourcesContent":["import { VNodeDirective } from 'vue/types/vnode'\nimport { DirectiveOptions } from 'vue'\n\ninterface ScrollVNodeDirective extends Omit<VNodeDirective, 'modifiers'> {\n value: EventListener | {\n handler: EventListener\n options?: boolean | AddEventListenerOptions\n } | EventListenerObject & { options?: boolean | AddEventListenerOptions }\n modifiers?: {\n self?: boolean\n }\n}\n\nfunction inserted (el: HTMLElement, binding: ScrollVNodeDirective) {\n const { self = false } = binding.modifiers || {}\n const value = binding.value\n const options = (typeof value === 'object' && value.options) || { passive: true }\n const handler = typeof value === 'function' || 'handleEvent' in value ? value : value.handler\n\n const target = self\n ? el\n : binding.arg\n ? document.querySelector(binding.arg)\n : window\n\n if (!target) return\n\n target.addEventListener('scroll', handler, options)\n\n el._onScroll = {\n handler,\n options,\n // Don't reference self\n target: self ? undefined : target,\n }\n}\n\nfunction unbind (el: HTMLElement) {\n if (!el._onScroll) return\n\n const { handler, options, target = el } = el._onScroll\n\n target.removeEventListener('scroll', handler, options)\n delete el._onScroll\n}\n\nexport const Scroll = {\n inserted,\n unbind,\n} as DirectiveOptions\n\nexport default Scroll\n"],"sourceRoot":"","file":"index.js"}
-104
View File
@@ -1,104 +0,0 @@
import { keys } from '../../util/helpers';
const handleGesture = wrapper => {
const {
touchstartX,
touchendX,
touchstartY,
touchendY
} = wrapper;
const dirRatio = 0.5;
const minDistance = 16;
wrapper.offsetX = touchendX - touchstartX;
wrapper.offsetY = touchendY - touchstartY;
if (Math.abs(wrapper.offsetY) < dirRatio * Math.abs(wrapper.offsetX)) {
wrapper.left && touchendX < touchstartX - minDistance && wrapper.left(wrapper);
wrapper.right && touchendX > touchstartX + minDistance && wrapper.right(wrapper);
}
if (Math.abs(wrapper.offsetX) < dirRatio * Math.abs(wrapper.offsetY)) {
wrapper.up && touchendY < touchstartY - minDistance && wrapper.up(wrapper);
wrapper.down && touchendY > touchstartY + minDistance && wrapper.down(wrapper);
}
};
function touchstart(event, wrapper) {
const touch = event.changedTouches[0];
wrapper.touchstartX = touch.clientX;
wrapper.touchstartY = touch.clientY;
wrapper.start && wrapper.start(Object.assign(event, wrapper));
}
function touchend(event, wrapper) {
const touch = event.changedTouches[0];
wrapper.touchendX = touch.clientX;
wrapper.touchendY = touch.clientY;
wrapper.end && wrapper.end(Object.assign(event, wrapper));
handleGesture(wrapper);
}
function touchmove(event, wrapper) {
const touch = event.changedTouches[0];
wrapper.touchmoveX = touch.clientX;
wrapper.touchmoveY = touch.clientY;
wrapper.move && wrapper.move(Object.assign(event, wrapper));
}
function createHandlers(value) {
const wrapper = {
touchstartX: 0,
touchstartY: 0,
touchendX: 0,
touchendY: 0,
touchmoveX: 0,
touchmoveY: 0,
offsetX: 0,
offsetY: 0,
left: value.left,
right: value.right,
up: value.up,
down: value.down,
start: value.start,
move: value.move,
end: value.end
};
return {
touchstart: e => touchstart(e, wrapper),
touchend: e => touchend(e, wrapper),
touchmove: e => touchmove(e, wrapper)
};
}
function inserted(el, binding, vnode) {
const value = binding.value;
const target = value.parent ? el.parentElement : el;
const options = value.options || {
passive: true
}; // Needed to pass unit tests
if (!target) return;
const handlers = createHandlers(binding.value);
target._touchHandlers = Object(target._touchHandlers);
target._touchHandlers[vnode.context._uid] = handlers;
keys(handlers).forEach(eventName => {
target.addEventListener(eventName, handlers[eventName], options);
});
}
function unbind(el, binding, vnode) {
const target = binding.value.parent ? el.parentElement : el;
if (!target || !target._touchHandlers) return;
const handlers = target._touchHandlers[vnode.context._uid];
keys(handlers).forEach(eventName => {
target.removeEventListener(eventName, handlers[eventName]);
});
delete target._touchHandlers[vnode.context._uid];
}
export const Touch = {
inserted,
unbind
};
export default Touch;
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long