@hortonstudio/main 1.2.15 → 1.2.19
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/.claude/settings.local.json +40 -0
- package/CLAUDE.md +45 -0
- package/animations/hero.js +613 -0
- package/animations/text.js +379 -0
- package/animations/transition.js +57 -0
- package/autoInit/smooth-scroll.js +89 -0
- package/debug-version.html +37 -0
- package/index.js +232 -0
- package/package.json +4 -24
- package/styles.css +29 -0
- package/utils/navbar.js +214 -0
- package/utils/scroll-progress.js +29 -0
- package/utils/toc.js +77 -0
- package/dist/index.js +0 -1
- package/dist/src-hero-UYNS76KU.js +0 -1
- package/dist/src-load-3UYE3H3N.js +0 -1
- package/dist/src-navbar-763V2PWX.js +0 -1
- package/dist/src-scroll-progress-EX62FWYD.js +0 -1
- package/dist/src-smooth-scroll-TG4SEEIC.js +0 -1
- package/dist/src-text-BZVCCQJP.js +0 -1
- package/dist/src-toc-SHTDW6BF.js +0 -1
- package/dist/src-transition-UBAPWTIU.js +0 -1
package/index.js
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
const API_NAME = 'hsmain';
|
2
|
+
|
3
|
+
const initializeHsMain = async () => {
|
4
|
+
if (window[API_NAME] && !Array.isArray(window[API_NAME]) && window[API_NAME].loaded) {
|
5
|
+
return;
|
6
|
+
}
|
7
|
+
|
8
|
+
const queuedModules = Array.isArray(window[API_NAME]) ? window[API_NAME] : [];
|
9
|
+
|
10
|
+
const animationModules = {
|
11
|
+
'data-hs-anim-text': true,
|
12
|
+
'data-hs-anim-hero': true,
|
13
|
+
'data-hs-anim-transition': true
|
14
|
+
};
|
15
|
+
|
16
|
+
const utilityModules = {
|
17
|
+
'data-hs-util-toc': true,
|
18
|
+
'data-hs-util-progress': true,
|
19
|
+
'data-hs-util-navbar': true
|
20
|
+
};
|
21
|
+
|
22
|
+
const autoInitModules = {
|
23
|
+
'smooth-scroll': true
|
24
|
+
};
|
25
|
+
|
26
|
+
const allDataAttributes = { ...animationModules, ...utilityModules };
|
27
|
+
|
28
|
+
const waitForWebflow = async () => new Promise(resolve => {
|
29
|
+
if (!window.Webflow) window.Webflow = [];
|
30
|
+
window.Webflow.push(resolve);
|
31
|
+
});
|
32
|
+
|
33
|
+
const waitForDOMContentLoaded = async () => new Promise(resolve => {
|
34
|
+
if (document.readyState === 'loading') {
|
35
|
+
document.addEventListener('DOMContentLoaded', resolve);
|
36
|
+
} else {
|
37
|
+
resolve();
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
const moduleMap = {
|
42
|
+
'data-hs-anim-text': () => import('./animations/text.js'),
|
43
|
+
'data-hs-anim-hero': () => import('./animations/hero.js'),
|
44
|
+
'data-hs-anim-transition': () => import('./animations/transition.js'),
|
45
|
+
'data-hs-util-toc': () => import('./utils/toc.js'),
|
46
|
+
'data-hs-util-progress': () => import('./utils/scroll-progress.js'),
|
47
|
+
'data-hs-util-navbar': () => import('./utils/navbar.js'),
|
48
|
+
'smooth-scroll': () => import('./autoInit/smooth-scroll.js')
|
49
|
+
};
|
50
|
+
|
51
|
+
let scripts = [...document.querySelectorAll(`script[type="module"][src="${import.meta.url}"]`)];
|
52
|
+
|
53
|
+
if (scripts.length === 0) {
|
54
|
+
scripts = [...document.querySelectorAll('script[type="module"][src*="@hortonstudio/main"]')]
|
55
|
+
.filter(script => {
|
56
|
+
const scriptSrc = script.src;
|
57
|
+
const currentSrc = import.meta.url;
|
58
|
+
const scriptPackage = scriptSrc.match(/@hortonstudio\/main(@[\d.]+)?/)?.[0];
|
59
|
+
const currentPackage = currentSrc.match(/@hortonstudio\/main(@[\d.]+)?/)?.[0];
|
60
|
+
return scriptPackage && currentPackage &&
|
61
|
+
scriptPackage.split('@')[0] === currentPackage.split('@')[0];
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
const loadModule = async (moduleName) => {
|
66
|
+
const instance = window[API_NAME];
|
67
|
+
if (instance.process.has(moduleName)) {
|
68
|
+
return instance.modules[moduleName]?.loading;
|
69
|
+
}
|
70
|
+
|
71
|
+
instance.process.add(moduleName);
|
72
|
+
|
73
|
+
const moduleData = instance.modules[moduleName] || {};
|
74
|
+
instance.modules[moduleName] = moduleData;
|
75
|
+
|
76
|
+
moduleData.loading = new Promise((resolve, reject) => {
|
77
|
+
moduleData.resolve = resolve;
|
78
|
+
moduleData.reject = reject;
|
79
|
+
});
|
80
|
+
|
81
|
+
try {
|
82
|
+
const { init, version } = await moduleMap[moduleName]();
|
83
|
+
const result = await init();
|
84
|
+
const { result: initResult, destroy } = result || {};
|
85
|
+
|
86
|
+
moduleData.version = version;
|
87
|
+
moduleData.destroy = () => {
|
88
|
+
destroy?.();
|
89
|
+
instance.process.delete(moduleName);
|
90
|
+
};
|
91
|
+
moduleData.restart = () => {
|
92
|
+
moduleData.destroy?.();
|
93
|
+
instance.load(moduleName);
|
94
|
+
};
|
95
|
+
|
96
|
+
moduleData.resolve?.(initResult);
|
97
|
+
delete moduleData.resolve;
|
98
|
+
delete moduleData.reject;
|
99
|
+
|
100
|
+
return initResult;
|
101
|
+
} catch (error) {
|
102
|
+
moduleData.reject?.(error);
|
103
|
+
instance.process.delete(moduleName);
|
104
|
+
throw error;
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
const readyCallbacks = [];
|
109
|
+
|
110
|
+
window[API_NAME] = {
|
111
|
+
scripts,
|
112
|
+
modules: {},
|
113
|
+
process: new Set(),
|
114
|
+
load: loadModule,
|
115
|
+
loaded: false,
|
116
|
+
push(...items) {
|
117
|
+
for (const [moduleName, callback] of items) {
|
118
|
+
if (typeof callback === 'function') {
|
119
|
+
this.modules[moduleName]?.loading?.then(callback);
|
120
|
+
} else {
|
121
|
+
this.load(moduleName);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
},
|
125
|
+
destroy() {
|
126
|
+
for (const moduleName in this.modules) {
|
127
|
+
this.modules[moduleName]?.destroy?.();
|
128
|
+
}
|
129
|
+
},
|
130
|
+
afterReady(callback) {
|
131
|
+
if (typeof callback === 'function') {
|
132
|
+
if (this.loaded) {
|
133
|
+
callback();
|
134
|
+
} else {
|
135
|
+
readyCallbacks.push(callback);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
},
|
139
|
+
afterWebflowReady(callback) {
|
140
|
+
if (typeof callback === 'function') {
|
141
|
+
if (this.loaded) {
|
142
|
+
callback();
|
143
|
+
} else {
|
144
|
+
readyCallbacks.push(callback);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
},
|
148
|
+
status(moduleName) {
|
149
|
+
if (moduleName) {
|
150
|
+
return {
|
151
|
+
loaded: !!this.modules[moduleName],
|
152
|
+
loading: this.process.has(moduleName)
|
153
|
+
};
|
154
|
+
}
|
155
|
+
return {
|
156
|
+
loaded: Object.keys(this.modules),
|
157
|
+
loading: [...this.process],
|
158
|
+
animations: Object.keys(animationModules),
|
159
|
+
utilities: Object.keys(utilityModules),
|
160
|
+
autoInit: Object.keys(autoInitModules)
|
161
|
+
};
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
const processModules = () => {
|
166
|
+
for (const script of scripts) {
|
167
|
+
const isAutoDetect = script.getAttribute('data-hs-auto') === 'true';
|
168
|
+
|
169
|
+
for (const attrName of Object.keys(allDataAttributes)) {
|
170
|
+
if (script.hasAttribute(attrName)) {
|
171
|
+
loadModule(attrName);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
if (isAutoDetect) {
|
176
|
+
waitForDOMContentLoaded().then(() => {
|
177
|
+
const foundAttributes = new Set();
|
178
|
+
const allElements = document.querySelectorAll('*');
|
179
|
+
|
180
|
+
for (const element of allElements) {
|
181
|
+
for (const attrName of element.getAttributeNames()) {
|
182
|
+
const match = attrName.match(/^(data-hs-(?:anim|util)-[^-=]+)/)?.[1];
|
183
|
+
if (match && allDataAttributes[match]) {
|
184
|
+
foundAttributes.add(match);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
for (const attrName of foundAttributes) {
|
190
|
+
loadModule(attrName);
|
191
|
+
}
|
192
|
+
});
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
for (const moduleName of Object.keys(autoInitModules)) {
|
197
|
+
loadModule(moduleName);
|
198
|
+
}
|
199
|
+
|
200
|
+
if (!scripts.some(script => script.hasAttribute('data-hs-anim-transition'))) {
|
201
|
+
document.querySelectorAll('.transition').forEach(element => {
|
202
|
+
element.style.display = 'none';
|
203
|
+
});
|
204
|
+
}
|
205
|
+
};
|
206
|
+
|
207
|
+
document.querySelectorAll('.w-richtext').forEach(richtext => {
|
208
|
+
richtext.querySelectorAll('img').forEach(img => {
|
209
|
+
img.loading = 'eager';
|
210
|
+
});
|
211
|
+
});
|
212
|
+
|
213
|
+
const finalize = async () => {
|
214
|
+
processModules();
|
215
|
+
await waitForWebflow();
|
216
|
+
window[API_NAME].loaded = true;
|
217
|
+
readyCallbacks.forEach(callback => {
|
218
|
+
try {
|
219
|
+
callback();
|
220
|
+
} catch (error) {
|
221
|
+
// Silent fail for callbacks
|
222
|
+
}
|
223
|
+
});
|
224
|
+
};
|
225
|
+
|
226
|
+
window[API_NAME].push(...queuedModules);
|
227
|
+
finalize().catch(() => {
|
228
|
+
// Silent fail for initialization
|
229
|
+
});
|
230
|
+
};
|
231
|
+
|
232
|
+
initializeHsMain();
|
package/package.json
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hortonstudio/main",
|
3
|
-
"version": "1.2.
|
4
|
-
"description": "
|
5
|
-
"main": "
|
3
|
+
"version": "1.2.19",
|
4
|
+
"description": "Animation and utility library for client websites",
|
5
|
+
"main": "index.js",
|
6
6
|
"type": "module",
|
7
|
-
"files": [
|
8
|
-
"dist/**/*"
|
9
|
-
],
|
10
7
|
"keywords": [
|
11
8
|
"animation",
|
12
9
|
"gsap",
|
@@ -16,23 +13,6 @@
|
|
16
13
|
"author": "Horton Studio",
|
17
14
|
"license": "ISC",
|
18
15
|
"scripts": {
|
19
|
-
"
|
20
|
-
"build:dev": "tsx bin/build.ts --dev",
|
21
|
-
"dev": "tsx bin/build.ts --dev --watch",
|
22
|
-
"prepublishOnly": "npm run build"
|
23
|
-
},
|
24
|
-
"dependencies": {
|
25
|
-
"@hortonstudio/main-anim-hero": "^1.0.0",
|
26
|
-
"@hortonstudio/main-anim-text": "^1.0.0",
|
27
|
-
"@hortonstudio/main-anim-transition": "^1.0.0",
|
28
|
-
"@hortonstudio/main-util-navbar": "^1.0.0",
|
29
|
-
"@hortonstudio/main-util-toc": "^1.0.0",
|
30
|
-
"@hortonstudio/main-util-progress": "^1.0.0",
|
31
|
-
"@hortonstudio/main-smooth-scroll": "^1.0.0"
|
32
|
-
},
|
33
|
-
"devDependencies": {
|
34
|
-
"esbuild": "^0.19.0",
|
35
|
-
"tsx": "^4.0.0",
|
36
|
-
"typescript": "^5.0.0"
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
37
17
|
}
|
38
18
|
}
|
package/styles.css
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
/* transition */
|
2
|
+
body .transition {display: block}
|
3
|
+
.w-editor .transition {display: none;}
|
4
|
+
.no-scroll-transition {overflow: hidden; position: relative;}
|
5
|
+
|
6
|
+
/* splittext */
|
7
|
+
.line-mask, .word-mask, .char-mask {
|
8
|
+
padding-bottom: .1em;
|
9
|
+
margin-bottom: -.1em;
|
10
|
+
padding-inline: .1em;
|
11
|
+
margin-inline: -.1em;
|
12
|
+
}
|
13
|
+
|
14
|
+
|
15
|
+
/* scroll cleanliness */
|
16
|
+
html, body {
|
17
|
+
overscroll-behavior: none;
|
18
|
+
scrollbar-gutter: stable;
|
19
|
+
}
|
20
|
+
|
21
|
+
/* TOC focus handling - only show focus outline for keyboard navigation */
|
22
|
+
[data-hs-toc] div[id]:focus:not(:focus-visible) {
|
23
|
+
outline: none !important;
|
24
|
+
}
|
25
|
+
|
26
|
+
[data-hs-toc] div[id]:focus-visible {
|
27
|
+
outline: 2px solid #007bff !important;
|
28
|
+
outline-offset: 2px;
|
29
|
+
}
|
package/utils/navbar.js
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
export const init = () => {
|
2
|
+
// Find all dropdown wrappers
|
3
|
+
const dropdownWrappers = document.querySelectorAll('[data-hs-nav-dropdown="wrapper"]');
|
4
|
+
|
5
|
+
// Global array to track all dropdown instances
|
6
|
+
const allDropdowns = [];
|
7
|
+
|
8
|
+
// Function to close all dropdowns except the specified one
|
9
|
+
const closeAllDropdowns = (exceptWrapper = null) => {
|
10
|
+
allDropdowns.forEach(dropdown => {
|
11
|
+
if (dropdown.wrapper !== exceptWrapper && dropdown.isOpen) {
|
12
|
+
dropdown.closeDropdown();
|
13
|
+
}
|
14
|
+
});
|
15
|
+
};
|
16
|
+
|
17
|
+
dropdownWrappers.forEach(wrapper => {
|
18
|
+
const animationDuration = 0.3;
|
19
|
+
|
20
|
+
// Find elements within this wrapper
|
21
|
+
const toggle = wrapper.querySelector('a'); // the toggle link
|
22
|
+
const list = wrapper.querySelector('[data-hs-nav-dropdown="list"]');
|
23
|
+
const contain = list.querySelector('[data-hs-nav-dropdown="container"]');
|
24
|
+
const arrow = toggle.querySelector('[data-hs-nav-dropdown="arrow"]');
|
25
|
+
const text = toggle.querySelector('[data-hs-nav-dropdown="text"]'); // find the text element
|
26
|
+
|
27
|
+
// Set initial states with GSAP
|
28
|
+
gsap.set(contain, { yPercent: -110 });
|
29
|
+
gsap.set(list, { display: 'none' });
|
30
|
+
gsap.set(arrow, { rotation: 0, scale: 1, x: 0, color: '' });
|
31
|
+
gsap.set(text, { scale: 1, color: '' }); // empty string = default color
|
32
|
+
|
33
|
+
// Track if dropdown is open
|
34
|
+
let isOpen = false;
|
35
|
+
let currentTimeline = null;
|
36
|
+
|
37
|
+
// Open animation
|
38
|
+
function openDropdown() {
|
39
|
+
if (isOpen) return;
|
40
|
+
|
41
|
+
// Kill any existing timeline
|
42
|
+
if (currentTimeline) {
|
43
|
+
currentTimeline.kill();
|
44
|
+
}
|
45
|
+
|
46
|
+
// Close all other dropdowns first
|
47
|
+
closeAllDropdowns(wrapper);
|
48
|
+
|
49
|
+
isOpen = true;
|
50
|
+
|
51
|
+
// Update ARIA states
|
52
|
+
toggle.setAttribute('aria-expanded', 'true');
|
53
|
+
list.setAttribute('aria-hidden', 'false');
|
54
|
+
|
55
|
+
// GSAP animation
|
56
|
+
currentTimeline = gsap.timeline();
|
57
|
+
currentTimeline.set(list, { display: 'flex' })
|
58
|
+
.to(contain, {
|
59
|
+
yPercent: 0,
|
60
|
+
duration: animationDuration,
|
61
|
+
ease: 'ease'
|
62
|
+
}, 0)
|
63
|
+
.to(arrow, {
|
64
|
+
rotation: 90,
|
65
|
+
scale: 1.2,
|
66
|
+
x: 4,
|
67
|
+
color: 'var(--swatch--brand)',
|
68
|
+
duration: animationDuration,
|
69
|
+
ease: 'ease'
|
70
|
+
}, 0)
|
71
|
+
.to(text, {
|
72
|
+
scale: 1.1,
|
73
|
+
color: 'var(--swatch--brand)',
|
74
|
+
duration: animationDuration,
|
75
|
+
ease: 'ease'
|
76
|
+
}, 0);
|
77
|
+
}
|
78
|
+
|
79
|
+
// Close animation
|
80
|
+
function closeDropdown() {
|
81
|
+
if (!isOpen) return;
|
82
|
+
|
83
|
+
// Kill any existing timeline
|
84
|
+
if (currentTimeline) {
|
85
|
+
currentTimeline.kill();
|
86
|
+
}
|
87
|
+
|
88
|
+
// Check if focus should be restored to toggle
|
89
|
+
const shouldRestoreFocus = list.contains(document.activeElement);
|
90
|
+
|
91
|
+
isOpen = false;
|
92
|
+
currentMenuItemIndex = -1;
|
93
|
+
|
94
|
+
// Update ARIA states
|
95
|
+
toggle.setAttribute('aria-expanded', 'false');
|
96
|
+
list.setAttribute('aria-hidden', 'true');
|
97
|
+
|
98
|
+
// Temporarily remove role="menu" to help screen readers understand menu is closed
|
99
|
+
const originalRole = list.getAttribute('role');
|
100
|
+
list.removeAttribute('role');
|
101
|
+
|
102
|
+
// GSAP animation
|
103
|
+
currentTimeline = gsap.timeline();
|
104
|
+
currentTimeline.to(contain, {
|
105
|
+
yPercent: -110,
|
106
|
+
duration: animationDuration,
|
107
|
+
ease: 'ease'
|
108
|
+
}, 0)
|
109
|
+
.to(arrow, {
|
110
|
+
rotation: 0,
|
111
|
+
scale: 1,
|
112
|
+
x: 0,
|
113
|
+
color: '', // back to default color
|
114
|
+
duration: animationDuration,
|
115
|
+
ease: 'ease'
|
116
|
+
}, 0)
|
117
|
+
.to(text, {
|
118
|
+
scale: 1,
|
119
|
+
color: '', // back to default color
|
120
|
+
duration: animationDuration,
|
121
|
+
ease: 'ease'
|
122
|
+
}, 0)
|
123
|
+
.set(list, { display: 'none' })
|
124
|
+
.call(() => {
|
125
|
+
// Restore role after animation completes
|
126
|
+
list.setAttribute('role', originalRole || 'menu');
|
127
|
+
});
|
128
|
+
|
129
|
+
// Restore focus to toggle only if focus was inside dropdown
|
130
|
+
if (shouldRestoreFocus) {
|
131
|
+
// Small delay to ensure screen reader announces the state change
|
132
|
+
setTimeout(() => {
|
133
|
+
toggle.focus();
|
134
|
+
}, 50);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
// Get all menu items for navigation
|
139
|
+
const menuItems = list.querySelectorAll('a, button, [role="menuitem"]');
|
140
|
+
let currentMenuItemIndex = -1;
|
141
|
+
|
142
|
+
// Hover events
|
143
|
+
toggle.addEventListener('mouseenter', openDropdown);
|
144
|
+
wrapper.addEventListener('mouseleave', closeDropdown);
|
145
|
+
|
146
|
+
// Arrow key navigation within dropdown
|
147
|
+
list.addEventListener('keydown', function(e) {
|
148
|
+
if (!isOpen) return;
|
149
|
+
|
150
|
+
if (e.key === 'ArrowDown') {
|
151
|
+
e.preventDefault();
|
152
|
+
currentMenuItemIndex = (currentMenuItemIndex + 1) % menuItems.length;
|
153
|
+
menuItems[currentMenuItemIndex].focus();
|
154
|
+
} else if (e.key === 'ArrowUp') {
|
155
|
+
e.preventDefault();
|
156
|
+
currentMenuItemIndex = currentMenuItemIndex <= 0 ? menuItems.length - 1 : currentMenuItemIndex - 1;
|
157
|
+
menuItems[currentMenuItemIndex].focus();
|
158
|
+
} else if (e.key === 'Escape') {
|
159
|
+
e.preventDefault();
|
160
|
+
closeDropdown();
|
161
|
+
toggle.focus();
|
162
|
+
}
|
163
|
+
});
|
164
|
+
|
165
|
+
// Keyboard events for toggle
|
166
|
+
toggle.addEventListener('keydown', function(e) {
|
167
|
+
if (e.key === 'ArrowDown') {
|
168
|
+
e.preventDefault();
|
169
|
+
openDropdown();
|
170
|
+
// Focus first menu item after opening
|
171
|
+
if (menuItems.length > 0) {
|
172
|
+
currentMenuItemIndex = 0;
|
173
|
+
setTimeout(() => menuItems[0].focus(), 50);
|
174
|
+
}
|
175
|
+
} else if (e.key === ' ') {
|
176
|
+
e.preventDefault();
|
177
|
+
// Simple toggle: if closed open, if open close
|
178
|
+
if (isOpen) {
|
179
|
+
closeDropdown();
|
180
|
+
} else {
|
181
|
+
openDropdown();
|
182
|
+
}
|
183
|
+
} else if (e.key === 'ArrowUp' || e.key === 'Escape') {
|
184
|
+
e.preventDefault();
|
185
|
+
closeDropdown();
|
186
|
+
}
|
187
|
+
});
|
188
|
+
|
189
|
+
// Close dropdown when clicking outside
|
190
|
+
document.addEventListener('click', function(e) {
|
191
|
+
if (!wrapper.contains(e.target) && isOpen) {
|
192
|
+
closeDropdown();
|
193
|
+
}
|
194
|
+
});
|
195
|
+
|
196
|
+
// Add this dropdown instance to the global array
|
197
|
+
allDropdowns.push({
|
198
|
+
wrapper,
|
199
|
+
isOpen: () => isOpen,
|
200
|
+
closeDropdown
|
201
|
+
});
|
202
|
+
});
|
203
|
+
|
204
|
+
// Global focus management - close dropdown when tab focus moves outside
|
205
|
+
document.addEventListener('focusin', function(e) {
|
206
|
+
allDropdowns.forEach(dropdown => {
|
207
|
+
if (dropdown.isOpen() && !dropdown.wrapper.contains(e.target)) {
|
208
|
+
dropdown.closeDropdown();
|
209
|
+
}
|
210
|
+
});
|
211
|
+
});
|
212
|
+
|
213
|
+
return { result: 'navbar initialized' };
|
214
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export async function init() {
|
2
|
+
const progressBar = document.querySelector('[data-hs-progress="bar"]');
|
3
|
+
const progressContent = document.querySelector('[data-hs-progress="wrapper"]');
|
4
|
+
|
5
|
+
// Check if elements exist before using them
|
6
|
+
if (!progressBar || !progressContent) {
|
7
|
+
return {
|
8
|
+
result: 'util-scroll-progress initialized'
|
9
|
+
};
|
10
|
+
}
|
11
|
+
|
12
|
+
gsap.set(progressBar, { width: "0%" });
|
13
|
+
|
14
|
+
// Create the scroll progress animation
|
15
|
+
gsap.to(progressBar, {
|
16
|
+
width: "100%",
|
17
|
+
ease: "none",
|
18
|
+
scrollTrigger: {
|
19
|
+
trigger: progressContent,
|
20
|
+
start: "top bottom",
|
21
|
+
end: "bottom bottom",
|
22
|
+
scrub: true
|
23
|
+
}
|
24
|
+
});
|
25
|
+
|
26
|
+
return {
|
27
|
+
result: 'util-scroll-progress initialized'
|
28
|
+
};
|
29
|
+
}
|
package/utils/toc.js
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
export async function init() {
|
2
|
+
const contentArea = document.querySelector('[data-hs-toc="content"]');
|
3
|
+
const tocList = document.querySelector('[data-hs-toc="list"]');
|
4
|
+
|
5
|
+
// Check main elements
|
6
|
+
if (!contentArea) { return; }
|
7
|
+
if (!tocList) { return; }
|
8
|
+
if (tocList.children.length === 0) { return; }
|
9
|
+
|
10
|
+
const template = tocList.children[0];
|
11
|
+
tocList.innerHTML = '';
|
12
|
+
const h2Headings = contentArea.querySelectorAll('h2');
|
13
|
+
|
14
|
+
// Create sections and wrap content
|
15
|
+
h2Headings.forEach((heading, index) => {
|
16
|
+
const sectionId = heading.textContent.toLowerCase()
|
17
|
+
.replace(/[^a-z0-9]+/g, '-')
|
18
|
+
.replace(/(^-|-$)/g, '');
|
19
|
+
const section = document.createElement('div');
|
20
|
+
section.id = sectionId;
|
21
|
+
heading.parentNode.insertBefore(section, heading);
|
22
|
+
section.appendChild(heading);
|
23
|
+
let nextElement = section.nextElementSibling;
|
24
|
+
while (nextElement && nextElement.tagName !== 'H2') {
|
25
|
+
const elementToMove = nextElement;
|
26
|
+
nextElement = nextElement.nextElementSibling;
|
27
|
+
section.appendChild(elementToMove);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
// Create TOC entries
|
32
|
+
h2Headings.forEach((heading, index) => {
|
33
|
+
const tocItem = template.cloneNode(true);
|
34
|
+
const link = tocItem.querySelector('a');
|
35
|
+
const sectionId = heading.parentElement.id;
|
36
|
+
link.href = '#' + sectionId;
|
37
|
+
|
38
|
+
// Bold numbered text
|
39
|
+
const number = document.createElement('strong');
|
40
|
+
number.textContent = (index + 1) + '. ';
|
41
|
+
|
42
|
+
// Clear the link and add the number + text
|
43
|
+
link.innerHTML = '';
|
44
|
+
link.appendChild(number);
|
45
|
+
link.appendChild(document.createTextNode(heading.textContent));
|
46
|
+
|
47
|
+
// Add click handler for smooth scrolling
|
48
|
+
link.addEventListener('click', (e) => {
|
49
|
+
e.preventDefault();
|
50
|
+
|
51
|
+
const targetSection = document.getElementById(sectionId);
|
52
|
+
if (targetSection) {
|
53
|
+
targetSection.scrollIntoView({ behavior: 'smooth' });
|
54
|
+
// Focus on the section for accessibility (will only show outline for keyboard users due to CSS)
|
55
|
+
setTimeout(() => {
|
56
|
+
targetSection.focus();
|
57
|
+
}, 100);
|
58
|
+
}
|
59
|
+
});
|
60
|
+
|
61
|
+
// Ensure sections are focusable for keyboard users but use CSS to control focus visibility
|
62
|
+
const targetSection = document.getElementById(sectionId);
|
63
|
+
if (targetSection) {
|
64
|
+
targetSection.setAttribute('tabindex', '-1');
|
65
|
+
// Use focus-visible to only show outline for keyboard focus
|
66
|
+
targetSection.style.outline = 'none';
|
67
|
+
targetSection.style.setProperty('outline', 'none', 'important');
|
68
|
+
}
|
69
|
+
|
70
|
+
// Add item to the TOC list
|
71
|
+
tocList.appendChild(tocItem);
|
72
|
+
});
|
73
|
+
|
74
|
+
return {
|
75
|
+
result: 'util-toc initialized'
|
76
|
+
};
|
77
|
+
}
|
package/dist/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var n="hsmain",S=async()=>{if(window[n]&&!Array.isArray(window[n])&&window[n].loaded)return;let w=Array.isArray(window[n])?window[n]:[],h={"data-hs-anim-text":!0,"data-hs-anim-hero":!0,"data-hs-anim-transition":!0},f={"data-hs-util-toc":!0,"data-hs-util-progress":!0,"data-hs-util-navbar":!0},m={"smooth-scroll":!0},y={...h,...f},{loadModule:p}=await import("./src-load-3UYE3H3N.js"),g=async()=>new Promise(t=>{window.Webflow||(window.Webflow=[]),window.Webflow.push(t)}),A=async()=>new Promise(t=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}),a=[...document.querySelectorAll(`script[type="module"][src="${import.meta.url}"]`)];a.length===0&&(a=[...document.querySelectorAll('script[type="module"][src*="@hortonstudio/main"]')].filter(e=>{let o=e.src,s=import.meta.url,i=o.match(/@hortonstudio\/main(@[\d.]+)?/)?.[0],r=s.match(/@hortonstudio\/main(@[\d.]+)?/)?.[0];return i&&r&&i.split("@")[0]===r.split("@")[0]}));let l=async t=>{let e=window[n];if(e.process.has(t))return e.modules[t]?.loading;e.process.add(t);let o=e.modules[t]||{};e.modules[t]=o,o.loading=new Promise((s,i)=>{o.resolve=s,o.reject=i});try{let{init:s,version:i}=await p(t),r=await s(),{result:d,destroy:c}=r||{};return o.version=i,o.destroy=()=>{c?.(),e.process.delete(t)},o.restart=()=>(o.destroy?.(),e.load(t)),o.resolve?.(d),delete o.resolve,delete o.reject,d}catch(s){throw o.reject?.(s),e.process.delete(t),s}},u=[];window[n]={scripts:a,modules:{},process:new Set,load:l,loaded:!1,push(...t){for(let[e,o]of t)typeof o=="function"?this.modules[e]?.loading?.then(o):this.load(e)},destroy(){for(let t in this.modules)this.modules[t]?.destroy?.()},afterReady(t){typeof t=="function"&&(this.loaded?t():u.push(t))},afterWebflowReady(t){typeof t=="function"&&(this.loaded?t():u.push(t))},status(t){return t?{loaded:!!this.modules[t],loading:this.process.has(t)}:{loaded:Object.keys(this.modules),loading:[...this.process],animations:Object.keys(h),utilities:Object.keys(f),autoInit:Object.keys(m)}}};let b=()=>{for(let e of a){let o=e.getAttribute("data-hs-auto")==="true";for(let s of Object.keys(y))e.hasAttribute(s)&&l(s);o&&A().then(()=>{let s=new Set,i=document.querySelectorAll("*");for(let r of i)for(let d of r.getAttributeNames()){let c=d.match(/^(data-hs-(?:anim|util)-[^-=]+)/)?.[1];c&&y[c]&&s.add(c)}for(let r of s)l(r)})}for(let e of Object.keys(m))l(e);a.some(e=>e.hasAttribute("data-hs-anim-transition"))||document.querySelectorAll(".transition").forEach(o=>{o.style.display="none"})};document.querySelectorAll(".w-richtext").forEach(t=>{t.querySelectorAll("img").forEach(o=>{o.loading="eager"})});let M=async()=>{b(),await g(),window[n].loaded=!0,u.forEach(t=>{try{t()}catch{}})};window[n].push(...w),M().catch(()=>{})};S();
|
@@ -1 +0,0 @@
|
|
1
|
-
var m="hsmain",D=()=>window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,c={announce:0,nav:.1,navLogo:.3,navList:.35,navMenu:.35,navButton:.5,tag:.1,heading:.15,subheading:.25,button:.35,image:.5,appear:.6},r=null,y=[],C=[],x=null,e={global:{animationDelay:.2},headingSplit:{duration:1.5,stagger:.1,yPercent:110,ease:"power4.out"},subheadingSplit:{duration:1.5,stagger:.1,yPercent:110,ease:"power4.out"},appear:{y:50,duration:1.5,ease:"power3.out"},navStagger:{duration:1.5,stagger:.1,ease:"power3.out"},nav:{duration:1,ease:"power3.out"}};function B(p){function i(t,s){for(let d in s)s[d]&&typeof s[d]=="object"&&!Array.isArray(s[d])?(t[d]=t[d]||{},i(t[d],s[d])):t[d]=s[d];return t}i(e,p)}function w(){x&&(clearTimeout(x),x=null),r&&(r.kill(),r=null),y.forEach(t=>{t&&t.revert&&t.revert()}),y=[],C.forEach(t=>{t&&t.revert&&t.revert()}),C=[],document.querySelectorAll("[data-original-tabindex]").forEach(t=>{t.style.pointerEvents="";let s=t.getAttribute("data-original-tabindex");s==="0"?t.removeAttribute("tabindex"):t.setAttribute("tabindex",s),t.removeAttribute("data-original-tabindex")});let i=document.querySelector('[data-hs-hero="nav"]');i&&(i.style.pointerEvents="")}function P(){w(),j()}function N(){[...document.querySelectorAll('[data-hs-hero="announce"]'),...document.querySelectorAll('[data-hs-hero="nav"]'),...document.querySelectorAll('[data-hs-hero="nav-menu"]'),...document.querySelectorAll('[data-hs-hero="nav-logo"]'),...document.querySelectorAll('[data-hs-hero="nav-button"] > *:first-child'),...document.querySelectorAll('[data-hs-hero="nav-list"] > * > *:first-child'),...document.querySelectorAll('[data-hs-hero="heading"] > *:first-child'),...document.querySelectorAll('[data-hs-hero="subheading"] > *:first-child'),...document.querySelectorAll('[data-hs-hero="tag"] > *:first-child'),...document.querySelectorAll('[data-hs-hero="button"] > *'),...document.querySelectorAll('[data-hs-hero="image"]'),...document.querySelectorAll('[data-hs-hero="appear"]')].forEach(t=>{t&&(gsap.set(t,{autoAlpha:1,opacity:1,y:0,yPercent:0}),t.style.pointerEvents="")}),document.querySelectorAll("[data-original-tabindex]").forEach(t=>{t.style.pointerEvents="";let s=t.getAttribute("data-original-tabindex");s==="0"?t.removeAttribute("tabindex"):t.setAttribute("tabindex",s),t.removeAttribute("data-original-tabindex")})}async function j(){if(typeof window.gsap>"u"){console.error("GSAP not found - hero animations disabled");return}if(D())return N(),window[m]=window[m]||{},window[m].heroAnimations={config:e,updateConfig:B,start:P,kill:w,restart:()=>{w(),P()}},{result:"anim-hero initialized (reduced motion)"};gsap.registerPlugin(ScrollTrigger,SplitText);let p=document.querySelectorAll('[data-hs-hero="announce"]'),i=document.querySelector('[data-hs-hero="nav"]'),t=document.querySelectorAll('[data-hs-hero="nav-menu"]'),s=document.querySelectorAll('[data-hs-hero="nav-logo"]'),d=document.querySelectorAll('[data-hs-hero="image"]'),T=document.querySelectorAll('[data-hs-hero="appear"]'),g=i&&i.hasAttribute("data-hs-heroconfig")&&i.getAttribute("data-hs-heroconfig")==="advanced",b=[];g&&document.querySelectorAll('[data-hs-hero="nav-button"]').forEach(n=>{n.firstElementChild&&b.push(n.firstElementChild)});let L=[],v=[],H=document.querySelectorAll('[data-hs-hero="subheading"]'),F=[];H.forEach(a=>{a.firstElementChild&&((a.getAttribute("data-hs-heroconfig")||"appear")==="appear"?v.push(a.firstElementChild):(L.push(a.firstElementChild),F.push(a)))});let k=[],q=[],z=document.querySelectorAll('[data-hs-hero="heading"]'),M=[];z.forEach(a=>{a.firstElementChild&&((a.getAttribute("data-hs-heroconfig")||"word")==="appear"?q.push(a.firstElementChild):(k.push(a.firstElementChild),M.push(a)))});let A=[];document.querySelectorAll('[data-hs-hero="tag"]').forEach(a=>{a.firstElementChild&&A.push(a.firstElementChild)});let E=[];document.querySelectorAll('[data-hs-hero="button"]').forEach(a=>{let n=Array.from(a.children);E.push(...n)});let S=[];return g&&document.querySelectorAll('[data-hs-hero="nav-list"]').forEach(n=>{Array.from(n.children).forEach(l=>{l.classList.add("u-overflow-clip"),l.firstElementChild&&S.push(l.firstElementChild)})}),p.length>0&&gsap.set(p,{opacity:0,y:-50}),i&&(gsap.set(i,{opacity:0,y:-50}),i.style.pointerEvents="none"),g&&S.length>0&&gsap.set(S,{opacity:0,yPercent:110}),g&&t.length>0&&gsap.set(t,{opacity:0}),g&&b.length>0&&gsap.set(b,{opacity:0}),g&&s.length>0&&gsap.set(s,{opacity:0}),v.length>0&&gsap.set(v,{y:e.appear.y,opacity:0}),A.length>0&&gsap.set(A,{y:e.appear.y,opacity:0}),E.length>0&&gsap.set(E,{y:e.appear.y,opacity:0}),d.length>0&&gsap.set(d,{opacity:0}),T.length>0&&gsap.set(T,{y:e.appear.y,opacity:0}),q.length>0&&gsap.set(q,{y:e.appear.y,opacity:0}),document.querySelectorAll('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])').forEach(a=>{a.style.pointerEvents="none",a.setAttribute("data-original-tabindex",a.getAttribute("tabindex")||"0"),a.setAttribute("tabindex","-1")}),document.fonts.ready.then(()=>{y=[],k.length>0&&M.forEach((a,n)=>{let o=k[n],l=a.getAttribute("data-hs-heroconfig")||"word",u={},h="";l==="char"?(u={type:"words,chars",mask:"chars",charsClass:"char"},h="chars"):l==="line"?(u={type:"lines",mask:"lines",linesClass:"line"},h="lines"):(u={type:"words",mask:"words",wordsClass:"word"},h="words");let f=new SplitText(o,u);f.elementsClass=h,y.push(f),gsap.set(f[h],{yPercent:e.headingSplit.yPercent}),gsap.set(o,{autoAlpha:1})}),L.length>0&&F.forEach((a,n)=>{let o=L[n],l=a.getAttribute("data-hs-heroconfig")||"word",u={},h="";l==="char"?(u={type:"words,chars",mask:"chars",charsClass:"char"},h="chars"):l==="line"?(u={type:"lines",mask:"lines",linesClass:"line"},h="lines"):(u={type:"words",mask:"words",wordsClass:"word"},h="words");let f=new SplitText(o,u);f.elementsClass=h,C.push(f),gsap.set(f[h],{yPercent:e.subheadingSplit.yPercent}),gsap.set(o,{autoAlpha:1})}),x=setTimeout(()=>{r=gsap.timeline(),p.length>0&&r.to(p,{opacity:1,y:0,duration:e.nav.duration,ease:e.nav.ease},c.announce),i&&r.to(i,{opacity:1,y:0,duration:e.nav.duration,ease:e.nav.ease},c.nav),g&&s.length>0&&r.to(s,{opacity:1,duration:.5,ease:e.nav.ease},c.navLogo),g&&S.length>0&&r.to(S,{opacity:1,yPercent:0,duration:e.nav.duration,stagger:.05,ease:e.nav.ease,onComplete:()=>{document.querySelectorAll('[data-hs-hero="nav-list"]').forEach(o=>{let l=o.children;Array.from(l).forEach(u=>{u.classList.remove("u-overflow-clip")})})}},c.navList),g&&t.length>0&&r.to(t,{opacity:1,duration:e.nav.duration,ease:e.nav.ease},c.navMenu),g&&b.length>0&&r.to(b,{opacity:1,duration:e.nav.duration,ease:e.nav.ease},c.navButton),y.length>0&&y.forEach(n=>{r.to(n[n.elementsClass],{yPercent:0,duration:e.headingSplit.duration,stagger:e.headingSplit.stagger,ease:e.headingSplit.ease,onComplete:()=>{n&&n.revert}},c.heading)}),C.length>0&&C.forEach(n=>{r.to(n[n.elementsClass],{yPercent:0,duration:e.subheadingSplit.duration,stagger:e.subheadingSplit.stagger,ease:e.subheadingSplit.ease,onComplete:()=>{n&&n.revert}},c.subheading)}),v.length>0&&r.to(v,{y:0,opacity:1,duration:e.appear.duration,ease:e.appear.ease},c.subheading),A.length>0&&r.to(A,{y:0,opacity:1,duration:e.appear.duration,ease:e.appear.ease},c.tag),E.length>0&&r.to(E,{y:0,opacity:1,duration:e.navStagger.duration,stagger:e.navStagger.stagger,ease:e.navStagger.ease},c.button),d.length>0&&r.to(d,{opacity:1,duration:e.appear.duration,ease:e.appear.ease},c.image);let a=[...T,...q];a.length>0?r.to(a,{y:0,opacity:1,duration:e.appear.duration,ease:e.appear.ease,onComplete:()=>{document.querySelectorAll("[data-original-tabindex]").forEach(o=>{o.style.pointerEvents="";let l=o.getAttribute("data-original-tabindex");l==="0"?o.removeAttribute("tabindex"):o.setAttribute("tabindex",l),o.removeAttribute("data-original-tabindex")}),i&&(i.style.pointerEvents="")}},c.appear):r.call(()=>{document.querySelectorAll("[data-original-tabindex]").forEach(o=>{o.style.pointerEvents="";let l=o.getAttribute("data-original-tabindex");l==="0"?o.removeAttribute("tabindex"):o.setAttribute("tabindex",l),o.removeAttribute("data-original-tabindex")}),i&&(i.style.pointerEvents="")}),x=null},e.global.animationDelay*1e3)}),window[m]=window[m]||{},window[m].heroAnimations={config:e,updateConfig:B,start:P,kill:w,restart:()=>{w(),P()}},{result:"anim-hero initialized"}}export{j as init};
|
@@ -1 +0,0 @@
|
|
1
|
-
var r=async t=>{switch(t){case"data-hs-anim-text":return import("./src-text-BZVCCQJP.js");case"data-hs-anim-hero":return import("./src-hero-UYNS76KU.js");case"data-hs-anim-transition":return import("./src-transition-UBAPWTIU.js");case"data-hs-util-toc":return import("./src-toc-SHTDW6BF.js");case"data-hs-util-progress":return import("./src-scroll-progress-EX62FWYD.js");case"data-hs-util-navbar":return import("./src-navbar-763V2PWX.js");case"smooth-scroll":return import("./src-smooth-scroll-TG4SEEIC.js");default:throw new Error(`hsmain module "${t}" is not supported.`)}};export{r as loadModule};
|
@@ -1 +0,0 @@
|
|
1
|
-
var w=()=>{let v=document.querySelectorAll('[data-hs-nav-dropdown="wrapper"]'),u=[],y=(n=null)=>{u.forEach(a=>{a.wrapper!==n&&a.isOpen&&a.closeDropdown()})};return v.forEach(n=>{let r=n.querySelector("a"),t=n.querySelector('[data-hs-nav-dropdown="list"]'),d=t.querySelector('[data-hs-nav-dropdown="container"]'),f=r.querySelector('[data-hs-nav-dropdown="arrow"]'),p=r.querySelector('[data-hs-nav-dropdown="text"]');gsap.set(d,{yPercent:-110}),gsap.set(t,{display:"none"}),gsap.set(f,{rotation:0,scale:1,x:0,color:""}),gsap.set(p,{scale:1,color:""});let i=!1,s=null;function m(){i||(s&&s.kill(),y(n),i=!0,r.setAttribute("aria-expanded","true"),t.setAttribute("aria-hidden","false"),s=gsap.timeline(),s.set(t,{display:"flex"}).to(d,{yPercent:0,duration:.3,ease:"ease"},0).to(f,{rotation:90,scale:1.2,x:4,color:"var(--swatch--brand)",duration:.3,ease:"ease"},0).to(p,{scale:1.1,color:"var(--swatch--brand)",duration:.3,ease:"ease"},0))}function l(){if(!i)return;s&&s.kill();let e=t.contains(document.activeElement);i=!1,o=-1,r.setAttribute("aria-expanded","false"),t.setAttribute("aria-hidden","true");let D=t.getAttribute("role");t.removeAttribute("role"),s=gsap.timeline(),s.to(d,{yPercent:-110,duration:.3,ease:"ease"},0).to(f,{rotation:0,scale:1,x:0,color:"",duration:.3,ease:"ease"},0).to(p,{scale:1,color:"",duration:.3,ease:"ease"},0).set(t,{display:"none"}).call(()=>{t.setAttribute("role",D||"menu")}),e&&setTimeout(()=>{r.focus()},50)}let c=t.querySelectorAll('a, button, [role="menuitem"]'),o=-1;r.addEventListener("mouseenter",m),n.addEventListener("mouseleave",l),t.addEventListener("keydown",function(e){i&&(e.key==="ArrowDown"?(e.preventDefault(),o=(o+1)%c.length,c[o].focus()):e.key==="ArrowUp"?(e.preventDefault(),o=o<=0?c.length-1:o-1,c[o].focus()):e.key==="Escape"&&(e.preventDefault(),l(),r.focus()))}),r.addEventListener("keydown",function(e){e.key==="ArrowDown"?(e.preventDefault(),m(),c.length>0&&(o=0,setTimeout(()=>c[0].focus(),50))):e.key===" "?(e.preventDefault(),i?l():m()):(e.key==="ArrowUp"||e.key==="Escape")&&(e.preventDefault(),l())}),document.addEventListener("click",function(e){!n.contains(e.target)&&i&&l()}),u.push({wrapper:n,isOpen:()=>i,closeDropdown:l})}),document.addEventListener("focusin",function(n){u.forEach(a=>{a.isOpen()&&!a.wrapper.contains(n.target)&&a.closeDropdown()})}),{result:"navbar initialized"}};export{w as init};
|
@@ -1 +0,0 @@
|
|
1
|
-
async function e(){let r=document.querySelector('[data-hs-progress="bar"]'),t=document.querySelector('[data-hs-progress="wrapper"]');return!r||!t?{result:"util-scroll-progress initialized"}:(gsap.set(r,{width:"0%"}),gsap.to(r,{width:"100%",ease:"none",scrollTrigger:{trigger:t,start:"top bottom",end:"bottom bottom",scrub:!0}}),{result:"util-scroll-progress initialized"})}export{e as init};
|
@@ -1 +0,0 @@
|
|
1
|
-
var f="hsmain";async function m(){window[f].afterWebflowReady(()=>{typeof $<"u"&&$(document).off("click.wf-scroll")}),document.documentElement.style.scrollBehavior="auto",document.body.style.scrollBehavior="auto";function i(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function c(){let t=getComputedStyle(document.documentElement).getPropertyValue("--misc--scroll-offset").trim();return parseInt(t)||0}function l(t,e=0){if(t){if(i()){let n=t.getBoundingClientRect().top+window.scrollY-e;window.scrollTo(0,n),t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0});return}gsap.to(window,{duration:1,scrollTo:{y:t,offsetY:e},ease:"power2.out",onComplete:function(){t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})}})}}function s(){document.addEventListener("click",r),document.addEventListener("keydown",function(t){(t.key==="Enter"||t.key===" ")&&r(t)})}function r(t){let e=t.target.closest('a[href^="#"]');if(!e)return;let n=e.getAttribute("href");if(!n||n==="#")return;let u=n.substring(1),o=document.getElementById(u);if(o){t.preventDefault(),history.replaceState&&history.replaceState(null,null,`#${o.id}`);let d=c();l(o,d)}}return s(),{result:"autoInit-smooth-scroll initialized"}}export{m as init};
|