helpers.mjs.map 39 KB

1
  1. {"version":3,"file":"helpers.mjs","names":["camelize","capitalize","computed","Fragment","reactive","toRefs","watchEffect","IN_BROWSER","getNestedValue","obj","path","fallback","last","length","undefined","i","deepEqual","a","b","Date","getTime","Object","props","keys","every","p","getObjectValueByPath","replace","split","getPropertyFromItem","item","property","value","Array","isArray","createRange","start","arguments","from","v","k","getZIndex","el","nodeType","Node","ELEMENT_NODE","index","window","getComputedStyle","getPropertyValue","parentNode","convertToUnit","str","unit","isNaN","String","isFinite","Number","isObject","refElement","$el","keyCodes","freeze","enter","tab","delete","esc","space","up","down","left","right","end","home","del","backspace","insert","pageup","pagedown","shift","keyValues","o","has","key","hasOwnProperty","pick","paths","exclude","found","create","rest","some","RegExp","test","omit","clone","forEach","prop","only","include","filterInputAttrs","attrs","arrayDiff","diff","includes","push","wrapInArray","defaultFilter","search","toString","toLocaleLowerCase","indexOf","searchItems","items","toLowerCase","trim","filter","debounce","fn","delay","timeoutId","_len","args","_key","clearTimeout","setTimeout","throttle","limit","throttling","getPrefixedSlots","prefix","slots","startsWith","reduce","clamp","min","max","Math","getDecimals","trimmedStr","padEnd","char","repeat","padStart","chunk","size","chunked","substr","humanReadableFileSize","bytes","base","abs","toFixed","camelizeObjectKeys","mergeDeep","source","target","arrayFn","out","sourceProperty","targetProperty","fillArray","fill","flattenFragments","nodes","map","node","type","children","flat","randomHexColor","n","random","slice","toKebabCase","cache","get","kebab","set","Map","findChildren","vnode","child","component","subTree","findChildrenWithProvide","getOwnPropertySymbols","provides","_arr","WeakMap","_pointer","CircularBuffer","constructor","_classPrivateFieldInitSpec","writable","val","_classPrivateFieldGet","_classPrivateFieldSet","values","concat","getEventCoordinates","e","clientX","touches","clientY","destructComputed","getter","refs","flush","arr","onRE","isOn","eventName","propName","EventProp","Function","hasEvent","name","callEvent","handler","_len2","_key2","h","focusableChildren","filterByTabIndex","targets","s","join","querySelectorAll","getNextElement","elements","location","condition","_el","idx","document","activeElement","inc","offsetParent","focusChild","focusable","contains","focus","at","isEmpty","noop","matchesSelector","selector","supportsSelector","CSS","supports","matches","err"],"sources":["../../src/util/helpers.ts"],"sourcesContent":["// Utilities\nimport { camelize, capitalize, computed, Fragment, reactive, toRefs, watchEffect } from 'vue'\nimport { IN_BROWSER } from '@/util/globals'\n\n// Types\nimport type {\n ComponentInternalInstance,\n ComponentPublicInstance,\n ComputedGetter,\n InjectionKey,\n PropType,\n Ref,\n Slots,\n ToRefs,\n VNode,\n VNodeChild,\n} from 'vue'\n\nexport function getNestedValue (obj: any, path: (string | number)[], fallback?: any): any {\n const last = path.length - 1\n\n if (last < 0) return obj === undefined ? fallback : obj\n\n for (let i = 0; i < last; i++) {\n if (obj == null) {\n return fallback\n }\n obj = obj[path[i]]\n }\n\n if (obj == null) return fallback\n\n return obj[path[last]] === undefined ? fallback : obj[path[last]]\n}\n\nexport function deepEqual (a: any, b: any): boolean {\n if (a === b) return true\n\n if (\n a instanceof Date &&\n b instanceof Date &&\n a.getTime() !== b.getTime()\n ) {\n // If the values are Date, compare them as timestamps\n return false\n }\n\n if (a !== Object(a) || b !== Object(b)) {\n // If the values aren't objects, they were already checked for equality\n return false\n }\n\n const props = Object.keys(a)\n\n if (props.length !== Object.keys(b).length) {\n // Different number of props, don't bother to check\n return false\n }\n\n return props.every(p => deepEqual(a[p], b[p]))\n}\n\nexport function getObjectValueByPath (obj: any, path: string, fallback?: any): any {\n // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621\n if (obj == null || !path || typeof path !== 'string') return fallback\n if (obj[path] !== undefined) return obj[path]\n path = path.replace(/\\[(\\w+)\\]/g, '.$1') // convert indexes to properties\n path = path.replace(/^\\./, '') // strip a leading dot\n return getNestedValue(obj, path.split('.'), fallback)\n}\n\nexport type SelectItemKey =\n | boolean // Ignored\n | string // Lookup by key, can use dot notation for nested objects\n | (string | number)[] // Nested lookup by key, each array item is a key in the next level\n | ((item: Record<string, any>, fallback?: any) => any)\n\nexport function getPropertyFromItem (\n item: any,\n property: SelectItemKey,\n fallback?: any\n): any {\n if (property == null) return item === undefined ? fallback : item\n\n if (item !== Object(item)) {\n if (typeof property !== 'function') return fallback\n\n const value = property(item, fallback)\n\n return typeof value === 'undefined' ? fallback : value\n }\n\n if (typeof property === 'string') return getObjectValueByPath(item, property, fallback)\n\n if (Array.isArray(property)) return getNestedValue(item, property, fallback)\n\n if (typeof property !== 'function') return fallback\n\n const value = property(item, fallback)\n\n return typeof value === 'undefined' ? fallback : value\n}\n\nexport function createRange (length: number, start = 0): number[] {\n return Array.from({ length }, (v, k) => start + k)\n}\n\nexport function getZIndex (el?: Element | null): number {\n if (!el || el.nodeType !== Node.ELEMENT_NODE) return 0\n\n const index = +window.getComputedStyle(el).getPropertyValue('z-index')\n\n if (!index) return getZIndex(el.parentNode as Element)\n return index\n}\n\nexport function convertToUnit (str: number, unit?: string): string\nexport function convertToUnit (str: string | number | null | undefined, unit?: string): string | undefined\nexport function convertToUnit (str: string | number | null | undefined, unit = 'px'): string | undefined {\n if (str == null || str === '') {\n return undefined\n } else if (isNaN(+str!)) {\n return String(str)\n } else if (!isFinite(+str!)) {\n return undefined\n } else {\n return `${Number(str)}${unit}`\n }\n}\n\nexport function isObject (obj: any): obj is object {\n return obj !== null && typeof obj === 'object' && !Array.isArray(obj)\n}\n\nexport function refElement<T extends object | undefined> (obj: T): Exclude<T, ComponentPublicInstance> | HTMLElement {\n return obj && '$el' in obj\n ? obj.$el as HTMLElement\n : obj as HTMLElement\n}\n\n// KeyboardEvent.keyCode aliases\nexport const keyCodes = Object.freeze({\n enter: 13,\n tab: 9,\n delete: 46,\n esc: 27,\n space: 32,\n up: 38,\n down: 40,\n left: 37,\n right: 39,\n end: 35,\n home: 36,\n del: 46,\n backspace: 8,\n insert: 45,\n pageup: 33,\n pagedown: 34,\n shift: 16,\n})\n\nexport const keyValues: Record<string, string> = Object.freeze({\n enter: 'Enter',\n tab: 'Tab',\n delete: 'Delete',\n esc: 'Escape',\n space: 'Space',\n up: 'ArrowUp',\n down: 'ArrowDown',\n left: 'ArrowLeft',\n right: 'ArrowRight',\n end: 'End',\n home: 'Home',\n del: 'Delete',\n backspace: 'Backspace',\n insert: 'Insert',\n pageup: 'PageUp',\n pagedown: 'PageDown',\n shift: 'Shift',\n})\n\nexport function keys<O extends {}> (o: O) {\n return Object.keys(o) as (keyof O)[]\n}\n\nexport function has<T extends string> (obj: object, key: T[]): obj is Record<T, unknown> {\n return key.every(k => obj.hasOwnProperty(k))\n}\n\ntype MaybePick<\n T extends object,\n U extends Extract<keyof T, string>\n> = Record<string, unknown> extends T ? Partial<Pick<T, U>> : Pick<T, U>\n\n// Array of keys\nexport function pick<\n T extends object,\n U extends Extract<keyof T, string>,\n E extends Extract<keyof T, string>\n> (obj: T, paths: U[], exclude?: E[]): [yes: MaybePick<T, Exclude<U, E>>, no: Omit<T, Exclude<U, E>>]\n// Array of keys or RegExp to test keys against\nexport function pick<\n T extends object,\n U extends Extract<keyof T, string>,\n E extends Extract<keyof T, string>\n> (obj: T, paths: (U | RegExp)[], exclude?: E[]): [yes: Partial<T>, no: Partial<T>]\nexport function pick<\n T extends object,\n U extends Extract<keyof T, string>,\n E extends Extract<keyof T, string>\n> (obj: T, paths: (U | RegExp)[], exclude?: E[]): [yes: Partial<T>, no: Partial<T>] {\n const found = Object.create(null)\n const rest = Object.create(null)\n\n for (const key in obj) {\n if (\n paths.some(path => path instanceof RegExp\n ? path.test(key)\n : path === key\n ) && !exclude?.some(path => path === key)\n ) {\n found[key] = obj[key]\n } else {\n rest[key] = obj[key]\n }\n }\n\n return [found, rest]\n}\n\nexport function omit<\n T extends object,\n U extends Extract<keyof T, string>\n> (obj: T, exclude: U[]): Omit<T, U> {\n const clone = { ...obj }\n\n exclude.forEach(prop => delete clone[prop])\n\n return clone\n}\n\nexport function only<\n T extends object,\n U extends Extract<keyof T, string>\n> (obj: T, include: U[]): Pick<T, U> {\n const clone = {} as T\n\n include.forEach(prop => clone[prop] = obj[prop])\n\n return clone\n}\n\n/**\n * Filter attributes that should be applied to\n * the root element of a an input component. Remaining\n * attributes should be passed to the <input> element inside.\n */\nexport function filterInputAttrs (attrs: Record<string, unknown>) {\n return pick(attrs, ['class', 'style', 'id', /^data-/])\n}\n\n/**\n * Returns the set difference of B and A, i.e. the set of elements in B but not in A\n */\nexport function arrayDiff (a: any[], b: any[]): any[] {\n const diff: any[] = []\n for (let i = 0; i < b.length; i++) {\n if (!a.includes(b[i])) diff.push(b[i])\n }\n return diff\n}\n\ntype IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;\nexport function wrapInArray<T> (\n v: T | null | undefined\n): T extends readonly any[]\n ? IfAny<T, T[], T>\n : NonNullable<T>[] {\n return v == null\n ? []\n : Array.isArray(v)\n ? v as any : [v]\n}\n\nexport function defaultFilter (value: any, search: string | null, item: any) {\n return value != null &&\n search != null &&\n typeof value !== 'boolean' &&\n value.toString().toLocaleLowerCase().indexOf(search.toLocaleLowerCase()) !== -1\n}\n\nexport function searchItems<T extends any = any> (items: T[], search: string): T[] {\n if (!search) return items\n search = search.toString().toLowerCase()\n if (search.trim() === '') return items\n\n return items.filter((item: any) => Object.keys(item).some(key => defaultFilter(getObjectValueByPath(item, key), search, item)))\n}\n\nexport function debounce (fn: Function, delay: number) {\n let timeoutId = 0 as any\n return (...args: any[]) => {\n clearTimeout(timeoutId)\n timeoutId = setTimeout(() => fn(...args), delay)\n }\n}\n\nexport function throttle<T extends (...args: any[]) => any> (fn: T, limit: number) {\n let throttling = false\n return (...args: Parameters<T>): void | ReturnType<T> => {\n if (!throttling) {\n throttling = true\n setTimeout(() => throttling = false, limit)\n return fn(...args)\n }\n }\n}\n\ntype Writable<T> = {\n -readonly [P in keyof T]: T[P]\n}\n\n/**\n * Filters slots to only those starting with `prefix`, removing the prefix\n */\nexport function getPrefixedSlots (prefix: string, slots: Slots): Slots {\n return Object.keys(slots)\n .filter(k => k.startsWith(prefix))\n .reduce<Writable<Slots>>((obj, k) => {\n obj[k.replace(prefix, '')] = slots[k]\n return obj\n }, {})\n}\n\nexport function clamp (value: number, min = 0, max = 1) {\n return Math.max(min, Math.min(max, value))\n}\n\nexport function getDecimals (value: number) {\n const trimmedStr = value.toString().trim()\n return trimmedStr.includes('.')\n ? (trimmedStr.length - trimmedStr.indexOf('.') - 1)\n : 0\n}\n\nexport function padEnd (str: string, length: number, char = '0') {\n return str + char.repeat(Math.max(0, length - str.length))\n}\n\nexport function padStart (str: string, length: number, char = '0') {\n return char.repeat(Math.max(0, length - str.length)) + str\n}\n\nexport function chunk (str: string, size = 1) {\n const chunked: string[] = []\n let index = 0\n while (index < str.length) {\n chunked.push(str.substr(index, size))\n index += size\n }\n return chunked\n}\n\nexport function humanReadableFileSize (bytes: number, base: 1000 | 1024 = 1000): string {\n if (bytes < base) {\n return `${bytes} B`\n }\n\n const prefix = base === 1024 ? ['Ki', 'Mi', 'Gi'] : ['k', 'M', 'G']\n let unit = -1\n while (Math.abs(bytes) >= base && unit < prefix.length - 1) {\n bytes /= base\n ++unit\n }\n return `${bytes.toFixed(1)} ${prefix[unit]}B`\n}\n\nexport function camelizeObjectKeys (obj: Record<string, any> | null | undefined) {\n if (!obj) return {}\n\n return Object.keys(obj).reduce((o: any, key: string) => {\n o[camelize(key)] = obj[key]\n return o\n }, {})\n}\n\nexport function mergeDeep (\n source: Record<string, any> = {},\n target: Record<string, any> = {},\n arrayFn?: (a: unknown[], b: unknown[]) => unknown[],\n) {\n const out: Record<string, any> = {}\n\n for (const key in source) {\n out[key] = source[key]\n }\n\n for (const key in target) {\n const sourceProperty = source[key]\n const targetProperty = target[key]\n\n // Only continue deep merging if\n // both properties are objects\n if (\n isObject(sourceProperty) &&\n isObject(targetProperty)\n ) {\n out[key] = mergeDeep(sourceProperty, targetProperty, arrayFn)\n\n continue\n }\n\n if (Array.isArray(sourceProperty) && Array.isArray(targetProperty) && arrayFn) {\n out[key] = arrayFn(sourceProperty, targetProperty)\n\n continue\n }\n\n out[key] = targetProperty\n }\n\n return out\n}\n\nexport function fillArray<T> (length: number, obj: T) {\n return Array(length).fill(obj)\n}\n\nexport function flattenFragments (nodes: VNode[]): VNode[] {\n return nodes.map(node => {\n if (node.type === Fragment) {\n return flattenFragments(node.children as VNode[])\n } else {\n return node\n }\n }).flat()\n}\n\nexport const randomHexColor = () => {\n const n = (Math.random() * 0xfffff * 1000000).toString(16)\n return '#' + n.slice(0, 6)\n}\n\nexport function toKebabCase (str = '') {\n if (toKebabCase.cache.has(str)) return toKebabCase.cache.get(str)!\n const kebab = str\n .replace(/[^a-z]/gi, '-')\n .replace(/\\B([A-Z])/g, '-$1')\n .toLowerCase()\n toKebabCase.cache.set(str, kebab)\n return kebab\n}\ntoKebabCase.cache = new Map<string, string>()\n\nexport type MaybeRef<T> = T | Ref<T>\n\nexport function findChildren (vnode?: VNodeChild): ComponentInternalInstance[] {\n if (!vnode || typeof vnode !== 'object') {\n return []\n }\n\n if (Array.isArray(vnode)) {\n return vnode\n .map(child => findChildren(child))\n .filter(v => v)\n .flat(1)\n } else if (Array.isArray(vnode.children)) {\n return vnode.children\n .map(child => findChildren(child))\n .filter(v => v)\n .flat(1)\n } else if (vnode.component) {\n return [vnode.component, ...findChildren(vnode.component?.subTree)]\n .filter(v => v)\n .flat(1)\n }\n\n return []\n}\n\nexport function findChildrenWithProvide (\n key: InjectionKey<any> | symbol,\n vnode?: VNodeChild,\n): ComponentInternalInstance[] {\n if (!vnode || typeof vnode !== 'object') return []\n\n if (Array.isArray(vnode)) {\n return vnode.map(child => findChildrenWithProvide(key, child)).flat(1)\n } else if (Array.isArray(vnode.children)) {\n return vnode.children.map(child => findChildrenWithProvide(key, child)).flat(1)\n } else if (vnode.component) {\n if (Object.getOwnPropertySymbols(vnode.component.provides).includes(key as symbol)) {\n return [vnode.component]\n } else if (vnode.component.subTree) {\n return findChildrenWithProvide(key, vnode.component.subTree).flat(1)\n }\n }\n\n return []\n}\n\nexport class CircularBuffer<T = never> {\n readonly #arr: Array<T> = []\n #pointer = 0\n\n constructor (public readonly size: number) {}\n\n push (val: T) {\n this.#arr[this.#pointer] = val\n this.#pointer = (this.#pointer + 1) % this.size\n }\n\n values (): T[] {\n return this.#arr.slice(this.#pointer).concat(this.#arr.slice(0, this.#pointer))\n }\n}\n\nexport type UnionToIntersection<U> =\n (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never\n\nexport function getEventCoordinates (e: MouseEvent | TouchEvent) {\n if ('touches' in e) {\n return { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY }\n }\n\n return { clientX: e.clientX, clientY: e.clientY }\n}\n\n// Only allow a single return type\ntype NotAUnion<T> = [T] extends [infer U] ? _NotAUnion<U, U> : never\ntype _NotAUnion<T, U> = U extends any ? [T] extends [U] ? unknown : never : never\n\n/**\n * Convert a computed ref to a record of refs.\n * The getter function must always return an object with the same keys.\n */\nexport function destructComputed<T extends object> (getter: ComputedGetter<T & NotAUnion<T>>): ToRefs<T>\nexport function destructComputed<T extends object> (getter: ComputedGetter<T>) {\n const refs = reactive({}) as T\n const base = computed(getter)\n watchEffect(() => {\n for (const key in base.value) {\n refs[key] = base.value[key]\n }\n }, { flush: 'sync' })\n return toRefs(refs)\n}\n\n/** Array.includes but value can be any type */\nexport function includes (arr: readonly any[], val: any) {\n return arr.includes(val)\n}\n\nconst onRE = /^on[^a-z]/\nexport const isOn = (key: string) => onRE.test(key)\n\nexport function eventName (propName: string) {\n return propName[2].toLowerCase() + propName.slice(3)\n}\n\nexport type EventProp<T extends any[] = any[], F = (...args: T) => any> = F | F[]\nexport const EventProp = <T extends any[] = any[]>() => [Function, Array] as PropType<EventProp<T>>\n\nexport function hasEvent (props: Record<string, any>, name: string) {\n name = 'on' + capitalize(name)\n return !!(props[name] || props[`${name}Once`] || props[`${name}Capture`] || props[`${name}OnceCapture`] || props[`${name}CaptureOnce`])\n}\n\nexport function callEvent<T extends any[]> (handler: EventProp<T> | undefined, ...args: T) {\n if (Array.isArray(handler)) {\n for (const h of handler) {\n h(...args)\n }\n } else if (typeof handler === 'function') {\n handler(...args)\n }\n}\n\nexport function focusableChildren (el: Element, filterByTabIndex = true) {\n const targets = ['button', '[href]', 'input:not([type=\"hidden\"])', 'select', 'textarea', '[tabindex]']\n .map(s => `${s}${filterByTabIndex ? ':not([tabindex=\"-1\"])' : ''}:not([disabled])`)\n .join(', ')\n return [...el.querySelectorAll(targets)] as HTMLElement[]\n}\n\nexport function getNextElement (elements: HTMLElement[], location?: 'next' | 'prev', condition?: (el: HTMLElement) => boolean) {\n let _el\n let idx = elements.indexOf(document.activeElement as HTMLElement)\n const inc = location === 'next' ? 1 : -1\n do {\n idx += inc\n _el = elements[idx]\n } while ((!_el || _el.offsetParent == null || !(condition?.(_el) ?? true)) && idx < elements.length && idx >= 0)\n return _el\n}\n\nexport function focusChild (el: Element, location?: 'next' | 'prev' | 'first' | 'last' | number) {\n const focusable = focusableChildren(el)\n\n if (!location) {\n if (el === document.activeElement || !el.contains(document.activeElement)) {\n focusable[0]?.focus()\n }\n } else if (location === 'first') {\n focusable[0]?.focus()\n } else if (location === 'last') {\n focusable.at(-1)?.focus()\n } else if (typeof location === 'number') {\n focusable[location]?.focus()\n } else {\n const _el = getNextElement(focusable, location)\n if (_el) _el.focus()\n else focusChild(el, location === 'next' ? 'first' : 'last')\n }\n}\n\nexport function isEmpty (val: any): boolean {\n return val === null || val === undefined || (typeof val === 'string' && val.trim() === '')\n}\n\nexport function noop () {}\n\n/** Returns null if the selector is not supported or we can't check */\nexport function matchesSelector (el: Element | undefined, selector: string): boolean | null {\n const supportsSelector = IN_BROWSER &&\n typeof CSS !== 'undefined' &&\n typeof CSS.supports !== 'undefined' &&\n CSS.supports(`selector(${selector})`)\n\n if (!supportsSelector) return null\n\n try {\n return !!el && el.matches(selector)\n } catch (err) {\n return null\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAQ,K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