@hortonstudio/main 1.1.3 → 1.1.5
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/index.js +2 -32
- package/package.json +1 -1
package/index.js
CHANGED
@@ -12,8 +12,7 @@ const animationModules = {
|
|
12
12
|
|
13
13
|
const utilityModules = {
|
14
14
|
"data-hs-util-toc": "./utils/toc.js",
|
15
|
-
"data-hs-util-progress": "./utils/scroll-progress.js"
|
16
|
-
"data-hs-util-navbar": "./utils/navbar.js"
|
15
|
+
"data-hs-util-progress": "./utils/scroll-progress.js"
|
17
16
|
};
|
18
17
|
|
19
18
|
// Modules that auto-initialize
|
@@ -24,23 +23,6 @@ const autoInitModules = {
|
|
24
23
|
// Store callbacks to run after Webflow.ready()
|
25
24
|
const postWebflowCallbacks = [];
|
26
25
|
|
27
|
-
// Get the base URL from the current script's location
|
28
|
-
const getBaseUrl = () => {
|
29
|
-
const currentScript = document.querySelector('script[data-hs-main]');
|
30
|
-
console.log('🔍 Script tag found:', currentScript);
|
31
|
-
console.log('🔍 Script src:', currentScript?.src);
|
32
|
-
|
33
|
-
if (currentScript && currentScript.src) {
|
34
|
-
const result = currentScript.src.substring(0, currentScript.src.lastIndexOf('/') + 1);
|
35
|
-
console.log('🔍 Base URL from script:', result);
|
36
|
-
return result;
|
37
|
-
}
|
38
|
-
|
39
|
-
const fallback = new URL('./', import.meta.url).href;
|
40
|
-
console.log('🔍 Base URL from import.meta:', fallback);
|
41
|
-
return fallback;
|
42
|
-
};
|
43
|
-
|
44
26
|
const loadModule = (moduleName) => {
|
45
27
|
// Check manual modules first
|
46
28
|
let modulePath = animationModules[moduleName] || utilityModules[moduleName];
|
@@ -53,18 +35,7 @@ const loadModule = (moduleName) => {
|
|
53
35
|
if (!modulePath) {
|
54
36
|
throw new Error(`HortonStudio module "${moduleName}" is not supported.`);
|
55
37
|
}
|
56
|
-
|
57
|
-
// Convert relative path to absolute URL
|
58
|
-
const baseUrl = getBaseUrl();
|
59
|
-
const absoluteUrl = new URL(modulePath, baseUrl).href;
|
60
|
-
|
61
|
-
// DEBUG: Log what URLs we're creating
|
62
|
-
console.log('🔍 Debug info for module:', moduleName);
|
63
|
-
console.log(' - Base URL:', baseUrl);
|
64
|
-
console.log(' - Module path:', modulePath);
|
65
|
-
console.log(' - Final URL:', absoluteUrl);
|
66
|
-
|
67
|
-
return import(absoluteUrl);
|
38
|
+
return import(modulePath);
|
68
39
|
};
|
69
40
|
|
70
41
|
const findCurrentScriptTag = () => {
|
@@ -156,7 +127,6 @@ const loadHsModule = async (moduleName) => {
|
|
156
127
|
};
|
157
128
|
|
158
129
|
const initializeAPI = () => {
|
159
|
-
console.log('🔍 Initializing HortonStudio API...');
|
160
130
|
const apiInstance = window[API_NAME];
|
161
131
|
|
162
132
|
const existingRequests = Array.isArray(apiInstance) ? apiInstance : [];
|