vlite3 1.5.35 → 1.5.38
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.
- package/components/AppShell/useAppShell.js +34 -31
- package/components/Carousel/Carousel.vue.js +2 -2
- package/components/Carousel/Carousel2.vue.js +38 -31
- package/components/CategoryManager/CategoryManager2.vue.js +1 -1
- package/components/Form/{AccordionView2.vue.js → AccordionView.vue.js} +1 -1
- package/components/Form/index2.vue.js +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/directives/ScrollReveal/ScrollRevealContainer.d.ts +43 -0
- package/directives/ScrollReveal/ScrollRevealContainer.js +88 -0
- package/directives/ScrollReveal/ScrollRevealMotion.d.ts +16 -0
- package/directives/ScrollReveal/ScrollRevealMotion.js +91 -0
- package/directives/ScrollReveal/ScrollRevealOptions.d.ts +19 -0
- package/directives/ScrollReveal/ScrollRevealOptions.js +34 -0
- package/directives/ScrollReveal/ScrollRevealPager.d.ts +33 -0
- package/directives/ScrollReveal/ScrollRevealPager.js +239 -0
- package/directives/vScrollReveal.d.ts +5 -2
- package/directives/vScrollReveal.js +18 -47
- package/docs/ScrollRevealMigrationAudit.md +227 -0
- package/docs/component-index.md +4 -2
- package/docs/components/carousel.md +1 -1
- package/docs/components/scroll-reveal.md +178 -0
- package/docs-manifest.json +10 -4
- package/package.json +1 -3
- package/style.css +7 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as n, shallowRef as I, ref as
|
|
1
|
+
import { computed as n, shallowRef as I, ref as o, provide as L, watch as k, onMounted as Y, onUnmounted as _, nextTick as U } from "vue";
|
|
2
2
|
import { useRoute as V } from "vue-router";
|
|
3
3
|
import { useLocalStorage as W, useBreakpoints as F, breakpointsTailwind as K } from "@vueuse/core";
|
|
4
4
|
import { useBreadcrumb as q } from "../../composables/useBreadcrumb.js";
|
|
@@ -8,7 +8,7 @@ function ne(e, v) {
|
|
|
8
8
|
const O = e.breadcrumb ? q({
|
|
9
9
|
homeIcon: e.breadcrumbHomeIcon,
|
|
10
10
|
labelMap: e.breadcrumbLabels || {}
|
|
11
|
-
}) : { items: n(() => []) }, f = I([]), u =
|
|
11
|
+
}) : { items: n(() => []) }, f = I([]), u = o("");
|
|
12
12
|
L("navbar-context", {
|
|
13
13
|
compact: n(() => e.compact),
|
|
14
14
|
renderNestedTabs: n(() => e.renderNestedTabs),
|
|
@@ -16,30 +16,33 @@ function ne(e, v) {
|
|
|
16
16
|
f.value = l, u.value = i;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const b =
|
|
19
|
+
const b = o(!1), w = o(null), x = o(null), H = n(
|
|
20
20
|
() => (e.breakpointSource ?? "viewport") === "container" ? "@container" : ""
|
|
21
21
|
);
|
|
22
|
-
k(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
k(
|
|
23
|
+
[w, () => e.breakpointSource ?? "viewport"],
|
|
24
|
+
([l, i], t, d) => {
|
|
25
|
+
if (i !== "container" || !l) {
|
|
26
|
+
x.value = null;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const r = new ResizeObserver((a) => {
|
|
30
|
+
x.value = a[0]?.contentRect.width ?? 0;
|
|
31
|
+
});
|
|
32
|
+
r.observe(l), d(() => r.disconnect());
|
|
26
33
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
o.observe(l), t(() => o.disconnect());
|
|
31
|
-
});
|
|
32
|
-
const x = d(!1), r = d(null), h = d(null), j = G(), y = n(() => j.value), R = n(
|
|
34
|
+
);
|
|
35
|
+
const c = o(!1), s = o(null), h = o(null), j = G(), y = n(() => j.value), R = n(
|
|
33
36
|
() => y.value ? "opacity-0 translate-x-2" : "opacity-0 -translate-x-2"
|
|
34
|
-
),
|
|
35
|
-
|
|
36
|
-
}, B = n(() => e.hideSidebar || $.value && !
|
|
37
|
+
), m = W("vlite-appshell-sidebar-visible", !0), $ = n(() => e.sidebarToggle && v), E = () => {
|
|
38
|
+
m.value = !m.value;
|
|
39
|
+
}, B = n(() => e.hideSidebar || $.value && !m.value), M = (l) => {
|
|
37
40
|
f.value.find((t) => t.value === l) && (typeof l == "string" && l.startsWith("/") ? import("vue-router").then(({ useRouter: t }) => {
|
|
38
41
|
t().push(l).catch(() => {
|
|
39
42
|
});
|
|
40
43
|
}) : u.value = l);
|
|
41
44
|
}, S = () => {
|
|
42
|
-
|
|
45
|
+
c.value = window.scrollY > 10;
|
|
43
46
|
};
|
|
44
47
|
Y(() => {
|
|
45
48
|
window.addEventListener("scroll", S, { passive: !0 });
|
|
@@ -47,7 +50,7 @@ function ne(e, v) {
|
|
|
47
50
|
window.removeEventListener("scroll", S);
|
|
48
51
|
});
|
|
49
52
|
const p = n(() => {
|
|
50
|
-
const l = e.mobileBreakpoint || "md", i = e.compact ? "w-20" : "", t = (e.breakpointSource ?? "viewport") === "container",
|
|
53
|
+
const l = e.mobileBreakpoint || "md", i = e.compact ? "w-20" : "", t = (e.breakpointSource ?? "viewport") === "container", d = {
|
|
51
54
|
sm: {
|
|
52
55
|
mobileTrigger: "sm:hidden",
|
|
53
56
|
desktopContent: "hidden sm:flex",
|
|
@@ -84,7 +87,7 @@ function ne(e, v) {
|
|
|
84
87
|
desktopOnly: "hidden xl:flex",
|
|
85
88
|
mobileSidebar: "max-xl:hidden"
|
|
86
89
|
}
|
|
87
|
-
},
|
|
90
|
+
}, r = {
|
|
88
91
|
sm: {
|
|
89
92
|
mobileTrigger: "@min-[640px]:hidden",
|
|
90
93
|
desktopContent: "hidden @min-[640px]:flex",
|
|
@@ -122,21 +125,21 @@ function ne(e, v) {
|
|
|
122
125
|
mobileSidebar: "@max-[1279px]:hidden"
|
|
123
126
|
}
|
|
124
127
|
};
|
|
125
|
-
return (t ?
|
|
128
|
+
return (t ? r : d)[l];
|
|
126
129
|
}), z = n(() => {
|
|
127
130
|
const l = e.variant === "sidebar", i = {
|
|
128
131
|
fixed: "relative z-40",
|
|
129
132
|
sticky: "relative z-40",
|
|
130
133
|
relative: "relative z-10",
|
|
131
134
|
absolute: "relative z-40"
|
|
132
|
-
}, t = "bg-body",
|
|
133
|
-
e.glass && (
|
|
135
|
+
}, t = "bg-body", d = [
|
|
136
|
+
e.glass && (c.value || l || e.floating) ? "bg-background/95" : "bg-background",
|
|
134
137
|
e.border && !e.floating ? l ? "border-e border-border" : "border-b border-border" : "",
|
|
135
138
|
e.floating ? "m-4 rounded shadow-lg border border-border/50" : "",
|
|
136
|
-
|
|
137
|
-
],
|
|
138
|
-
let
|
|
139
|
-
return l ?
|
|
139
|
+
c.value && !e.floating && !l && e.position === "sticky" ? "shadow-sm" : ""
|
|
140
|
+
], r = l ? p.value.mobileSidebar : "";
|
|
141
|
+
let a = "";
|
|
142
|
+
return l ? a = p.value.sidebarLayout : (e.breakpointSource ?? "viewport") === "container" ? a = `flex items-center gap-4 w-full px-4 @min-[640px]:px-6 @min-[1024px]:px-8 ${e.height}` : a = `flex items-center gap-4 w-full px-4 sm:px-6 lg:px-8 ${e.height}`, [t, i[e.position], ...d, a, r, e.class].filter(Boolean).join(" ");
|
|
140
143
|
}), N = n(() => {
|
|
141
144
|
if (e.variant === "sidebar")
|
|
142
145
|
return "flex-1 py-4 overflow-y-auto scrollbar-thin scrollbar-stable";
|
|
@@ -147,11 +150,11 @@ function ne(e, v) {
|
|
|
147
150
|
() => g.path,
|
|
148
151
|
() => {
|
|
149
152
|
b.value = !1, U(() => {
|
|
150
|
-
|
|
153
|
+
s.value && (s.value.scrollTop = 0, s.value.firstElementChild && (s.value.firstElementChild.scrollTop = 0)), h.value && (h.value.scrollTop = 0);
|
|
151
154
|
});
|
|
152
155
|
}
|
|
153
156
|
);
|
|
154
|
-
const P = { sm: 640, md: 768, lg: 1024, xl: 1280 }, A = F(K).greater(e.mobileBreakpoint), T = n(() => (e.breakpointSource ?? "viewport") !== "container" ? A.value :
|
|
157
|
+
const P = { sm: 640, md: 768, lg: 1024, xl: 1280 }, A = F(K).greater(e.mobileBreakpoint), T = n(() => (e.breakpointSource ?? "viewport") !== "container" ? A.value : x.value == null ? null : x.value >= P[e.mobileBreakpoint || "md"]);
|
|
155
158
|
k(T, (l) => {
|
|
156
159
|
l && (b.value = !1);
|
|
157
160
|
});
|
|
@@ -159,16 +162,16 @@ function ne(e, v) {
|
|
|
159
162
|
props: e,
|
|
160
163
|
isLayoutMode: v,
|
|
161
164
|
isMobileMenuOpen: b,
|
|
162
|
-
isSidebarVisible:
|
|
165
|
+
isSidebarVisible: m,
|
|
163
166
|
sidebarHidden: B,
|
|
164
167
|
isDesktop: T,
|
|
165
168
|
shellRef: w,
|
|
166
169
|
shellClass: H,
|
|
167
170
|
pageTitle: D,
|
|
168
|
-
isScrolled:
|
|
171
|
+
isScrolled: c,
|
|
169
172
|
isRtl: y,
|
|
170
173
|
sidebarSlideFromClass: R,
|
|
171
|
-
mainScrollRef:
|
|
174
|
+
mainScrollRef: s,
|
|
172
175
|
layoutMainRef: h,
|
|
173
176
|
toggleSidebar: E,
|
|
174
177
|
handleNestedTabClick: M,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Carousel2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-a6f69bd0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as x, shallowRef as w, computed as o, openBlock as T, createElementBlock as b, createVNode as N, unref as C, mergeProps as z, createSlots as K, renderList as _, withCtx as k, renderSlot as G, normalizeProps as R, guardReactiveProps as E } from "vue";
|
|
2
2
|
import I from "vue-carousel-lite";
|
|
3
3
|
import "vue-carousel-lite/style.css";
|
|
4
|
-
const
|
|
4
|
+
const L = /* @__PURE__ */ x({
|
|
5
5
|
__name: "Carousel",
|
|
6
6
|
props: {
|
|
7
7
|
data: { default: () => [] },
|
|
@@ -37,48 +37,55 @@ const V = { class: "carousel-wrapper" }, $ = /* @__PURE__ */ S({
|
|
|
37
37
|
updateKey: { default: void 0 }
|
|
38
38
|
},
|
|
39
39
|
emits: ["slide-change"],
|
|
40
|
-
setup(
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
setup(s, { expose: u, emit: i }) {
|
|
41
|
+
const l = s;
|
|
42
|
+
function d(e) {
|
|
43
|
+
(e.ctrlKey || e.metaKey || e.altKey || e.shiftKey || l.direction === "horizontal" && Math.abs(e.deltaY) >= Math.abs(e.deltaX)) && e.stopPropagation();
|
|
44
|
+
}
|
|
45
|
+
const f = i, t = w(null), p = (e, a) => {
|
|
46
|
+
t.value?.goToSlide(e, a);
|
|
45
47
|
}, c = (e) => {
|
|
46
|
-
t.value?.
|
|
48
|
+
t.value?.goNext(e);
|
|
47
49
|
}, g = (e) => {
|
|
48
|
-
t.value?.
|
|
50
|
+
t.value?.goPrev(e);
|
|
49
51
|
}, m = (e) => {
|
|
52
|
+
t.value?.goNextPage(e);
|
|
53
|
+
}, h = (e) => {
|
|
50
54
|
t.value?.goPrevPage(e);
|
|
51
|
-
},
|
|
55
|
+
}, y = () => {
|
|
52
56
|
t.value?.focus?.();
|
|
53
|
-
},
|
|
54
|
-
return
|
|
55
|
-
goToSlide:
|
|
56
|
-
goNext:
|
|
57
|
-
goPrev:
|
|
58
|
-
goNextPage:
|
|
59
|
-
goPrevPage:
|
|
60
|
-
focus:
|
|
61
|
-
state:
|
|
57
|
+
}, v = o(() => t.value?.state), P = o(() => t.value?.canGoNext ?? !0), B = o(() => t.value?.canGoPrev ?? !1);
|
|
58
|
+
return u({
|
|
59
|
+
goToSlide: p,
|
|
60
|
+
goNext: c,
|
|
61
|
+
goPrev: g,
|
|
62
|
+
goNextPage: m,
|
|
63
|
+
goPrevPage: h,
|
|
64
|
+
focus: y,
|
|
65
|
+
state: v,
|
|
62
66
|
canGoNext: P,
|
|
63
|
-
canGoPrev:
|
|
64
|
-
}), (e,
|
|
65
|
-
|
|
67
|
+
canGoPrev: B
|
|
68
|
+
}), (e, a) => (T(), b("div", {
|
|
69
|
+
class: "carousel-wrapper",
|
|
70
|
+
onWheelCapture: d
|
|
71
|
+
}, [
|
|
72
|
+
N(C(I), z({
|
|
66
73
|
ref_key: "carouselRef",
|
|
67
74
|
ref: t
|
|
68
|
-
},
|
|
75
|
+
}, l, {
|
|
69
76
|
style: { height: "100%", width: "100%" },
|
|
70
|
-
onSlideChange:
|
|
71
|
-
}),
|
|
72
|
-
|
|
73
|
-
name:
|
|
74
|
-
fn:
|
|
75
|
-
G(e.$slots,
|
|
77
|
+
onSlideChange: a[0] || (a[0] = (n) => f("slide-change", n))
|
|
78
|
+
}), K({ _: 2 }, [
|
|
79
|
+
_(e.$slots, (n, r) => ({
|
|
80
|
+
name: r,
|
|
81
|
+
fn: k((S) => [
|
|
82
|
+
G(e.$slots, r, R(E(S || {})), void 0, !0)
|
|
76
83
|
])
|
|
77
84
|
}))
|
|
78
85
|
]), 1040)
|
|
79
|
-
]));
|
|
86
|
+
], 32));
|
|
80
87
|
}
|
|
81
88
|
});
|
|
82
89
|
export {
|
|
83
|
-
|
|
90
|
+
L as default
|
|
84
91
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as g, computed as d, openBlock as n, createElementBlock as R, createElementVNode as x, createBlock as s, withCtx as k, createTextVNode as B, toDisplayString as I, createCommentVNode as y, unref as l } from "vue";
|
|
2
2
|
import T from "./TableView.vue.js";
|
|
3
|
-
import C from "./
|
|
3
|
+
import C from "./AccordionView.vue.js";
|
|
4
4
|
import U from "../Label.vue.js";
|
|
5
5
|
import z from "../Button.vue.js";
|
|
6
6
|
import { useCustomFieldRows as N } from "./composables/useCustomFieldRows.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ScrollRevealOptions } from './ScrollRevealOptions';
|
|
2
|
+
type Registration = {
|
|
3
|
+
snap: boolean;
|
|
4
|
+
options: Required<ScrollRevealOptions>;
|
|
5
|
+
};
|
|
6
|
+
export interface ScrollRevealContext {
|
|
7
|
+
container: HTMLElement;
|
|
8
|
+
documentRoot: boolean;
|
|
9
|
+
reducedMotion: MediaQueryList;
|
|
10
|
+
finePointer: MediaQueryList;
|
|
11
|
+
position: () => number;
|
|
12
|
+
limit: () => number;
|
|
13
|
+
padding: () => number;
|
|
14
|
+
viewport: () => {
|
|
15
|
+
top: number;
|
|
16
|
+
bottom: number;
|
|
17
|
+
};
|
|
18
|
+
write: (position: number) => void;
|
|
19
|
+
canReveal: () => boolean;
|
|
20
|
+
syncNavigation: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function resolveScrollRevealContainer(element: HTMLElement): HTMLElement;
|
|
23
|
+
export declare function getScrollRevealContainer(element: HTMLElement): ScrollRevealContainer;
|
|
24
|
+
/** One lifetime, resource policy and pair of internal engines per actual scroller. */
|
|
25
|
+
export declare class ScrollRevealContainer {
|
|
26
|
+
readonly context: ScrollRevealContext;
|
|
27
|
+
private registrations;
|
|
28
|
+
private motion;
|
|
29
|
+
private pager;
|
|
30
|
+
private lifetime;
|
|
31
|
+
private suppressRevealUntil;
|
|
32
|
+
private href;
|
|
33
|
+
constructor(container: HTMLElement);
|
|
34
|
+
register(element: HTMLElement, registration: Registration): void;
|
|
35
|
+
unregister(element: HTMLElement): void;
|
|
36
|
+
private onChange;
|
|
37
|
+
private syncNavigation;
|
|
38
|
+
private onNavigation;
|
|
39
|
+
private onFocus;
|
|
40
|
+
private showHash;
|
|
41
|
+
private onClick;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ScrollRevealMotion as g } from "./ScrollRevealMotion.js";
|
|
2
|
+
import { ScrollRevealPager as p } from "./ScrollRevealPager.js";
|
|
3
|
+
import { sameScrollReveal as u } from "./ScrollRevealOptions.js";
|
|
4
|
+
const l = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function m(r) {
|
|
6
|
+
for (let e = r.parentElement; e && e !== document.body && e !== document.documentElement; e = e.parentElement)
|
|
7
|
+
if (/^(auto|scroll|overlay)$/.test(getComputedStyle(e).overflowY) && e.scrollHeight > e.clientHeight) return e;
|
|
8
|
+
return document.scrollingElement || document.documentElement;
|
|
9
|
+
}
|
|
10
|
+
function E(r) {
|
|
11
|
+
const e = m(r);
|
|
12
|
+
let t = l.get(e);
|
|
13
|
+
return t || (t = new f(e), l.set(e, t)), t;
|
|
14
|
+
}
|
|
15
|
+
class f {
|
|
16
|
+
context;
|
|
17
|
+
registrations = /* @__PURE__ */ new Map();
|
|
18
|
+
motion;
|
|
19
|
+
pager;
|
|
20
|
+
lifetime = new AbortController();
|
|
21
|
+
suppressRevealUntil = 0;
|
|
22
|
+
href = window.location.href;
|
|
23
|
+
constructor(e) {
|
|
24
|
+
const t = e === document.scrollingElement || e === document.documentElement, o = window.matchMedia("(prefers-reduced-motion: reduce)"), d = window.matchMedia("(hover: hover) and (pointer: fine)"), s = navigator, h = s.connection, c = () => {
|
|
25
|
+
if (t) return { top: 0, bottom: window.innerHeight };
|
|
26
|
+
const i = e.getBoundingClientRect().top + e.clientTop;
|
|
27
|
+
return { top: i, bottom: i + e.clientHeight };
|
|
28
|
+
};
|
|
29
|
+
this.context = {
|
|
30
|
+
container: e,
|
|
31
|
+
documentRoot: t,
|
|
32
|
+
reducedMotion: o,
|
|
33
|
+
finePointer: d,
|
|
34
|
+
viewport: c,
|
|
35
|
+
syncNavigation: this.syncNavigation,
|
|
36
|
+
position: () => e.scrollTop,
|
|
37
|
+
limit: () => Math.max(0, e.scrollHeight - (t ? window.innerHeight : e.clientHeight)),
|
|
38
|
+
padding: () => {
|
|
39
|
+
const i = getComputedStyle(e).scrollPaddingTop;
|
|
40
|
+
return i.endsWith("%") ? parseFloat(i) / 100 * (c().bottom - c().top) : parseFloat(i) || 0;
|
|
41
|
+
},
|
|
42
|
+
write: (i) => e.scrollTo({ top: i, behavior: "instant" }),
|
|
43
|
+
canReveal: () => performance.now() >= this.suppressRevealUntil && !o.matches && !document.hidden && !h?.saveData && !/^(slow-)?2g$/.test(h?.effectiveType ?? "") && !(s.hardwareConcurrency > 0 && s.hardwareConcurrency <= 4) && !(s.deviceMemory !== void 0 && s.deviceMemory <= 4)
|
|
44
|
+
}, this.motion = new g(this.context), this.pager = new p(this.context);
|
|
45
|
+
const n = { signal: this.lifetime.signal }, a = t ? document : e;
|
|
46
|
+
a.addEventListener("focusin", this.onFocus, n), a.addEventListener("click", this.onClick, { ...n, capture: !0 }), a.addEventListener("pointerdown", this.pager.reset, { ...n, capture: !0 }), a.addEventListener("touchstart", this.pager.reset, { ...n, capture: !0, passive: !0 });
|
|
47
|
+
for (const i of ["hashchange", "popstate", "pageshow", "pagehide"]) window.addEventListener(i, this.onNavigation, n);
|
|
48
|
+
window.addEventListener("resize", this.onChange, n), window.addEventListener("blur", this.onChange, n), document.addEventListener("visibilitychange", this.onChange, n), o.addEventListener("change", this.onChange, n), d.addEventListener("change", this.onChange, n), h?.addEventListener("change", this.onChange, n);
|
|
49
|
+
}
|
|
50
|
+
register(e, t) {
|
|
51
|
+
this.syncNavigation();
|
|
52
|
+
const o = this.registrations.get(e);
|
|
53
|
+
o && o.snap === t.snap && u(o.options, t.options) || (o?.snap !== t.snap && (o?.snap ? this.pager.unregister(e) : o && this.motion.unregister(e)), this.registrations.set(e, t), t.snap ? o?.snap || this.pager.register(e) : this.motion.register(e, t.options), this.showHash());
|
|
54
|
+
}
|
|
55
|
+
unregister(e) {
|
|
56
|
+
const t = this.registrations.get(e);
|
|
57
|
+
t && (t.snap ? this.pager.unregister(e) : this.motion.unregister(e), this.registrations.delete(e), this.pager.reset(), !this.registrations.size && (this.lifetime.abort(), this.motion.destroy(), this.pager.destroy(), l.delete(this.context.container)));
|
|
58
|
+
}
|
|
59
|
+
onChange = () => {
|
|
60
|
+
this.pager.reset(), this.motion.refresh();
|
|
61
|
+
};
|
|
62
|
+
syncNavigation = () => {
|
|
63
|
+
this.href !== window.location.href && this.onNavigation();
|
|
64
|
+
};
|
|
65
|
+
onNavigation = () => {
|
|
66
|
+
this.href = window.location.href, this.suppressRevealUntil = performance.now() + 500, this.onChange(), this.showHash();
|
|
67
|
+
};
|
|
68
|
+
onFocus = (e) => {
|
|
69
|
+
this.pager.reset(), e.target instanceof Node && this.motion.show(e.target);
|
|
70
|
+
};
|
|
71
|
+
showHash(e = window.location.hash) {
|
|
72
|
+
if (!(!e || e === "#"))
|
|
73
|
+
try {
|
|
74
|
+
const t = document.getElementById(decodeURIComponent(e.slice(1)));
|
|
75
|
+
t && this.motion.show(t, !0);
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
onClick = (e) => {
|
|
80
|
+
const t = e.composedPath().find((o) => o instanceof HTMLAnchorElement);
|
|
81
|
+
!t || t.origin !== location.origin || t.pathname !== location.pathname || t.search !== location.search || !t.hash || (this.pager.reset(), this.showHash(t.hash));
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
f as ScrollRevealContainer,
|
|
86
|
+
E as getScrollRevealContainer,
|
|
87
|
+
m as resolveScrollRevealContainer
|
|
88
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ScrollRevealContext } from './ScrollRevealContainer';
|
|
2
|
+
import { ScrollRevealOptions } from './ScrollRevealOptions';
|
|
3
|
+
/** Visible DOM is the resting state; only an entering element receives keyframes. */
|
|
4
|
+
export declare class ScrollRevealMotion {
|
|
5
|
+
private records;
|
|
6
|
+
private observer?;
|
|
7
|
+
private context;
|
|
8
|
+
constructor(context: ScrollRevealContext);
|
|
9
|
+
register(element: HTMLElement, options: Required<ScrollRevealOptions>): void;
|
|
10
|
+
unregister(element: HTMLElement): void;
|
|
11
|
+
private cancel;
|
|
12
|
+
show(target: Node, descendants?: boolean): void;
|
|
13
|
+
refresh(): void;
|
|
14
|
+
private onEntries;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
class R {
|
|
2
|
+
records = /* @__PURE__ */ new Map();
|
|
3
|
+
observer;
|
|
4
|
+
context;
|
|
5
|
+
constructor(e) {
|
|
6
|
+
this.context = e, !(typeof IntersectionObserver > "u" || typeof Element.prototype.animate != "function") && (this.observer = new IntersectionObserver(this.onEntries, {
|
|
7
|
+
root: e.documentRoot ? null : e.container,
|
|
8
|
+
threshold: Array.from({ length: 101 }, (s, t) => t / 100)
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
register(e, s) {
|
|
12
|
+
const t = this.records.get(e);
|
|
13
|
+
this.cancel(t);
|
|
14
|
+
const o = e.getBoundingClientRect(), i = this.context.viewport(), n = t?.seen ?? o.top < i.bottom;
|
|
15
|
+
this.records.set(e, { options: s, seen: n, entered: t?.entered ?? !!n }), this.observer && (s.reset || !n) ? this.observer.observe(e) : this.observer?.unobserve(e);
|
|
16
|
+
}
|
|
17
|
+
unregister(e) {
|
|
18
|
+
this.cancel(this.records.get(e)), this.records.delete(e), this.observer?.unobserve(e);
|
|
19
|
+
}
|
|
20
|
+
cancel(e) {
|
|
21
|
+
const s = e?.animation;
|
|
22
|
+
s && (s.onfinish = s.oncancel = null, s.cancel(), e.animation = void 0);
|
|
23
|
+
}
|
|
24
|
+
show(e, s = !1) {
|
|
25
|
+
for (const [t, o] of this.records)
|
|
26
|
+
(t.contains(e) || s && e.contains(t)) && (this.cancel(o), o.seen = o.entered = !0, o.options.reset || this.observer?.unobserve(t));
|
|
27
|
+
}
|
|
28
|
+
refresh() {
|
|
29
|
+
const e = this.context.viewport();
|
|
30
|
+
for (const [s, t] of this.records) {
|
|
31
|
+
this.cancel(t);
|
|
32
|
+
const o = s.getBoundingClientRect();
|
|
33
|
+
o.bottom > e.top && o.top < e.bottom || !t.options.reset && o.top < e.bottom ? (t.seen = t.entered = !0, t.options.reset || this.observer?.unobserve(s)) : t.options.reset && (t.seen = !1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onEntries = (e) => {
|
|
37
|
+
let s = 0;
|
|
38
|
+
for (const t of e) {
|
|
39
|
+
const o = t.target, i = this.records.get(o);
|
|
40
|
+
if (!i || !o.isConnected) continue;
|
|
41
|
+
const { options: n } = i;
|
|
42
|
+
if (!t.isIntersecting) {
|
|
43
|
+
n.reset && !i.animation && (i.seen = !1);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const c = t.rootBounds, g = c && t.boundingClientRect.height > 0 && t.boundingClientRect.width > 0 ? Math.min(1, c.height / t.boundingClientRect.height) * Math.min(1, c.width / t.boundingClientRect.width) : 1;
|
|
47
|
+
if (i.seen || t.intersectionRatio + 0.01 < Math.min(n.viewFactor, g)) continue;
|
|
48
|
+
i.seen = !0;
|
|
49
|
+
const l = i.entered;
|
|
50
|
+
i.entered = !0, n.reset || this.observer?.unobserve(o);
|
|
51
|
+
const b = this.context.viewport();
|
|
52
|
+
if (!this.context.canReveal() || !n.mobile && !this.context.finePointer.matches || t.boundingClientRect.top < b.top && !(n.reset && l) || o.contains(document.activeElement)) continue;
|
|
53
|
+
const d = Array.from(o.querySelectorAll("img"));
|
|
54
|
+
o instanceof HTMLImageElement && d.push(o);
|
|
55
|
+
let h = !0;
|
|
56
|
+
for (const r of d)
|
|
57
|
+
(!r.complete || r.naturalWidth === 0) && (h = !1, r.loading = "eager", r.decode?.().catch(() => {
|
|
58
|
+
}));
|
|
59
|
+
if (!h) continue;
|
|
60
|
+
const p = n.useDelay === "always" || n.useDelay === "once" && !l || n.useDelay === "onload" && document.readyState !== "complete" ? n.delay : 0, f = n.origin === "left" || n.origin === "top" ? `calc(-1 * ${n.distance})` : n.distance, y = n.origin === "left" || n.origin === "right" ? `translateX(${f})` : `translateY(${f})`, a = getComputedStyle(o), u = a.transform === "none" ? "" : a.transform;
|
|
61
|
+
try {
|
|
62
|
+
this.cancel(i);
|
|
63
|
+
const r = o.animate([
|
|
64
|
+
{ opacity: n.opacity, transform: `${u} ${y} scale(${n.scale === 0 ? 2e-4 : n.scale})` },
|
|
65
|
+
{ opacity: a.opacity, transform: u || "none" }
|
|
66
|
+
], {
|
|
67
|
+
duration: n.duration,
|
|
68
|
+
delay: Math.min(1e3, p + s++ * n.interval),
|
|
69
|
+
easing: n.easing,
|
|
70
|
+
fill: "backwards"
|
|
71
|
+
});
|
|
72
|
+
i.animation = r, r.onfinish = r.oncancel = () => {
|
|
73
|
+
if (i.animation === r) {
|
|
74
|
+
if (r.onfinish = r.oncancel = null, i.animation = void 0, n.reset) {
|
|
75
|
+
const m = o.getBoundingClientRect(), v = this.context.viewport();
|
|
76
|
+
(m.bottom <= v.top || m.top >= v.bottom) && (i.seen = !1);
|
|
77
|
+
}
|
|
78
|
+
n.cleanup && r.cancel();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
destroy() {
|
|
86
|
+
this.observer?.disconnect(), this.records.forEach((e) => this.cancel(e)), this.records.clear();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
R as ScrollRevealMotion
|
|
91
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Native, serializable reveal options. Invalid values fall back to defaults. */
|
|
2
|
+
export interface ScrollRevealOptions {
|
|
3
|
+
distance?: string;
|
|
4
|
+
duration?: number;
|
|
5
|
+
delay?: number;
|
|
6
|
+
easing?: string;
|
|
7
|
+
origin?: 'top' | 'right' | 'bottom' | 'left';
|
|
8
|
+
opacity?: number;
|
|
9
|
+
scale?: number;
|
|
10
|
+
reset?: boolean;
|
|
11
|
+
viewFactor?: number;
|
|
12
|
+
mobile?: boolean;
|
|
13
|
+
cleanup?: boolean;
|
|
14
|
+
useDelay?: 'always' | 'once' | 'onload';
|
|
15
|
+
interval?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const scrollRevealDefaults: Required<ScrollRevealOptions>;
|
|
18
|
+
export declare function normalizeScrollReveal(value: unknown): Required<ScrollRevealOptions>;
|
|
19
|
+
export declare function sameScrollReveal(a: Required<ScrollRevealOptions>, b: Required<ScrollRevealOptions>): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const a = {
|
|
2
|
+
distance: "50px",
|
|
3
|
+
duration: 800,
|
|
4
|
+
delay: 200,
|
|
5
|
+
easing: "cubic-bezier(0.5, 0, 0, 1)",
|
|
6
|
+
origin: "bottom",
|
|
7
|
+
opacity: 0,
|
|
8
|
+
scale: 1,
|
|
9
|
+
reset: !1,
|
|
10
|
+
viewFactor: 0,
|
|
11
|
+
mobile: !0,
|
|
12
|
+
cleanup: !1,
|
|
13
|
+
useDelay: "always",
|
|
14
|
+
interval: 0
|
|
15
|
+
};
|
|
16
|
+
function s(i) {
|
|
17
|
+
const e = i && typeof i == "object" ? i : {}, t = { ...a };
|
|
18
|
+
for (const o of ["duration", "delay", "interval", "scale", "opacity", "viewFactor"]) {
|
|
19
|
+
const n = e[o];
|
|
20
|
+
typeof n == "number" && Number.isFinite(n) && n >= 0 && (t[o] = o === "opacity" || o === "viewFactor" ? Math.min(1, n) : n);
|
|
21
|
+
}
|
|
22
|
+
t.viewFactor = Math.round(t.viewFactor * 100) / 100;
|
|
23
|
+
for (const o of ["reset", "mobile", "cleanup"])
|
|
24
|
+
typeof e[o] == "boolean" && (t[o] = e[o]);
|
|
25
|
+
return ["top", "right", "bottom", "left"].includes(e.origin) && (t.origin = e.origin), ["always", "once", "onload"].includes(e.useDelay) && (t.useDelay = e.useDelay), typeof e.distance == "string" && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("transform", `translateX(${e.distance})`) && (t.distance = e.distance), typeof e.easing == "string" && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("animation-timing-function", e.easing) && (t.easing = e.easing), t;
|
|
26
|
+
}
|
|
27
|
+
function r(i, e) {
|
|
28
|
+
return Object.keys(a).every((t) => i[t] === e[t]);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
s as normalizeScrollReveal,
|
|
32
|
+
r as sameScrollReveal,
|
|
33
|
+
a as scrollRevealDefaults
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ScrollRevealContext } from './ScrollRevealContainer';
|
|
2
|
+
/** Paging owns only registered stops and one cancellable scroll-position animation. */
|
|
3
|
+
export declare class ScrollRevealPager {
|
|
4
|
+
private sections;
|
|
5
|
+
private desktop;
|
|
6
|
+
private listeners?;
|
|
7
|
+
private movement?;
|
|
8
|
+
private lastWheel;
|
|
9
|
+
private direction;
|
|
10
|
+
private distance;
|
|
11
|
+
private consumed;
|
|
12
|
+
private readingElement?;
|
|
13
|
+
private context;
|
|
14
|
+
constructor(context: ScrollRevealContext);
|
|
15
|
+
register(element: HTMLElement): void;
|
|
16
|
+
unregister(element: HTMLElement): void;
|
|
17
|
+
private configure;
|
|
18
|
+
reset: () => void;
|
|
19
|
+
private cancel;
|
|
20
|
+
private geometry;
|
|
21
|
+
private measureSection;
|
|
22
|
+
private measure;
|
|
23
|
+
private hasPagingStops;
|
|
24
|
+
private readWheel;
|
|
25
|
+
/** Child scroll owners win, including at a contained overscroll boundary. */
|
|
26
|
+
private nestedOwns;
|
|
27
|
+
private enabled;
|
|
28
|
+
private destination;
|
|
29
|
+
private move;
|
|
30
|
+
private onWheel;
|
|
31
|
+
private onKeydown;
|
|
32
|
+
destroy(): void;
|
|
33
|
+
}
|