@fynd-design-engineering/fynd-one-v2 3.4.61 → 3.4.63
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/dist/accordians/dropdown.js +95 -1
- package/dist/accordians/index.js +391 -1
- package/dist/cms-listing/index.js +24 -1
- package/dist/filters/clear-search.js +32 -1
- package/dist/filters/konnect.js +165 -1
- package/dist/filters/show-count.js +66 -1
- package/dist/form/country-dropdown.css +160 -1
- package/dist/form/cs-gated-redirection.js +40 -1
- package/dist/form/download-file.js +70 -1
- package/dist/form/validation.css +1019 -1
- package/dist/form/validation.js +10611 -7
- package/dist/global/anchor-scroll.js +174 -1
- package/dist/global/auth.js +87 -1
- package/dist/global/chat.js +185 -1
- package/dist/global/console-links.js +89 -1
- package/dist/global/contact-popup.js +83 -2
- package/dist/global/css/in-page-embed.css +1043 -1
- package/dist/global/css/in-project-settings.css +173 -1
- package/dist/global/css/temp.css +89 -1
- package/dist/global/custom-bg-video.js +40 -1
- package/dist/global/footer-accordion.js +44 -1
- package/dist/global/lazy-loader.js +135 -1
- package/dist/global/loader.js +166 -2
- package/dist/global/media-card.js +166 -1
- package/dist/global/miscellaneous.js +136 -1
- package/dist/global/number-count.js +82 -1
- package/dist/global/popup-video.js +276 -1
- package/dist/global/progressive-scroll.js +222 -1
- package/dist/global/responsive-video.js +321 -1
- package/dist/global/style.css +1065 -1
- package/dist/global/video-card.js +50 -1
- package/dist/hacktimus/2025.js +177 -1
- package/dist/hacktimus/styles.css +91 -1
- package/dist/home/index.js +17 -1
- package/dist/marquee/index.js +3104 -1
- package/dist/marquee/marquee-swiper.js +36 -1
- package/dist/navigation/announcement/index.js +5169 -1
- package/dist/navigation/context-menu/index.js +31 -1
- package/dist/navigation/desktop/index.js +4603 -1
- package/dist/navigation/initialization.js +602 -1
- package/dist/navigation/main.js +4911 -1
- package/dist/navigation/mobile/index.js +286 -1
- package/dist/navigation/scroll/index.js +62 -1
- package/dist/navigation/secondary-navigation/index.js +437 -1
- package/dist/navigation/style.css +154 -1
- package/dist/navigation/temp.css +2 -0
- package/dist/navigation/theme.css +69 -1
- package/dist/navigation-v2/index.js +4990 -1
- package/dist/navigation-v2/styles.css +233 -1
- package/dist/others/feature-detail.js +75 -0
- package/dist/others/feature-detail.js.map +7 -0
- package/dist/others/geolocation.js +50 -1
- package/dist/others/hero-aniamtion.js +53 -1
- package/dist/others/hero-india-animation-2.js +70 -1
- package/dist/others/hero-india-animation.js +93 -1
- package/dist/others/home-solution-tab.js +115 -1
- package/dist/others/storefront-chat/index.js +487 -1
- package/dist/others/storefront-chat/styles.css +107 -1
- package/dist/playbook-2026/hero-reveal.js +47 -1
- package/dist/playbook-2026/index.js +536 -1
- package/dist/playbook-2026/styles.css +110 -1
- package/dist/posthog-and-ga/attributes.js +190 -1
- package/dist/posthog-and-ga/main.js +528 -1
- package/dist/progressive-scroll/index.js +147 -1
- package/dist/quick-fix/reload.js +22 -1
- package/dist/seo/schema.js +465 -1
- package/dist/slider/freescroll.js +34 -1
- package/dist/test/sample.js +15 -1
- package/dist/testimonials/index.js +2654 -1
- package/dist/timeline/index.js +160 -1
- package/dist/timeline/style.css +42 -1
- package/dist/tracking/custom-id.js +75 -1
- package/dist/tracking/fill-form-fields.js +238 -1
- package/dist/tracking/fill-form-fields.js.map +2 -2
- package/dist/tracking/form-tracker.js +146 -1
- package/dist/tracking/page-categories.js +20 -1
- package/dist/tracking/user-journey.js +839 -1
- package/dist/tracking/utm-links.js +194 -1
- package/dist/utils/sample.js +17 -1
- package/dist/validations/localhost.js +221 -1
- package/package.json +1 -1
|
@@ -1 +1,173 @@
|
|
|
1
|
-
|
|
1
|
+
/* src/global/css/in-project-settings.css */
|
|
2
|
+
[fynd-sticky-target] {
|
|
3
|
+
height: 90vh;
|
|
4
|
+
position: sticky;
|
|
5
|
+
top: 12vh;
|
|
6
|
+
z-index: 2;
|
|
7
|
+
}
|
|
8
|
+
[fynd-scroll-blocks] {
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
[fynd-scroll-source] {
|
|
12
|
+
height: 80vh;
|
|
13
|
+
}
|
|
14
|
+
[fynd-sticky-source] {
|
|
15
|
+
height: 80vh;
|
|
16
|
+
width: 100%;
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0px;
|
|
19
|
+
opacity: 0;
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
}
|
|
22
|
+
[fynd-scroll-container] {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
[fynd-sticky-target] {
|
|
26
|
+
height: 80vh;
|
|
27
|
+
border-radius: 1rem;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
[fynd-scroll-column] {
|
|
31
|
+
padding-left: 0rem;
|
|
32
|
+
padding-right: 0rem;
|
|
33
|
+
}
|
|
34
|
+
.progressive-scroll-image {
|
|
35
|
+
object-fit: cover;
|
|
36
|
+
}
|
|
37
|
+
@media (max-width: 991px) {
|
|
38
|
+
[fynd-scroll-container] {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
[fynd-scroll-blocks] {
|
|
43
|
+
display: flex;
|
|
44
|
+
}
|
|
45
|
+
[fynd-sticky-source] {
|
|
46
|
+
height: auto;
|
|
47
|
+
position: static;
|
|
48
|
+
opacity: 1;
|
|
49
|
+
}
|
|
50
|
+
[fynd-scroll-source] {
|
|
51
|
+
height: auto;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
[fynd-console-auth=user-blob] {
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
[fynd-console-auth-status=true] {
|
|
58
|
+
padding: 0 14px 0 4px !important;
|
|
59
|
+
}
|
|
60
|
+
[fynd-console-auth-status=false] {
|
|
61
|
+
padding: 0 16px 0 16px !important;
|
|
62
|
+
}
|
|
63
|
+
[style-nav-primary-button=white] [fynd-console-auth=initial-text] {
|
|
64
|
+
color: #ffffff;
|
|
65
|
+
}
|
|
66
|
+
[style-nav-primary-button=white] [fynd-console-auth=user-blob] {
|
|
67
|
+
background-color: #0e0e0e;
|
|
68
|
+
}
|
|
69
|
+
.webflow-only-placeholder,
|
|
70
|
+
[only-in-webflow=true] {
|
|
71
|
+
display: none;
|
|
72
|
+
visibility: hidden;
|
|
73
|
+
}
|
|
74
|
+
.w-webflow-badge {
|
|
75
|
+
display: none !important;
|
|
76
|
+
}
|
|
77
|
+
.termly-styles-logo-cc6217.termly-styles-logo-c34670 {
|
|
78
|
+
display: none !important;
|
|
79
|
+
}
|
|
80
|
+
[fynd-wrapper-field=product-interested-select] {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
[fynd-wrapper-field=product-interested-input] {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
[fynd-chat=input] {
|
|
87
|
+
border: none;
|
|
88
|
+
outline: none;
|
|
89
|
+
width: 100%;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
pointer-events: auto;
|
|
93
|
+
}
|
|
94
|
+
[fynd-chat=input-container] {
|
|
95
|
+
transform: translate(0px, 100px);
|
|
96
|
+
}
|
|
97
|
+
[fynd-chat=window] {
|
|
98
|
+
position: absolute !important;
|
|
99
|
+
z-index: 4;
|
|
100
|
+
transform-origin: bottom center;
|
|
101
|
+
pointer-events: auto;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
transform: scale(0);
|
|
104
|
+
}
|
|
105
|
+
[fynd-chat=window-overlay] {
|
|
106
|
+
pointer-events: auto;
|
|
107
|
+
opacity: 0;
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
[fynd-chat=wrapper] {
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
display: flex;
|
|
113
|
+
}
|
|
114
|
+
[fynd-chat=input-ghost] {
|
|
115
|
+
position: absolute;
|
|
116
|
+
visibility: hidden;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
font-size: 16px;
|
|
119
|
+
font-family: sans-serif;
|
|
120
|
+
}
|
|
121
|
+
[fynd-chat=input]::placeholder {
|
|
122
|
+
color: white;
|
|
123
|
+
}
|
|
124
|
+
[fynd-chat=input]:focus {
|
|
125
|
+
box-shadow: 0 0 0 6px #00000020;
|
|
126
|
+
}
|
|
127
|
+
[fynd-chat=input],
|
|
128
|
+
[fynd-chat=input]::placeholder,
|
|
129
|
+
[fynd-chat=icon],
|
|
130
|
+
[fynd-chat=button] {
|
|
131
|
+
transition: all 0.4s ease;
|
|
132
|
+
}
|
|
133
|
+
[fynd-chat=input][fynd-chat-active=true] {
|
|
134
|
+
background-color: #fff;
|
|
135
|
+
border: 1px solid #E3E3E3;
|
|
136
|
+
color: #000;
|
|
137
|
+
}
|
|
138
|
+
[fynd-chat=input][fynd-chat-active=true]::placeholder {
|
|
139
|
+
color: #A0A1A2;
|
|
140
|
+
}
|
|
141
|
+
[fynd-chat=input][fynd-chat-active=true]:focus {
|
|
142
|
+
box-shadow: 0 0 0 6px #00000020;
|
|
143
|
+
}
|
|
144
|
+
[fynd-chat=icon][fynd-chat-active=true] {
|
|
145
|
+
color: #000000;
|
|
146
|
+
}
|
|
147
|
+
[fynd-chat=button][fynd-chat-active=true] {
|
|
148
|
+
background-color: #000000;
|
|
149
|
+
color: #ffffff;
|
|
150
|
+
border: 1px solid #000;
|
|
151
|
+
}
|
|
152
|
+
[fynd-chat=input][fynd-chat-active=false] {
|
|
153
|
+
border: 1px solid #ffffff80;
|
|
154
|
+
background-color: #0000001a;
|
|
155
|
+
color: #fff;
|
|
156
|
+
}
|
|
157
|
+
[fynd-chat=input][fynd-chat-active=true]:focus {
|
|
158
|
+
box-shadow: 0 0 0 6px #a2a2a220;
|
|
159
|
+
}
|
|
160
|
+
[fynd-chat=icon][fynd-chat-active=false] {
|
|
161
|
+
color: #fff;
|
|
162
|
+
}
|
|
163
|
+
[fynd-chat=button][fynd-chat-active=false] {
|
|
164
|
+
background-color: transparent;
|
|
165
|
+
color: #ffffff;
|
|
166
|
+
border: 1px solid #ffffffb3;
|
|
167
|
+
}
|
|
168
|
+
@media screen and (max-width: 479px) {
|
|
169
|
+
[fynd-chat=input] {
|
|
170
|
+
width: 80vw;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/*# sourceMappingURL=in-project-settings.css.map */
|
package/dist/global/css/temp.css
CHANGED
|
@@ -1 +1,89 @@
|
|
|
1
|
-
|
|
1
|
+
/* src/global/css/temp.css */
|
|
2
|
+
[fynd-chat=input] {
|
|
3
|
+
border: none;
|
|
4
|
+
outline: none;
|
|
5
|
+
width: 100%;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
pointer-events: auto;
|
|
9
|
+
}
|
|
10
|
+
[fynd-chat=input-container] {
|
|
11
|
+
transform: translate(0px, 100px);
|
|
12
|
+
}
|
|
13
|
+
[fynd-chat=window] {
|
|
14
|
+
position: absolute !important;
|
|
15
|
+
z-index: 4;
|
|
16
|
+
transform-origin: bottom center;
|
|
17
|
+
pointer-events: auto;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
transform: scale(0);
|
|
20
|
+
}
|
|
21
|
+
[fynd-chat=window-overlay] {
|
|
22
|
+
pointer-events: auto;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
[fynd-chat=wrapper] {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
display: flex;
|
|
29
|
+
}
|
|
30
|
+
[fynd-chat=input-ghost] {
|
|
31
|
+
position: absolute;
|
|
32
|
+
visibility: hidden;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
font-family: sans-serif;
|
|
36
|
+
}
|
|
37
|
+
[fynd-chat=input]::placeholder {
|
|
38
|
+
color: white;
|
|
39
|
+
}
|
|
40
|
+
[fynd-chat=input]:focus {
|
|
41
|
+
box-shadow: 0 0 0 6px #00000020;
|
|
42
|
+
}
|
|
43
|
+
[fynd-chat=input],
|
|
44
|
+
[fynd-chat=input]::placeholder,
|
|
45
|
+
[fynd-chat=icon],
|
|
46
|
+
[fynd-chat=button] {
|
|
47
|
+
transition: all 0.4s ease;
|
|
48
|
+
}
|
|
49
|
+
[fynd-chat=input][fynd-chat-active=true] {
|
|
50
|
+
background-color: #fff;
|
|
51
|
+
border: 1px solid #E3E3E3;
|
|
52
|
+
color: #000;
|
|
53
|
+
}
|
|
54
|
+
[fynd-chat=input][fynd-chat-active=true]::placeholder {
|
|
55
|
+
color: #A0A1A2;
|
|
56
|
+
}
|
|
57
|
+
[fynd-chat=input][fynd-chat-active=true]:focus {
|
|
58
|
+
box-shadow: 0 0 0 6px #00000020;
|
|
59
|
+
}
|
|
60
|
+
[fynd-chat=icon][fynd-chat-active=true] {
|
|
61
|
+
color: #000000;
|
|
62
|
+
}
|
|
63
|
+
[fynd-chat=button][fynd-chat-active=true] {
|
|
64
|
+
background-color: #000000;
|
|
65
|
+
color: #ffffff;
|
|
66
|
+
border: 1px solid #000;
|
|
67
|
+
}
|
|
68
|
+
[fynd-chat=input][fynd-chat-active=false] {
|
|
69
|
+
border: 1px solid #ffffff80;
|
|
70
|
+
background-color: #0000001a;
|
|
71
|
+
color: #fff;
|
|
72
|
+
}
|
|
73
|
+
[fynd-chat=input][fynd-chat-active=true]:focus {
|
|
74
|
+
box-shadow: 0 0 0 6px #a2a2a220;
|
|
75
|
+
}
|
|
76
|
+
[fynd-chat=icon][fynd-chat-active=false] {
|
|
77
|
+
color: #fff;
|
|
78
|
+
}
|
|
79
|
+
[fynd-chat=button][fynd-chat-active=false] {
|
|
80
|
+
background-color: transparent;
|
|
81
|
+
color: #ffffff;
|
|
82
|
+
border: 1px solid #ffffffb3;
|
|
83
|
+
}
|
|
84
|
+
@media screen and (max-width: 479px) {
|
|
85
|
+
[fynd-chat=input] {
|
|
86
|
+
width: 80vw;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/*# sourceMappingURL=temp.css.map */
|
|
@@ -1 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// bin/live-reload.js
|
|
4
|
+
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
|
|
5
|
+
new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
|
|
6
|
+
"change",
|
|
7
|
+
() => location.reload()
|
|
8
|
+
);
|
|
9
|
+
} else {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/global/custom-bg-video.ts
|
|
13
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
14
|
+
const wrappers = document.querySelectorAll("[custom-video]");
|
|
15
|
+
wrappers.forEach((wrapper) => {
|
|
16
|
+
const video = wrapper.querySelector("video");
|
|
17
|
+
const img = wrapper.querySelector("img");
|
|
18
|
+
if (!video || !img) return;
|
|
19
|
+
video.muted = true;
|
|
20
|
+
video.loop = true;
|
|
21
|
+
video.autoplay = true;
|
|
22
|
+
video.preload = "auto";
|
|
23
|
+
const startPlayback = () => {
|
|
24
|
+
img.style.display = "none";
|
|
25
|
+
video.play().catch(() => {
|
|
26
|
+
video.muted = true;
|
|
27
|
+
video.play().catch(() => {
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
video.removeEventListener("loadeddata", startPlayback);
|
|
31
|
+
};
|
|
32
|
+
if (video.readyState >= 2) {
|
|
33
|
+
startPlayback();
|
|
34
|
+
} else {
|
|
35
|
+
video.addEventListener("loadeddata", startPlayback);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
})();
|
|
40
|
+
//# sourceMappingURL=custom-bg-video.js.map
|
|
@@ -1 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// bin/live-reload.js
|
|
4
|
+
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
|
|
5
|
+
new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
|
|
6
|
+
"change",
|
|
7
|
+
() => location.reload()
|
|
8
|
+
);
|
|
9
|
+
} else {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/global/footer-accordion.ts
|
|
13
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
14
|
+
const BREAKPOINT = 992;
|
|
15
|
+
const toggles = document.querySelectorAll("[footer-accordion-toggle]");
|
|
16
|
+
const contents = document.querySelectorAll("[footer-accordion-content]");
|
|
17
|
+
const isMobile = () => {
|
|
18
|
+
return window.innerWidth < BREAKPOINT;
|
|
19
|
+
};
|
|
20
|
+
const closeAll = () => {
|
|
21
|
+
contents.forEach((content) => {
|
|
22
|
+
content.style.display = "none";
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
toggles.forEach((toggle) => {
|
|
26
|
+
toggle.addEventListener("click", () => {
|
|
27
|
+
if (!isMobile()) return;
|
|
28
|
+
const content = toggle.nextElementSibling;
|
|
29
|
+
if (!content || !content.hasAttribute("footer-accordion-content")) return;
|
|
30
|
+
const isOpen = content.style.display === "grid";
|
|
31
|
+
closeAll();
|
|
32
|
+
if (!isOpen) {
|
|
33
|
+
content.style.display = "grid";
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
window.addEventListener("resize", () => {
|
|
38
|
+
if (!isMobile()) {
|
|
39
|
+
closeAll();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
})();
|
|
44
|
+
//# sourceMappingURL=footer-accordion.js.map
|
|
@@ -1 +1,135 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// bin/live-reload.js
|
|
4
|
+
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
|
|
5
|
+
new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
|
|
6
|
+
"change",
|
|
7
|
+
() => location.reload()
|
|
8
|
+
);
|
|
9
|
+
} else {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/global/lazy-loader.ts
|
|
13
|
+
(function() {
|
|
14
|
+
"use strict";
|
|
15
|
+
const DEFAULT_IDLE_TIMEOUT_MS = 3e3;
|
|
16
|
+
const FALLBACK_DELAY_MS = 2e3;
|
|
17
|
+
const LOAD_ON = "load";
|
|
18
|
+
const ENABLED_GROUPS = /* @__PURE__ */ new Set();
|
|
19
|
+
function log(...args) {
|
|
20
|
+
const DEBUG = false;
|
|
21
|
+
if (DEBUG) {
|
|
22
|
+
console.log("[lazy-loader]", ...args);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function runWhenIdle(fn, timeoutMs = DEFAULT_IDLE_TIMEOUT_MS) {
|
|
26
|
+
if ("requestIdleCallback" in window) {
|
|
27
|
+
window.requestIdleCallback(
|
|
28
|
+
() => fn(),
|
|
29
|
+
{ timeout: timeoutMs }
|
|
30
|
+
);
|
|
31
|
+
} else {
|
|
32
|
+
setTimeout(fn, FALLBACK_DELAY_MS);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function matchesEnabledGroups(node) {
|
|
36
|
+
if (ENABLED_GROUPS.size === 0) return true;
|
|
37
|
+
const g = node.getAttribute("data-group");
|
|
38
|
+
return g !== null && ENABLED_GROUPS.has(g);
|
|
39
|
+
}
|
|
40
|
+
function loadExternalScript(src, {
|
|
41
|
+
async = false,
|
|
42
|
+
defer = false,
|
|
43
|
+
type = "",
|
|
44
|
+
crossOrigin = "",
|
|
45
|
+
referrerPolicy = ""
|
|
46
|
+
} = {}) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const s = document.createElement("script");
|
|
49
|
+
s.src = src;
|
|
50
|
+
if (async) s.async = true;
|
|
51
|
+
if (defer) s.defer = true;
|
|
52
|
+
if (type) s.type = type;
|
|
53
|
+
if (crossOrigin) s.crossOrigin = crossOrigin;
|
|
54
|
+
if (referrerPolicy) s.referrerPolicy = referrerPolicy;
|
|
55
|
+
s.onload = () => resolve();
|
|
56
|
+
s.onerror = () => reject(new Error("Failed to load: " + src));
|
|
57
|
+
document.head.appendChild(s);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function runInline(code) {
|
|
61
|
+
const s = document.createElement("script");
|
|
62
|
+
s.type = "text/javascript";
|
|
63
|
+
s.text = code;
|
|
64
|
+
document.head.appendChild(s);
|
|
65
|
+
}
|
|
66
|
+
async function processLazyScripts(nodes) {
|
|
67
|
+
for (const node of nodes) {
|
|
68
|
+
if (!matchesEnabledGroups(node)) continue;
|
|
69
|
+
const src = node.getAttribute("data-src");
|
|
70
|
+
const isAsync = node.getAttribute("data-async") === "true";
|
|
71
|
+
const crossOrigin = node.getAttribute("data-crossorigin") || "";
|
|
72
|
+
const referrerPolicy = node.getAttribute("data-referrerpolicy") || "";
|
|
73
|
+
try {
|
|
74
|
+
if (src) {
|
|
75
|
+
log("Loading", src, "async=", isAsync);
|
|
76
|
+
await loadExternalScript(src, {
|
|
77
|
+
async: isAsync,
|
|
78
|
+
crossOrigin,
|
|
79
|
+
referrerPolicy
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
const code = node.textContent || "";
|
|
83
|
+
if (code.trim()) {
|
|
84
|
+
log("Running inline lazy script");
|
|
85
|
+
runInline(code);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.warn("[lazy-loader]", e);
|
|
90
|
+
} finally {
|
|
91
|
+
node.type = "text/javascript";
|
|
92
|
+
node.removeAttribute("data-src");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function collectLazyNodes() {
|
|
97
|
+
return Array.from(
|
|
98
|
+
document.querySelectorAll(
|
|
99
|
+
'script[type="text/lazyjs"], script[data-lazy="true"]'
|
|
100
|
+
)
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function init() {
|
|
104
|
+
const nodes = collectLazyNodes();
|
|
105
|
+
if (!nodes.length) {
|
|
106
|
+
log("No lazy scripts found.");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
log("Found", nodes.length, "lazy scripts");
|
|
110
|
+
runWhenIdle(() => {
|
|
111
|
+
void processLazyScripts(nodes);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (document.readyState === "complete") {
|
|
115
|
+
runWhenIdle(init);
|
|
116
|
+
} else {
|
|
117
|
+
window.addEventListener(
|
|
118
|
+
LOAD_ON,
|
|
119
|
+
() => runWhenIdle(init),
|
|
120
|
+
{ once: true }
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
window.LazyLoader = {
|
|
124
|
+
loadNow: () => processLazyScripts(collectLazyNodes()),
|
|
125
|
+
loadGroupNow: async (groupName) => {
|
|
126
|
+
const nodes = collectLazyNodes().filter(
|
|
127
|
+
(n) => (n.getAttribute("data-group") || "") === groupName
|
|
128
|
+
);
|
|
129
|
+
await processLazyScripts(nodes);
|
|
130
|
+
},
|
|
131
|
+
loadScriptNow: (src, opts) => loadExternalScript(src, opts)
|
|
132
|
+
};
|
|
133
|
+
})();
|
|
134
|
+
})();
|
|
135
|
+
//# sourceMappingURL=lazy-loader.js.map
|
package/dist/global/loader.js
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// bin/live-reload.js
|
|
4
|
+
if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
|
|
5
|
+
new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
|
|
6
|
+
"change",
|
|
7
|
+
() => location.reload()
|
|
8
|
+
);
|
|
9
|
+
} else {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/global/loader.ts
|
|
13
|
+
var PageLoader = class {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.progressBar = null;
|
|
16
|
+
this.progressText = null;
|
|
17
|
+
this.loadingOverlay = null;
|
|
18
|
+
this.currentProgress = 0;
|
|
19
|
+
this.loaderFill = null;
|
|
20
|
+
this.clickLoader = null;
|
|
21
|
+
this.init();
|
|
22
|
+
}
|
|
23
|
+
init() {
|
|
24
|
+
this.createLoader();
|
|
25
|
+
this.interceptLinks();
|
|
26
|
+
this.monitorPageLoad();
|
|
27
|
+
}
|
|
28
|
+
createLoader() {
|
|
29
|
+
this.loaderFill = document.querySelector(".loader-fill[loader-fill]");
|
|
30
|
+
this.clickLoader = document.querySelector(".click-loader");
|
|
31
|
+
if (!this.loaderFill) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (this.clickLoader && !this.clickLoader.style.position && getComputedStyle(this.clickLoader).position !== "fixed") {
|
|
35
|
+
this.loadingOverlay = document.createElement("div");
|
|
36
|
+
this.loadingOverlay.id = "page-loading-overlay";
|
|
37
|
+
this.loadingOverlay.innerHTML = this.clickLoader.outerHTML;
|
|
38
|
+
const styles = `
|
|
2
39
|
<style>
|
|
3
40
|
#page-loading-overlay {
|
|
4
41
|
position: fixed;
|
|
@@ -28,4 +65,131 @@
|
|
|
28
65
|
}
|
|
29
66
|
|
|
30
67
|
</style>
|
|
31
|
-
|
|
68
|
+
`;
|
|
69
|
+
document.head.insertAdjacentHTML("beforeend", styles);
|
|
70
|
+
document.body.appendChild(this.loadingOverlay);
|
|
71
|
+
this.loaderFill = this.loadingOverlay.querySelector(
|
|
72
|
+
".loader-fill[loader-fill]"
|
|
73
|
+
);
|
|
74
|
+
} else {
|
|
75
|
+
if (this.clickLoader) {
|
|
76
|
+
this.clickLoader.style.display = "none";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (this.loaderFill) {
|
|
80
|
+
this.loaderFill.style.width = "0%";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
interceptLinks() {
|
|
84
|
+
document.addEventListener("click", (e) => {
|
|
85
|
+
const target = e.target;
|
|
86
|
+
const link = target.closest("a[href]");
|
|
87
|
+
if (link && !link.hasAttribute("no-loader")) {
|
|
88
|
+
const href = link.getAttribute("href");
|
|
89
|
+
if (href && (href.startsWith("http") || href.startsWith("#") || href.startsWith("javascript:"))) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
if (href) {
|
|
94
|
+
this.navigateWithProgress(href);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
navigateWithProgress(url) {
|
|
100
|
+
this.showLoader();
|
|
101
|
+
this.simulateProgress(url);
|
|
102
|
+
}
|
|
103
|
+
showLoader() {
|
|
104
|
+
if (this.loadingOverlay) {
|
|
105
|
+
this.loadingOverlay.style.display = "block";
|
|
106
|
+
} else if (this.clickLoader) {
|
|
107
|
+
this.clickLoader.style.display = "block";
|
|
108
|
+
}
|
|
109
|
+
this.currentProgress = 0;
|
|
110
|
+
this.updateProgress(0, "Initializing...");
|
|
111
|
+
}
|
|
112
|
+
hideLoader() {
|
|
113
|
+
if (this.loadingOverlay) {
|
|
114
|
+
this.loadingOverlay.style.display = "none";
|
|
115
|
+
} else if (this.clickLoader) {
|
|
116
|
+
this.clickLoader.style.display = "none";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
updateProgress(percent, message = "") {
|
|
120
|
+
this.currentProgress = Math.min(percent, 100);
|
|
121
|
+
if (this.loaderFill) {
|
|
122
|
+
this.loaderFill.style.width = this.currentProgress + "%";
|
|
123
|
+
}
|
|
124
|
+
const displayMessage = message || `Loading... ${Math.round(this.currentProgress)}%`;
|
|
125
|
+
}
|
|
126
|
+
simulateProgress(url) {
|
|
127
|
+
const stages = [
|
|
128
|
+
{ progress: 10, message: "Preparing request...", delay: 100 },
|
|
129
|
+
{ progress: 25, message: "Connecting to server...", delay: 150 },
|
|
130
|
+
{ progress: 40, message: "Sending request...", delay: 100 },
|
|
131
|
+
{ progress: 60, message: "Receiving response...", delay: 150 },
|
|
132
|
+
{ progress: 80, message: "Processing content...", delay: 50 },
|
|
133
|
+
{ progress: 95, message: "Finalizing...", delay: 50 },
|
|
134
|
+
{ progress: 100, message: "Complete!", delay: 100 }
|
|
135
|
+
];
|
|
136
|
+
let currentStage = 0;
|
|
137
|
+
const processStage = () => {
|
|
138
|
+
if (currentStage < stages.length) {
|
|
139
|
+
const stage = stages[currentStage];
|
|
140
|
+
this.updateProgress(stage.progress, stage.message);
|
|
141
|
+
setTimeout(() => {
|
|
142
|
+
currentStage++;
|
|
143
|
+
processStage();
|
|
144
|
+
}, stage.delay);
|
|
145
|
+
} else {
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
window.location.href = url;
|
|
148
|
+
}, 200);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
processStage();
|
|
152
|
+
}
|
|
153
|
+
// Monitor actual page loading events
|
|
154
|
+
monitorPageLoad() {
|
|
155
|
+
window.addEventListener("beforeunload", () => {
|
|
156
|
+
});
|
|
157
|
+
window.addEventListener("load", () => {
|
|
158
|
+
this.hideLoader();
|
|
159
|
+
});
|
|
160
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
161
|
+
});
|
|
162
|
+
if ("performance" in window) {
|
|
163
|
+
window.addEventListener("load", () => {
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
const timing = performance.timing;
|
|
166
|
+
const loadTime = timing.loadEventEnd - timing.navigationStart;
|
|
167
|
+
const dnsLookupTime = timing.domainLookupEnd - timing.domainLookupStart;
|
|
168
|
+
const tcpConnectionTime = timing.connectEnd - timing.connectStart;
|
|
169
|
+
const requestTime = timing.responseStart - timing.requestStart;
|
|
170
|
+
const responseTime = timing.responseEnd - timing.responseStart;
|
|
171
|
+
const domProcessingTime = timing.domComplete - timing.domLoading;
|
|
172
|
+
}, 100);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
if (document.readyState === "loading") {
|
|
178
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
179
|
+
new PageLoader();
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
new PageLoader();
|
|
183
|
+
}
|
|
184
|
+
window.showPageLoader = function(url) {
|
|
185
|
+
if (window.pageLoaderInstance) {
|
|
186
|
+
window.pageLoaderInstance.navigateWithProgress(url);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
window.addEventListener("load", () => {
|
|
190
|
+
if (!window.pageLoaderInstance) {
|
|
191
|
+
window.pageLoaderInstance = new PageLoader();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
})();
|
|
195
|
+
//# sourceMappingURL=loader.js.map
|