1 line
13 KiB
Plaintext
1 line
13 KiB
Plaintext
|
{"version":3,"file":"display.mjs","names":["computed","inject","reactive","shallowRef","toRefs","watchEffect","getCurrentInstanceName","mergeDeep","propsFactory","IN_BROWSER","SUPPORTS_TOUCH","breakpoints","DisplaySymbol","Symbol","for","defaultDisplayOptions","mobileBreakpoint","thresholds","xs","sm","md","lg","xl","xxl","parseDisplayOptions","options","arguments","length","undefined","getClientWidth","ssr","window","innerWidth","clientWidth","getClientHeight","innerHeight","clientHeight","getPlatform","userAgent","navigator","match","regexp","Boolean","android","ios","cordova","electron","chrome","edge","firefox","opera","win","mac","linux","touch","createDisplay","height","platform","state","width","updateSize","value","update","name","breakpointValue","mobile","smAndUp","mdAndUp","lgAndUp","xlAndUp","smAndDown","mdAndDown","lgAndDown","xlAndDown","addEventListener","passive","makeDisplayProps","Number","String","useDisplay","props","display","Error","displayClasses"],"sources":["../../src/composables/display.ts"],"sourcesContent":["// Utilities\nimport { computed, inject, reactive, shallowRef, toRefs, watchEffect } from 'vue'\nimport { getCurrentInstanceName, mergeDeep, propsFactory } from '@/util'\nimport { IN_BROWSER, SUPPORTS_TOUCH } from '@/util/globals'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\n\nexport const breakpoints = ['sm', 'md', 'lg', 'xl', 'xxl'] as const // no xs\n\nexport type Breakpoint = typeof breakpoints[number]\n\nexport type DisplayBreakpoint = 'xs' | Breakpoint\n\nexport type DisplayThresholds = {\n [key in DisplayBreakpoint]: number\n}\n\nexport interface DisplayProps {\n mobileBreakpoint?: number | DisplayBreakpoint\n}\n\nexport interface DisplayOptions {\n mobileBreakpoint?: number | DisplayBreakpoint\n thresholds?: Partial<DisplayThresholds>\n}\n\nexport interface InternalDisplayOptions {\n mobileBreakpoint: number | DisplayBreakpoint\n thresholds: DisplayThresholds\n}\n\nexport type SSROptions = boolean | {\n clientWidth: number\n clientHeight?: number\n}\n\nexport interface DisplayPlatform {\n android: boolean\n ios: boolean\n cordova: boolean\n electron: boolean\n chrome: boolean\n edge: boolean\n firefox: boolean\n opera: boolean\n win: boolean\n mac: boolean\n linux: boolean\n touch: boolean\n ssr: boolean\n}\n\nexport interface DisplayInstance {\n xs: Ref<boolean>\n sm: Ref<boolean>\n md: Ref<boolean>\n lg: Ref<boolean>\n xl: Ref<boolean>\n xxl: Ref<boolean>\n smAndUp: Ref<boolean>\n mdAndUp: Ref<boolean>\n lgAndUp: Ref<boolean>\n xlAndUp: Ref<boolean>\n smAndDown: Ref<boolean>\n mdAndDown: Ref<boolean>\n lgAndDown: Ref<boolean>\n xlAndDown: Ref<boolean>\n name: Ref<DisplayBreakpoint>\n height: Ref<number>\n width: Ref<number>\n mobile: Ref<boolean>\n mobileBreakpoint: Ref<number | DisplayBreakpoint>\n platform: Ref<DisplayPlatform>\n thresholds: Ref<DisplayThresholds>\n\n /** @internal */\n ssr: boolean\n\n update (): void\n}\n\nexport const DisplaySymbol: InjectionKey<DisplayInstance> = Symbol.for('vuetify:display')\n\nconst defaultDisplayOptions: DisplayOptions = {\n mobileBreakpoint: 'lg',\n thresholds: {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n xxl: 2560,\n },\n}\n\nconst parseDisplayOptions = (options: DisplayOptions = defaultDisplayOptions) => {\n return mergeDeep(defaultDisplayOptions, options) as InternalDisplayOptions\n}\n\nfunction getClientWidth (ssr?: SSROptions) {\n return IN_BROWSER && !ssr\n ? window.innerWidth\n : (typeof ssr === 'object' && ssr.clientWidth) || 0\n}\n\nfunction getClientHeight (ssr?: SSROptions) {\n return IN_BROWSER && !ssr\n ? window.innerHeight\n : (typeof ssr === 'object' && ssr.clientHeight) || 0\n}\n\nfunction getPlatform (ssr?: SSROptions): DisplayPlatform {\n const userAgent = IN_BROWSER && !ssr\n ? window.navigator.userAgent\n : 'ssr'\n\n function match (regexp: RegExp) {\n return Boolean(userAgent.match(regexp))\n }\n\n const android = match(/android/i)\n const ios = match(/iphone|ipad|ipod/i)\n const cor
|