init component
This commit is contained in:
2
node_modules/buetify/lib/composables/windowSize/index.d.ts
generated
vendored
Executable file
2
node_modules/buetify/lib/composables/windowSize/index.d.ts
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
export * from './provideWindowSize';
|
||||
export * from './useWindowSize';
|
||||
3
node_modules/buetify/lib/composables/windowSize/index.js
generated
vendored
Executable file
3
node_modules/buetify/lib/composables/windowSize/index.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
export * from './provideWindowSize';
|
||||
export * from './useWindowSize';
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/buetify/lib/composables/windowSize/index.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/windowSize/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/composables/windowSize/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAd;AACA,cAAc,iBAAd","sourcesContent":["export * from './provideWindowSize';\nexport * from './useWindowSize';\n"],"sourceRoot":"","file":"index.js"}
|
||||
48
node_modules/buetify/lib/composables/windowSize/provideWindowSize.d.ts
generated
vendored
Executable file
48
node_modules/buetify/lib/composables/windowSize/provideWindowSize.d.ts
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
import { Option } from 'fp-ts/lib/Option';
|
||||
import { Ref, PropType, ExtractPropTypes } from 'vue';
|
||||
export interface WindowSize {
|
||||
windowWidth: number;
|
||||
isMobile: boolean;
|
||||
isTablet: boolean;
|
||||
isTouch: boolean;
|
||||
isDesktop: boolean;
|
||||
isWidescreen: boolean;
|
||||
isFullHD: boolean;
|
||||
}
|
||||
export interface WindowSizeInjection {
|
||||
windowSize: Ref<Option<WindowSize>>;
|
||||
}
|
||||
export declare const DEFAULT_WINDOW_SIZE_INJECTION: WindowSizeInjection;
|
||||
export declare const DEFAULT_BREAK_POINTS: Ref<{
|
||||
mobile: number;
|
||||
tablet: number;
|
||||
desktop: number;
|
||||
widescreen: number;
|
||||
fullHD: number;
|
||||
}>;
|
||||
export declare type BreakPoints = typeof DEFAULT_BREAK_POINTS.value;
|
||||
export declare const WINDOW_SIZE_SYMBOL: unique symbol;
|
||||
export declare const ProvideWindowSizePropsDefinition: {
|
||||
breakPoints: {
|
||||
type: PropType<{
|
||||
mobile: number;
|
||||
tablet: number;
|
||||
desktop: number;
|
||||
widescreen: number;
|
||||
fullHD: number;
|
||||
}>;
|
||||
required: boolean;
|
||||
default: import("fp-ts/lib/function").Lazy<{
|
||||
mobile: number;
|
||||
tablet: number;
|
||||
desktop: number;
|
||||
widescreen: number;
|
||||
fullHD: number;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
export declare type ProvideWindowSizeProps = ExtractPropTypes<typeof ProvideWindowSizePropsDefinition>;
|
||||
export declare function getWindowSize(): Ref<WindowSize>;
|
||||
export declare function provideWindowSize(props: ProvideWindowSizeProps): {
|
||||
windowSize: Ref<WindowSize>;
|
||||
};
|
||||
61
node_modules/buetify/lib/composables/windowSize/provideWindowSize.js
generated
vendored
Executable file
61
node_modules/buetify/lib/composables/windowSize/provideWindowSize.js
generated
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
import { constant } from 'fp-ts/lib/function';
|
||||
import { none, some } from 'fp-ts/lib/Option';
|
||||
import debounce from 'lodash.debounce';
|
||||
import { watchEffect, provide, shallowRef, computed, onMounted, onUnmounted } from 'vue';
|
||||
export const DEFAULT_WINDOW_SIZE_INJECTION = {
|
||||
windowSize: shallowRef(none)
|
||||
};
|
||||
export const DEFAULT_BREAK_POINTS = shallowRef({
|
||||
mobile: 768,
|
||||
tablet: 1023,
|
||||
desktop: 1215,
|
||||
widescreen: 1407,
|
||||
fullHD: 1408
|
||||
});
|
||||
export const WINDOW_SIZE_SYMBOL = Symbol('window-size');
|
||||
export const ProvideWindowSizePropsDefinition = {
|
||||
breakPoints: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: constant(DEFAULT_BREAK_POINTS.value)
|
||||
}
|
||||
};
|
||||
export function getWindowSize() {
|
||||
const windowWidth = shallowRef(window.innerWidth);
|
||||
const resizeHandler = debounce(() => {
|
||||
windowWidth.value = window.innerWidth;
|
||||
}, 250);
|
||||
onMounted(() => window.addEventListener('resize', resizeHandler, {
|
||||
passive: true
|
||||
}));
|
||||
onUnmounted(() => window.removeEventListener('resize', resizeHandler));
|
||||
return computed(() => {
|
||||
const breakPoints = DEFAULT_BREAK_POINTS.value;
|
||||
const innerWidth = windowWidth.value;
|
||||
const isMobile = innerWidth <= breakPoints.mobile;
|
||||
const isTablet = innerWidth <= breakPoints.tablet && innerWidth > breakPoints.mobile;
|
||||
return {
|
||||
windowWidth: innerWidth,
|
||||
isMobile,
|
||||
isTablet,
|
||||
isTouch: isMobile || isTablet,
|
||||
isDesktop: innerWidth <= breakPoints.desktop && innerWidth > breakPoints.tablet,
|
||||
isWidescreen: innerWidth <= breakPoints.widescreen && innerWidth > breakPoints.desktop,
|
||||
isFullHD: innerWidth >= breakPoints.fullHD
|
||||
};
|
||||
});
|
||||
}
|
||||
export function provideWindowSize(props) {
|
||||
watchEffect(() => {
|
||||
DEFAULT_BREAK_POINTS.value = props.breakPoints;
|
||||
});
|
||||
const windowSize = getWindowSize();
|
||||
const injection = {
|
||||
windowSize: computed(() => some(windowSize.value))
|
||||
};
|
||||
provide(WINDOW_SIZE_SYMBOL, injection);
|
||||
return {
|
||||
windowSize
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=provideWindowSize.js.map
|
||||
1
node_modules/buetify/lib/composables/windowSize/provideWindowSize.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/windowSize/provideWindowSize.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/composables/windowSize/provideWindowSize.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,QAAyB,oBAAzB;AACA,SAAS,IAAT,EAAuB,IAAvB,QAAmC,kBAAnC;AACA,OAAO,QAAP,MAAqB,iBAArB;AACA,SACE,WADF,EAEE,OAFF,EA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C,MAA3C;AACA,UAAM,QAAQ,GAAG,UAAU,IAAI,WAAW,CAAC,MAA1B,IAAoC,UAAU,GAAG,WAAW,CAAC,MAA9E;AACA,WAAO;AACL,MAAA,WAAW,EAAE,UADR;AAEL,MAAA,QAFK;AAGL,MAAA,QAHK;AAIL,MAAA,OAAO,EAAE,QAAQ,IAAI,QAJhB;AAKL,MAAA,SAAS,EAAE,UAAU,IAAI,WAAW,CAAC,OAA1B,IAAqC,UAAU,GAAG,WAAW,CAAC,MALpE;AAML,MAAA,YAAY,EAAE,UAAU,IAAI,WAAW,CAAC,UAA1B,IAAwC,UAAU,GAAG,WAAW,CAAC,OAN1E;AAOL,MAAA,QAAQ,EAAE,UAAU,IAAI,WAAW,CAAC;AAP/B,KAAP;AASD,GAdc,CAAf;AAeD;AAED,OAAM,SAAU,iBAAV,CAA4B,KAA5B,EAAyD;AAC7D,EAAA,WAAW,CAAC,MAAK;AACf,IAAA,oBAAoB,CAAC,KAArB,GAA6B,KAAK,CAAC,WAAnC;AACD,GAFU,CAAX;AAGA,QAAM,UAAU,GAAG,aAAa,EAAhC;AAEA,QAAM,SAAS,GAAwB;AACrC,IAAA,UAAU,EAAE,QAAQ,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAZ,CAAX;AADiB,GAAvC;AAIA,EAAA,OAAO,CAAC,kBAAD,EAAqB,SAArB,CAAP;AAEA,SAAO;AACL,IAAA;AADK,GAAP;AAGD","sourcesContent":["import { constant } from 'fp-ts/lib/function';\nimport { none, Option, some } from 'fp-ts/lib/Option';\nimport debounce from 'lodash.debounce';\nimport {\n watchEffect,\n provide,\n shallowRef,\n Ref,\n PropType,\n ExtractPropTypes,\n computed,\n onMounted,\n onUnmounted\n} from 'vue';\n\nexport interface WindowSize {\n windowWidth: number;\n isMobile: boolean;\n isTablet: boolean;\n isTouch: boolean;\n isDesktop: boolean;\n isWidescreen: boolean;\n isFullHD: boolean;\n}\n\nexport interface WindowSizeInjection {\n windowSize: Ref<Option<WindowSize>>;\n}\n\nexport const DEFAULT_WINDOW_SIZE_INJECTION: WindowSizeInjection = {\n windowSize: shallowRef(none)\n};\n\nexport const DEFAULT_BREAK_POINTS = shallowRef({\n mobile: 768,\n tablet: 1023,\n desktop: 1215,\n widescreen: 1407,\n fullHD: 1408\n});\n\nexport type BreakPoints = typeof DEFAULT_BREAK_POINTS.value;\n\nexport const WINDOW_SIZE_SYMBOL = Symbol('window-size');\n\nexport const ProvideWindowSizePropsDefinition = {\n breakPoints: {\n type: Object as PropType<BreakPoints>,\n required: false,\n default: constant(DEFAULT_BREAK_POINTS.value)\n }\n};\n\nexport type ProvideWindowSizeProps = ExtractPropTypes<typeof ProvideWindowSizePropsDefinition>;\n\nexport function getWindowSize(): Ref<WindowSize> {\n const windowWidth = shallowRef(window.innerWidth);\n\n const resizeHandler = debounce(() => {\n windowWidth.value = window.innerWidth;\n }, 250);\n\n onMounted(() => window.addEventListener('resize', resizeHandler, { passive: true }));\n onUnmounted(() => window.removeEventListener('resize', resizeHandler));\n\n return computed(() => {\n const breakPoints = DEFAULT_BREAK_POINTS.value;\n const innerWidth = windowWidth.value;\n const isMobile = innerWidth <= breakPoints.mobile;\n const isTablet = innerWidth <= breakPoints.tablet && innerWidth > breakPoints.mobile;\n return {\n windowWidth: innerWidth,\n isMobile,\n isTablet,\n isTouch: isMobile || isTablet,\n isDesktop: innerWidth <= breakPoints.desktop && innerWidth > breakPoints.tablet,\n isWidescreen: innerWidth <= breakPoints.widescreen && innerWidth > breakPoints.desktop,\n isFullHD: innerWidth >= breakPoints.fullHD\n };\n });\n}\n\nexport function provideWindowSize(props: ProvideWindowSizeProps) {\n watchEffect(() => {\n DEFAULT_BREAK_POINTS.value = props.breakPoints;\n });\n const windowSize = getWindowSize();\n\n const injection: WindowSizeInjection = {\n windowSize: computed(() => some(windowSize.value))\n };\n\n provide(WINDOW_SIZE_SYMBOL, injection);\n\n return {\n windowSize\n };\n}\n"],"sourceRoot":"","file":"provideWindowSize.js"}
|
||||
1
node_modules/buetify/lib/composables/windowSize/useWindowSize.d.ts
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/windowSize/useWindowSize.d.ts
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
export declare function useWindowSize(): import("vue").ComputedRef<import("./provideWindowSize").WindowSize>;
|
||||
10
node_modules/buetify/lib/composables/windowSize/useWindowSize.js
generated
vendored
Executable file
10
node_modules/buetify/lib/composables/windowSize/useWindowSize.js
generated
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
import { isSome, none } from 'fp-ts/lib/Option';
|
||||
import { shallowRef, inject, computed } from 'vue';
|
||||
import { getWindowSize, WINDOW_SIZE_SYMBOL } from './provideWindowSize';
|
||||
export function useWindowSize() {
|
||||
const injection = inject(WINDOW_SIZE_SYMBOL, {
|
||||
windowSize: shallowRef(none)
|
||||
});
|
||||
return computed(() => isSome(injection.windowSize.value) ? injection.windowSize.value.value : getWindowSize().value);
|
||||
}
|
||||
//# sourceMappingURL=useWindowSize.js.map
|
||||
1
node_modules/buetify/lib/composables/windowSize/useWindowSize.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/windowSize/useWindowSize.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/composables/windowSize/useWindowSize.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,EAAiB,IAAjB,QAA6B,kBAA7B;AACA,SAAS,UAAT,EAAqB,MAArB,EAA6B,QAA7B,QAA6C,KAA7C;AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAuE,qBAAvE;AAEA,OAAM,SAAU,aAAV,GAAuB;AAC3B,QAAM,SAAS,GAAG,MAAM,CAAC,kBAAD,EAAqB;AAAE,IAAA,UAAU,EAAE,UAAU,CAAC,IAAD;AAAxB,GAArB,CAAxB;AACA,SAAO,QAAQ,CAAC,MACd,MAAM,CAAC,SAAS,CAAC,UAAV,CAAqB,KAAtB,CAAN,GAAqC,SAAS,CAAC,UAAV,CAAqB,KAArB,CAA2B,KAAhE,GAAwE,aAAa,GAAG,KAD3E,CAAf;AAGD","sourcesContent":["import { isSome, none } from 'fp-ts/lib/Option';\nimport { shallowRef, inject, computed } from 'vue';\nimport { getWindowSize, WINDOW_SIZE_SYMBOL, WindowSizeInjection } from './provideWindowSize';\n\nexport function useWindowSize() {\n const injection = inject(WINDOW_SIZE_SYMBOL, { windowSize: shallowRef(none) } as WindowSizeInjection);\n return computed(() =>\n isSome(injection.windowSize.value) ? injection.windowSize.value.value : getWindowSize().value\n );\n}\n"],"sourceRoot":"","file":"useWindowSize.js"}
|
||||
Reference in New Issue
Block a user