@gluhar/app 5.0.8 → 5.0.9

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.
@@ -1,370 +0,0 @@
1
- import Lenis from "lenis";
2
- import { type Ref } from "vue";
3
- interface LenisOptions {
4
- wrapper?: HTMLElement | string;
5
- content?: HTMLElement;
6
- lerp?: number;
7
- duration?: number;
8
- orientation?: "vertical" | "horizontal";
9
- gestureOrientation?: "vertical" | "horizontal" | "both";
10
- smoothWheel?: boolean;
11
- smoothTouch?: boolean;
12
- wheelMultiplier?: number;
13
- touchMultiplier?: number;
14
- normalizeWheel?: boolean;
15
- easing?: (t: number) => number;
16
- }
17
- export declare const useLenis: (wrapperOrOptions?: string | HTMLElement | Ref<HTMLElement | undefined> | LenisOptions) => {
18
- lenis: Ref<{
19
- isTouching?: boolean | undefined;
20
- time: number;
21
- userData: import("lenis").UserData;
22
- lastVelocity: number;
23
- velocity: number;
24
- direction: 1 | -1 | 0;
25
- options: {
26
- wrapper: Window | HTMLElement | Element;
27
- content: HTMLElement | Element;
28
- eventsTarget: Window | HTMLElement | Element;
29
- smoothWheel: boolean;
30
- syncTouch: boolean;
31
- syncTouchLerp: number;
32
- touchInertiaExponent: number;
33
- lerp: number;
34
- infinite: boolean;
35
- orientation: import("lenis").Orientation;
36
- gestureOrientation: import("lenis").GestureOrientation;
37
- touchMultiplier: number;
38
- wheelMultiplier: number;
39
- autoResize: boolean;
40
- overscroll: boolean;
41
- autoRaf: boolean;
42
- anchors: boolean | {
43
- offset?: number | undefined;
44
- immediate?: boolean | undefined;
45
- lock?: boolean | undefined;
46
- duration?: number | undefined;
47
- easing?: import("lenis").EasingFunction | undefined;
48
- lerp?: number | undefined;
49
- onStart?: ((lenis: Lenis) => void) | undefined;
50
- onComplete?: ((lenis: Lenis) => void) | undefined;
51
- force?: boolean | undefined;
52
- programmatic?: boolean | undefined;
53
- userData?: import("lenis").UserData | undefined;
54
- };
55
- autoToggle: boolean;
56
- allowNestedScroll: boolean;
57
- __experimental__naiveDimensions: boolean;
58
- virtualScroll?: ((data: import("lenis").VirtualScrollData) => boolean) | undefined;
59
- duration?: number | undefined;
60
- easing?: import("lenis").EasingFunction | undefined;
61
- prevent?: ((node: HTMLElement) => boolean) | undefined;
62
- };
63
- targetScroll: number;
64
- animatedScroll: number;
65
- readonly dimensions: {
66
- width: number;
67
- height: number;
68
- scrollHeight: number;
69
- scrollWidth: number;
70
- destroy: () => void;
71
- resize: () => void;
72
- onWrapperResize: () => void;
73
- onContentResize: () => void;
74
- readonly limit: {
75
- x: number;
76
- y: number;
77
- };
78
- };
79
- destroy: () => void;
80
- on: {
81
- (event: "scroll", callback: import("lenis").ScrollCallback): () => void;
82
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): () => void;
83
- };
84
- off: {
85
- (event: "scroll", callback: import("lenis").ScrollCallback): void;
86
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): void;
87
- };
88
- resize: () => void;
89
- start: () => void;
90
- stop: () => void;
91
- raf: (time: number) => void;
92
- scrollTo: (target: number | string | HTMLElement, { offset, immediate, lock, duration, easing, lerp, onStart, onComplete, force, programmatic, userData, }?: import("lenis").ScrollToOptions) => void;
93
- readonly rootElement: HTMLElement;
94
- readonly limit: number;
95
- readonly isHorizontal: boolean;
96
- readonly actualScroll: number;
97
- readonly scroll: number;
98
- readonly progress: number;
99
- isScrolling: import("lenis").Scrolling;
100
- isStopped: boolean;
101
- isLocked: boolean;
102
- readonly isSmooth: boolean;
103
- readonly className: string;
104
- } | null, Lenis | {
105
- isTouching?: boolean | undefined;
106
- time: number;
107
- userData: import("lenis").UserData;
108
- lastVelocity: number;
109
- velocity: number;
110
- direction: 1 | -1 | 0;
111
- options: {
112
- wrapper: Window | HTMLElement | Element;
113
- content: HTMLElement | Element;
114
- eventsTarget: Window | HTMLElement | Element;
115
- smoothWheel: boolean;
116
- syncTouch: boolean;
117
- syncTouchLerp: number;
118
- touchInertiaExponent: number;
119
- lerp: number;
120
- infinite: boolean;
121
- orientation: import("lenis").Orientation;
122
- gestureOrientation: import("lenis").GestureOrientation;
123
- touchMultiplier: number;
124
- wheelMultiplier: number;
125
- autoResize: boolean;
126
- overscroll: boolean;
127
- autoRaf: boolean;
128
- anchors: boolean | {
129
- offset?: number | undefined;
130
- immediate?: boolean | undefined;
131
- lock?: boolean | undefined;
132
- duration?: number | undefined;
133
- easing?: import("lenis").EasingFunction | undefined;
134
- lerp?: number | undefined;
135
- onStart?: ((lenis: Lenis) => void) | undefined;
136
- onComplete?: ((lenis: Lenis) => void) | undefined;
137
- force?: boolean | undefined;
138
- programmatic?: boolean | undefined;
139
- userData?: import("lenis").UserData | undefined;
140
- };
141
- autoToggle: boolean;
142
- allowNestedScroll: boolean;
143
- __experimental__naiveDimensions: boolean;
144
- virtualScroll?: ((data: import("lenis").VirtualScrollData) => boolean) | undefined;
145
- duration?: number | undefined;
146
- easing?: import("lenis").EasingFunction | undefined;
147
- prevent?: ((node: HTMLElement) => boolean) | undefined;
148
- };
149
- targetScroll: number;
150
- animatedScroll: number;
151
- readonly dimensions: {
152
- width: number;
153
- height: number;
154
- scrollHeight: number;
155
- scrollWidth: number;
156
- destroy: () => void;
157
- resize: () => void;
158
- onWrapperResize: () => void;
159
- onContentResize: () => void;
160
- readonly limit: {
161
- x: number;
162
- y: number;
163
- };
164
- };
165
- destroy: () => void;
166
- on: {
167
- (event: "scroll", callback: import("lenis").ScrollCallback): () => void;
168
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): () => void;
169
- };
170
- off: {
171
- (event: "scroll", callback: import("lenis").ScrollCallback): void;
172
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): void;
173
- };
174
- resize: () => void;
175
- start: () => void;
176
- stop: () => void;
177
- raf: (time: number) => void;
178
- scrollTo: (target: number | string | HTMLElement, { offset, immediate, lock, duration, easing, lerp, onStart, onComplete, force, programmatic, userData, }?: import("lenis").ScrollToOptions) => void;
179
- readonly rootElement: HTMLElement;
180
- readonly limit: number;
181
- readonly isHorizontal: boolean;
182
- readonly actualScroll: number;
183
- readonly scroll: number;
184
- readonly progress: number;
185
- isScrolling: import("lenis").Scrolling;
186
- isStopped: boolean;
187
- isLocked: boolean;
188
- readonly isSmooth: boolean;
189
- readonly className: string;
190
- } | null>;
191
- destroy: () => void;
192
- createInstance?: undefined;
193
- } | {
194
- lenis: Ref<{
195
- isTouching?: boolean | undefined;
196
- time: number;
197
- userData: import("lenis").UserData;
198
- lastVelocity: number;
199
- velocity: number;
200
- direction: 1 | -1 | 0;
201
- options: {
202
- wrapper: Window | HTMLElement | Element;
203
- content: HTMLElement | Element;
204
- eventsTarget: Window | HTMLElement | Element;
205
- smoothWheel: boolean;
206
- syncTouch: boolean;
207
- syncTouchLerp: number;
208
- touchInertiaExponent: number;
209
- lerp: number;
210
- infinite: boolean;
211
- orientation: import("lenis").Orientation;
212
- gestureOrientation: import("lenis").GestureOrientation;
213
- touchMultiplier: number;
214
- wheelMultiplier: number;
215
- autoResize: boolean;
216
- overscroll: boolean;
217
- autoRaf: boolean;
218
- anchors: boolean | {
219
- offset?: number | undefined;
220
- immediate?: boolean | undefined;
221
- lock?: boolean | undefined;
222
- duration?: number | undefined;
223
- easing?: import("lenis").EasingFunction | undefined;
224
- lerp?: number | undefined;
225
- onStart?: ((lenis: Lenis) => void) | undefined;
226
- onComplete?: ((lenis: Lenis) => void) | undefined;
227
- force?: boolean | undefined;
228
- programmatic?: boolean | undefined;
229
- userData?: import("lenis").UserData | undefined;
230
- };
231
- autoToggle: boolean;
232
- allowNestedScroll: boolean;
233
- __experimental__naiveDimensions: boolean;
234
- virtualScroll?: ((data: import("lenis").VirtualScrollData) => boolean) | undefined;
235
- duration?: number | undefined;
236
- easing?: import("lenis").EasingFunction | undefined;
237
- prevent?: ((node: HTMLElement) => boolean) | undefined;
238
- };
239
- targetScroll: number;
240
- animatedScroll: number;
241
- readonly dimensions: {
242
- width: number;
243
- height: number;
244
- scrollHeight: number;
245
- scrollWidth: number;
246
- destroy: () => void;
247
- resize: () => void;
248
- onWrapperResize: () => void;
249
- onContentResize: () => void;
250
- readonly limit: {
251
- x: number;
252
- y: number;
253
- };
254
- };
255
- destroy: () => void;
256
- on: {
257
- (event: "scroll", callback: import("lenis").ScrollCallback): () => void;
258
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): () => void;
259
- };
260
- off: {
261
- (event: "scroll", callback: import("lenis").ScrollCallback): void;
262
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): void;
263
- };
264
- resize: () => void;
265
- start: () => void;
266
- stop: () => void;
267
- raf: (time: number) => void;
268
- scrollTo: (target: number | string | HTMLElement, { offset, immediate, lock, duration, easing, lerp, onStart, onComplete, force, programmatic, userData, }?: import("lenis").ScrollToOptions) => void;
269
- readonly rootElement: HTMLElement;
270
- readonly limit: number;
271
- readonly isHorizontal: boolean;
272
- readonly actualScroll: number;
273
- readonly scroll: number;
274
- readonly progress: number;
275
- isScrolling: import("lenis").Scrolling;
276
- isStopped: boolean;
277
- isLocked: boolean;
278
- readonly isSmooth: boolean;
279
- readonly className: string;
280
- } | null, Lenis | {
281
- isTouching?: boolean | undefined;
282
- time: number;
283
- userData: import("lenis").UserData;
284
- lastVelocity: number;
285
- velocity: number;
286
- direction: 1 | -1 | 0;
287
- options: {
288
- wrapper: Window | HTMLElement | Element;
289
- content: HTMLElement | Element;
290
- eventsTarget: Window | HTMLElement | Element;
291
- smoothWheel: boolean;
292
- syncTouch: boolean;
293
- syncTouchLerp: number;
294
- touchInertiaExponent: number;
295
- lerp: number;
296
- infinite: boolean;
297
- orientation: import("lenis").Orientation;
298
- gestureOrientation: import("lenis").GestureOrientation;
299
- touchMultiplier: number;
300
- wheelMultiplier: number;
301
- autoResize: boolean;
302
- overscroll: boolean;
303
- autoRaf: boolean;
304
- anchors: boolean | {
305
- offset?: number | undefined;
306
- immediate?: boolean | undefined;
307
- lock?: boolean | undefined;
308
- duration?: number | undefined;
309
- easing?: import("lenis").EasingFunction | undefined;
310
- lerp?: number | undefined;
311
- onStart?: ((lenis: Lenis) => void) | undefined;
312
- onComplete?: ((lenis: Lenis) => void) | undefined;
313
- force?: boolean | undefined;
314
- programmatic?: boolean | undefined;
315
- userData?: import("lenis").UserData | undefined;
316
- };
317
- autoToggle: boolean;
318
- allowNestedScroll: boolean;
319
- __experimental__naiveDimensions: boolean;
320
- virtualScroll?: ((data: import("lenis").VirtualScrollData) => boolean) | undefined;
321
- duration?: number | undefined;
322
- easing?: import("lenis").EasingFunction | undefined;
323
- prevent?: ((node: HTMLElement) => boolean) | undefined;
324
- };
325
- targetScroll: number;
326
- animatedScroll: number;
327
- readonly dimensions: {
328
- width: number;
329
- height: number;
330
- scrollHeight: number;
331
- scrollWidth: number;
332
- destroy: () => void;
333
- resize: () => void;
334
- onWrapperResize: () => void;
335
- onContentResize: () => void;
336
- readonly limit: {
337
- x: number;
338
- y: number;
339
- };
340
- };
341
- destroy: () => void;
342
- on: {
343
- (event: "scroll", callback: import("lenis").ScrollCallback): () => void;
344
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): () => void;
345
- };
346
- off: {
347
- (event: "scroll", callback: import("lenis").ScrollCallback): void;
348
- (event: "virtual-scroll", callback: import("lenis").VirtualScrollCallback): void;
349
- };
350
- resize: () => void;
351
- start: () => void;
352
- stop: () => void;
353
- raf: (time: number) => void;
354
- scrollTo: (target: number | string | HTMLElement, { offset, immediate, lock, duration, easing, lerp, onStart, onComplete, force, programmatic, userData, }?: import("lenis").ScrollToOptions) => void;
355
- readonly rootElement: HTMLElement;
356
- readonly limit: number;
357
- readonly isHorizontal: boolean;
358
- readonly actualScroll: number;
359
- readonly scroll: number;
360
- readonly progress: number;
361
- isScrolling: import("lenis").Scrolling;
362
- isStopped: boolean;
363
- isLocked: boolean;
364
- readonly isSmooth: boolean;
365
- readonly className: string;
366
- } | null>;
367
- createInstance: (customOptions?: LenisOptions) => Lenis | null;
368
- destroy: () => void;
369
- };
370
- export {};
@@ -1,101 +0,0 @@
1
- import Lenis from "lenis";
2
- import { ScrollTrigger } from "gsap/ScrollTrigger";
3
- import { computed, onMounted, onUnmounted, isRef, ref } from "vue";
4
- import { useClientOnly, useGSAP, watch } from "#imports";
5
- const globalLenis = ref(null);
6
- const globalDestroy = () => {
7
- if (globalLenis.value) {
8
- globalLenis.value.destroy();
9
- globalLenis.value = null;
10
- }
11
- };
12
- export const useLenis = (wrapperOrOptions) => {
13
- const { isClient } = useClientOnly();
14
- const gsap = useGSAP();
15
- if (!wrapperOrOptions) {
16
- return {
17
- lenis: globalLenis,
18
- destroy: globalDestroy
19
- };
20
- }
21
- const lenis = ref(null);
22
- const options = computed(() => {
23
- if (!isClient.value) return {};
24
- if (typeof wrapperOrOptions === "string" || wrapperOrOptions instanceof HTMLElement) {
25
- return { wrapper: wrapperOrOptions };
26
- }
27
- if (isRef(wrapperOrOptions)) {
28
- return { wrapper: wrapperOrOptions.value };
29
- }
30
- return wrapperOrOptions || {};
31
- });
32
- const initLenis = (customOptions = {}) => {
33
- if (!isClient.value) return null;
34
- const currentOptions = options.value;
35
- if (currentOptions.wrapper === void 0) {
36
- return null;
37
- }
38
- const lenisOptions = {
39
- wrapper: window,
40
- // Default to window/body instead of #scroller
41
- ...currentOptions,
42
- ...customOptions
43
- };
44
- let wrapper = lenisOptions.wrapper;
45
- if (typeof wrapper === "string") {
46
- wrapper = document.querySelector(wrapper) || window;
47
- }
48
- const lenisInstance = new Lenis({
49
- ...lenisOptions,
50
- wrapper
51
- });
52
- lenisInstance.on("scroll", ScrollTrigger.update);
53
- gsap.ticker.add((time) => {
54
- lenisInstance.raf(time * 1e3);
55
- });
56
- gsap.ticker.lagSmoothing(0);
57
- return lenisInstance;
58
- };
59
- const createInstance = (customOptions = {}) => {
60
- const instance = initLenis(customOptions);
61
- if (!lenis.value) {
62
- lenis.value = instance;
63
- }
64
- return instance;
65
- };
66
- const destroy = () => {
67
- if (lenis.value) {
68
- lenis.value.destroy();
69
- lenis.value = null;
70
- }
71
- };
72
- watch(
73
- () => options.value.wrapper,
74
- (newWrapper) => {
75
- if (newWrapper && !lenis.value) {
76
- lenis.value = initLenis();
77
- if (newWrapper === "#scroller" || typeof newWrapper === "object" && newWrapper?.id === "scroller") {
78
- globalLenis.value = lenis.value;
79
- }
80
- }
81
- },
82
- { immediate: true }
83
- );
84
- onMounted(() => {
85
- if (!lenis.value) {
86
- lenis.value = initLenis();
87
- const currentWrapper = options.value.wrapper;
88
- if (currentWrapper === "#scroller" || typeof currentWrapper === "object" && currentWrapper?.id === "scroller") {
89
- globalLenis.value = lenis.value;
90
- }
91
- }
92
- });
93
- onUnmounted(() => {
94
- destroy();
95
- });
96
- return {
97
- lenis,
98
- createInstance,
99
- destroy
100
- };
101
- };
@@ -1,23 +0,0 @@
1
- import type { AsyncDataRequestStatus } from "#app";
2
- import type { KeysOf, PickFrom } from "#app/composables/asyncData";
3
- import type { SanityPage } from "@gluhar/sanity/types";
4
- interface Page extends SanityPage {
5
- _type: "page";
6
- }
7
- type PageTypeKeys = "page" | string;
8
- type PageInterfaces = Record<PageTypeKeys, Page | SanityPage>;
9
- type PageTypes<PI extends PageInterfaces> = Record<keyof PI, {
10
- query: string;
11
- slug: string;
12
- type?: string;
13
- }>;
14
- export declare const useSanityPage: <PI extends PageInterfaces = {
15
- page: Page;
16
- }, PT extends PageTypes<PI> = PageTypes<PI>>(types?: PT, slug?: string | string[]) => Promise<{
17
- page: import("vue").Ref<PickFrom<PI[Extract<keyof PT, string>], KeysOf<PI[Extract<keyof PT, string>]>> | null, PickFrom<PI[Extract<keyof PT, string>], KeysOf<PI[Extract<keyof PT, string>]>> | null>;
18
- status: import("vue").Ref<AsyncDataRequestStatus, AsyncDataRequestStatus>;
19
- } | {
20
- page: import("vue").Ref<Page | null, Page | null>;
21
- status: import("vue").Ref<AsyncDataRequestStatus, AsyncDataRequestStatus>;
22
- }>;
23
- export {};
@@ -1,60 +0,0 @@
1
- import {
2
- getCanonicalUrl,
3
- groq,
4
- useHead,
5
- useRoute,
6
- useSanityQueryWithPreview
7
- } from "#imports";
8
- import { imageWithAsset, linkWithPage } from "@gluhar/sanity/query";
9
- export const useSanityPage = async (types, slug) => {
10
- const route = useRoute();
11
- const s = slug ? slug : route.params.slug;
12
- const sl = Array.isArray(s) ? s : [s];
13
- if (types && sl.length > 1) {
14
- for (const type in types) {
15
- const options = types[type];
16
- if (sl[0] === options.slug) {
17
- const query2 = groq`
18
- *[_type == "${type}" && slug.current == "${sl[1]}"]{
19
- ${options.query}
20
- }[0]
21
- `;
22
- const { data: page2, status: status2 } = await useSanityQueryWithPreview(query2);
23
- useHead({
24
- link: [
25
- {
26
- rel: "canonical",
27
- href: getCanonicalUrl(page2?.value)
28
- }
29
- ]
30
- });
31
- return { page: page2, status: status2 };
32
- }
33
- }
34
- }
35
- const pageQuery = groq`
36
- ...,
37
- content[]{
38
- ...,
39
- _ref != null => @-> {
40
- ...,
41
- button{ ${linkWithPage} },
42
- thumbnail{ ${imageWithAsset} },
43
- image{ ${imageWithAsset} },
44
- images[]{ ${imageWithAsset} },
45
- bckg{ ${imageWithAsset} },
46
- }
47
- }
48
- `;
49
- const query = groq`
50
- *[_type == "page" && slug.current == "${sl[0] ? sl?.join("/") : "/"}"]{
51
- ${types?.page?.query ?? pageQuery}
52
- }[0]
53
- `;
54
- const { data: page, status } = await useSanityQueryWithPreview(query);
55
- if (page.value) page.value._type = "page";
56
- useHead({
57
- link: [{ rel: "canonical", href: getCanonicalUrl(page.value) }]
58
- });
59
- return { page, status };
60
- };
@@ -1,2 +0,0 @@
1
- import type { Seo } from "@gluhar/sanity/types";
2
- export declare const useSeo: (seo?: Seo) => void;
@@ -1,34 +0,0 @@
1
- import { useGStore } from "../stores/useGStore.js";
2
- import { useMessages } from "#imports";
3
- import {
4
- useSeoMeta,
5
- useServerSeoMeta
6
- } from "@unhead/vue";
7
- export const useSeo = (seo) => {
8
- const store = useGStore();
9
- const { l } = useMessages();
10
- const meta = {
11
- title: l(store.defaultSeo?.title),
12
- ogTitle: l(store.defaultSeo?.title),
13
- description: l(store.defaultSeo?.description),
14
- ogDescription: l(store.defaultSeo?.description),
15
- ogImage: store.defaultSeo?.ogImage?.asset?.url,
16
- twitterCard: "summary_large_image"
17
- };
18
- if (seo) {
19
- const { title, description, ogImage } = seo;
20
- if (title && l(title)) {
21
- meta.title = l(title);
22
- meta.ogTitle = l(title);
23
- }
24
- if (description && l(description)) {
25
- meta.description = l(description);
26
- meta.ogDescription = l(description);
27
- }
28
- if (ogImage && ogImage.asset?.url) {
29
- meta.ogImage = ogImage.asset?.url;
30
- }
31
- }
32
- useServerSeoMeta(meta);
33
- useSeoMeta(meta);
34
- };