@wix/site-service-interactions 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/build/implementations/interactionsScriptContent.js +30 -16
- package/cjs/build/implementations/interactionsScriptContent.js.map +1 -1
- package/dist/implementations/interactionsScriptContent.js +30 -16
- package/dist/implementations/interactionsScriptContent.js.map +1 -1
- package/package.json +2 -2
- package/src/implementations/interactionsScriptContent.ts +30 -16
|
@@ -4,25 +4,39 @@ exports.getInteractionsScriptContent = void 0;
|
|
|
4
4
|
const getInteractionsScriptContent = (configId, isReducedMotion) => `
|
|
5
5
|
await import(\`https://static.parastorage.com/services/interact/dist/interact.umd.min.js\`);
|
|
6
6
|
|
|
7
|
+
// Wix pages run an AMD loader (RequireJS) whose define wins the interact UMD wrapper, so the
|
|
8
|
+
// bundle registers itself as a named AMD module instead of assigning window.interact. Read the
|
|
9
|
+
// global first, and when it is absent pull the module back out of the AMD loader.
|
|
10
|
+
let interactModule = window.interact;
|
|
11
|
+
if (!interactModule?.Interact) {
|
|
12
|
+
if (typeof window.require === \`function\`) {
|
|
13
|
+
try {
|
|
14
|
+
interactModule = await new Promise(function (resolve, reject) {
|
|
15
|
+
window.require([\`interact\`], resolve, reject);
|
|
16
|
+
});
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error(\`Failed loading Interact via the AMD loader\`, error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Interact = interactModule?.Interact;
|
|
7
24
|
const configElement = document.getElementById(\`${configId}\`);
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} else {
|
|
13
|
-
const config = JSON.parse(decodeURIComponent(configElement.textContent));
|
|
25
|
+
if (!Interact) {
|
|
26
|
+
console.error(\`Interact library is not loaded\`);
|
|
27
|
+
} else if (configElement) {
|
|
28
|
+
const config = JSON.parse(decodeURIComponent(configElement.textContent));
|
|
14
29
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
Interact.forceReducedMotion = ${isReducedMotion};
|
|
31
|
+
Interact.setup({
|
|
32
|
+
scrollOptionsGetter: function(){ return document.getElementById(\`site-root\`) },
|
|
33
|
+
allowA11yTriggers: true,
|
|
34
|
+
viewEnter: {
|
|
35
|
+
useSafeViewEnter: true,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
}
|
|
39
|
+
Interact.create(config);
|
|
26
40
|
}
|
|
27
41
|
`;
|
|
28
42
|
exports.getInteractionsScriptContent = getInteractionsScriptContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsScriptContent.js","sourceRoot":"","sources":["../../../src/implementations/interactionsScriptContent.ts"],"names":[],"mappings":";;;AAAO,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAE,eAAwB,EAAE,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"interactionsScriptContent.js","sourceRoot":"","sources":["../../../src/implementations/interactionsScriptContent.ts"],"names":[],"mappings":";;;AAAO,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAE,eAAwB,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;sDAoBtC,QAAQ;;;;;;wCAMtB,eAAe;;;;;;;;;;;CAWtD,CAAA;AArCY,QAAA,4BAA4B,gCAqCxC"}
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
export const getInteractionsScriptContent = (configId, isReducedMotion) => `
|
|
2
2
|
await import(\`https://static.parastorage.com/services/interact/dist/interact.umd.min.js\`);
|
|
3
3
|
|
|
4
|
+
// Wix pages run an AMD loader (RequireJS) whose define wins the interact UMD wrapper, so the
|
|
5
|
+
// bundle registers itself as a named AMD module instead of assigning window.interact. Read the
|
|
6
|
+
// global first, and when it is absent pull the module back out of the AMD loader.
|
|
7
|
+
let interactModule = window.interact;
|
|
8
|
+
if (!interactModule?.Interact) {
|
|
9
|
+
if (typeof window.require === \`function\`) {
|
|
10
|
+
try {
|
|
11
|
+
interactModule = await new Promise(function (resolve, reject) {
|
|
12
|
+
window.require([\`interact\`], resolve, reject);
|
|
13
|
+
});
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(\`Failed loading Interact via the AMD loader\`, error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Interact = interactModule?.Interact;
|
|
4
21
|
const configElement = document.getElementById(\`${configId}\`);
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} else {
|
|
10
|
-
const config = JSON.parse(decodeURIComponent(configElement.textContent));
|
|
22
|
+
if (!Interact) {
|
|
23
|
+
console.error(\`Interact library is not loaded\`);
|
|
24
|
+
} else if (configElement) {
|
|
25
|
+
const config = JSON.parse(decodeURIComponent(configElement.textContent));
|
|
11
26
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
Interact.forceReducedMotion = ${isReducedMotion};
|
|
28
|
+
Interact.setup({
|
|
29
|
+
scrollOptionsGetter: function(){ return document.getElementById(\`site-root\`) },
|
|
30
|
+
allowA11yTriggers: true,
|
|
31
|
+
viewEnter: {
|
|
32
|
+
useSafeViewEnter: true,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
}
|
|
36
|
+
Interact.create(config);
|
|
23
37
|
}
|
|
24
38
|
`;
|
|
25
39
|
//# sourceMappingURL=interactionsScriptContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsScriptContent.js","sourceRoot":"","sources":["../../src/implementations/interactionsScriptContent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAE,eAAwB,EAAE,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"interactionsScriptContent.js","sourceRoot":"","sources":["../../src/implementations/interactionsScriptContent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAE,eAAwB,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;sDAoBtC,QAAQ;;;;;;wCAMtB,eAAe;;;;;;;;;;;CAWtD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/site-service-interactions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"main": "cjs/build/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
]
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
|
-
"falconPackageHash": "
|
|
93
|
+
"falconPackageHash": "629f3f89a2fc1e079366d274ab06644e0a74eba7c695c37d6f234e61"
|
|
94
94
|
}
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
export const getInteractionsScriptContent = (configId: string, isReducedMotion: boolean) => `
|
|
2
2
|
await import(\`https://static.parastorage.com/services/interact/dist/interact.umd.min.js\`);
|
|
3
3
|
|
|
4
|
+
// Wix pages run an AMD loader (RequireJS) whose define wins the interact UMD wrapper, so the
|
|
5
|
+
// bundle registers itself as a named AMD module instead of assigning window.interact. Read the
|
|
6
|
+
// global first, and when it is absent pull the module back out of the AMD loader.
|
|
7
|
+
let interactModule = window.interact;
|
|
8
|
+
if (!interactModule?.Interact) {
|
|
9
|
+
if (typeof window.require === \`function\`) {
|
|
10
|
+
try {
|
|
11
|
+
interactModule = await new Promise(function (resolve, reject) {
|
|
12
|
+
window.require([\`interact\`], resolve, reject);
|
|
13
|
+
});
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(\`Failed loading Interact via the AMD loader\`, error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Interact = interactModule?.Interact;
|
|
4
21
|
const configElement = document.getElementById(\`${configId}\`);
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} else {
|
|
10
|
-
const config = JSON.parse(decodeURIComponent(configElement.textContent));
|
|
22
|
+
if (!Interact) {
|
|
23
|
+
console.error(\`Interact library is not loaded\`);
|
|
24
|
+
} else if (configElement) {
|
|
25
|
+
const config = JSON.parse(decodeURIComponent(configElement.textContent));
|
|
11
26
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
Interact.forceReducedMotion = ${isReducedMotion};
|
|
28
|
+
Interact.setup({
|
|
29
|
+
scrollOptionsGetter: function(){ return document.getElementById(\`site-root\`) },
|
|
30
|
+
allowA11yTriggers: true,
|
|
31
|
+
viewEnter: {
|
|
32
|
+
useSafeViewEnter: true,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
}
|
|
36
|
+
Interact.create(config);
|
|
23
37
|
}
|
|
24
38
|
`
|